diff --git a/.evergreen/auth_aws/README.md b/.evergreen/auth_aws/README.md deleted file mode 100644 index 028e3d0f2..000000000 --- a/.evergreen/auth_aws/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Configuration Scripts for End-to-end Testing - -These scripts were taken from [mongo-enterprise-modules](https://github.com/10gen/mongo-enterprise-modules/tree/master/jstests/external_auth_aws) -and intended to simplify creating users, attaching roles to existing EC2 instances, launching an Amazon ECS container instance, etc. \ No newline at end of file diff --git a/.evergreen/auth_aws/aws_e2e_assume_role.js b/.evergreen/auth_aws/aws_e2e_assume_role.js deleted file mode 100644 index ae5169667..000000000 --- a/.evergreen/auth_aws/aws_e2e_assume_role.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Verify the AWS IAM Auth works with temporary credentials from sts:AssumeRole - */ - -load("lib/aws_e2e_lib.js"); - -(function() { -"use strict"; - -const ASSUMED_ROLE = "arn:aws:sts::557821124784:assumed-role/authtest_user_assume_role/*"; - -function getAssumeCredentials() { - const config = readSetupJson(); - - const env = { - AWS_ACCESS_KEY_ID: config["iam_auth_assume_aws_account"], - AWS_SECRET_ACCESS_KEY: config["iam_auth_assume_aws_secret_access_key"], - }; - - const role_name = config["iam_auth_assume_role_name"]; - - const python_command = getPython3Binary() + - ` -u lib/aws_assume_role.py --role_name=${role_name} > creds.json`; - - const ret = runShellCmdWithEnv(python_command, env); - assert.eq(ret, 0, "Failed to assume role on the current machine"); - - const result = cat("creds.json"); - try { - return JSON.parse(result); - } catch (e) { - jsTestLog("Failed to parse: " + result); - throw e; - } -} - -const credentials = getAssumeCredentials(); -const admin = Mongo().getDB("admin"); -const external = admin.getMongo().getDB("$external"); - -assert(admin.auth("bob", "pwd123")); -assert.commandWorked(external.runCommand({createUser: ASSUMED_ROLE, roles:[{role: 'read', db: "aws"}]})); -assert(external.auth({ - user: credentials["AccessKeyId"], - pwd: credentials["SecretAccessKey"], - awsIamSessionToken: credentials["SessionToken"], - mechanism: 'MONGODB-AWS' -})); -}()); diff --git a/.evergreen/auth_aws/aws_e2e_ec2.js b/.evergreen/auth_aws/aws_e2e_ec2.js deleted file mode 100644 index a492db86d..000000000 --- a/.evergreen/auth_aws/aws_e2e_ec2.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Verify the AWS IAM EC2 hosted auth works - */ -load("lib/aws_e2e_lib.js"); - -(function() { -"use strict"; - -// This varies based on hosting EC2 as the account id and role name can vary -const AWS_ACCOUNT_ARN = "arn:aws:sts::557821124784:assumed-role/authtest_instance_profile_role/*"; - -function assignInstanceProfile() { - const config = readSetupJson(); - - const env = { - AWS_ACCESS_KEY_ID: config["iam_auth_ec2_instance_account"], - AWS_SECRET_ACCESS_KEY: config["iam_auth_ec2_instance_secret_access_key"], - }; - - const instanceProfileName = config["iam_auth_ec2_instance_profile"]; - const python_command = getPython3Binary() + - ` -u lib/aws_assign_instance_profile.py --instance_profile_arn=${instanceProfileName}`; - - const ret = runShellCmdWithEnv(python_command, env); - if (ret == 2) { - print("WARNING: Request limit exceeded for AWS API"); - return false; - } - - assert.eq(ret, 0, "Failed to assign an instance profile to the current machine"); - return true; -} - -if (!assignInstanceProfile()) { - return; -} - -const admin = Mongo().getDB("admin"); -const external = admin.getMongo().getDB("$external"); - -assert(admin.auth("bob", "pwd123")); -assert.commandWorked(external.runCommand({createUser: AWS_ACCOUNT_ARN, roles:[{role: 'read', db: "aws"}]})); - -// Try the command line -const smoke = runMongoProgram("mongo", - "--host", - "localhost", - '--authenticationMechanism', - 'MONGODB-AWS', - '--authenticationDatabase', - '$external', - "--eval", - "1"); -assert.eq(smoke, 0, "Could not auth with smoke user"); - -// Try the auth function -assert(external.auth({mechanism: 'MONGODB-AWS'})); -}()); diff --git a/.evergreen/auth_aws/aws_e2e_ecs.js b/.evergreen/auth_aws/aws_e2e_ecs.js deleted file mode 100644 index 8efd8cb43..000000000 --- a/.evergreen/auth_aws/aws_e2e_ecs.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Validate that MONGODB-AWS auth works from ECS temporary credentials. - */ -load("lib/aws_e2e_lib.js"); - -(function() { - 'use strict'; - - assert.eq(typeof mongo_binaries != 'undefined', true, "mongo_binaries must be set"); - assert.eq(typeof project_dir != 'undefined', true, "project_dir must be set"); - - const config = readSetupJson(); - - const base_command = getPython3Binary() + " -u lib/container_tester.py"; - const run_prune_command = base_command + ' -v remote_gc_services ' + - ' --cluster ' + config['iam_auth_ecs_cluster']; - - const run_test_command = base_command + ' -d -v run_e2e_test' + - ' --cluster ' + config['iam_auth_ecs_cluster'] + ' --task_definition ' + - config['iam_auth_ecs_task_definition'] + ' --subnets ' + - config['iam_auth_ecs_subnet_a'] + ' --subnets ' + - config['iam_auth_ecs_subnet_b'] + ' --security_group ' + - config['iam_auth_ecs_security_group'] + - ` --files ${mongo_binaries}/mongod:/root/mongod ${mongo_binaries}/mongo:/root/mongo ` + - " lib/ecs_hosted_test.js:/root/ecs_hosted_test.js " + - `${project_dir}:/root` + - " --script lib/ecs_hosted_test.sh"; - - // Pass in the AWS credentials as environment variables - // AWS_SHARED_CREDENTIALS_FILE does not work in evergreen for an unknown - // reason - const env = { - AWS_ACCESS_KEY_ID: config['iam_auth_ecs_account'], - AWS_SECRET_ACCESS_KEY: config['iam_auth_ecs_secret_access_key'], - }; - - // Prune other containers - let ret = runWithEnv(['/bin/sh', '-c', run_prune_command], env); - assert.eq(ret, 0, 'Prune Container failed'); - - // Run the test in a container - ret = runWithEnv(['/bin/sh', '-c', run_test_command], env); - assert.eq(ret, 0, 'Container Test failed'); -}()); diff --git a/.evergreen/auth_aws/aws_e2e_regular_aws.js b/.evergreen/auth_aws/aws_e2e_regular_aws.js deleted file mode 100644 index 1c4f2d032..000000000 --- a/.evergreen/auth_aws/aws_e2e_regular_aws.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Validate that the server supports real credentials from AWS and can talk to a real AWS STS - * service - */ -load("lib/aws_e2e_lib.js"); - -(function() { -"use strict"; - -const admin = Mongo().getDB("admin"); -const external = admin.getMongo().getDB("$external"); -assert(admin.auth("bob", "pwd123")); - -const config = readSetupJson(); -assert.commandWorked( - external.runCommand({createUser: config["iam_auth_ecs_account_arn"], roles:[{role: 'read', db: "aws"}]})); - -assert(external.auth({ - user: config["iam_auth_ecs_account"], - pwd: config["iam_auth_ecs_secret_access_key"], - mechanism: 'MONGODB-AWS' -})); -}()); \ No newline at end of file diff --git a/.evergreen/auth_aws/lib/aws_assign_instance_profile.py b/.evergreen/auth_aws/lib/aws_assign_instance_profile.py deleted file mode 100644 index cb3ad154d..000000000 --- a/.evergreen/auth_aws/lib/aws_assign_instance_profile.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python3 -""" -Script for assign an instance policy to the current machine. -""" - -import argparse -import urllib.request -import logging -import sys -import time - -import boto3 -import botocore - -LOGGER = logging.getLogger(__name__) - -def _get_local_instance_id(): - return urllib.request.urlopen('http://169.254.169.254/latest/meta-data/instance-id').read().decode() - -def _has_instance_profile(): - base_url = "http://169.254.169.254/latest/meta-data/iam/security-credentials/" - try: - print("Reading: " + base_url) - iam_role = urllib.request.urlopen(base_url).read().decode() - except urllib.error.HTTPError as e: - print(e) - if e.code == 404: - return False - raise e - - try: - url = base_url + iam_role - print("Reading: " + url) - req = urllib.request.urlopen(url) - except urllib.error.HTTPError as e: - print(e) - if e.code == 404: - return False - raise e - - return True - -def _wait_instance_profile(): - retry = 60 - while not _has_instance_profile() and retry: - time.sleep(5) - retry -= 1 - - if retry == 0: - raise ValueError("Timeout on waiting for instance profile") - -def _assign_instance_policy(iam_instance_arn): - - if _has_instance_profile(): - print("IMPORTANT: Found machine already has instance profile, skipping the assignment") - return - - instance_id = _get_local_instance_id() - - ec2_client = boto3.client("ec2", 'us-east-1') - - #https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.associate_iam_instance_profile - try: - response = ec2_client.associate_iam_instance_profile( - IamInstanceProfile={ - 'Arn' : iam_instance_arn, - }, - InstanceId = instance_id) - - print(response) - - # Wait for the instance profile to be assigned by polling the local instance metadata service - _wait_instance_profile() - - except botocore.exceptions.ClientError as ce: - if ce.response["Error"]["Code"] == "RequestLimitExceeded": - print("WARNING: RequestLimitExceeded, exiting with error code 2") - sys.exit(2) - raise - -def main() -> None: - """Execute Main entry point.""" - - parser = argparse.ArgumentParser(description='IAM Assign Instance frontend.') - - parser.add_argument('-v', "--verbose", action='store_true', help="Enable verbose logging") - parser.add_argument('-d', "--debug", action='store_true', help="Enable debug logging") - - parser.add_argument('--instance_profile_arn', type=str, help="Name of instance profile") - - args = parser.parse_args() - - if args.debug: - logging.basicConfig(level=logging.DEBUG) - elif args.verbose: - logging.basicConfig(level=logging.INFO) - - _assign_instance_policy(args.instance_profile_arn) - - -if __name__ == "__main__": - main() diff --git a/.evergreen/auth_aws/lib/aws_assume_role.py b/.evergreen/auth_aws/lib/aws_assume_role.py deleted file mode 100644 index 6df1fc7ef..000000000 --- a/.evergreen/auth_aws/lib/aws_assume_role.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python3 -""" -Script for assuming an aws role. -""" - -import argparse -import uuid -import logging - -import boto3 - -LOGGER = logging.getLogger(__name__) - -STS_DEFAULT_ROLE_NAME = "arn:aws:iam::579766882180:role/mark.benvenuto" - -def _assume_role(role_name): - sts_client = boto3.client("sts") - - response = sts_client.assume_role(RoleArn=role_name, RoleSessionName=str(uuid.uuid4()), DurationSeconds=900) - - creds = response["Credentials"] - - - print(f"""{{ - "AccessKeyId" : "{creds["AccessKeyId"]}", - "SecretAccessKey" : "{creds["SecretAccessKey"]}", - "SessionToken" : "{creds["SessionToken"]}", - "Expiration" : "{str(creds["Expiration"])}" -}}""") - - -def main() -> None: - """Execute Main entry point.""" - - parser = argparse.ArgumentParser(description='Assume Role frontend.') - - parser.add_argument('-v', "--verbose", action='store_true', help="Enable verbose logging") - parser.add_argument('-d', "--debug", action='store_true', help="Enable debug logging") - - parser.add_argument('--role_name', type=str, default=STS_DEFAULT_ROLE_NAME, help="Role to assume") - - args = parser.parse_args() - - if args.debug: - logging.basicConfig(level=logging.DEBUG) - elif args.verbose: - logging.basicConfig(level=logging.INFO) - - _assume_role(args.role_name) - - -if __name__ == "__main__": - main() diff --git a/.evergreen/auth_aws/lib/aws_e2e_lib.js b/.evergreen/auth_aws/lib/aws_e2e_lib.js deleted file mode 100644 index d38471ac8..000000000 --- a/.evergreen/auth_aws/lib/aws_e2e_lib.js +++ /dev/null @@ -1,39 +0,0 @@ - -function readSetupJson() { - let result; - try { - result = cat("aws_e2e_setup.json"); - } catch (e) { - jsTestLog( - "Failed to parse read aws_e2e_setup.json. See evergreen.yml for how to generate this file which contains evergreen secrets."); - throw e; - } - - try { - return JSON.parse(result); - } catch (e) { - jsTestLog("Failed to parse: aws_e2e_setup.json"); - throw e; - } -} - -function runWithEnv(args, env) { - const pid = _startMongoProgram({args: args, env: env}); - return waitProgram(pid); -} - -function runShellCmdWithEnv(argStr, env) { - if (_isWindows()) { - return runWithEnv(['cmd.exe', '/c', argStr], env); - } else { - return runWithEnv(['/bin/sh', '-c', argStr], env); - } -} - -function getPython3Binary() { - if (_isWindows()) { - return "python.exe"; - } - - return "python3"; -} diff --git a/.evergreen/auth_aws/lib/container_tester.py b/.evergreen/auth_aws/lib/container_tester.py deleted file mode 100644 index eb3703c8f..000000000 --- a/.evergreen/auth_aws/lib/container_tester.py +++ /dev/null @@ -1,385 +0,0 @@ -#!/usr/bin/env python3 -""" -Script for testing mongodb in containers. - -Requires ssh, scp, and sh on local and remote hosts. -Assumes remote host is Linux -""" - -import argparse -import datetime -import logging -import os -import pprint -import subprocess -import uuid - -import boto3 - -LOGGER = logging.getLogger(__name__) - - -############################################################################ -# Default configuration settings for working with a ECS cluster in a region -# - -# These settings depend on a cluster, task subnets, and security group already setup -ECS_DEFAULT_CLUSTER = "arn:aws:ecs:us-east-2:579766882180:cluster/tf-mcb-ecs-cluster" -ECS_DEFAULT_TASK_DEFINITION = "arn:aws:ecs:us-east-2:579766882180:task-definition/tf-app:2" -ECS_DEFAULT_SUBNETS = ['subnet-a5e114cc'] -# Must allow ssh from 0.0.0.0 -ECS_DEFAULT_SECURITY_GROUP = 'sg-051a91d96332f8f3a' - -# This is just a string local to this file -DEFAULT_SERVICE_NAME = 'script-test' - -# Garbage collection threshold for old/stale services -DEFAULT_GARBAGE_COLLECTION_THRESHOLD = datetime.timedelta(hours=1) - -############################################################################ - - -def _run_process(params, cwd=None): - LOGGER.info("RUNNING COMMAND: %s", params) - ret = subprocess.run(params, cwd=cwd) - return ret.returncode - -def _userandhostandport(endpoint): - user_and_host = endpoint.find("@") - if user_and_host == -1: - raise ValueError("Invalid endpoint, Endpoint must be user@host:port") - (user, host) = (endpoint[:user_and_host], endpoint[user_and_host + 1:]) - - colon = host.find(":") - if colon == -1: - return (user, host, "22") - return (user, host[:colon], host[colon + 1:]) - -def _scp(endpoint, src, dest): - (user, host, port) = _userandhostandport(endpoint) - cmd = ["scp", "-o", "StrictHostKeyChecking=no", "-P", port, src, "%s@%s:%s" % (user, host, dest)] - if os.path.isdir(src): - cmd.insert(5, "-r") - _run_process(cmd) - -def _ssh(endpoint, cmd): - (user, host, port) = _userandhostandport(endpoint) - cmd = ["ssh", "-o", "StrictHostKeyChecking=no", "-p", port, "%s@%s" % (user, host), cmd ] - ret = _run_process(cmd) - LOGGER.info("RETURN CODE: %s", ret) - return ret - -def _run_test_args(args): - run_test(args.endpoint, args.script, args.files) - -def run_test(endpoint, script, files): - """ - Run a test on a machine - - Steps - 1. Copy over a files which are tuples of (src, dest) - 2. Copy over the test script to "/tmp/test.sh" - 3. Run the test script and return the results - """ - LOGGER.info("Copying files to %s", endpoint) - - for file in files: - colon = file.find(":") - (src, dest) = (file[:colon], file[colon + 1:]) - _scp(endpoint, src, dest) - - LOGGER.info("Copying script to %s", endpoint) - _scp(endpoint, script, "/tmp/test.sh") - return_code = _ssh(endpoint, "/bin/bash -x /tmp/test.sh") - if return_code != 0: - LOGGER.error("FAILED: %s", return_code) - raise ValueError(f"test failed with {return_code}") - -def _get_region(arn): - return arn.split(':')[3] - - -def _remote_ps_container_args(args): - remote_ps_container(args.cluster) - -def remote_ps_container(cluster): - """ - Get a list of task running in the cluster with their network addresses. - - Emulates the docker ps and ecs-cli ps commands. - """ - ecs_client = boto3.client('ecs', region_name=_get_region(cluster)) - ec2_client = boto3.client('ec2', region_name=_get_region(cluster)) - - tasks = ecs_client.list_tasks(cluster=cluster) - - task_list = ecs_client.describe_tasks(cluster=cluster, tasks=tasks['taskArns']) - - #Example from ecs-cli tool - #Name State Ports TaskDefinition Health - #aa2c2642-3013-4370-885e-8b8d956e753d/sshd RUNNING 3.15.149.114:22->22/tcp sshd:1 UNKNOWN - - print("Name State Public IP Private IP TaskDefinition Health") - for task in task_list['tasks']: - - taskDefinition = task['taskDefinitionArn'] - taskDefinition_short = taskDefinition[taskDefinition.rfind('/') + 1:] - - private_ip_address = None - enis = [] - for b in [ a['details'] for a in task["attachments"] if a['type'] == 'ElasticNetworkInterface']: - for c in b: - if c['name'] == 'networkInterfaceId': - enis.append(c['value']) - elif c['name'] == 'privateIPv4Address': - private_ip_address = c['value'] - assert enis - assert private_ip_address - - eni = ec2_client.describe_network_interfaces(NetworkInterfaceIds=enis) - public_ip = [n["Association"]["PublicIp"] for n in eni["NetworkInterfaces"]][0] - - for container in task['containers']: - taskArn = container['taskArn'] - task_id = taskArn[taskArn.rfind('/')+ 1:] - name = container['name'] - task_id = task_id + "/" + name - lastStatus = container['lastStatus'] - - print("{:<43}{:<9}{:<25}{:<25}{:<16}".format(task_id, lastStatus, public_ip, private_ip_address, taskDefinition_short )) - -def _remote_create_container_args(args): - remote_create_container(args.cluster, args.task_definition, args.service, args.subnets, args.security_group) - -def remote_create_container(cluster, task_definition, service_name, subnets, security_group): - """ - Create a task in ECS - """ - ecs_client = boto3.client('ecs', region_name=_get_region(cluster)) - - resp = ecs_client.create_service(cluster=cluster, serviceName=service_name, - taskDefinition = task_definition, - desiredCount = 1, - launchType='FARGATE', - networkConfiguration={ - 'awsvpcConfiguration': { - 'subnets': subnets, - 'securityGroups': [ - security_group, - ], - 'assignPublicIp': "ENABLED" - } - } - ) - - pprint.pprint(resp) - - service_arn = resp["service"]["serviceArn"] - print(f"Waiting for Service {service_arn} to become active...") - - waiter = ecs_client.get_waiter('services_stable') - - waiter.wait(cluster=cluster, services=[service_arn]) - -def _remote_stop_container_args(args): - remote_stop_container(args.cluster, args.service) - -def remote_stop_container(cluster, service_name): - """ - Stop a ECS task - """ - ecs_client = boto3.client('ecs', region_name=_get_region(cluster)) - - resp = ecs_client.delete_service(cluster=cluster, service=service_name, force=True) - pprint.pprint(resp) - - service_arn = resp["service"]["serviceArn"] - - print(f"Waiting for Service {service_arn} to become inactive...") - waiter = ecs_client.get_waiter('services_inactive') - - waiter.wait(cluster=cluster, services=[service_arn]) - -def _remote_gc_services_container_args(args): - remote_gc_services_container(args.cluster) - -def remote_gc_services_container(cluster): - """ - Delete all ECS services over then a given treshold. - """ - ecs_client = boto3.client('ecs', region_name=_get_region(cluster)) - - services = ecs_client.list_services(cluster=cluster) - if not services["serviceArns"]: - return - - services_details = ecs_client.describe_services(cluster=cluster, services=services["serviceArns"]) - - not_expired_now = datetime.datetime.now().astimezone() - DEFAULT_GARBAGE_COLLECTION_THRESHOLD - - for service in services_details["services"]: - created_at = service["createdAt"] - - # Find the services that we created "too" long ago - if created_at < not_expired_now: - print("DELETING expired service %s which was created at %s." % (service["serviceName"], created_at)) - - remote_stop_container(cluster, service["serviceName"]) - -def remote_get_public_endpoint_str(cluster, service_name): - """ - Get an SSH connection string for the remote service via the public ip address - """ - ecs_client = boto3.client('ecs', region_name=_get_region(cluster)) - ec2_client = boto3.client('ec2', region_name=_get_region(cluster)) - - tasks = ecs_client.list_tasks(cluster=cluster, serviceName=service_name) - - task_list = ecs_client.describe_tasks(cluster=cluster, tasks=tasks['taskArns']) - - for task in task_list['tasks']: - - enis = [] - for b in [ a['details'] for a in task["attachments"] if a['type'] == 'ElasticNetworkInterface']: - for c in b: - if c['name'] == 'networkInterfaceId': - enis.append(c['value']) - assert enis - - eni = ec2_client.describe_network_interfaces(NetworkInterfaceIds=enis) - public_ip = [n["Association"]["PublicIp"] for n in eni["NetworkInterfaces"]][0] - break - - return f"root@{public_ip}:22" - -def remote_get_endpoint_str(cluster, service_name): - """ - Get an SSH connection string for the remote service via the private ip address - """ - ecs_client = boto3.client('ecs', region_name=_get_region(cluster)) - - tasks = ecs_client.list_tasks(cluster=cluster, serviceName=service_name) - - task_list = ecs_client.describe_tasks(cluster=cluster, tasks=tasks['taskArns']) - - for task in task_list['tasks']: - - private_ip_address = None - for b in [ a['details'] for a in task["attachments"] if a['type'] == 'ElasticNetworkInterface']: - for c in b: - if c['name'] == 'privateIPv4Address': - private_ip_address = c['value'] - assert private_ip_address - break - - return f"root@{private_ip_address}:22" - -def _remote_get_endpoint_args(args): - _remote_get_endpoint(args.cluster, args.service) - -def _remote_get_endpoint(cluster, service_name): - endpoint = remote_get_endpoint_str(cluster, service_name) - print(endpoint) - -def _get_caller_identity(args): - sts_client = boto3.client('sts') - - pprint.pprint(sts_client.get_caller_identity()) - - -def _run_e2e_test_args(args): - _run_e2e_test(args.script, args.files, args.cluster, args.task_definition, args.subnets, args.security_group) - -def _run_e2e_test(script, files, cluster, task_definition, subnets, security_group): - """ - Run a test end-to-end - - 1. Start an ECS service - 2. Copy the files over and run the test - 3. Stop the ECS service - """ - service_name = str(uuid.uuid4()) - - remote_create_container(cluster, task_definition, service_name, subnets, security_group) - - # The build account hosted ECS tasks are only available via the private ip address - endpoint = remote_get_endpoint_str(cluster, service_name) - if cluster == ECS_DEFAULT_CLUSTER: - # The test account hosted ECS tasks are the opposite, only public ip address access - endpoint = remote_get_public_endpoint_str(cluster, service_name) - - try: - run_test(endpoint, script, files) - finally: - remote_stop_container(cluster, service_name) - - -def main() -> None: - """Execute Main entry point.""" - - parser = argparse.ArgumentParser(description='ECS container tester.') - - parser.add_argument('-v', "--verbose", action='store_true', help="Enable verbose logging") - parser.add_argument('-d', "--debug", action='store_true', help="Enable debug logging") - - sub = parser.add_subparsers(title="Container Tester subcommands", help="sub-command help") - - run_test_cmd = sub.add_parser('run_test', help='Run Test') - run_test_cmd.add_argument("--endpoint", required=True, type=str, help="User and Host and port, ie user@host:port") - run_test_cmd.add_argument("--script", required=True, type=str, help="script to run") - run_test_cmd.add_argument("--files", type=str, nargs="*", help="Files to copy, each string must be a pair of src:dest joined by a colon") - run_test_cmd.set_defaults(func=_run_test_args) - - remote_ps_cmd = sub.add_parser('remote_ps', help='Stop Local Container') - remote_ps_cmd.add_argument("--cluster", type=str, default=ECS_DEFAULT_CLUSTER, help="ECS Cluster to target") - remote_ps_cmd.set_defaults(func=_remote_ps_container_args) - - remote_create_cmd = sub.add_parser('remote_create', help='Create Remote Container') - remote_create_cmd.add_argument("--cluster", type=str, default=ECS_DEFAULT_CLUSTER, help="ECS Cluster to target") - remote_create_cmd.add_argument("--service", type=str, default=DEFAULT_SERVICE_NAME, help="ECS Service to create") - remote_create_cmd.add_argument("--task_definition", type=str, default=ECS_DEFAULT_TASK_DEFINITION, help="ECS Task Definition to use to create service") - remote_create_cmd.add_argument("--subnets", type=str, nargs="*", default=ECS_DEFAULT_SUBNETS, help="EC2 subnets to use") - remote_create_cmd.add_argument("--security_group", type=str, default=ECS_DEFAULT_SECURITY_GROUP, help="EC2 security group use") - remote_create_cmd.set_defaults(func=_remote_create_container_args) - - remote_stop_cmd = sub.add_parser('remote_stop', help='Stop Remote Container') - remote_stop_cmd.add_argument("--cluster", type=str, default=ECS_DEFAULT_CLUSTER, help="ECS Cluster to target") - remote_stop_cmd.add_argument("--service", type=str, default=DEFAULT_SERVICE_NAME, help="ECS Service to stop") - remote_stop_cmd.set_defaults(func=_remote_stop_container_args) - - remote_gc_services_cmd = sub.add_parser('remote_gc_services', help='GC Remote Container') - remote_gc_services_cmd.add_argument("--cluster", type=str, default=ECS_DEFAULT_CLUSTER, help="ECS Cluster to target") - remote_gc_services_cmd.set_defaults(func=_remote_gc_services_container_args) - - get_caller_identity_cmd = sub.add_parser('get_caller_identity', help='Get the AWS IAM caller identity') - get_caller_identity_cmd.set_defaults(func=_get_caller_identity) - - remote_get_endpoint_cmd = sub.add_parser('remote_get_endpoint', help='Get SSH remote endpoint') - remote_get_endpoint_cmd.add_argument("--cluster", type=str, default=ECS_DEFAULT_CLUSTER, help="ECS Cluster to target") - remote_get_endpoint_cmd.add_argument("--service", type=str, default=DEFAULT_SERVICE_NAME, help="ECS Service to stop") - remote_get_endpoint_cmd.set_defaults(func=_remote_get_endpoint_args) - - run_e2e_test_cmd = sub.add_parser('run_e2e_test', help='Run Test') - run_e2e_test_cmd.add_argument("--script", required=True, type=str, help="script to run") - run_e2e_test_cmd.add_argument("--files", type=str, nargs="*", help="Files to copy, each string must be a pair of src:dest joined by a colon") - run_e2e_test_cmd.add_argument("--cluster", type=str, default=ECS_DEFAULT_CLUSTER, help="ECS Cluster to target") - run_e2e_test_cmd.add_argument("--task_definition", type=str, default=ECS_DEFAULT_TASK_DEFINITION, help="ECS Task Definition to use to create service") - run_e2e_test_cmd.add_argument("--subnets", type=str, nargs="*", default=ECS_DEFAULT_SUBNETS, help="EC2 subnets to use") - run_e2e_test_cmd.add_argument("--security_group", type=str, default=ECS_DEFAULT_SECURITY_GROUP, help="EC2 security group use") - run_e2e_test_cmd.set_defaults(func=_run_e2e_test_args) - - args = parser.parse_args() - - print("AWS_SHARED_CREDENTIALS_FILE: %s" % (os.getenv("AWS_SHARED_CREDENTIALS_FILE"))) - - if args.debug: - logging.basicConfig(level=logging.DEBUG) - elif args.verbose: - logging.basicConfig(level=logging.INFO) - - - args.func(args) - - -if __name__ == "__main__": - main() diff --git a/.evergreen/auth_aws/lib/ecs_hosted_test.js b/.evergreen/auth_aws/lib/ecs_hosted_test.js deleted file mode 100644 index 17d4b3703..000000000 --- a/.evergreen/auth_aws/lib/ecs_hosted_test.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Verify the AWS IAM ECS hosted auth works - */ - -(function() { -"use strict"; - -// This varies based on hosting ECS task as the account id and role name can vary -const AWS_ACCOUNT_ARN = "arn:aws:sts::557821124784:assumed-role/ecsTaskExecutionRole/*"; - -const conn = MongoRunner.runMongod({ - setParameter: { - "authenticationMechanisms": "MONGODB-AWS,SCRAM-SHA-256", - }, - auth: "", -}); - -const external = conn.getDB("$external"); -const admin = conn.getDB("admin"); - -assert.commandWorked(admin.runCommand({createUser: "admin", pwd: "pwd", roles: ['root']})); -assert(admin.auth("admin", "pwd")); - -assert.commandWorked(external.runCommand({createUser: AWS_ACCOUNT_ARN, roles:[{role: 'read', db: "aws"}]})); - -const uri = "mongodb://127.0.0.1:20000/aws?authMechanism=MONGODB-AWS"; -const program = "/root/src/.evergreen/run-mongodb-aws-ecs-test.sh"; - -// Try the command line -const smoke = runMongoProgram(program, uri); -assert.eq(smoke, 0, "Could not auth with smoke user"); - -// Try the auth function -assert(external.auth({mechanism: 'MONGODB-AWS'})); - -MongoRunner.stopMongod(conn); -}()); diff --git a/.evergreen/auth_aws/lib/ecs_hosted_test.sh b/.evergreen/auth_aws/lib/ecs_hosted_test.sh deleted file mode 100644 index 7dddbc80b..000000000 --- a/.evergreen/auth_aws/lib/ecs_hosted_test.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# A shell script to run in an ECS hosted task - -# The environment variable is always set during interactive logins -# But for non-interactive logs, ~/.bashrc does not appear to be read on Ubuntu but it works on Fedora -[[ -z "${AWS_CONTAINER_CREDENTIALS_RELATIVE_URI}" ]] && export $(strings /proc/1/environ | grep AWS_CONTAINER_CREDENTIALS_RELATIVE_URI) - -env - -mkdir -p /data/db || true - -/root/mongo --verbose --nodb ecs_hosted_test.js - -RET_CODE=$? -echo RETURN CODE: $RET_CODE -exit $RET_CODE diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 89af57e31..490093811 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -9,9 +9,9 @@ command_type: system # Fail builds when pre tasks fail. pre_error_fails_task: true -# Protect ourselves against rogue test case that runs forever. Tasks are killed after 20 minutes, which shouldn't occur +# Protect ourselves against rogue test case that runs forever. Tasks are killed after 30 minutes, which shouldn't occur # under normal circumstances. -exec_timeout_secs: 1200 +exec_timeout_secs: 1800 # These pre and post rules apply to all tasks not part of a task group, which should only ever be tests against local # MongoDB instances. All other tasks that require special preparation should be run from within a task group @@ -66,12 +66,10 @@ include: # Automatically generated files - filename: .evergreen/config/generated/build/build-extension.yml - - filename: .evergreen/config/generated/build/build-extension-next-minor.yml - filename: .evergreen/config/generated/test/local.yml - filename: .evergreen/config/generated/test/load-balanced.yml - filename: .evergreen/config/generated/test/require-api-version.yml - filename: .evergreen/config/generated/test/csfle.yml - filename: .evergreen/config/generated/test-variant/modern-php-full.yml - - filename: .evergreen/config/generated/test-variant/legacy-php-full.yml - filename: .evergreen/config/generated/test-variant/phpc.yml - filename: .evergreen/config/generated/test-variant/lowest.yml diff --git a/.evergreen/config/build-task-groups.yml b/.evergreen/config/build-task-groups.yml index 892548181..f745f78ad 100644 --- a/.evergreen/config/build-task-groups.yml +++ b/.evergreen/config/build-task-groups.yml @@ -11,22 +11,10 @@ task_groups: # Builds all versions of PHP - name: "build-all-php" # Keep this number in sync with the number of PHP versions to allow for parallel builds - max_hosts: 4 + max_hosts: 3 setup_task: *build_setup setup_task_can_fail_task: true setup_task_timeout_secs: 1800 teardown_task: *build_teardown tasks: - ".build" - - # Builds all versions of PHP that support OpenSSL 3 (PHP 8.1+) - - name: "build-php-openssl3" - # Keep this number in sync with the number of PHP versions to allow for parallel builds - # Subtract 2 versions as PHP 7.4 and 8.0 are not built with OpenSSL 3 - max_hosts: 2 - setup_task: *build_setup - setup_task_can_fail_task: true - setup_task_timeout_secs: 1800 - teardown_task: *build_teardown - tasks: - - ".build !.php7.4 !.php8.0" diff --git a/.evergreen/config/build-variants.yml b/.evergreen/config/build-variants.yml index 26eaec881..43b7ed4f2 100644 --- a/.evergreen/config/build-variants.yml +++ b/.evergreen/config/build-variants.yml @@ -8,7 +8,7 @@ buildvariants: tags: ["build", "debian", "x64"] run_on: debian12-small tasks: - - name: "build-php-openssl3" + - name: "build-all-php" - name: build-debian11 display_name: "Build: Debian 11" tags: ["build", "debian", "x64", "pr", "tag"] @@ -22,11 +22,17 @@ buildvariants: tags: ["build", "rhel", "x64", "pr", "tag"] run_on: rhel90-small tasks: - - name: "build-php-openssl3" - - name: build-rhel83-zseries - display_name: "Build: RHEL 8.3 Zseries" + - name: "build-all-php" + - name: build-rhel9-zseries + display_name: "Build: RHEL 9 Zseries" tags: ["build", "rhel", "zseries", "tag"] - run_on: rhel83-zseries-small + run_on: rhel9-zseries-small + tasks: + - name: "build-all-php" + - name: build-rhel9-power + display_name: "Build: RHEL 9 PPC" + tags: ["build", "rhel", "power", "tag"] + run_on: rhel9-power-small tasks: - name: "build-all-php" - name: build-rhel82-arm64 @@ -35,12 +41,6 @@ buildvariants: run_on: rhel82-arm64 tasks: - name: "build-all-php" - - name: build-rhel81-power8 - display_name: "Build: RHEL 8.1 Power8" - tags: ["build", "rhel", "power8", "tag"] - run_on: rhel81-power8-large - tasks: - - name: "build-all-php" - name: build-rhel80 display_name: "Build: RHEL 8.0" tags: ["build", "rhel", "x64", "pr", "tag"] @@ -54,13 +54,13 @@ buildvariants: tags: ["build", "ubuntu", "x64", "pr", "tag"] run_on: ubuntu2204-small tasks: - - name: "build-php-openssl3" + - name: "build-all-php" - name: build-ubuntu2204-arm64 display_name: "Build: Ubuntu 22.04 ARM64" tags: ["build", "ubuntu", "arm64", "tag"] run_on: ubuntu2204-arm64-small tasks: - - name: "build-php-openssl3" + - name: "build-all-php" - name: build-ubuntu2004 display_name: "Build: Ubuntu 20.04 x64" tags: ["build", "ubuntu", "x64", "pr", "tag"] diff --git a/.evergreen/config/functions.yml b/.evergreen/config/functions.yml index 34f7c3960..e91c21f87 100644 --- a/.evergreen/config/functions.yml +++ b/.evergreen/config/functions.yml @@ -4,7 +4,7 @@ functions: - command: git.get_project params: directory: "src" - # Make an evergreen exapanstion file with dynamic values + # Make an evergreen expansion file with dynamic values - command: shell.exec params: working_dir: "src" @@ -16,7 +16,7 @@ functions: CURRENT_VERSION=latest fi - export DRIVERS_TOOLS="$(pwd)/../drivers-tools" + export DRIVERS_TOOLS="$(pwd)/tests/drivers-evergreen-tools" export PROJECT_DIRECTORY="$(pwd)" # Python has cygwin path problems on Windows. Detect prospective mongo-orchestration home directory @@ -111,15 +111,10 @@ functions: "prepare resources": - command: shell.exec params: + working_dir: src script: | ${PREPARE_SHELL} - rm -rf $DRIVERS_TOOLS - if [ "${project}" = "drivers-tools" ]; then - # If this was a patch build, doing a fresh clone would not actually test the patch - cp -R ${PROJECT_DIRECTORY}/ $DRIVERS_TOOLS - else - git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git --depth 1 $DRIVERS_TOOLS - fi + git submodule update --init echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" > $MONGO_ORCHESTRATION_HOME/orchestration.config "upload test results": @@ -131,6 +126,26 @@ functions: - command: attach.results params: file_location: "${DRIVERS_TOOLS}/results.json" + - command: shell.exec + params: + working_dir: src + script: | + ${PREPARE_SHELL} + if [ -f test-results.xml ]; then + curl -Os https://cli.codecov.io/latest/linux/codecov + curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM + shasum -a 256 -c codecov.SHA256SUM + sudo chmod +x codecov + ./codecov upload-process \ + --report-type test_results \ + --disable-search \ + --fail-on-error \ + --token ${CODECOV_TOKEN} \ + --flag "${MONGODB_VERSION}-${TOPOLOGY}" \ + --file test-results.xml + else + echo "Skipping codecov test result upload" + fi "bootstrap mongo-orchestration": - command: shell.exec @@ -148,6 +163,12 @@ functions: LOAD_BALANCER=${LOAD_BALANCER} \ REQUIRE_API_VERSION=${REQUIRE_API_VERSION} \ bash ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh + - command: shell.exec + params: + script: | + printf "\n" >> mo-expansion.yml + printf "MONGODB_VERSION: '%s'\n" "${MONGODB_VERSION}" >> mo-expansion.yml + printf "TOPOLOGY: '%s'\n" "${TOPOLOGY}" >> mo-expansion.yml # run-orchestration generates expansion file with MONGODB_URI and CRYPT_SHARED_LIB_PATH - command: expansions.update params: @@ -163,6 +184,7 @@ functions: "bootstrap mongohoused": - command: shell.exec params: + include_expansions_in_env: [AWS_SECRET_ACCESS_KEY, AWS_ACCESS_KEY_ID, AWS_SESSION_TOKEN] script: | cd ${DRIVERS_TOOLS}/.evergreen/atlas_data_lake @@ -176,38 +198,6 @@ functions: DRIVERS_TOOLS="${DRIVERS_TOOLS}" \ bash ./run-mongohouse-image.sh - "create serverless instance": - - command: subprocess.exec - params: - working_dir: "src" - binary: bash - args: - - ${DRIVERS_TOOLS}/.evergreen/serverless/create-instance.sh - - command: expansions.update - params: - file: src/serverless-expansion.yml - - "create serverless proxy instance": - - command: shell.exec - params: - working_dir: "src" - script: | - ${PREPARE_SHELL} - - VAULT_NAME=serverless_next \ - bash ${DRIVERS_TOOLS}/.evergreen/serverless/create-instance.sh - - command: expansions.update - params: - file: src/serverless-expansion.yml - - "delete serverless instance": - - command: subprocess.exec - params: - working_dir: "src" - binary: bash - args: - - ${DRIVERS_TOOLS}/.evergreen/serverless/delete-instance.sh - "run tests": - command: shell.exec type: test @@ -243,55 +233,6 @@ functions: TESTS=${TESTS} \ bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh - "run atlas data lake test": - - command: shell.exec - type: test - params: - working_dir: "src" - script: | - ${PREPARE_SHELL} - export PATH="${PHP_PATH}/bin:$PATH" - - MONGODB_URI="mongodb://mhuser:pencil@127.0.0.1:27017" \ - TESTS="atlas-data-lake" \ - bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh - - "run serverless tests": - - command: shell.exec - type: test - params: - working_dir: "src" - script: | - ${PREPARE_SHELL} - export AWS_ACCESS_KEY_ID="${client_side_encryption_aws_access_key_id}" - export AWS_SECRET_ACCESS_KEY="${client_side_encryption_aws_secret_access_key}" - export AWS_TEMP_ACCESS_KEY_ID="${client_side_encryption_aws_temp_access_key_id}" - export AWS_TEMP_SECRET_ACCESS_KEY="${client_side_encryption_aws_temp_secret_access_key_key}" - export AWS_TEMP_SESSION_TOKEN="${client_side_encryption_aws_temp_session_token}" - export AZURE_TENANT_ID="${client_side_encryption_azure_tenant_id}" - export AZURE_CLIENT_ID="${client_side_encryption_azure_client_id}" - export AZURE_CLIENT_SECRET="${client_side_encryption_azure_client_secret}" - export GCP_EMAIL="${client_side_encryption_gcp_email}" - export GCP_PRIVATE_KEY="${client_side_encryption_gcp_privatekey}" - export KMIP_ENDPOINT="${client_side_encryption_kmip_endpoint}" - export KMS_ENDPOINT_EXPIRED="${client_side_encryption_kms_endpoint_expired}" - export KMS_ENDPOINT_WRONG_HOST="${client_side_encryption_kms_endpoint_wrong_host}" - export KMS_ENDPOINT_REQUIRE_CLIENT_CERT="${client_side_encryption_kms_endpoint_require_client_cert}" - export KMS_TLS_CA_FILE="${client_side_encryption_kms_tls_ca_file}" - export KMS_TLS_CERTIFICATE_KEY_FILE="${client_side_encryption_kms_tls_certificate_key_file}" - export MONGODB_IS_SERVERLESS=on - export PATH="${PHP_PATH}/bin:$PATH" - - . ${DRIVERS_TOOLS}/.evergreen/serverless/secrets-export.sh - - export MONGODB_USERNAME=$SERVERLESS_ATLAS_USER - export MONGODB_PASSWORD=$SERVERLESS_ATLAS_PASSWORD - - CRYPT_SHARED_LIB_PATH=${CRYPT_SHARED_LIB_PATH} \ - MONGODB_URI="${SERVERLESS_URI}" \ - TESTS="serverless" \ - bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh - "cleanup": - command: shell.exec params: diff --git a/.evergreen/config/generate-config.php b/.evergreen/config/generate-config.php old mode 100644 new mode 100755 index 227813b8b..c39a10829 --- a/.evergreen/config/generate-config.php +++ b/.evergreen/config/generate-config.php @@ -1,22 +1,15 @@ -#!/bin/env php +#!/usr/bin/env php = 5.0, < 8.0 - - name: test-debian11-php-8.0-local - tags: ["test", "debian", "x64", "php8.0", "pr", "tag"] - display_name: "Test: Debian 11, PHP 8.0" - run_on: debian11-small - expansions: - FETCH_BUILD_VARIANT: "build-debian11" - FETCH_BUILD_TASK: "build-php-8.0" - PHP_VERSION: "8.0" - VARIANT: debian11 # Referenced by ADL build script for downloading MQLRun - depends_on: - - variant: "build-debian11" - name: "build-php-8.0" - tasks: - # Remember to add new major versions here as they are released - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.8.0 !.rapid !.latest" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.8.0 !.rapid !.latest" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.8.0 !.rapid !.latest" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.8.0 !.rapid !.latest" - - "test-atlas-data-lake" - - # Test versions < 5.0 - - name: test-rhel80-php-8.0 - tags: ["test", "rhel", "x64", "php8.0", "pr", "tag"] - display_name: "Test: RHEL 8.0, PHP 8.0" - run_on: rhel80-small - expansions: - FETCH_BUILD_VARIANT: "build-rhel80" - FETCH_BUILD_TASK: "build-php-8.0" - PHP_VERSION: "8.0" - depends_on: - - variant: "build-rhel80" - name: "build-php-8.0" - tasks: - # Remember to add new major versions here as they are released - - ".standalone .local !.csfle !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".replicaset .local !.csfle !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".sharded .local !.csfle !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".loadbalanced .local !.csfle !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - "test_atlas_task_group" - - ".csfle" -# TODO PHPLIB-955: This file can be removed when requiring PHP 8.1+ - # Test MongoDB >= 5.0, < 8.0 - - name: test-debian11-php-7.4-local - tags: ["test", "debian", "x64", "php7.4", "pr", "tag"] - display_name: "Test: Debian 11, PHP 7.4" - run_on: debian11-small - expansions: - FETCH_BUILD_VARIANT: "build-debian11" - FETCH_BUILD_TASK: "build-php-7.4" - PHP_VERSION: "7.4" - VARIANT: debian11 # Referenced by ADL build script for downloading MQLRun - depends_on: - - variant: "build-debian11" - name: "build-php-7.4" - tasks: - # Remember to add new major versions here as they are released - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.8.0 !.rapid !.latest" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.8.0 !.rapid !.latest" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.8.0 !.rapid !.latest" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.8.0 !.rapid !.latest" - - "test-atlas-data-lake" - - # Test versions < 5.0 - - name: test-rhel80-php-7.4 - tags: ["test", "rhel", "x64", "php7.4", "pr", "tag"] - display_name: "Test: RHEL 8.0, PHP 7.4" - run_on: rhel80-small - expansions: - FETCH_BUILD_VARIANT: "build-rhel80" - FETCH_BUILD_TASK: "build-php-7.4" - PHP_VERSION: "7.4" - depends_on: - - variant: "build-rhel80" - name: "build-php-7.4" - tasks: - # Remember to add new major versions here as they are released - - ".standalone .local !.csfle !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".replicaset .local !.csfle !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".sharded .local !.csfle !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".loadbalanced .local !.csfle !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - "test_atlas_task_group" - - ".csfle" diff --git a/.evergreen/config/generated/test-variant/lowest.yml b/.evergreen/config/generated/test-variant/lowest.yml index 842a937e3..0e3b79709 100644 --- a/.evergreen/config/generated/test-variant/lowest.yml +++ b/.evergreen/config/generated/test-variant/lowest.yml @@ -1,16 +1,16 @@ # This file is generated automatically - please edit the "templates/test-variant/lowest.yml" template file instead. buildvariants: - - name: test-rhel80-php-7.4-local-lowest - tags: ["test", "rhel", "x64", "php7.4", "pr", "tag"] - display_name: "Test: RHEL 8.0, PHP 7.4, Lowest Dependencies" + - name: test-rhel80-php-8.1-local-lowest + tags: ["test", "rhel", "x64", "php8.1", "pr", "tag"] + display_name: "Test: RHEL 8.0, PHP 8.1, Lowest Dependencies" run_on: rhel80-small expansions: FETCH_BUILD_VARIANT: "build-rhel80" - FETCH_BUILD_TASK: "build-php-7.4-lowest" - PHP_VERSION: "7.4" + FETCH_BUILD_TASK: "build-php-8.1-lowest" + PHP_VERSION: "8.1" DEPENDENCIES: "lowest" depends_on: - variant: "build-rhel80" - name: "build-php-7.4-lowest" + name: "build-php-8.1-lowest" tasks: - - ".replicaset .local .4.0 !.csfle" + - ".replicaset .local .4.2 !.csfle" diff --git a/.evergreen/config/generated/test-variant/modern-php-full.yml b/.evergreen/config/generated/test-variant/modern-php-full.yml index 24c0a6f8d..1186c35a5 100644 --- a/.evergreen/config/generated/test-variant/modern-php-full.yml +++ b/.evergreen/config/generated/test-variant/modern-php-full.yml @@ -14,13 +14,10 @@ buildvariants: - variant: "build-debian12" name: "build-php-8.4" tasks: - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - "test_serverless_task_group" - - "test_serverless_proxy_task_group" - - "test-atlas-data-lake" + - ".standalone .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".replicaset .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".sharded .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".loadbalanced .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" # Test MongoDB 5.0 and 6.0 - name: test-debian11-php-8.4-local @@ -36,10 +33,10 @@ buildvariants: name: "build-php-8.4" tasks: # Remember to add new major versions here as they are released - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".standalone .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".replicaset .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".sharded .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".loadbalanced .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" # Test versions < 5.0 - name: test-rhel80-php-8.4 @@ -75,13 +72,10 @@ buildvariants: - variant: "build-debian12" name: "build-php-8.3" tasks: - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - "test_serverless_task_group" - - "test_serverless_proxy_task_group" - - "test-atlas-data-lake" + - ".standalone .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".replicaset .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".sharded .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".loadbalanced .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" # Test MongoDB 5.0 and 6.0 - name: test-debian11-php-8.3-local @@ -97,10 +91,10 @@ buildvariants: name: "build-php-8.3" tasks: # Remember to add new major versions here as they are released - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".standalone .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".replicaset .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".sharded .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".loadbalanced .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" # Test versions < 5.0 - name: test-rhel80-php-8.3 @@ -136,13 +130,10 @@ buildvariants: - variant: "build-debian12" name: "build-php-8.2" tasks: - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - "test_serverless_task_group" - - "test_serverless_proxy_task_group" - - "test-atlas-data-lake" + - ".standalone .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".replicaset .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".sharded .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".loadbalanced .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" # Test MongoDB 5.0 and 6.0 - name: test-debian11-php-8.2-local @@ -158,10 +149,10 @@ buildvariants: name: "build-php-8.2" tasks: # Remember to add new major versions here as they are released - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".standalone .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".replicaset .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".sharded .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".loadbalanced .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" # Test versions < 5.0 - name: test-rhel80-php-8.2 @@ -197,13 +188,10 @@ buildvariants: - variant: "build-debian12" name: "build-php-8.1" tasks: - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - "test_serverless_task_group" - - "test_serverless_proxy_task_group" - - "test-atlas-data-lake" + - ".standalone .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".replicaset .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".sharded .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".loadbalanced .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" # Test MongoDB 5.0 and 6.0 - name: test-debian11-php-8.1-local @@ -219,10 +207,10 @@ buildvariants: name: "build-php-8.1" tasks: # Remember to add new major versions here as they are released - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".standalone .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".replicaset .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".sharded .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".loadbalanced .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" # Test versions < 5.0 - name: test-rhel80-php-8.1 diff --git a/.evergreen/config/generated/test-variant/phpc.yml b/.evergreen/config/generated/test-variant/phpc.yml index e0eb428ce..65907fba4 100644 --- a/.evergreen/config/generated/test-variant/phpc.yml +++ b/.evergreen/config/generated/test-variant/phpc.yml @@ -1,42 +1,37 @@ # This file is generated automatically - please edit the "templates/test-variant/phpc.yml" template file instead. buildvariants: # Variants with different PHPC versions - - name: test-debian12-php-8.3-phpc-next-stable - tags: ["test", "debian", "x64", "php8.3", "pr", "tag"] - display_name: "Test: Debian 12, PHP 8.3, PHPC next-stable" + - name: test-debian12-php-8.4-phpc-next-stable + tags: ["test", "debian", "x64", "php8.4", "pr", "tag"] + display_name: "Test: Debian 12, PHP 8.4, PHPC next-stable" run_on: debian12-small expansions: FETCH_BUILD_VARIANT: "build-debian12" - FETCH_BUILD_TASK: "build-php-8.3-next-stable" - PHP_VERSION: "8.3" + FETCH_BUILD_TASK: "build-php-8.4-next-stable" + PHP_VERSION: "8.4" depends_on: - variant: "build-debian12" - name: "build-php-8.3-next-stable" + name: "build-php-8.4-next-stable" tasks: - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - "test_serverless_task_group" - - "test_serverless_proxy_task_group" + - ".standalone .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".replicaset .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".sharded .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".loadbalanced .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" - "test-atlas-data-lake" - - name: test-debian12-php-8.3-phpc-next-minor - tags: ["test", "debian", "x64", "php8.3"] - display_name: "Test: Debian 12, PHP 8.3, PHPC next-minor" + - name: test-debian12-php-8.4-phpc-next-minor + tags: ["test", "debian", "x64", "php8.4"] + display_name: "Test: Debian 12, PHP 8.4, PHPC next-minor" run_on: debian12-small expansions: FETCH_BUILD_VARIANT: "build-debian12" - FETCH_BUILD_TASK: "build-php-8.3-next-minor" - PHP_VERSION: "8.3" + FETCH_BUILD_TASK: "build-php-8.4-next-minor" + PHP_VERSION: "8.4" depends_on: - variant: "build-debian12" - name: "build-php-8.3-next-minor" + name: "build-php-8.4-next-minor" tasks: - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - "test_serverless_task_group" - - "test_serverless_proxy_task_group" - - "test-atlas-data-lake" + - ".standalone .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".replicaset .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".sharded .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".loadbalanced .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" diff --git a/.evergreen/config/generated/test/local.yml b/.evergreen/config/generated/test/local.yml index 87592e4ac..cee192412 100644 --- a/.evergreen/config/generated/test/local.yml +++ b/.evergreen/config/generated/test/local.yml @@ -256,35 +256,3 @@ tasks: - func: "start kms servers" - func: "set aws temp creds" - func: "run tests" - - name: "test-mongodb-4.0-standalone-noauth-nossl" - tags: ["standalone", "local", "4.0", "tag"] - commands: - - func: "bootstrap mongo-orchestration" - vars: - TOPOLOGY: "server" - MONGODB_VERSION: "4.0" - - func: "start kms servers" - - func: "set aws temp creds" - - func: "run tests" - - - name: "test-mongodb-4.0-replicaset-noauth-nossl" - tags: ["replicaset", "local", "4.0", "pr", "tag"] - commands: - - func: "bootstrap mongo-orchestration" - vars: - TOPOLOGY: "replica_set" - MONGODB_VERSION: "4.0" - - func: "start kms servers" - - func: "set aws temp creds" - - func: "run tests" - - - name: "test-mongodb-4.0-sharded-noauth-nossl" - tags: ["sharded", "local", "4.0", "tag"] - commands: - - func: "bootstrap mongo-orchestration" - vars: - TOPOLOGY: "sharded_cluster" - MONGODB_VERSION: "4.0" - - func: "start kms servers" - - func: "set aws temp creds" - - func: "run tests" diff --git a/.evergreen/config/templates/build/build-extension-next-minor.yml b/.evergreen/config/templates/build/build-extension-next-minor.yml deleted file mode 100644 index 1638e25ad..000000000 --- a/.evergreen/config/templates/build/build-extension-next-minor.yml +++ /dev/null @@ -1,10 +0,0 @@ - - name: "build-php-%phpVersion%-next-minor" - tags: ["build", "php%phpVersion%", "next-minor"] - commands: - - func: "locate PHP binaries" - vars: - PHP_VERSION: "%phpVersion%" - - func: "compile extension" - vars: - EXTENSION_BRANCH: "v1.x" - - func: "upload extension" diff --git a/.evergreen/config/templates/build/build-extension.yml b/.evergreen/config/templates/build/build-extension.yml index 4592aadab..c6b1f411c 100644 --- a/.evergreen/config/templates/build/build-extension.yml +++ b/.evergreen/config/templates/build/build-extension.yml @@ -5,6 +5,9 @@ vars: PHP_VERSION: "%phpVersion%" - func: "compile extension" + # TODO: Remove vars to switch to latest stable version when 2.1.0 is releeased + vars: + EXTENSION_BRANCH: "v2.x" - func: "upload extension" - name: "build-php-%phpVersion%-lowest" tags: ["build", "php%phpVersion%", "lowest", "pr", "tag"] @@ -14,7 +17,9 @@ PHP_VERSION: "%phpVersion%" - func: "compile extension" vars: - EXTENSION_VERSION: "1.20.0" + # TODO: Switch to 2.1.0 when it is released + # EXTENSION_VERSION: "2.0.0" + EXTENSION_BRANCH: "v2.x" - func: "upload extension" - name: "build-php-%phpVersion%-next-stable" tags: ["build", "php%phpVersion%", "next-stable", "pr", "tag"] @@ -24,5 +29,17 @@ PHP_VERSION: "%phpVersion%" - func: "compile extension" vars: - EXTENSION_BRANCH: "v1.20" + # TODO: Switch to v2.1 when 2.1.0 is released + # EXTENSION_VERSION: "v2.1" + EXTENSION_BRANCH: "v2.x" + - func: "upload extension" + - name: "build-php-%phpVersion%-next-minor" + tags: ["build", "php%phpVersion%", "next-minor"] + commands: + - func: "locate PHP binaries" + vars: + PHP_VERSION: "%phpVersion%" + - func: "compile extension" + vars: + EXTENSION_BRANCH: "v2.x" - func: "upload extension" diff --git a/.evergreen/config/templates/test-variant/legacy-php-full.yml b/.evergreen/config/templates/test-variant/legacy-php-full.yml deleted file mode 100644 index ba199dc4b..000000000 --- a/.evergreen/config/templates/test-variant/legacy-php-full.yml +++ /dev/null @@ -1,42 +0,0 @@ -# TODO PHPLIB-955: This file can be removed when requiring PHP 8.1+ - # Test MongoDB >= 5.0, < 8.0 - - name: test-debian11-php-%phpVersion%-local - tags: ["test", "debian", "x64", "php%phpVersion%", "pr", "tag"] - display_name: "Test: Debian 11, PHP %phpVersion%" - run_on: debian11-small - expansions: - FETCH_BUILD_VARIANT: "build-debian11" - FETCH_BUILD_TASK: "build-php-%phpVersion%" - PHP_VERSION: "%phpVersion%" - VARIANT: debian11 # Referenced by ADL build script for downloading MQLRun - depends_on: - - variant: "build-debian11" - name: "build-php-%phpVersion%" - tasks: - # Remember to add new major versions here as they are released - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.8.0 !.rapid !.latest" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.8.0 !.rapid !.latest" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.8.0 !.rapid !.latest" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.8.0 !.rapid !.latest" - - "test-atlas-data-lake" - - # Test versions < 5.0 - - name: test-rhel80-php-%phpVersion% - tags: ["test", "rhel", "x64", "php%phpVersion%", "pr", "tag"] - display_name: "Test: RHEL 8.0, PHP %phpVersion%" - run_on: rhel80-small - expansions: - FETCH_BUILD_VARIANT: "build-rhel80" - FETCH_BUILD_TASK: "build-php-%phpVersion%" - PHP_VERSION: "%phpVersion%" - depends_on: - - variant: "build-rhel80" - name: "build-php-%phpVersion%" - tasks: - # Remember to add new major versions here as they are released - - ".standalone .local !.csfle !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".replicaset .local !.csfle !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".sharded .local !.csfle !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - ".loadbalanced .local !.csfle !.6.0 !.7.0 !.8.0 !.rapid !.latest" - - "test_atlas_task_group" - - ".csfle" diff --git a/.evergreen/config/templates/test-variant/lowest.yml b/.evergreen/config/templates/test-variant/lowest.yml index ff416a287..0959127fd 100644 --- a/.evergreen/config/templates/test-variant/lowest.yml +++ b/.evergreen/config/templates/test-variant/lowest.yml @@ -11,4 +11,4 @@ - variant: "build-rhel80" name: "build-php-%phpVersion%-lowest" tasks: - - ".replicaset .local .4.0 !.csfle" + - ".replicaset .local .4.2 !.csfle" diff --git a/.evergreen/config/templates/test-variant/modern-php-full.yml b/.evergreen/config/templates/test-variant/modern-php-full.yml index 21468390d..5a57d1c24 100644 --- a/.evergreen/config/templates/test-variant/modern-php-full.yml +++ b/.evergreen/config/templates/test-variant/modern-php-full.yml @@ -12,13 +12,10 @@ - variant: "build-debian12" name: "build-php-%phpVersion%" tasks: - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - "test_serverless_task_group" - - "test_serverless_proxy_task_group" - - "test-atlas-data-lake" + - ".standalone .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".replicaset .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".sharded .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".loadbalanced .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" # Test MongoDB 5.0 and 6.0 - name: test-debian11-php-%phpVersion%-local @@ -34,10 +31,10 @@ name: "build-php-%phpVersion%" tasks: # Remember to add new major versions here as they are released - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".standalone .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".replicaset .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".sharded .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" + - ".loadbalanced .local !.csfle !.4.2 !.4.4 !.7.0 !.8.0 !.rapid !.latest" # Test versions < 5.0 - name: test-rhel80-php-%phpVersion% diff --git a/.evergreen/config/templates/test-variant/phpc.yml b/.evergreen/config/templates/test-variant/phpc.yml index 88d0dd248..667bda98a 100644 --- a/.evergreen/config/templates/test-variant/phpc.yml +++ b/.evergreen/config/templates/test-variant/phpc.yml @@ -11,12 +11,10 @@ - variant: "build-debian12" name: "build-php-%phpVersion%-next-stable" tasks: - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - "test_serverless_task_group" - - "test_serverless_proxy_task_group" + - ".standalone .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".replicaset .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".sharded .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".loadbalanced .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" - "test-atlas-data-lake" - name: test-debian12-php-%phpVersion%-phpc-next-minor @@ -31,10 +29,7 @@ - variant: "build-debian12" name: "build-php-%phpVersion%-next-minor" tasks: - - ".standalone .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".replicaset .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".sharded .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - ".loadbalanced .local !.csfle !.4.0 !.4.2 !.4.4 !.5.0 !.6.0" - - "test_serverless_task_group" - - "test_serverless_proxy_task_group" - - "test-atlas-data-lake" + - ".standalone .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".replicaset .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".sharded .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" + - ".loadbalanced .local !.csfle !.4.2 !.4.4 !.5.0 !.6.0" diff --git a/.evergreen/config/test-task-groups.yml b/.evergreen/config/test-task-groups.yml index a8edffa41..06f159ac2 100644 --- a/.evergreen/config/test-task-groups.yml +++ b/.evergreen/config/test-task-groups.yml @@ -8,6 +8,9 @@ task_groups: - func: "locate PHP binaries" - func: "fetch extension" - func: "install composer" + - command: ec2.assume_role + params: + role_arn: ${aws_test_secrets_role} - command: subprocess.exec params: working_dir: src @@ -34,41 +37,3 @@ task_groups: setup_group_timeout_secs: 1800 tasks: - test-atlas - - - name: test_serverless_task_group - setup_group: - - func: "fetch source" - - func: "prepare resources" - - func: "fix absolute paths" - - func: "install dependencies" - - func: "locate PHP binaries" - - func: "fetch extension" - - func: "install composer" - - func: "create serverless instance" - teardown_group: - - func: "delete serverless instance" - - func: "upload test results" - - func: "cleanup" - setup_group_can_fail_task: true - setup_group_timeout_secs: 1800 - tasks: - - test-serverless - - - name: test_serverless_proxy_task_group - setup_group: - - func: "fetch source" - - func: "prepare resources" - - func: "fix absolute paths" - - func: "install dependencies" - - func: "locate PHP binaries" - - func: "fetch extension" - - func: "install composer" - - func: "create serverless proxy instance" - teardown_group: - - func: "delete serverless instance" - - func: "upload test results" - - func: "cleanup" - setup_group_can_fail_task: true - setup_group_timeout_secs: 1800 - tasks: - - test-serverless-proxy diff --git a/.evergreen/config/test-tasks.yml b/.evergreen/config/test-tasks.yml index 51631e78c..5dabc8a10 100644 --- a/.evergreen/config/test-tasks.yml +++ b/.evergreen/config/test-tasks.yml @@ -7,27 +7,6 @@ tasks: vars: TESTS: "atlas" - - name: "test-serverless" - tags: ["serverless"] - exec_timeout_secs: 10800 - commands: - - func: "start kms servers" - - func: "set aws temp creds" - - func: "run serverless tests" - - - name: "test-serverless-proxy" - tags: ["serverless"] - exec_timeout_secs: 10800 - commands: - - func: "start kms servers" - - func: "set aws temp creds" - - func: "run serverless tests" - - - name: "test-atlas-data-lake" - commands: - - func: "bootstrap mongohoused" - - func: "run atlas data lake test" - - name: "run-benchmark" exec_timeout_secs: 3600 commands: @@ -36,6 +15,35 @@ tasks: TOPOLOGY: "server" MONGODB_VERSION: "v6.0-perf" - func: "run benchmark" - - command: perf.send + - command: shell.exec params: - file: src/benchmark/.phpbench/results.json + script: | + # We use the requester expansion to determine whether the data is from a mainline evergreen run or not + if [ "${requester}" == "commit" ]; then + is_mainline=true + else + is_mainline=false + fi + + # We parse the username out of the order_id as patches append that in and SPS does not need that information + parsed_order_id=$(echo "${revision_order_id}" | awk -F'_' '{print $NF}') + + # Submit the performance data to the SPS endpoint + response=$(curl -s -w "\nHTTP_STATUS:%{http_code}" -X 'POST' \ + "https://performance-monitoring-api.corp.mongodb.com/raw_perf_results/cedar_report?project=${project_id}&version=${version_id}&variant=${build_variant}&order=$parsed_order_id&task_name=${task_name}&task_id=${task_id}&execution=${execution}&mainline=$is_mainline" \ + -H 'accept: application/json' \ + -H 'Content-Type: application/json' \ + -d @src/benchmark/.phpbench/results.json) + + http_status=$(echo "$response" | grep "HTTP_STATUS" | awk -F':' '{print $2}') + response_body=$(echo "$response" | sed '/HTTP_STATUS/d') + + # We want to throw an error if the data was not successfully submitted + if [ "$http_status" -ne 200 ]; then + echo "Error: Received HTTP status $http_status" + echo "Response Body: $response_body" + exit 1 + fi + + echo "Response Body: $response_body" + echo "HTTP Status: $http_status" diff --git a/.evergreen/config/test-variants.yml b/.evergreen/config/test-variants.yml index 9166476e4..816d1bc76 100644 --- a/.evergreen/config/test-variants.yml +++ b/.evergreen/config/test-variants.yml @@ -13,18 +13,3 @@ buildvariants: name: "build-php-8.2" tasks: - "run-benchmark" - - # Run Atlas Data Lake Tests on Ubuntu - - name: test-ubuntu2204-php82-local - tags: ["test", "ubuntu", "x64"] - display_name: "Test: Ubuntu 22.04 x64, PHP 8.2" - run_on: ubuntu2204-small - expansions: - FETCH_BUILD_VARIANT: "build-ubuntu2204" - FETCH_BUILD_TASK: "build-php-8.2" - PHP_VERSION: "8.2" - depends_on: - - variant: "build-ubuntu2204" - name: "build-php-8.2" - tasks: - - "test-atlas-data-lake" diff --git a/.evergreen/ocsp/README.md b/.evergreen/ocsp/README.md deleted file mode 100644 index 845d64996..000000000 --- a/.evergreen/ocsp/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# Generating Test Certificates - -The test certificates here were generating using a fork of the server -team's -[`mkcert.py`](https://github.com/mongodb/mongo/blob/master/jstests/ssl/x509/mkcert.py) -tool. - -In order to generate a fresh set of certificates, clone this branch of -a fork of the -[`mongo` repository](https://github.com/vincentkam/mongo/tree/mkcert-ecdsa) and -run the following command from the root of the `mongo` repository: - -`python3 jstests/ssl/x509/mkcert.py --config ../drivers-evergreen-tools/.evergreen/ocsp/certs.yml` - -Passing a certificate ID as the final parameter will limit certificate -generation to that certificate and all its leaves. Note: if -regenerating ECDSA leaf certificates, ``ecsda/ca.pem`` will need to be -temporarily renamed back to ``ecdsa-ca-ocsp.pem``. - -The ECDSA certificates will be output into the folder specified by the -`global.output_path` option in the `certs.yml` file, which defaults to -`ecsda` directory contained in this directory. The RSA certificate -definitions override this value on a per certificate basis and are -output into the `rsa` directory. The default configuration also -assumes that the `mongo` repository and the `driver-evergreen-tools` -repository have the same parent directory. - -After generating the RSA root certificate, one must manually split the -`rsa/ca.pem` file, which contains both the private key and the public -certificate, into two files. `rsa/ca.crt` should contain the public -certificate, and `ras/ca.key` should contain the private certificate. - -When generating ECDSA certificates, one must normalize the ECDSA -certificate names by running `ecdsa/rename.sh`. diff --git a/.evergreen/ocsp/certs.yml b/.evergreen/ocsp/certs.yml deleted file mode 100755 index 3fa364da3..000000000 --- a/.evergreen/ocsp/certs.yml +++ /dev/null @@ -1,169 +0,0 @@ - -global: - # All subject names will have these elements automatically, - # unless `explicit_subject: true` is specified. - output_path: '../drivers-evergreen-tools/.evergreen/ocsp/ecdsa/' # See README.md if customizing this path - Subject: - C: 'US' - ST: 'New York' - L: 'New York City' - O: 'MongoDB' - OU: 'Kernel' - -certs: - -### -# OCSP Tree -### -- name: 'ca.pem' - description: >- - Primary Root Certificate Authority - Most Certificates are issued by this CA. - Subject: {CN: 'Kernel Test CA'} - Issuer: self - include_header: false - output_path: '../drivers-evergreen-tools/.evergreen/ocsp/rsa' - extensions: - basicConstraints: - critical: true - CA: true - -- name: 'server.pem' - description: >- - Certificate with OCSP for the mongodb server. - Subject: - CN: 'localhost' - C: US - ST: NY - L: OCSP-1 - Issuer: 'ca.pem' - include_header: false - output_path: '../drivers-evergreen-tools/.evergreen/ocsp/rsa' - extensions: - basicConstraints: {CA: false} - subjectAltName: - DNS: localhost - IP: 127.0.0.1 - authorityInfoAccess: 'OCSP;URI:http://localhost:9001/power/level,OCSP;URI:http://localhost:8100/status' - subjectKeyIdentifier: hash - keyUsage: [digitalSignature, keyEncipherment] - extendedKeyUsage: [serverAuth, clientAuth] - -- name: 'server-mustStaple.pem' - description: >- - Certificate with Must Staple OCSP for the mongodb server. - Subject: - CN: 'localhost' - C: US - ST: NY - L: OCSP-1 - Issuer: 'ca.pem' - include_header: false - output_path: '../drivers-evergreen-tools/.evergreen/ocsp/rsa' - extensions: - basicConstraints: {CA: false} - subjectAltName: - DNS: localhost - IP: 127.0.0.1 - authorityInfoAccess: 'OCSP;URI:http://localhost:9001/power/level,OCSP;URI:http://localhost:8100/status' - mustStaple: true - subjectKeyIdentifier: hash - keyUsage: [digitalSignature, keyEncipherment] - extendedKeyUsage: [serverAuth, clientAuth] - -- name: 'server-singleEndpoint.pem' - description: >- - Certificate with a single OCSP endpoint for the mongodb server. - Subject: - CN: 'localhost' - C: US - ST: NY - L: OCSP-1 - Issuer: 'ca.pem' - include_header: false - output_path: '../drivers-evergreen-tools/.evergreen/ocsp/rsa' - extensions: - basicConstraints: {CA: false} - subjectAltName: - DNS: localhost - IP: 127.0.0.1 - authorityInfoAccess: 'OCSP;URI:http://localhost:8100/status' - subjectKeyIdentifier: hash - keyUsage: [digitalSignature, keyEncipherment] - extendedKeyUsage: [serverAuth, clientAuth] - -- name: 'server-mustStaple-singleEndpoint.pem' - description: >- - Certificate with Must Staple OCSP and one OCSP endpoint for the mongodb server. - Subject: - CN: 'localhost' - C: US - ST: NY - L: OCSP-1 - Issuer: 'ca.pem' - include_header: false - output_path: '../drivers-evergreen-tools/.evergreen/ocsp/rsa' - extensions: - basicConstraints: {CA: false} - subjectAltName: - DNS: localhost - IP: 127.0.0.1 - authorityInfoAccess: 'OCSP;URI:http://localhost:8100/status' - mustStaple: true - subjectKeyIdentifier: hash - keyUsage: [digitalSignature, keyEncipherment] - extendedKeyUsage: [serverAuth, clientAuth] - -- name: 'ocsp-responder.crt' - description: Certificate and key for the OCSP responder - Subject: - CN: 'localhost' - C: US - ST: NY - L: OCSP-3 - Issuer: 'ca.pem' - include_header: false - keyfile: 'ocsp-responder.key' - output_path: '../drivers-evergreen-tools/.evergreen/ocsp/rsa' - extensions: - basicConstraints: {CA: false} - keyUsage: [nonRepudiation, digitalSignature, keyEncipherment] - extendedKeyUsage: [OCSPSigning] - #noCheck: true - -### -# ECDSA tree -### - -# These are all special cases handled internally by mkcert.py -# Do NOT change the names - -- name: 'ecdsa-ca-ocsp.pem' - description: Root of ECDSA tree for OCSP testing - Issuer: self - tags: [ecdsa] - -- name: 'ecdsa-server-ocsp.pem' - description: ECDSA server certificate w/OCSP - Issuer: 'ecdsa-ca-ocsp.pem' - tags: [ecdsa, ocsp] - -- name: 'ecdsa-server-ocsp-mustStaple.pem' - description: ECDSA server certificate w/OCSP + must-staple - Issuer: 'ecdsa-ca-ocsp.pem' - tags: [ecdsa, ocsp, must-staple] - -- name: 'ecdsa-ocsp-responder.crt' - description: ECDSA certificate and key for OCSP responder - Issuer: 'ecdsa-ca-ocsp.pem' - tags: [ecdsa, ocsp, responder ] - -- name: 'ecdsa-server-ocsp-singleEndpoint.pem' - description: ECDSA server certificate w/OCSP + one OCSP endpoint - Issuer: 'ecdsa-ca-ocsp.pem' - tags: [ecdsa, ocsp, single-ocsp-endpoint] - -- name: 'ecdsa-server-ocsp-mustStaple-singleEndpoint.pem' - description: ECDSA server certificate w/OCSP + must-staple + one OCSP endpoint - Issuer: 'ecdsa-ca-ocsp.pem' - tags: [ecdsa, ocsp, must-staple, single-ocsp-endpoint] diff --git a/.evergreen/ocsp/ecdsa/ca.crt b/.evergreen/ocsp/ecdsa/ca.crt deleted file mode 100644 index 623739ecb..000000000 --- a/.evergreen/ocsp/ecdsa/ca.crt +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIB9jCCAZygAwIBAgIERIhZ3jAKBggqhkjOPQQDAjB6MQswCQYDVQQGEwJVUzER -MA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAOBgNV -BAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEdMBsGA1UEAwwUS2VybmVsIFRl -c3QgRVNDREEgQ0EwHhcNMjAwMzE3MTk0NjU5WhcNNDAwMzEyMTk0NjU5WjB6MQsw -CQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3Jr -IENpdHkxEDAOBgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEdMBsGA1UE -AwwUS2VybmVsIFRlc3QgRVNDREEgQ0EwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC -AAT1rsrbhlZEQAubaPkS23tOfSEdWNd+u7N5kV4nxKQDNxPcScnSGrb41tBEINdG -LQ/SopWZx9O8UJSrh8sqaV1AoxAwDjAMBgNVHRMEBTADAQH/MAoGCCqGSM49BAMC -A0gAMEUCIDEvg1FnzNQNnLDxyOthbOqpX58A0YfLjgGb8xAvvdr4AiEAtvF2jMt6 -/o4HVXXKdohjBJbETbr7XILEvnZ4Zt7QNl8= ------END CERTIFICATE----- diff --git a/.evergreen/ocsp/ecdsa/ca.key b/.evergreen/ocsp/ecdsa/ca.key deleted file mode 100644 index 05935962b..000000000 --- a/.evergreen/ocsp/ecdsa/ca.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgMzE6ziHkSWt+sE2O -RMFZ9wqjOg88cWTuMMYrKXXL1UWhRANCAAT1rsrbhlZEQAubaPkS23tOfSEdWNd+ -u7N5kV4nxKQDNxPcScnSGrb41tBEINdGLQ/SopWZx9O8UJSrh8sqaV1A ------END PRIVATE KEY----- diff --git a/.evergreen/ocsp/ecdsa/ca.pem b/.evergreen/ocsp/ecdsa/ca.pem deleted file mode 100644 index b5037745c..000000000 --- a/.evergreen/ocsp/ecdsa/ca.pem +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIB9jCCAZygAwIBAgIERIhZ3jAKBggqhkjOPQQDAjB6MQswCQYDVQQGEwJVUzER -MA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAOBgNV -BAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEdMBsGA1UEAwwUS2VybmVsIFRl -c3QgRVNDREEgQ0EwHhcNMjAwMzE3MTk0NjU5WhcNNDAwMzEyMTk0NjU5WjB6MQsw -CQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3Jr -IENpdHkxEDAOBgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEdMBsGA1UE -AwwUS2VybmVsIFRlc3QgRVNDREEgQ0EwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNC -AAT1rsrbhlZEQAubaPkS23tOfSEdWNd+u7N5kV4nxKQDNxPcScnSGrb41tBEINdG -LQ/SopWZx9O8UJSrh8sqaV1AoxAwDjAMBgNVHRMEBTADAQH/MAoGCCqGSM49BAMC -A0gAMEUCIDEvg1FnzNQNnLDxyOthbOqpX58A0YfLjgGb8xAvvdr4AiEAtvF2jMt6 -/o4HVXXKdohjBJbETbr7XILEvnZ4Zt7QNl8= ------END CERTIFICATE----- ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgMzE6ziHkSWt+sE2O -RMFZ9wqjOg88cWTuMMYrKXXL1UWhRANCAAT1rsrbhlZEQAubaPkS23tOfSEdWNd+ -u7N5kV4nxKQDNxPcScnSGrb41tBEINdGLQ/SopWZx9O8UJSrh8sqaV1A ------END PRIVATE KEY----- diff --git a/.evergreen/ocsp/ecdsa/mock-delegate-revoked.sh b/.evergreen/ocsp/ecdsa/mock-delegate-revoked.sh deleted file mode 100755 index 1e40fba5a..000000000 --- a/.evergreen/ocsp/ecdsa/mock-delegate-revoked.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env sh -python3 ../ocsp_mock.py \ - --ca_file ca.pem \ - --ocsp_responder_cert ocsp-responder.crt \ - --ocsp_responder_key ocsp-responder.key \ - -p 8100 \ - -v \ - --fault revoked diff --git a/.evergreen/ocsp/ecdsa/mock-delegate-valid.sh b/.evergreen/ocsp/ecdsa/mock-delegate-valid.sh deleted file mode 100755 index 5074a7eca..000000000 --- a/.evergreen/ocsp/ecdsa/mock-delegate-valid.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env sh -python3 ../ocsp_mock.py \ - --ca_file ca.pem \ - --ocsp_responder_cert ocsp-responder.crt \ - --ocsp_responder_key ocsp-responder.key \ - -p 8100 \ - -v diff --git a/.evergreen/ocsp/ecdsa/mock-revoked.sh b/.evergreen/ocsp/ecdsa/mock-revoked.sh deleted file mode 100755 index a6bf2ef02..000000000 --- a/.evergreen/ocsp/ecdsa/mock-revoked.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env sh -# Use the CA as the OCSP responder -python3 ../ocsp_mock.py \ - --ca_file ca.pem \ - --ocsp_responder_cert ca.crt \ - --ocsp_responder_key ca.key \ - -p 8100 \ - -v \ - --fault revoked - diff --git a/.evergreen/ocsp/ecdsa/mock-valid.sh b/.evergreen/ocsp/ecdsa/mock-valid.sh deleted file mode 100755 index c89ce9e95..000000000 --- a/.evergreen/ocsp/ecdsa/mock-valid.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env sh -python3 ../ocsp_mock.py \ - --ca_file ca.pem \ - --ocsp_responder_cert ca.crt \ - --ocsp_responder_key ca.key \ - -p 8100 \ - -v diff --git a/.evergreen/ocsp/ecdsa/ocsp-responder.crt b/.evergreen/ocsp/ecdsa/ocsp-responder.crt deleted file mode 100644 index 4d3f3e929..000000000 --- a/.evergreen/ocsp/ecdsa/ocsp-responder.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICVTCCAfygAwIBAgIEfpRhITAKBggqhkjOPQQDAjB6MQswCQYDVQQGEwJVUzER -MA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAOBgNV -BAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEdMBsGA1UEAwwUS2VybmVsIFRl -c3QgRVNDREEgQ0EwHhcNMjAwMzE3MTk0NzAwWhcNNDAwMzEyMTk0NzAwWjBsMQsw -CQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3Jr -IENpdHkxEDAOBgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEPMA0GA1UE -AwwGc2VydmVyMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAERca9Bv0PDLkCULyx -axwx8nyPqonFF88MQiZpY7wK7atBfWkpZ9B/ukq5p+xVDXxS49huEIQUWOZ5xosF -frma96N+MHwwCQYDVR0TBAIwADAaBgNVHREEEzARgglsb2NhbGhvc3SHBH8AAAEw -HQYDVR0OBBYEFNQUc8MKrQDR4wAFZZ2o9PNLAiUHMAsGA1UdDwQEAwIF4DAnBgNV -HSUEIDAeBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMJMAoGCCqGSM49BAMC -A0cAMEQCIBQs56OofXC3Io6DjP4ccgpkX8cLHpMRb3jfZ6MxulniAiBVLoXo8K23 -YmpwoWKLFBKBdtGU+WDdD01Mb8X4iQ1gYg== ------END CERTIFICATE----- diff --git a/.evergreen/ocsp/ecdsa/ocsp-responder.key b/.evergreen/ocsp/ecdsa/ocsp-responder.key deleted file mode 100644 index 9e7eaa64e..000000000 --- a/.evergreen/ocsp/ecdsa/ocsp-responder.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgxxFxGTsPETczP0SW -69vnqYXZIgk+qG61j6JKElHa6duhRANCAARFxr0G/Q8MuQJQvLFrHDHyfI+qicUX -zwxCJmljvArtq0F9aSln0H+6Srmn7FUNfFLj2G4QhBRY5nnGiwV+uZr3 ------END PRIVATE KEY----- diff --git a/.evergreen/ocsp/ecdsa/rename.sh b/.evergreen/ocsp/ecdsa/rename.sh deleted file mode 100755 index cf72559c0..000000000 --- a/.evergreen/ocsp/ecdsa/rename.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -[ ! -f ecdsa-ca-ocsp.pem ] || mv ecdsa-ca-ocsp.pem ca.pem -[ ! -f ecdsa-ca-ocsp.crt ] || mv ecdsa-ca-ocsp.crt ca.crt -[ ! -f ecdsa-ca-ocsp.key ] || mv ecdsa-ca-ocsp.key ca.key -[ ! -f ecdsa-server-ocsp.pem ] || mv ecdsa-server-ocsp.pem server.pem -[ ! -f ecdsa-server-ocsp-mustStaple.pem ] || mv ecdsa-server-ocsp-mustStaple.pem server-mustStaple.pem -[ ! -f ecdsa-server-ocsp-singleEndpoint.pem ] || mv ecdsa-server-ocsp-singleEndpoint.pem server-singleEndpoint.pem -[ ! -f ecdsa-server-ocsp-mustStaple-singleEndpoint.pem ] || mv ecdsa-server-ocsp-mustStaple-singleEndpoint.pem server-mustStaple-singleEndpoint.pem -[ ! -f ecdsa-ocsp-responder.crt ] || mv ecdsa-ocsp-responder.crt ocsp-responder.crt -[ ! -f ecdsa-ocsp-responder.key ] || mv ecdsa-ocsp-responder.key ocsp-responder.key diff --git a/.evergreen/ocsp/ecdsa/server-mustStaple-singleEndpoint.pem b/.evergreen/ocsp/ecdsa/server-mustStaple-singleEndpoint.pem deleted file mode 100644 index c2d3caa3d..000000000 --- a/.evergreen/ocsp/ecdsa/server-mustStaple-singleEndpoint.pem +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICmzCCAkGgAwIBAgIEK6+qITAKBggqhkjOPQQDAjB6MQswCQYDVQQGEwJVUzER -MA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAOBgNV -BAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEdMBsGA1UEAwwUS2VybmVsIFRl -c3QgRVNDREEgQ0EwHhcNMjAwNDE3MjIwNzM4WhcNNDAwNDEyMjIwNzM4WjBsMQsw -CQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3Jr -IENpdHkxEDAOBgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEPMA0GA1UE -AwwGc2VydmVyMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQp0AXlVttI8EFDhm -YZZTGT0W9XZvUwk+HCVvTyRruyFI/VRW6PvLuCrMpFiXrM6kSoDQDDwcIH4jBv6u -y5mhYaOBwjCBvzAJBgNVHRMEAjAAMBoGA1UdEQQTMBGCCWxvY2FsaG9zdIcEfwAA -ATAdBgNVHQ4EFgQUHnyVeKPYHhZOYzAfQW+C48W+mQowCwYDVR0PBAQDAgWgMB0G -A1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjA4BggrBgEFBQcBAQQsMCowKAYI -KwYBBQUHMAGGHGh0dHA6Ly9sb2NhbGhvc3Q6ODEwMC9zdGF0dXMwEQYIKwYBBQUH -ARgEBTADAgEFMAoGCCqGSM49BAMCA0gAMEUCIHiAly+9pDK3z4shFjqQZILGcvaP -/71l3WSdKAjfKd1LAiEA9CpCiaGR1a5D8qSvr518WZtqOVB+YsEk63aJs/2PtM0= ------END CERTIFICATE----- ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgniP9x8ixUXWk16LR -EKiL5dqh2aH/ON6EmULoaReDLTKhRANCAARCnQBeVW20jwQUOGZhllMZPRb1dm9T -CT4cJW9PJGu7IUj9VFbo+8u4KsykWJeszqRKgNAMPBwgfiMG/q7LmaFh ------END PRIVATE KEY----- diff --git a/.evergreen/ocsp/ecdsa/server-mustStaple.pem b/.evergreen/ocsp/ecdsa/server-mustStaple.pem deleted file mode 100644 index b539779ef..000000000 --- a/.evergreen/ocsp/ecdsa/server-mustStaple.pem +++ /dev/null @@ -1,22 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICyjCCAnCgAwIBAgIEA54uVTAKBggqhkjOPQQDAjB6MQswCQYDVQQGEwJVUzER -MA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAOBgNV -BAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEdMBsGA1UEAwwUS2VybmVsIFRl -c3QgRVNDREEgQ0EwHhcNMjAwMzI2MTU1NzU1WhcNNDAwMzIxMTU1NzU1WjBsMQsw -CQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3Jr -IENpdHkxEDAOBgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEPMA0GA1UE -AwwGc2VydmVyMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEJjAN/Hd2R/RRBoAu -YouPhTbS/y2DiD47YQaUu1TlnrvABcvIgkMKYfbeNIhBfu44KzF2sKsmKrG6T6rs -NdJ3pqOB8TCB7jAJBgNVHRMEAjAAMBoGA1UdEQQTMBGCCWxvY2FsaG9zdIcEfwAA -ATAdBgNVHQ4EFgQUvHVMhH4zuedQN+9sQJ8LN7jvy3owCwYDVR0PBAQDAgWgMB0G -A1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjBnBggrBgEFBQcBAQRbMFkwLQYI -KwYBBQUHMAGGIWh0dHA6Ly9sb2NhbGhvc3Q6OTAwMS9wb3dlci9sZXZlbDAoBggr -BgEFBQcwAYYcaHR0cDovL2xvY2FsaG9zdDo4MTAwL3N0YXR1czARBggrBgEFBQcB -GAQFMAMCAQUwCgYIKoZIzj0EAwIDSAAwRQIgDiL8zqWkCR5Rc/YoAgV81qryUMrK -BQoP7fb1M0KKarECIQDPa5q1pFu+5UZ8gn7CP4/9xDcBiG6tQYK5N0FHAZXzEg== ------END CERTIFICATE----- ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg1IHezsqNUk0tfGOS -E2RcM7R00ue1/E8/pBBUGSt7RW2hRANCAAQmMA38d3ZH9FEGgC5ii4+FNtL/LYOI -PjthBpS7VOWeu8AFy8iCQwph9t40iEF+7jgrMXawqyYqsbpPquw10nem ------END PRIVATE KEY----- diff --git a/.evergreen/ocsp/ecdsa/server-singleEndpoint.pem b/.evergreen/ocsp/ecdsa/server-singleEndpoint.pem deleted file mode 100644 index fb2cfc596..000000000 --- a/.evergreen/ocsp/ecdsa/server-singleEndpoint.pem +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICiTCCAi6gAwIBAgIELzCNWTAKBggqhkjOPQQDAjB6MQswCQYDVQQGEwJVUzER -MA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAOBgNV -BAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEdMBsGA1UEAwwUS2VybmVsIFRl -c3QgRVNDREEgQ0EwHhcNMjAwNDE3MjIwNzQ0WhcNNDAwNDEyMjIwNzQ0WjBsMQsw -CQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3Jr -IENpdHkxEDAOBgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEPMA0GA1UE -AwwGc2VydmVyMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAESvwx4QUCP0f5Dr8N -MMfO40epXIcain4+XEVy8hcAtR0nYD0QpnFJSX7E4b5eY7A/Lr7UEKx64Qg3qYEl -FgbezaOBrzCBrDAJBgNVHRMEAjAAMBoGA1UdEQQTMBGCCWxvY2FsaG9zdIcEfwAA -ATAdBgNVHQ4EFgQUfOg4eUnUTje/rTmAHnZ3XzdyStIwCwYDVR0PBAQDAgWgMB0G -A1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjA4BggrBgEFBQcBAQQsMCowKAYI -KwYBBQUHMAGGHGh0dHA6Ly9sb2NhbGhvc3Q6ODEwMC9zdGF0dXMwCgYIKoZIzj0E -AwIDSQAwRgIhAKT+d/zTlhzZnOeU05Gi6hJAC0W9Fq4K2Sh04Cdys9kgAiEAyEla -DrZl0P+kGIJN49CUTHBiXN1t6nSRflNrkFiPFmI= ------END CERTIFICATE----- ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgqD1jXcZlgcRjdj1l -i2i0L0+hE4YmhdetvKwZ8REk8jqhRANCAARK/DHhBQI/R/kOvw0wx87jR6lchxqK -fj5cRXLyFwC1HSdgPRCmcUlJfsThvl5jsD8uvtQQrHrhCDepgSUWBt7N ------END PRIVATE KEY----- diff --git a/.evergreen/ocsp/ecdsa/server.pem b/.evergreen/ocsp/ecdsa/server.pem deleted file mode 100644 index d120e1852..000000000 --- a/.evergreen/ocsp/ecdsa/server.pem +++ /dev/null @@ -1,22 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICtzCCAl2gAwIBAgIEP6OYOTAKBggqhkjOPQQDAjB6MQswCQYDVQQGEwJVUzER -MA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAOBgNV -BAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEdMBsGA1UEAwwUS2VybmVsIFRl -c3QgRVNDREEgQ0EwHhcNMjAwMzI2MTU1ODA2WhcNNDAwMzIxMTU1ODA2WjBsMQsw -CQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3Jr -IENpdHkxEDAOBgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEPMA0GA1UE -AwwGc2VydmVyMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEK4FR+soHPeGhF5c+ -bPBX9/+gm+RimTqlXQAkHQHopLETOVexyt0eAVJe/euPAdKx3JvQ2fx2YOaBZK2U -D98UoKOB3jCB2zAJBgNVHRMEAjAAMBoGA1UdEQQTMBGCCWxvY2FsaG9zdIcEfwAA -ATAdBgNVHQ4EFgQU2JCna5G/Yd+Hd9hkAoWXxSjQ7acwCwYDVR0PBAQDAgWgMB0G -A1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjBnBggrBgEFBQcBAQRbMFkwLQYI -KwYBBQUHMAGGIWh0dHA6Ly9sb2NhbGhvc3Q6OTAwMS9wb3dlci9sZXZlbDAoBggr -BgEFBQcwAYYcaHR0cDovL2xvY2FsaG9zdDo4MTAwL3N0YXR1czAKBggqhkjOPQQD -AgNIADBFAiEA3F6MCGLS+gBDMl3+GTAVxYYuxLbhW92CQLwh/FbDozYCIHQzJ2G/ -ht6PGW9nKueW0yDfppBVlxBmlKody9ugpcpO ------END CERTIFICATE----- ------BEGIN PRIVATE KEY----- -MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgp33qfUjflX1C7ROa -e5F/RNyIhLE9hnxg4eFQQTqdxUqhRANCAAQrgVH6ygc94aEXlz5s8Ff3/6Cb5GKZ -OqVdACQdAeiksRM5V7HK3R4BUl79648B0rHcm9DZ/HZg5oFkrZQP3xSg ------END PRIVATE KEY----- diff --git a/.evergreen/ocsp/mock-ocsp-responder-requirements.txt b/.evergreen/ocsp/mock-ocsp-responder-requirements.txt deleted file mode 100644 index 0344252b6..000000000 --- a/.evergreen/ocsp/mock-ocsp-responder-requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -asn1crypto==1.3.0 -flask==1.1.1 -oscrypto==1.2.0 diff --git a/.evergreen/ocsp/mock_ocsp_responder.py b/.evergreen/ocsp/mock_ocsp_responder.py deleted file mode 100755 index 6274e97ac..000000000 --- a/.evergreen/ocsp/mock_ocsp_responder.py +++ /dev/null @@ -1,614 +0,0 @@ -# -# This file has been modified in 2019 by MongoDB Inc. -# - -# OCSPBuilder is derived from https://github.com/wbond/ocspbuilder -# OCSPResponder is derived from https://github.com/threema-ch/ocspresponder - -# Copyright (c) 2015-2018 Will Bond - -# Permission is hereby granted, free of charge, to any person obtaining a copy of -# this software and associated documentation files (the "Software"), to deal in -# the Software without restriction, including without limitation the rights to -# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -# of the Software, and to permit persons to whom the Software is furnished to do -# so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -# Copyright 2016 Threema GmbH - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from __future__ import unicode_literals, division, absolute_import, print_function - -import logging -import base64 -import inspect -import re -import enum -import sys -import textwrap -from datetime import datetime, timezone, timedelta -from typing import Callable, Tuple, Optional - -from asn1crypto import x509, keys, core, ocsp -from asn1crypto.ocsp import OCSPRequest, OCSPResponse -from oscrypto import asymmetric -from flask import Flask, request, Response - -__version__ = '0.10.2' -__version_info__ = (0, 10, 2) - -logger = logging.getLogger(__name__) - -if sys.version_info < (3,): - byte_cls = str -else: - byte_cls = bytes - -def _pretty_message(string, *params): - """ - Takes a multi-line string and does the following: - - dedents - - converts newlines with text before and after into a single line - - strips leading and trailing whitespace - :param string: - The string to format - :param *params: - Params to interpolate into the string - :return: - The formatted string - """ - - output = textwrap.dedent(string) - - # Unwrap lines, taking into account bulleted lists, ordered lists and - # underlines consisting of = signs - if output.find('\n') != -1: - output = re.sub('(?<=\\S)\n(?=[^ \n\t\\d\\*\\-=])', ' ', output) - - if params: - output = output % params - - output = output.strip() - - return output - - -def _type_name(value): - """ - :param value: - A value to get the object name of - :return: - A unicode string of the object name - """ - - if inspect.isclass(value): - cls = value - else: - cls = value.__class__ - if cls.__module__ in set(['builtins', '__builtin__']): - return cls.__name__ - return '%s.%s' % (cls.__module__, cls.__name__) - -def _writer(func): - """ - Decorator for a custom writer, but a default reader - """ - - name = func.__name__ - return property(fget=lambda self: getattr(self, '_%s' % name), fset=func) - - -class OCSPResponseBuilder(object): - - _response_status = None - _certificate = None - _certificate_status = None - _revocation_date = None - _certificate_issuer = None - _hash_algo = None - _key_hash_algo = None - _nonce = None - _this_update = None - _next_update = None - _response_data_extensions = None - _single_response_extensions = None - - def __init__(self, response_status, certificate_status_list=[], revocation_date=None): - """ - Unless changed, responses will use SHA-256 for the signature, - and will be valid from the moment created for one week. - :param response_status: - A unicode string of OCSP response type: - - "successful" - when the response includes information about the certificate - - "malformed_request" - when the request could not be understood - - "internal_error" - when an internal error occured with the OCSP responder - - "try_later" - when the OCSP responder is temporarily unavailable - - "sign_required" - when the OCSP request must be signed - - "unauthorized" - when the responder is not the correct responder for the certificate - :param certificate_list: - A list of tuples with certificate serial number and certificate status objects. - certificate_status: - A unicode string of the status of the certificate. Only required if - the response_status is "successful". - - "good" - when the certificate is in good standing - - "revoked" - when the certificate is revoked without a reason code - - "key_compromise" - when a private key is compromised - - "ca_compromise" - when the CA issuing the certificate is compromised - - "affiliation_changed" - when the certificate subject name changed - - "superseded" - when the certificate was replaced with a new one - - "cessation_of_operation" - when the certificate is no longer needed - - "certificate_hold" - when the certificate is temporarily invalid - - "remove_from_crl" - only delta CRLs - when temporary hold is removed - - "privilege_withdrawn" - one of the usages for a certificate was removed - - "unknown" - the responder doesn't know about the certificate being requested - :param revocation_date: - A datetime.datetime object of when the certificate was revoked, if - the response_status is "successful" and the certificate status is - not "good" or "unknown". - """ - self._response_status = response_status - self._certificate_status_list = certificate_status_list - self._revocation_date = revocation_date - - self._key_hash_algo = 'sha1' - self._hash_algo = 'sha256' - self._response_data_extensions = {} - self._single_response_extensions = {} - - @_writer - def nonce(self, value): - """ - The nonce that was provided during the request. - """ - - if not isinstance(value, byte_cls): - raise TypeError(_pretty_message( - ''' - nonce must be a byte string, not %s - ''', - _type_name(value) - )) - - self._nonce = value - - @_writer - def certificate_issuer(self, value): - """ - An asn1crypto.x509.Certificate object of the issuer of the certificate. - This should only be set if the OCSP responder is not the issuer of - the certificate, but instead a special certificate only for OCSP - responses. - """ - - if value is not None: - is_oscrypto = isinstance(value, asymmetric.Certificate) - if not is_oscrypto and not isinstance(value, x509.Certificate): - raise TypeError(_pretty_message( - ''' - certificate_issuer must be an instance of - asn1crypto.x509.Certificate or - oscrypto.asymmetric.Certificate, not %s - ''', - _type_name(value) - )) - - if is_oscrypto: - value = value.asn1 - - self._certificate_issuer = value - - @_writer - def next_update(self, value): - """ - A datetime.datetime object of when the response may next change. This - should only be set if responses are cached. If responses are generated - fresh on every request, this should not be set. - """ - - if not isinstance(value, datetime): - raise TypeError(_pretty_message( - ''' - next_update must be an instance of datetime.datetime, not %s - ''', - _type_name(value) - )) - - self._next_update = value - - def build(self, responder_private_key=None, responder_certificate=None): - """ - Validates the request information, constructs the ASN.1 structure and - signs it. - The responder_private_key and responder_certificate parameters are onlystr - required if the response_status is "successful". - :param responder_private_key: - An asn1crypto.keys.PrivateKeyInfo or oscrypto.asymmetric.PrivateKey - object for the private key to sign the response with - :param responder_certificate: - An asn1crypto.x509.Certificate or oscrypto.asymmetric.Certificate - object of the certificate associated with the private key - :return: - An asn1crypto.ocsp.OCSPResponse object of the response - """ - if self._response_status != 'successful': - return ocsp.OCSPResponse({ - 'response_status': self._response_status - }) - - is_oscrypto = isinstance(responder_private_key, asymmetric.PrivateKey) - if not isinstance(responder_private_key, keys.PrivateKeyInfo) and not is_oscrypto: - raise TypeError(_pretty_message( - ''' - responder_private_key must be an instance ofthe c - asn1crypto.keys.PrivateKeyInfo or - oscrypto.asymmetric.PrivateKey, not %s - ''', - _type_name(responder_private_key) - )) - - cert_is_oscrypto = isinstance(responder_certificate, asymmetric.Certificate) - if not isinstance(responder_certificate, x509.Certificate) and not cert_is_oscrypto: - raise TypeError(_pretty_message( - ''' - responder_certificate must be an instance of - asn1crypto.x509.Certificate or - oscrypto.asymmetric.Certificate, not %s - ''', - _type_name(responder_certificate) - )) - - if cert_is_oscrypto: - responder_certificate = responder_certificate.asn1 - - if self._certificate_status_list is None: - raise ValueError(_pretty_message( - ''' - certificate_status_list must be set if the response_status is - "successful" - ''' - )) - - def _make_extension(name, value): - return { - 'extn_id': name, - 'critical': False, - 'extn_value': value - } - - responses = [] - for serial, status in self._certificate_status_list: - response_data_extensions = [] - single_response_extensions = [] - for name, value in self._response_data_extensions.items(): - response_data_extensions.append(_make_extension(name, value)) - if self._nonce: - response_data_extensions.append( - _make_extension('nonce', self._nonce) - ) - - if not response_data_extensions: - response_data_extensions = None - - for name, value in self._single_response_extensions.items(): - single_response_extensions.append(_make_extension(name, value)) - - if self._certificate_issuer: - single_response_extensions.append( - _make_extension( - 'certificate_issuer', - [ - x509.GeneralName( - name='directory_name', - value=self._certificate_issuer.subject - ) - ] - ) - ) - - if not single_response_extensions: - single_response_extensions = None - - responder_key_hash = getattr(responder_certificate.public_key, self._key_hash_algo) - - if status == 'good': - cert_status = ocsp.CertStatus( - name='good', - value=core.Null() - ) - elif status == 'unknown': - cert_status = ocsp.CertStatus( - name='unknown', - value=core.Null() - ) - else: - reason = status if status != 'revoked' else 'unspecified' - cert_status = ocsp.CertStatus( - name='revoked', - value={ - 'revocation_time': self._revocation_date, - 'revocation_reason': reason, - } - ) - - issuer = self._certificate_issuer if self._certificate_issuer else responder_certificate - - produced_at = datetime.now(timezone.utc).replace(microsecond=0) - - if self._this_update is None: - self._this_update = produced_at - - if self._next_update is None: - self._next_update = (self._this_update + timedelta(days=7)).replace(microsecond=0) - - response = { - 'cert_id': { - 'hash_algorithm': { - 'algorithm': self._key_hash_algo - }, - 'issuer_name_hash': getattr(issuer.subject, self._key_hash_algo), - 'issuer_key_hash': getattr(issuer.public_key, self._key_hash_algo), - 'serial_number': serial, - }, - 'cert_status': cert_status, - 'this_update': self._this_update, - 'next_update': self._next_update, - 'single_extensions': single_response_extensions - } - responses.append(response) - - response_data = ocsp.ResponseData({ - 'responder_id': ocsp.ResponderId(name='by_key', value=responder_key_hash), - 'produced_at': produced_at, - 'responses': responses, - 'response_extensions': response_data_extensions - }) - - signature_algo = responder_private_key.algorithm - if signature_algo == 'ec': - signature_algo = 'ecdsa' - - signature_algorithm_id = '%s_%s' % (self._hash_algo, signature_algo) - - if responder_private_key.algorithm == 'rsa': - sign_func = asymmetric.rsa_pkcs1v15_sign - elif responder_private_key.algorithm == 'dsa': - sign_func = asymmetric.dsa_sign - elif responder_private_key.algorithm == 'ec': - sign_func = asymmetric.ecdsa_sign - - if not is_oscrypto: - responder_private_key = asymmetric.load_private_key(responder_private_key) - signature_bytes = sign_func(responder_private_key, response_data.dump(), self._hash_algo) - - certs = None - if self._certificate_issuer and getattr(self._certificate_issuer.public_key, self._key_hash_algo) != responder_key_hash: - certs = [responder_certificate] - - return ocsp.OCSPResponse({ - 'response_status': self._response_status, - 'response_bytes': { - 'response_type': 'basic_ocsp_response', - 'response': { - 'tbs_response_data': response_data, - 'signature_algorithm': {'algorithm': signature_algorithm_id}, - 'signature': signature_bytes, - 'certs': certs, - } - } - }) - -# Enums - -class ResponseStatus(enum.Enum): - successful = 'successful' - malformed_request = 'malformed_request' - internal_error = 'internal_error' - try_later = 'try_later' - sign_required = 'sign_required' - unauthorized = 'unauthorized' - - -class CertificateStatus(enum.Enum): - good = 'good' - revoked = 'revoked' - key_compromise = 'key_compromise' - ca_compromise = 'ca_compromise' - affiliation_changed = 'affiliation_changed' - superseded = 'superseded' - cessation_of_operation = 'cessation_of_operation' - certificate_hold = 'certificate_hold' - remove_from_crl = 'remove_from_crl' - privilege_withdrawn = 'privilege_withdrawn' - unknown = 'unknown' - - -# API endpoints -FAULT_REVOKED = "revoked" -FAULT_UNKNOWN = "unknown" - -app = Flask(__name__) -class OCSPResponder: - - def __init__(self, issuer_cert: str, responder_cert: str, responder_key: str, - fault: str, next_update_seconds: int): - """ - Create a new OCSPResponder instance. - - :param issuer_cert: Path to the issuer certificate. - :param responder_cert: Path to the certificate of the OCSP responder - with the `OCSP Signing` extension. - :param responder_key: Path to the private key belonging to the - responder cert. - :param validate_func: A function that - given a certificate serial - - will return the appropriate :class:`CertificateStatus` and - - depending on the status - a revocation datetime. - :param cert_retrieve_func: A function that - given a certificate serial - - will return the corresponding certificate as a string. - :param next_update_seconds: The ``nextUpdate`` value that will be written - into the response. Default: 9 hours. - - """ - # Certs and keys - self._issuer_cert = asymmetric.load_certificate(issuer_cert) - self._responder_cert = asymmetric.load_certificate(responder_cert) - self._responder_key = asymmetric.load_private_key(responder_key) - - # Next update - self._next_update_seconds = next_update_seconds - - self._fault = fault - - def _fail(self, status: ResponseStatus) -> OCSPResponse: - builder = OCSPResponseBuilder(response_status=status.value) - return builder.build() - - def parse_ocsp_request(self, request_der: bytes) -> OCSPRequest: - """ - Parse the request bytes, return an ``OCSPRequest`` instance. - """ - return OCSPRequest.load(request_der) - - def validate(self): - time = datetime(2018, 1, 1, 1, 00, 00, 00, timezone.utc) - if self._fault == FAULT_REVOKED: - return (CertificateStatus.revoked, time) - elif self._fault == FAULT_UNKNOWN: - return (CertificateStatus.unknown, None) - elif self._fault != None: - raise NotImplemented('Fault type could not be found') - return (CertificateStatus.good, time) - - def _build_ocsp_response(self, ocsp_request: OCSPRequest) -> OCSPResponse: - """ - Create and return an OCSP response from an OCSP request. - """ - # Get the certificate serial - tbs_request = ocsp_request['tbs_request'] - request_list = tbs_request['request_list'] - if len(request_list) < 1: - logger.warning('Received OCSP request with no requests') - raise NotImplemented('Empty requests not supported') - - single_request = request_list[0] # TODO: Support more than one request - req_cert = single_request['req_cert'] - serial = req_cert['serial_number'].native - - # Check certificate status - try: - certificate_status, revocation_date = self.validate() - except Exception as e: - logger.exception('Could not determine certificate status: %s', e) - return self._fail(ResponseStatus.internal_error) - - certificate_status_list = [(serial, certificate_status.value)] - - # Build the response - builder = OCSPResponseBuilder(**{ - 'response_status': ResponseStatus.successful.value, - 'certificate_status_list': certificate_status_list, - 'revocation_date': revocation_date, - }) - - # Parse extensions - for extension in tbs_request['request_extensions']: - extn_id = extension['extn_id'].native - critical = extension['critical'].native - value = extension['extn_value'].parsed - - # This variable tracks whether any unknown extensions were encountered - unknown = False - - # Handle nonce extension - if extn_id == 'nonce': - builder.nonce = value.native - - # That's all we know - else: - unknown = True - - # If an unknown critical extension is encountered (which should not - # usually happen, according to RFC 6960 4.1.2), we should throw our - # hands up in despair and run. - if unknown is True and critical is True: - logger.warning('Could not parse unknown critical extension: %r', - dict(extension.native)) - return self._fail(ResponseStatus.internal_error) - - # If it's an unknown non-critical extension, we can safely ignore it. - elif unknown is True: - logger.info('Ignored unknown non-critical extension: %r', dict(extension.native)) - - # Set certificate issuer - builder.certificate_issuer = self._issuer_cert - - # Set next update date - now = datetime.now(timezone.utc) - builder.next_update = (now + timedelta(seconds=self._next_update_seconds)).replace(microsecond=0) - - return builder.build(self._responder_key, self._responder_cert) - - def build_http_response(self, request_der: bytes) -> Response: - global app - response_der = self._build_ocsp_response(request_der).dump() - resp = app.make_response((response_der, 200)) - resp.headers['content_type'] = 'application/ocsp-response' - return resp - - -responder = None - -def init_responder(issuer_cert: str, responder_cert: str, responder_key: str, fault: str, next_update_seconds: int): - global responder - responder = OCSPResponder(issuer_cert=issuer_cert, responder_cert=responder_cert, responder_key=responder_key, fault=fault, next_update_seconds=next_update_seconds) - -def init(port=8080, debug=False): - logger.info('Launching %sserver on port %d', 'debug' if debug else '', port) - app.run(port=port, debug=debug) - -@app.route('/', methods=['GET']) -def _handle_root(): - return 'ocsp-responder' - -@app.route('/status/', defaults={'u_path': ''}, methods=['GET']) -@app.route('/status/', methods=['GET']) -def _handle_get(u_path): - global responder - """ - An OCSP GET request contains the DER-in-base64 encoded OCSP request in the - HTTP request URL. - """ - der = base64.b64decode(u_path) - ocsp_request = responder.parse_ocsp_request(der) - return responder.build_http_response(ocsp_request) - -@app.route('/status', methods=['POST']) -def _handle_post(): - global responder - """ - An OCSP POST request contains the DER encoded OCSP request in the HTTP - request body. - """ - ocsp_request = responder.parse_ocsp_request(request.data) - return responder.build_http_response(ocsp_request) diff --git a/.evergreen/ocsp/ocsp_mock.py b/.evergreen/ocsp/ocsp_mock.py deleted file mode 100755 index 04963b385..000000000 --- a/.evergreen/ocsp/ocsp_mock.py +++ /dev/null @@ -1,48 +0,0 @@ -#! /usr/bin/env python3 -""" -Python script to interface as a mock OCSP responder. -""" - -import argparse -import logging -import sys -import os - -sys.path.append(os.path.join(os.getcwd() ,'src', 'third_party', 'mock_ocsp_responder')) - -import mock_ocsp_responder - -def main(): - """Main entry point""" - parser = argparse.ArgumentParser(description="MongoDB Mock OCSP Responder.") - - parser.add_argument('-p', '--port', type=int, default=8080, help="Port to listen on") - - parser.add_argument('--ca_file', type=str, required=True, help="CA file for OCSP responder") - - parser.add_argument('-v', '--verbose', action='count', help="Enable verbose tracing") - - parser.add_argument('--ocsp_responder_cert', type=str, required=True, help="OCSP Responder Certificate") - - parser.add_argument('--ocsp_responder_key', type=str, required=True, help="OCSP Responder Keyfile") - - parser.add_argument('--fault', choices=[mock_ocsp_responder.FAULT_REVOKED, mock_ocsp_responder.FAULT_UNKNOWN, None], default=None, type=str, help="Specify a specific fault to test") - - parser.add_argument('--next_update_seconds', type=int, default=32400, help="Specify how long the OCSP response should be valid for") - - args = parser.parse_args() - if args.verbose: - logging.basicConfig(level=logging.DEBUG) - - print('Initializing OCSP Responder') - mock_ocsp_responder.init_responder(issuer_cert=args.ca_file, responder_cert=args.ocsp_responder_cert, responder_key=args.ocsp_responder_key, fault=args.fault, next_update_seconds=args.next_update_seconds) - - if args.verbose: - mock_ocsp_responder.init(args.port, debug=True) - else: - mock_ocsp_responder.init(args.port) - - print('Mock OCSP Responder is running on port %s' % (str(args.port))) - -if __name__ == '__main__': - main() diff --git a/.evergreen/ocsp/rsa/ca.crt b/.evergreen/ocsp/rsa/ca.crt deleted file mode 100644 index ee6dc5a65..000000000 --- a/.evergreen/ocsp/rsa/ca.crt +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDeTCCAmGgAwIBAgIEZLtwgzANBgkqhkiG9w0BAQsFADB0MQswCQYDVQQGEwJV -UzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAO -BgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEXMBUGA1UEAwwOS2VybmVs -IFRlc3QgQ0EwHhcNMjAwMjA2MjAxMzExWhcNNDAwMjA4MjAxMzExWjB0MQswCQYD -VQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENp -dHkxEDAOBgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEXMBUGA1UEAwwO -S2VybmVsIFRlc3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC0 -D1mnIrh7RRrCUEocNYLMZ2azo6c6NUTqSAMQyDDvRUsezil2NCqKo0ptMRtmb8Ws -yuaRUkjFhh9M69kiuj89GKRALXxExHjWX7e8iS1NTGL+Uakc1J23Z5FvlUyVLucC -fcAZ6MvcC7n6qpzUxkqz1u/27Ze9nv2mleLYBVWbGpjSHAUDuZzMCBs5Q/QrUwL7 -4cIxNsS0iHpYI3aee67cmFoK4guN9LBOtviyXUTP22kJLXe41HDjdWh01+FxcuwH -rGmeGQwiSlw48wkdoC0M51SwpHEq+K91BqGsTboC5mshqKA88OPf5JK9ied/OsNX -+K6p5v3RVHn89VaWiTorAgMBAAGjEzARMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI -hvcNAQELBQADggEBAAd1jj1GECUEJMH00IX3VFgb2RpJ4Qi8TKAZgMMHdE7Cyv4M -p4w/zvQC1F6i54n+TWucq3I+c33lEj63ybFdJO5HOWoGzC/f5qO7z0gYdP2Ltdxg -My2uVZNQS+B8hF9MhGUeFnOpzAbKW2If3KN1fn/m2NDYGEK/Z2t7ZkpOcpEW5Lib -vX+BBG/s4DeyhRXy+grs0ASU/z8VOhZYSJpgdbvXsY4RXXloTDcWIlNqra5K6+3T -nVEkBDm0Qw97Y6FsqBVxk4kgWC6xNxQ4Sp+Sg4wthMQ70iFGlMin0kYRo7kAIUF9 -M+v2vMwTFWkcl0BT5LobE39kWVbQKEVPH7nkItE= ------END CERTIFICATE----- diff --git a/.evergreen/ocsp/rsa/ca.key b/.evergreen/ocsp/rsa/ca.key deleted file mode 100644 index 9d10cb2db..000000000 --- a/.evergreen/ocsp/rsa/ca.key +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC0D1mnIrh7RRrC -UEocNYLMZ2azo6c6NUTqSAMQyDDvRUsezil2NCqKo0ptMRtmb8WsyuaRUkjFhh9M -69kiuj89GKRALXxExHjWX7e8iS1NTGL+Uakc1J23Z5FvlUyVLucCfcAZ6MvcC7n6 -qpzUxkqz1u/27Ze9nv2mleLYBVWbGpjSHAUDuZzMCBs5Q/QrUwL74cIxNsS0iHpY -I3aee67cmFoK4guN9LBOtviyXUTP22kJLXe41HDjdWh01+FxcuwHrGmeGQwiSlw4 -8wkdoC0M51SwpHEq+K91BqGsTboC5mshqKA88OPf5JK9ied/OsNX+K6p5v3RVHn8 -9VaWiTorAgMBAAECggEBAJ7umazMGdg80/TGF9Q0a2JutplDj5zyXgUJUSNkAMWB -/V+Qi8pZG1/J6CzfVpche3McmU2WOsOWslQcLUnY6W7NLFW1kGXGof5e+HgDASik -jxB6FfJrvVagpR+/wZxAjQmG46Q69o4hD6SxKcMpz9BTnPXxG6n1B2EeFd+lPb2r -zf/C4uXBczWn5rFXkj0DZGq81ZXewcnUNnxjQnccVCuYW+hqYxznSxqWTCD6hsvg -sGceqv0Ppp6TqMSECCIIJ+kVlbiAC2i6mnoertheFVrNUdwDb8nRn6fs8T+F0ShW -PdxIfSvAaBKqvseJqqueVpuwVcdSl+moJYlCdMb4cUECgYEA30AIHvMQq/s33ipV -62xOKXcEZ7tKaJrAbJvG4cx934wNiQ0tLwRNlonGbuTjsUaPRvagVeJND/UPIsfH -ZwoY1Uw25fZNaveoQtU8LQBAG53R5yaMiUH48JWVvKRdfG09zr6EFCM/k2loHS1W -/CiDlaIl59B8REnihyn0wvkiaIsCgYEAznlZRhlruk+n2sWklierav4M8GEK22+/ -A/UP1eUnlcHgSaFZoM0sukSrisZnj6zu/BAfFEVN5czra3ARrLClLQteFREr2BMF -9XymrjNG99QkBAall7BGpfkDW/D2DFZa4G5R6AMG+pYZHCU84U4QT5ZKyfdhTUbQ -uTYx2F31COECgYAIUm+7D56AerXjbzqSsw/a1dfxMfcdHR+tLMVmJ2RNz/+1KyuT -BBsMUIh4G8otEo9GuuzRJsVuodj1l/Lj8WlpkhS9z8elBCRekWpT1x2Mqf5oGnTE -rRPli/3v8USW3c+fBFUSFxpImXZLGCSU88Gr80ZsdMYdGY/7L+Iy3myc7wKBgQC1 -uHeqCpWV1KWXFnxU63UjJZWdussjdqZXhUf6qUS9uXT9WNTZgbrr9aRE73oWKc3s -awPvg0+cAU7xsCDeLFoz2t1jDUnZUmTcOmk4yEidtkg8gt0bNDn5ucALG3hyQ06Y -WIAeAwwRYCmZa+y5H0ubwFryhpdMvBbX66rTE16mAQKBgC5PJd9zLEzyLj/jUfZ0 -xOwXubu9GejOuCiVwKMTn73nvdi57zFBOrDxSl9yVCRhve61L5fcJixRDiwx8qtd -VGclRMxbVPKVfKpAyKjpsmZXk3IPHjXjJb3fYLXAnzRHk6v+yjVn4fy2Z93pW/cF -wBgQNqXLNTGrBzrFi469oc1s ------END PRIVATE KEY----- diff --git a/.evergreen/ocsp/rsa/ca.pem b/.evergreen/ocsp/rsa/ca.pem deleted file mode 100644 index afa468f04..000000000 --- a/.evergreen/ocsp/rsa/ca.pem +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDeTCCAmGgAwIBAgIEZLtwgzANBgkqhkiG9w0BAQsFADB0MQswCQYDVQQGEwJV -UzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAO -BgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEXMBUGA1UEAwwOS2VybmVs -IFRlc3QgQ0EwHhcNMjAwMjA2MjAxMzExWhcNNDAwMjA4MjAxMzExWjB0MQswCQYD -VQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENp -dHkxEDAOBgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEXMBUGA1UEAwwO -S2VybmVsIFRlc3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC0 -D1mnIrh7RRrCUEocNYLMZ2azo6c6NUTqSAMQyDDvRUsezil2NCqKo0ptMRtmb8Ws -yuaRUkjFhh9M69kiuj89GKRALXxExHjWX7e8iS1NTGL+Uakc1J23Z5FvlUyVLucC -fcAZ6MvcC7n6qpzUxkqz1u/27Ze9nv2mleLYBVWbGpjSHAUDuZzMCBs5Q/QrUwL7 -4cIxNsS0iHpYI3aee67cmFoK4guN9LBOtviyXUTP22kJLXe41HDjdWh01+FxcuwH -rGmeGQwiSlw48wkdoC0M51SwpHEq+K91BqGsTboC5mshqKA88OPf5JK9ied/OsNX -+K6p5v3RVHn89VaWiTorAgMBAAGjEzARMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI -hvcNAQELBQADggEBAAd1jj1GECUEJMH00IX3VFgb2RpJ4Qi8TKAZgMMHdE7Cyv4M -p4w/zvQC1F6i54n+TWucq3I+c33lEj63ybFdJO5HOWoGzC/f5qO7z0gYdP2Ltdxg -My2uVZNQS+B8hF9MhGUeFnOpzAbKW2If3KN1fn/m2NDYGEK/Z2t7ZkpOcpEW5Lib -vX+BBG/s4DeyhRXy+grs0ASU/z8VOhZYSJpgdbvXsY4RXXloTDcWIlNqra5K6+3T -nVEkBDm0Qw97Y6FsqBVxk4kgWC6xNxQ4Sp+Sg4wthMQ70iFGlMin0kYRo7kAIUF9 -M+v2vMwTFWkcl0BT5LobE39kWVbQKEVPH7nkItE= ------END CERTIFICATE----- ------BEGIN PRIVATE KEY----- -MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC0D1mnIrh7RRrC -UEocNYLMZ2azo6c6NUTqSAMQyDDvRUsezil2NCqKo0ptMRtmb8WsyuaRUkjFhh9M -69kiuj89GKRALXxExHjWX7e8iS1NTGL+Uakc1J23Z5FvlUyVLucCfcAZ6MvcC7n6 -qpzUxkqz1u/27Ze9nv2mleLYBVWbGpjSHAUDuZzMCBs5Q/QrUwL74cIxNsS0iHpY -I3aee67cmFoK4guN9LBOtviyXUTP22kJLXe41HDjdWh01+FxcuwHrGmeGQwiSlw4 -8wkdoC0M51SwpHEq+K91BqGsTboC5mshqKA88OPf5JK9ied/OsNX+K6p5v3RVHn8 -9VaWiTorAgMBAAECggEBAJ7umazMGdg80/TGF9Q0a2JutplDj5zyXgUJUSNkAMWB -/V+Qi8pZG1/J6CzfVpche3McmU2WOsOWslQcLUnY6W7NLFW1kGXGof5e+HgDASik -jxB6FfJrvVagpR+/wZxAjQmG46Q69o4hD6SxKcMpz9BTnPXxG6n1B2EeFd+lPb2r -zf/C4uXBczWn5rFXkj0DZGq81ZXewcnUNnxjQnccVCuYW+hqYxznSxqWTCD6hsvg -sGceqv0Ppp6TqMSECCIIJ+kVlbiAC2i6mnoertheFVrNUdwDb8nRn6fs8T+F0ShW -PdxIfSvAaBKqvseJqqueVpuwVcdSl+moJYlCdMb4cUECgYEA30AIHvMQq/s33ipV -62xOKXcEZ7tKaJrAbJvG4cx934wNiQ0tLwRNlonGbuTjsUaPRvagVeJND/UPIsfH -ZwoY1Uw25fZNaveoQtU8LQBAG53R5yaMiUH48JWVvKRdfG09zr6EFCM/k2loHS1W -/CiDlaIl59B8REnihyn0wvkiaIsCgYEAznlZRhlruk+n2sWklierav4M8GEK22+/ -A/UP1eUnlcHgSaFZoM0sukSrisZnj6zu/BAfFEVN5czra3ARrLClLQteFREr2BMF -9XymrjNG99QkBAall7BGpfkDW/D2DFZa4G5R6AMG+pYZHCU84U4QT5ZKyfdhTUbQ -uTYx2F31COECgYAIUm+7D56AerXjbzqSsw/a1dfxMfcdHR+tLMVmJ2RNz/+1KyuT -BBsMUIh4G8otEo9GuuzRJsVuodj1l/Lj8WlpkhS9z8elBCRekWpT1x2Mqf5oGnTE -rRPli/3v8USW3c+fBFUSFxpImXZLGCSU88Gr80ZsdMYdGY/7L+Iy3myc7wKBgQC1 -uHeqCpWV1KWXFnxU63UjJZWdussjdqZXhUf6qUS9uXT9WNTZgbrr9aRE73oWKc3s -awPvg0+cAU7xsCDeLFoz2t1jDUnZUmTcOmk4yEidtkg8gt0bNDn5ucALG3hyQ06Y -WIAeAwwRYCmZa+y5H0ubwFryhpdMvBbX66rTE16mAQKBgC5PJd9zLEzyLj/jUfZ0 -xOwXubu9GejOuCiVwKMTn73nvdi57zFBOrDxSl9yVCRhve61L5fcJixRDiwx8qtd -VGclRMxbVPKVfKpAyKjpsmZXk3IPHjXjJb3fYLXAnzRHk6v+yjVn4fy2Z93pW/cF -wBgQNqXLNTGrBzrFi469oc1s ------END PRIVATE KEY----- diff --git a/.evergreen/ocsp/rsa/mock-delegate-revoked.sh b/.evergreen/ocsp/rsa/mock-delegate-revoked.sh deleted file mode 100755 index adf026ce1..000000000 --- a/.evergreen/ocsp/rsa/mock-delegate-revoked.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env sh -python3 ../ocsp_mock.py \ - --ca_file ca.pem \ - --ocsp_responder_cert ocsp_responder.crt \ - --ocsp_responder_key ocsp_responder.key \ - -p 8100 \ - -v \ - --fault revoked diff --git a/.evergreen/ocsp/rsa/mock-delegate-valid.sh b/.evergreen/ocsp/rsa/mock-delegate-valid.sh deleted file mode 100755 index 5074a7eca..000000000 --- a/.evergreen/ocsp/rsa/mock-delegate-valid.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env sh -python3 ../ocsp_mock.py \ - --ca_file ca.pem \ - --ocsp_responder_cert ocsp-responder.crt \ - --ocsp_responder_key ocsp-responder.key \ - -p 8100 \ - -v diff --git a/.evergreen/ocsp/rsa/mock-revoked.sh b/.evergreen/ocsp/rsa/mock-revoked.sh deleted file mode 100755 index 4a17926b9..000000000 --- a/.evergreen/ocsp/rsa/mock-revoked.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env sh -python3 ../ocsp_mock.py \ - --ca_file ca.pem \ - --ocsp_responder_cert ca.crt \ - --ocsp_responder_key ca.key \ - -p 8100 \ - -v \ - --fault revoked diff --git a/.evergreen/ocsp/rsa/mock-valid.sh b/.evergreen/ocsp/rsa/mock-valid.sh deleted file mode 100755 index c89ce9e95..000000000 --- a/.evergreen/ocsp/rsa/mock-valid.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env sh -python3 ../ocsp_mock.py \ - --ca_file ca.pem \ - --ocsp_responder_cert ca.crt \ - --ocsp_responder_key ca.key \ - -p 8100 \ - -v diff --git a/.evergreen/ocsp/rsa/ocsp-responder.crt b/.evergreen/ocsp/rsa/ocsp-responder.crt deleted file mode 100644 index 58caba358..000000000 --- a/.evergreen/ocsp/rsa/ocsp-responder.crt +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDgzCCAmugAwIBAgIEA0v5yzANBgkqhkiG9w0BAQsFADB0MQswCQYDVQQGEwJV -UzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAO -BgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEXMBUGA1UEAwwOS2VybmVs -IFRlc3QgQ0EwHhcNMjAwMjA2MjMyMjU4WhcNNDAwMjA4MjMyMjU4WjBiMRAwDgYD -VQQKDAdNb25nb0RCMQ8wDQYDVQQLDAZLZXJuZWwxEjAQBgNVBAMMCWxvY2FsaG9z -dDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk5ZMQ8wDQYDVQQHDAZPQ1NQLTMwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDiHYXGCSOK3gxlEmNSLepoFJbv -hfYxxaqAWEceiTQdRpN97YRr/ywPm0+932EsE6/gIjqVs8IOtsiFKK1lQ9sL/9f+ -ckS5gj9AR+Cta+FLDRP5plE+aao5no0kA8qMx2HHd47XFnuxKtUztRmgmTBNYbYh -PdY1kjBSRyuXXBn1V6TRaYhk6dsK56Zvhgo6Y3YqpjpldePa4E0XpUlBhY020QXt -K3iWFauEYKcKR2JI2oVjY0tR60zf3GHkMLCe7SdbofCdwkBHcCctLSp4xYb44JGb -JX1npM1mhxR4pnp80tbEXNvXQ4S3kmd7/QFUYE4IdXVkXNhkK6PtIdDKbLa9AgMB -AAGjLzAtMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgXgMBMGA1UdJQQMMAoGCCsGAQUF -BwMJMA0GCSqGSIb3DQEBCwUAA4IBAQB5igUUQSzxzWvL+28TDYFuNnTB0hvqTnd7 -ZVyk8RVBiUkudxEmt5uFRWT6GOc7Y1H6w4igtuhhqxAeG9bUob+VQkCyc4GxaHSO -oBtl/Zu+ts+0gUUlm+Bs6wFnFsGhM0awV/vqigDADZT2jbqbHBm2lP99eq8fsi6L -kpohhbuTVWjLuViARYIOJLoBnNRpVXqwD5A8uNqwZI2OVGh1cQYNZcmfLJ1u2j5C -ycohoa+o8NGgkxEhG2QETdVodfHT2dUgzPDvO42CVa3MK7J0sovBU5DeuIDPV/hh -j+v5A8L8gMiNpkLClqt2TEiFH2GItWDNQjTgrLq9iFUgJnbwuj4F ------END CERTIFICATE----- diff --git a/.evergreen/ocsp/rsa/ocsp-responder.key b/.evergreen/ocsp/rsa/ocsp-responder.key deleted file mode 100644 index ab3001e7f..000000000 --- a/.evergreen/ocsp/rsa/ocsp-responder.key +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDiHYXGCSOK3gxl -EmNSLepoFJbvhfYxxaqAWEceiTQdRpN97YRr/ywPm0+932EsE6/gIjqVs8IOtsiF -KK1lQ9sL/9f+ckS5gj9AR+Cta+FLDRP5plE+aao5no0kA8qMx2HHd47XFnuxKtUz -tRmgmTBNYbYhPdY1kjBSRyuXXBn1V6TRaYhk6dsK56Zvhgo6Y3YqpjpldePa4E0X -pUlBhY020QXtK3iWFauEYKcKR2JI2oVjY0tR60zf3GHkMLCe7SdbofCdwkBHcCct -LSp4xYb44JGbJX1npM1mhxR4pnp80tbEXNvXQ4S3kmd7/QFUYE4IdXVkXNhkK6Pt -IdDKbLa9AgMBAAECggEBAMMYOe4OwI323LbwUKX9W/0Flt1/tlZneJ9Yi7R7KW4B -EQ1cPB96gafNl9X5wLvpGJzIq8ey28MaTpUl7cYr7/nAe7rdGRL+oFh0LBU1uaOp -2wxSRlMVlHw2owzqAH/LIECclbBbg8nvbRk6Lqx0wEpj/mNcGVELm4nCQohMPVGC -9/8GZ63r+tS35jry9SBG0X4R5jYKsNzgNgcjR+lgMv/2FfpuZDryk9TWIP9ApQoc -7/DpTfC6P34f/ermfo4f2GEmRJsTACphA0kkpQX/n88r35cUSGeO5M9jYICUeCFw -IK4L6KNQcTRVOknFYeVJembVrj0RYKtWT+oU84a4XPkCgYEA+k7fcXhU2K+NX8RN -7HUPbxBE/TfLTNHdLTuWCUI77j+J3LUPNQ4BUyue+pUaFxI7Huc6x1zvvD27EqJ8 -0ge5MkFNflTUdUotuU/FKg7GKOU7rfdEvthzU2MbAZrHc0SeF+9/YrpvWZ+ZMKQ5 -IBQhiloFLsVGpGFzzF/MjpFdYo8CgYEA50HQxDDmfzmvNnURRZZV0lQ203m9I4KF -DbL2x59q0DaJkUpFr3uyvghAoz4y/OD5vNIwbzHWbmDQEA06v7iFoJ6BcJFG1syc -7A7KTB3PNQK4+ASG6pC3tYJ78mWtJwK130hFpuVkS/VPhQZJ/21EcWj9V153SZpA -RUqv/L+lx/MCgYEAs7E7p3IDNyuQClgauM2wrsK3RDFxuUxPw9Eq/KqX64mhptg0 -epn7SYHfN3Uirb1gw+arw8NsN275hX8wrHbu9Kz8vNyZSTpfaNFjcbX5fBJUrab9 -qyQoZoyXLqe214FDHVvJz06X8Xcpukmq2OSaz3+giNsGw6tSPj3n09F3gPECgYBI -1NGK+FufdetYm0X1RIOC2kLqF00aAeElj1dpRyu8p3Br8ZhAzBRfBPpWbyBfw/rj -HM9kNa3y1Uqxw3jdKJ/tFf5uFVLaE1bYgU/06O55I4Jdmg9jkHBLGe0vShZeUtw0 -le5ZwaT0xy1kF7b2WtNTZF1lRrsK0ymqqPsD/teXQQKBgBTyYVxPEHKr86kEQqL5 -/OKByVpqAxA7LQ1lTLNV9lXMRawp848flv/Uc8pj43MitAIiYazfXkpeeC6gGntJ -kkRT9jraOzy51tVAIh2KXm3l6KY/gnYTO3UXrxZOZU4IA7OttP3BG7xKq/9HP+kV -5P1bAkqo+n3XNxKoSSeJteCd ------END PRIVATE KEY----- diff --git a/.evergreen/ocsp/rsa/server-mustStaple-singleEndpoint.pem b/.evergreen/ocsp/rsa/server-mustStaple-singleEndpoint.pem deleted file mode 100644 index 47112c02b..000000000 --- a/.evergreen/ocsp/rsa/server-mustStaple-singleEndpoint.pem +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEFzCCAv+gAwIBAgIETUEXPjANBgkqhkiG9w0BAQsFADB0MQswCQYDVQQGEwJV -UzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAO -BgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEXMBUGA1UEAwwOS2VybmVs -IFRlc3QgQ0EwHhcNMjAwNDIxMTkxNDA3WhcNNDAwNDIzMTkxNDA3WjBiMRAwDgYD -VQQKDAdNb25nb0RCMQ8wDQYDVQQLDAZLZXJuZWwxEjAQBgNVBAMMCWxvY2FsaG9z -dDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk5ZMQ8wDQYDVQQHDAZPQ1NQLTEwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDEWuLtsdzYxDK//wc9VXyyQPlS -AmkRHrLrTH0OSSPBvXK0NSkHtOjh3gX4jzTN8jTpEVkbfYt1EInZnucWOcX7mRRP -LRp0Fcq7j1pCPJ15uNSZDqDnfEA8kiY2Qg9n9oAIR2yk3FFj/8raBB13EnzOHeq4 -27BXH7oOgOgvd8PyuOB1OmNKjCLf5laaRbB+/lyrGfPFwmNcgH2lxtkfeBhTM5kS -vDkbAFIX6KqeWtvaV+WRPcyooa0FvNXTfCiS26qtw4rMZnWNODG13pgJCPckDZt7 -kX9qM+cS4L4oj6Hm3NrWkTpJzOFOQwZMily0X6ee1IH9m0yaLS7vq3pKlr67AgMB -AAGjgcIwgb8wCQYDVR0TBAIwADALBgNVHQ8EBAMCBaAwHQYDVR0lBBYwFAYIKwYB -BQUHAwEGCCsGAQUFBwMCMB0GA1UdDgQWBBQX4EjmQUUFCdz2ZKGKMHEPkkGHCDA4 -BggrBgEFBQcBAQQsMCowKAYIKwYBBQUHMAGGHGh0dHA6Ly9sb2NhbGhvc3Q6ODEw -MC9zdGF0dXMwEQYIKwYBBQUHARgEBTADAgEFMBoGA1UdEQQTMBGCCWxvY2FsaG9z -dIcEfwAAATANBgkqhkiG9w0BAQsFAAOCAQEAkZd/uV401ejVjqMaQ5ogkdo97Isz -Rjrx6dDY1Ll+5LzViqdRlXiAAc/bUq8NhYQkbjUC7b931meksIRRdtJUZx9zLt43 -npjjGKDdWEilLKKwT1IvKaAb2A7hmrT4WkwDtHZODvvpE+wvmEQ2LwthHDs+FwqN -2YDTuxdhO8mMePDXfK0Ch4WJQaJV/PT0sI34sYoeF7KC0TACWKwG08+qI9vawujq -qWw5fRwNTqxAj9X66wp6RdE6bJ3mWOrPmUppaDww3yRGVxdsWKCC8WoH3etNl8Km -iwDcp+WF+DmoOt2VAcvzoQsvsoUGdaMHYQ1MTJb5YsURr3BuGmcEUQI/yA== ------END CERTIFICATE----- ------BEGIN PRIVATE KEY----- -MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDEWuLtsdzYxDK/ -/wc9VXyyQPlSAmkRHrLrTH0OSSPBvXK0NSkHtOjh3gX4jzTN8jTpEVkbfYt1EInZ -nucWOcX7mRRPLRp0Fcq7j1pCPJ15uNSZDqDnfEA8kiY2Qg9n9oAIR2yk3FFj/8ra -BB13EnzOHeq427BXH7oOgOgvd8PyuOB1OmNKjCLf5laaRbB+/lyrGfPFwmNcgH2l -xtkfeBhTM5kSvDkbAFIX6KqeWtvaV+WRPcyooa0FvNXTfCiS26qtw4rMZnWNODG1 -3pgJCPckDZt7kX9qM+cS4L4oj6Hm3NrWkTpJzOFOQwZMily0X6ee1IH9m0yaLS7v -q3pKlr67AgMBAAECggEBAJqjLUafJdt9IK6+TVhLZAoKS4//n/lAoQ3YTkCa71Mc -PSKZHzgXjLSdIzyuo5px3qOS6wdQZy0JmlbN4xZI55gO5cS5M7UqmGAANMgnbqm3 -G49yytujqf9J5lgizHlG02wxu+lWLa9AeuQaC46D+9BkFUACnCzxKplTgggoHSSg -fTm/AKPRg/ZxejoorqveHK3IGjwVxk/2b6aqcCsr0GCuR5ons7hCQ66clvAqR/AH -ejz77lM/Nn6jq29Dgq/KhX22uabjML1yHFxZW0gF58chpJWTP8Rn3FEDw2mgMdao -C5C9Im9WWHquy05GQZRP/V5bhPuAgg5E4X+nCyn4eTECgYEA7eXTp+zLsGYe6l4a -MvXohDKMCouDF8w40hyIvJ9lF5ikQEhnJRQLPzbM7qx1AeeQwZevtyNBchX0nVwJ -VRd9c5qsSFkar489vBvhjEJ4B57B7KNoE5BHaR0+tfzWsWwK6BxHl9PmeGSn59i/ -7UwBhIzaC6dyJpTowCu/Scv8LhMCgYEA00vR/qeC0L7YPSG+VjHwerFhzUCTfnbd -wFpJM+N6PMRZA4GRWQLLxGmzPohjSfzwWMgUCXjopWiWOnxTEUlvTQgCWLAceMlk -rbTnHBtlXPPpSHvlmgVEG0+U/CpqONY7upEYrbt1xPMxNponS/7Yl0BXB2Qx8Je4 -pXs2H7wTIbkCgYEAgFOxUKwTVBxCIPqR91tfCbCaijWniXbIT87Ek7sHtSrJr0Nf -IEknp/nPog+1LknTdBp21rtV2kytnxS+lAAP1ARjWsN1+a2zB32itR5F0RZ6VUPw -KF1zp+f2pAS3aw109LAMjoHnmJnzWMU7Aq41Q2MXW6H/mYBJ7R+sGArJBbECgYBY -Y1Qx+bLATcU5NV9gwT0+pesqqEPK2ECFEX+jxBnDR8OQsuexW3kP7cN8eiNGtRd5 -nCC9oaV4ZBrL1mwNRDHaAGqy3ODcKisCezVeTZuGWcYRezqdxmwqHI1POxL6Oav8 -rGutaUinna/Njoi3wqCqDNEbF2/InD8ygisu9UbviQKBgQCS4Mxw+uOl5WvXjrze -z6B8L69MkT4fidgGkqimfpjk+N5Yt49otfvlvFPjkrVqR3lMqrqjV2r0W4fTeoSo -SDE3vZFZC9mi6ptUbgrW+aYqLHYQGYsJQXmj48Nkm/9uhkN1YEE9o04uSau1yVg+ -fDqxV7pLZwfnUbvGnYGjBShkMQ== ------END PRIVATE KEY----- diff --git a/.evergreen/ocsp/rsa/server-mustStaple.pem b/.evergreen/ocsp/rsa/server-mustStaple.pem deleted file mode 100644 index 5c80602e4..000000000 --- a/.evergreen/ocsp/rsa/server-mustStaple.pem +++ /dev/null @@ -1,53 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIERjCCAy6gAwIBAgIEJ++lZzANBgkqhkiG9w0BAQsFADB0MQswCQYDVQQGEwJV -UzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAO -BgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEXMBUGA1UEAwwOS2VybmVs -IFRlc3QgQ0EwHhcNMjAwMzE5MTU1NjIyWhcNNDAwMzIxMTU1NjIyWjBiMRAwDgYD -VQQKDAdNb25nb0RCMQ8wDQYDVQQLDAZLZXJuZWwxEjAQBgNVBAMMCWxvY2FsaG9z -dDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk5ZMQ8wDQYDVQQHDAZPQ1NQLTEwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDykV3fTFJgaqjfAgbAC7TGPk9V -VVsRYRgLF8Zjh9GDRU/TQ6pGZG7qo64D11oQurW0WT2Zv/lqhXW4mWNFv8+qoS5L -9z2Dtmxr8CZbb6YftA0e22KPUuDCQ5nYhOY21A6SYFwqEZ6ZsrZAMkgfhx+TY1kZ -0jZM/jgkvRtpG9I8BbddHyF8eFATCJ41DnLOzjfNukd5zKSIdVxY6r+ZBOr29kii -dcNHkCAck7+WXl9/KSqH7jF5asU0S3x/68G2R/qdKAxki9b2fe70N3XGZE0P2WHi -lq2aJeE0eqjAv+hBGiEb4iJl0s8iheardrHFeL4EMbiiVfVdVCHKkp58wjB9AgMB -AAGjgfEwge4wCQYDVR0TBAIwADALBgNVHQ8EBAMCBaAwHQYDVR0lBBYwFAYIKwYB -BQUHAwEGCCsGAQUFBwMCMB0GA1UdDgQWBBTOLiS9HKGWpiVKx81nNuRlK+HAITBn -BggrBgEFBQcBAQRbMFkwLQYIKwYBBQUHMAGGIWh0dHA6Ly9sb2NhbGhvc3Q6OTAw -MS9wb3dlci9sZXZlbDAoBggrBgEFBQcwAYYcaHR0cDovL2xvY2FsaG9zdDo4MTAw -L3N0YXR1czARBggrBgEFBQcBGAQFMAMCAQUwGgYDVR0RBBMwEYIJbG9jYWxob3N0 -hwR/AAABMA0GCSqGSIb3DQEBCwUAA4IBAQCg3NfTO8eCdhtmdDVF5WwP4/lXMYJY -5wn7PhYKMyUQI3rjUpQRIQwCVerHAJAiiflpgefxB8PD5spHPFq6RqAvH9SKpP5x -nyhiRdo51BmijCIl7VNdqyM5ZgDAN2fm2m56mDxpo9xqeTWg83YK8YY1xvBHl3jl -vQC+bBJzhaTp6SYXMc/70qIPcln0IElbuLN8vL4aG6xULkivtjiv7qBSZrNrBMSf -QJan9En4wcNGFt5ozrgJthZHTTX9pXOGVZe4LXbPCQSrBxZiBD9bITUyhtbeYhYR -4yfXjr7IeuoX+0g6+EEtxqrbWfIkJ3D7UaxAorZEsCt18GC7fap9/fzv ------END CERTIFICATE----- ------BEGIN PRIVATE KEY----- -MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDykV3fTFJgaqjf -AgbAC7TGPk9VVVsRYRgLF8Zjh9GDRU/TQ6pGZG7qo64D11oQurW0WT2Zv/lqhXW4 -mWNFv8+qoS5L9z2Dtmxr8CZbb6YftA0e22KPUuDCQ5nYhOY21A6SYFwqEZ6ZsrZA -Mkgfhx+TY1kZ0jZM/jgkvRtpG9I8BbddHyF8eFATCJ41DnLOzjfNukd5zKSIdVxY -6r+ZBOr29kiidcNHkCAck7+WXl9/KSqH7jF5asU0S3x/68G2R/qdKAxki9b2fe70 -N3XGZE0P2WHilq2aJeE0eqjAv+hBGiEb4iJl0s8iheardrHFeL4EMbiiVfVdVCHK -kp58wjB9AgMBAAECggEATA91Bf3insUTKspx32pMRxVmvvVC1xJA/cl4teDyu1zS -iQZgsC3x8bVdbWrrnO9O5rxM6pcd2F786OOAE3Dv5ysfX0apjVF4cegdvvIlfy9w -JcrY/uQYAhI8fX4+ydZ4s0Fv5OkdeEhniX26y9gM+KRgXg5iZIYaiLqbi7vjkloE -NBIDWGj8PCNKUVc2PSbZFVMMTc+7qZeUR0WRKr9CsaXBiEkWKfuw4MH1YUL0HJOs -uLd/oYg0l0eHPluUkKQW+KVq1GKsmr2sSc8NOcGtVTsUygSgX4hw36V7Vw3MfQRv -sNIgKp3RDEyynoXRoG3laHrib1GdYwDKRsHB2znKQQKBgQD+NAOOqoEx0lmlg/Wf -sNImv+3da0owE1TqTMHBWXriGo+DwqT+d9S+M5x3JMpmgH9vTEDlLOM2+qF8M3B3 -TLlu1k7F8D1G7YCdIZwMLUNCekCSHsqQcU9HMHlQqXd2cxFqWbyATk9tvJzj7xC9 -zMhaKGKvIS/EF0Ld8kIvrINmGQKBgQD0SExjk4yshv/DvWknxfJr8OupgQrriLHA -Hrk+n84Iv/4vzupgKsXJQE6VN0xM6e/ANhGATuxiaA3UE4p6K9wJNryHrw/wdnyf -I9AR0Cea9F4pa26BBCdLtQuyRqgl7dBZA1n3il7vKX6wB0MLoy/uYWYCedk4w+9d -acqh7S0CBQKBgBl8x5qHV/rR13E0AO2pAfkmp0fbGQ4m8g2n8olbWmnPNfKFEpv9 -EdScQiTkCHMskRpsr9kKniGGEajtU2pyw+jsDevkwZAaAho/I3FJHIRO06iS88Z1 -xfgiUReYVkUHFojuRGss7uPW1Hg6IRiWrsPzZqmejzZ/CpJMVvyGtIoJAoGAXmo7 -LBlxO5WJ8SuaIwc85T9etkrr35EbsnetfWjihzs9kVjV+YlOnLRAKygOU4PvaEj9 -hqv6bSZugdNzqDifeOgxAfhFntkM3a1H1DqxtBBS/ItLUI48aeR1utfYUaCS8HR9 -J1HR03okPwDvhuXxtp7qgHZ74JbKQz6KVP+Ib8kCgYEA7w0NnuOoZ0la17XuyQzA -UeTZZavgm0tNqqT4JcPiUV9zkR8WJsFQE704KQ8BjDyeYMWwe8EpfJaqsGqdJKGo -RnnxwNuwT4uSNb78MxXXVRG0fN/2iu70lNySKOl/DmA8siRc/weQj5JPsGbyZkjZ -IsaTqaZQUdtbZ7vRukyPo8Q= ------END PRIVATE KEY----- diff --git a/.evergreen/ocsp/rsa/server-singleEndpoint.pem b/.evergreen/ocsp/rsa/server-singleEndpoint.pem deleted file mode 100644 index 66849f535..000000000 --- a/.evergreen/ocsp/rsa/server-singleEndpoint.pem +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEBDCCAuygAwIBAgIEZ0Q/vTANBgkqhkiG9w0BAQsFADB0MQswCQYDVQQGEwJV -UzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAO -BgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEXMBUGA1UEAwwOS2VybmVs -IFRlc3QgQ0EwHhcNMjAwNDEwMjA1NDEzWhcNNDAwNDEyMjA1NDEzWjBiMRAwDgYD -VQQKDAdNb25nb0RCMQ8wDQYDVQQLDAZLZXJuZWwxEjAQBgNVBAMMCWxvY2FsaG9z -dDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk5ZMQ8wDQYDVQQHDAZPQ1NQLTEwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDH3pCRRVSRghw0+55xvfRRWQx/ -5BO/M7XGtiLwAUU+R42FyQYdu8rgZQavtDLU/KQaws6xoIBvl0YezBGRTbEa4pM/ -ATeGSTz9Xdo5Zp9oQgb41yimdjVCxTrdMUAtocHi5UurkmuBJcyZ6UHLvQ11whgL -tZfGFO3drhLm8A/mDFr4o+9LX4q+9qh+cDFEWnTx5j16ZN2pWNR8lFF5pu/wsqPL -CJEC/dq95EuwQJoupjF+bC/faGx+b1/CLx2HyCR0pDSvNq9AlK9W0qw5br01qIhT -+mvv6+nPs8zzdixrguNlzHsEZN/pPnFZ3xBZii88F4xfxfPoPE+rfPO5M6DfAgMB -AAGjga8wgawwCQYDVR0TBAIwADALBgNVHQ8EBAMCBaAwHQYDVR0lBBYwFAYIKwYB -BQUHAwEGCCsGAQUFBwMCMB0GA1UdDgQWBBRWLvOTPv7G74DYdxd+Lv/7DzLabDA4 -BggrBgEFBQcBAQQsMCowKAYIKwYBBQUHMAGGHGh0dHA6Ly9sb2NhbGhvc3Q6ODEw -MC9zdGF0dXMwGgYDVR0RBBMwEYIJbG9jYWxob3N0hwR/AAABMA0GCSqGSIb3DQEB -CwUAA4IBAQAJvPmDizmNplKTdBu4YsF2E7EsAfJREuN7TKAbLsiYtyAMuIu5BIv6 -Ma4pcxeJUvYML5czHoPwjXNC9+M7aTsb18q8ZRAJzY2kVhvzhT2lVH5YFC8vhJ92 -aeX8GTpoa+lslXuvVe8os+tGcQzqMtiVF2xZHbAYOiAno+fVQey9VSjU+pXIcKUT -7nF/b0rRHHo8ziPsfI+h3kKWttywB+iQ60Zlt3ajlfWgTuL1fdbt9GEFl68Rhhsy -6s1h8oXSSM0VIBzJKqrubJgziXH2kVN9p1XtQcCwW2lrZ3z0GQq5nLvIsgTQHwx6 -FsuONP/eS2esZIn7LwT2nSNa/Hfh9pq/ ------END CERTIFICATE----- ------BEGIN PRIVATE KEY----- -MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDH3pCRRVSRghw0 -+55xvfRRWQx/5BO/M7XGtiLwAUU+R42FyQYdu8rgZQavtDLU/KQaws6xoIBvl0Ye -zBGRTbEa4pM/ATeGSTz9Xdo5Zp9oQgb41yimdjVCxTrdMUAtocHi5UurkmuBJcyZ -6UHLvQ11whgLtZfGFO3drhLm8A/mDFr4o+9LX4q+9qh+cDFEWnTx5j16ZN2pWNR8 -lFF5pu/wsqPLCJEC/dq95EuwQJoupjF+bC/faGx+b1/CLx2HyCR0pDSvNq9AlK9W -0qw5br01qIhT+mvv6+nPs8zzdixrguNlzHsEZN/pPnFZ3xBZii88F4xfxfPoPE+r -fPO5M6DfAgMBAAECggEAR6QUR64FMR7lA2zJj1WaNGpp25GiLl/XoUF55nNeIYO+ -S50Rryi4AJTVv7cknUltfRYkxnCUeOtNPA7DoUSq3csnImdKQr0PunWgmgCZ1OIN -47YjoP8v+h3+Cnjz2ydm+vBbnkUeea1V2DlO1zuNjo8i1Vei7mJkHJift92GpVtY -DW5GrTZfntPJXHQQjz6nGn5mQxTlEi1WafPPyDoqykwAIonehIyhYd7UCDw/e62D -XMWk8Bo7YmX0Y3utQF2tuu1ih2zz5+NXwviycBqE9GL4eoHZgdKJrPBA/nRBsy5J -SqorCKxLODvl77EIdqPUDZsyGzvWlmoEyDtthsvsiQKBgQDtFaIQW+DizGqibfuT -6/z5+4G8ZAp+FVJU/0Z/SmOX/ro2LzYhlV0l71OWvMVKxCfp30zlYaYWNo+R8h40 -O6zSsKcSE7JLFNh53euPz49Ium+N5OFZ6Yez7HBD/5sjWEt+iGDUZAr9SlqMZAGN -PhUSu51QvFj1kqqVbXxmA3TkiwKBgQDX0NOCri8J4jqBk8TuY4AZS3zq/2lVmFYh -81itma43zXRG3z8hFFct/CBqxObGwi1MQAGZAG7EeOvnH6FPV/85Tej1Wd0VtV8f -ryWgjSvZDt3dATZBKVcVibTfazdkfeqze2wtYRjFqNPlAitSF7HN8iOC8B02dIMq -ec6UM9w7fQKBgA03CHqK9IUPyd3V7ZD4NXilqTycAu22OImeVQqhVd3SCAUfKpBC -qBeGOI2NZh3dwy/JD5s1jzFrxyLmcQKOVPrFd/qM+IIw3kQkt42jjyQJqFArctg1 -KShBRJy1sasNr9+UsHkGPoqRy2xJ4sBBtqD9ri4i4X6Gt1Vu7eEtziUzAoGAafd0 -Uz8Zg53cIlGfKXobpM/m9zAP1WJmMGdfDGZgH7A2vrHROnnVUJPyitpBgihHu5/V -6P1IZhoFosdqGh5YCBgUIZxNLOKQYWtLa2jFtd9R2rlEnXwh8UZbVDQ9z47wFc6t -UB7T3gHGgTSudrGBsWCKRTmG7n0JBmsmnqhUI7UCgYBb4nBED+kaMGFdzRdpq8Dv -+KgShSjWa+4U2S4QZ3MYtb+rIMsAoRO4K8S3VMqIsun3S7T5szyp72jBqAQTHiHA -eGlRTrirc9dR8x6CO66UUf5tGMG05P7qo23Qoip+t1/rcCgrBH7er68AhMIZbxfK -2dj9RqANXyIWWI320Y+VkA== ------END PRIVATE KEY----- diff --git a/.evergreen/ocsp/rsa/server.pem b/.evergreen/ocsp/rsa/server.pem deleted file mode 100644 index abf978ef8..000000000 --- a/.evergreen/ocsp/rsa/server.pem +++ /dev/null @@ -1,53 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEMzCCAxugAwIBAgIET11AjzANBgkqhkiG9w0BAQsFADB0MQswCQYDVQQGEwJV -UzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAO -BgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5lbDEXMBUGA1UEAwwOS2VybmVs -IFRlc3QgQ0EwHhcNMjAwMzE5MTU1NjI1WhcNNDAwMzIxMTU1NjI1WjBiMRAwDgYD -VQQKDAdNb25nb0RCMQ8wDQYDVQQLDAZLZXJuZWwxEjAQBgNVBAMMCWxvY2FsaG9z -dDELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAk5ZMQ8wDQYDVQQHDAZPQ1NQLTEwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC0usokl3+yXDtLeYquHQyAkXIw -lY4tukv8nEgLtUlK0kt9Q7P8EdZigzFUeJtL7piFCTIaLuv6e4UqLLDXbIANxD/J -NXXQPtBasOSzdgZ2ToUj5ANPv0QegsFubpYGq5LXsMdKTRE8uTB91PJBvRzxY2Nx -O1kdQcIrYpSYXqKsNgq/8iAPrmAdZ3y+S7OBuNyvlQJZqWoB1Y0ZWuR1QrcLMgdm -q2SdBzZT/3P+r/dbHMKdDZ5JdJ9Nm4ylOG7mhZkfb38JfdvWedzXDMu6TzS2W67o -yM90Cj9Lt+UyHLJ2jlcsZSZp4km6Oj5RBNVhd95SFckvPJxLzSyFlpjOIXsNAgMB -AAGjgd4wgdswCQYDVR0TBAIwADALBgNVHQ8EBAMCBaAwHQYDVR0lBBYwFAYIKwYB -BQUHAwEGCCsGAQUFBwMCMB0GA1UdDgQWBBTe7IMKaO1aQILcpoj5wLFgIRuPHzBn -BggrBgEFBQcBAQRbMFkwLQYIKwYBBQUHMAGGIWh0dHA6Ly9sb2NhbGhvc3Q6OTAw -MS9wb3dlci9sZXZlbDAoBggrBgEFBQcwAYYcaHR0cDovL2xvY2FsaG9zdDo4MTAw -L3N0YXR1czAaBgNVHREEEzARgglsb2NhbGhvc3SHBH8AAAEwDQYJKoZIhvcNAQEL -BQADggEBAFMVds6y5Qy7DlFsca0u8WE+ckoONa427bWBqNx8b/Hwaj3N3C58XQx/ -EZRNt9XVy/LoEHr+NmOWsCl69fINeVpx8Ftot8XPbFG9YxL/xbJ3lvWesPR6bwpm -PZqGiwfl1VrZvuobXADz0Rfru7B7LPkurpSxDiNBf/9JuLPYe9ffZwdFWQoehw07 -b9FKVaJ7mSHno/5f4Z/uKau91sL0kiKKG9Lo2JEIEmpp8HJ3OKCFh7DFkeDlRCDl -WyYxF4g/PfvJQm2Hd89cu8m3RX84rLa9jn1RGL/8bmxE0dxk4Di/t9gl5KGWIH9Q -LBeVRSQmH9GbI/WmldMLkGkvARYYTp8= ------END CERTIFICATE----- ------BEGIN PRIVATE KEY----- -MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC0usokl3+yXDtL -eYquHQyAkXIwlY4tukv8nEgLtUlK0kt9Q7P8EdZigzFUeJtL7piFCTIaLuv6e4Uq -LLDXbIANxD/JNXXQPtBasOSzdgZ2ToUj5ANPv0QegsFubpYGq5LXsMdKTRE8uTB9 -1PJBvRzxY2NxO1kdQcIrYpSYXqKsNgq/8iAPrmAdZ3y+S7OBuNyvlQJZqWoB1Y0Z -WuR1QrcLMgdmq2SdBzZT/3P+r/dbHMKdDZ5JdJ9Nm4ylOG7mhZkfb38JfdvWedzX -DMu6TzS2W67oyM90Cj9Lt+UyHLJ2jlcsZSZp4km6Oj5RBNVhd95SFckvPJxLzSyF -lpjOIXsNAgMBAAECggEAIjNe4YHR5nzRs7yyY7SXkxTzGQKUP08L5ifk8mJCFmip -ZHEVdFQjz8yn3yZbrQjfz/0ngBD1Exeg4ZRHetzLds92iqsVOm1InIDxJozlOCov -w9T4U3UMfQGdfTpsJaL+TNblP8hJxMX+yTEtDwesnHmEbf8fJAw3pGIpYJQ4EIJv -1uPzyB8EsrTjj23a5NPF/FGdzzO+HP5fhNNIUmP83pqonXLUSy0v5rsRFNxNMBn3 -SPRWq+Z779eLQXnRjW/6hKssSBFg6zAOi3Gc4oDbrDa2WEbZ0BEU+JW3XduN91bU -SsO3yQ+VL+CQn5wvXGIsc4EHH6wO8Bs0vXfD7zeLgQKBgQDrHOzPymI0p0PnxL2+ -8LrSU1x0WdedPZJugwwfUYMfn7sjKx+FyVLvM+7wuJ8zsMOAab2AHv3S0Nxkovhb -aa4lH9SUAHILcU+nb7M6E+mwSr65AemGspvGz4ZC6L52CGVzRfIcoBDD0T8OZGH0 -4IeiqOluqtvgCoW4UV1dyw0nPQKBgQDEyQwcim5ghEQ7V2eDefE5yxNlkNEnSVnG -DNubM8KURR8jehpDWkIlxQ4p2tLBWGB0YeOCG9NmwfLnQUStvSFE6/XjP5bBJlov -jT66T98NgFRfUeVkcCAiVT/LlDzXWXXPLyZSY+bxtn8UA1NYNu0pLCLDR9TlH1dK -FKwiomdgEQKBgEimcHqo4/23LeGBRsyooGH7hlchp+GbtBLYBbfrvSPZfL8aRSxX -EHx/xLa3peIYHeEhS4A6k15AUcn7HdlJZ5lrI4n0NUlZ4y4u8ufgXVavUg3jDGEl -8cLWP3uPZcMdRxP+qhi0UVng36Y32JkNhHv7y935h+XL+pQA+GPSKadVAoGAPPvp -SvcDmdmjo5hEthQWU8jBbBpjFv++WIgnjoON65E4QzBV70WLdlUJPKNZ6R1QVwD3 -Fp00+IVml5A8jnMsWkWd4B0WxSjzjgUByY9zGqYIf7nLk0LEUp+Es7xu1nYc8mY0 -RBg9u+7IlxUowQ/Uk4vgAhDCw3bhAE5Dwj/+NWECgYBWnBz5l+Uar9oT1ErRSbJW -RVYx3iIsqka1lox/zw5nme1Q/dv2uTQy6uZRn9U9ikqGwePuMEexQTR1csnMqeMM -4i3pDFpGBfTZXJAvH790ak6eZ0eBXqzJlTyEjll4r4zXHk+slm/tAgpIg0Ps3J9j -Sd+bTtG47gpb4sRbqEtQFQ== ------END PRIVATE KEY----- diff --git a/.evergreen/orchestration/configs/sharded_clusters/basic.json b/.evergreen/orchestration/configs/sharded_clusters/basic.json deleted file mode 100644 index fd03f5686..000000000 --- a/.evergreen/orchestration/configs/sharded_clusters/basic.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "id": "shard_cluster_1", - "shards": [ - { - "id": "sh01", - "shardParams": { - "members": [ - { - "procParams": { - "ipv6": true, - "bind_ip": "127.0.0.1,::1", - "shardsvr": true, - "port": 27217 - } - }, - { - "procParams": { - "ipv6": true, - "bind_ip": "127.0.0.1,::1", - "shardsvr": true, - "port": 27218 - } - }, - { - "procParams": { - "ipv6": true, - "bind_ip": "127.0.0.1,::1", - "shardsvr": true, - "port": 27219 - } - } - ] - } - } - ], - "routers": [ - { - "ipv6": true, - "bind_ip": "127.0.0.1,::1", - "port": 27017 - }, - { - "ipv6": true, - "bind_ip": "127.0.0.1,::1", - "port": 27018 - } - ] -} diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index 4ff744cd9..b76b97004 100755 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -43,7 +43,7 @@ if [ "${IS_MATRIX_TESTING}" = "true" ]; then fi # Enable verbose output to see skipped and incomplete tests -PHPUNIT_OPTS="${PHPUNIT_OPTS} -v --configuration phpunit.evergreen.xml" +PHPUNIT_OPTS="${PHPUNIT_OPTS} --configuration phpunit.evergreen.xml" if [ "$SSL" = "yes" ]; then SSL_OPTS="ssl=true&sslallowinvalidcertificates=true" @@ -83,30 +83,22 @@ export MONGODB_MULTI_MONGOS_LB_URI="${MONGODB_MULTI_MONGOS_LB_URI}" # Run the tests, and store the results in a junit result file case "$TESTS" in atlas) - php vendor/bin/simple-phpunit $PHPUNIT_OPTS --group atlas - ;; - - atlas-data-lake) - php vendor/bin/simple-phpunit $PHPUNIT_OPTS --group atlas-data-lake + php vendor/bin/phpunit $PHPUNIT_OPTS --group atlas ;; csfle) - php vendor/bin/simple-phpunit $PHPUNIT_OPTS --group csfle + php vendor/bin/phpunit $PHPUNIT_OPTS --group csfle ;; csfle-without-aws-creds) - php vendor/bin/simple-phpunit $PHPUNIT_OPTS --group csfle-without-aws-creds + php vendor/bin/phpunit $PHPUNIT_OPTS --group csfle-without-aws-creds ;; versioned-api) - php vendor/bin/simple-phpunit $PHPUNIT_OPTS --group versioned-api - ;; - - serverless) - php vendor/bin/simple-phpunit $PHPUNIT_OPTS --group serverless + php vendor/bin/phpunit $PHPUNIT_OPTS --group versioned-api ;; *) - php vendor/bin/simple-phpunit $PHPUNIT_OPTS + php vendor/bin/phpunit $PHPUNIT_OPTS ;; esac diff --git a/.evergreen/x509gen/82e9b7a6.0 b/.evergreen/x509gen/82e9b7a6.0 deleted file mode 100644 index 6ac86cfcc..000000000 --- a/.evergreen/x509gen/82e9b7a6.0 +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDfzCCAmegAwIBAgIDB1MGMA0GCSqGSIb3DQEBCwUAMHkxGzAZBgNVBAMTEkRy -aXZlcnMgVGVzdGluZyBDQTEQMA4GA1UECxMHRHJpdmVyczEQMA4GA1UEChMHTW9u -Z29EQjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlvcmsx -CzAJBgNVBAYTAlVTMB4XDTE5MDUyMjIwMjMxMVoXDTM5MDUyMjIwMjMxMVoweTEb -MBkGA1UEAxMSRHJpdmVycyBUZXN0aW5nIENBMRAwDgYDVQQLEwdEcml2ZXJzMRAw -DgYDVQQKEwdNb25nb0RCMRYwFAYDVQQHEw1OZXcgWW9yayBDaXR5MREwDwYDVQQI -EwhOZXcgWW9yazELMAkGA1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw -ggEKAoIBAQCl7VN+WsQfHlwapcOpTLZVoeMAl1LTbWTFuXSAavIyy0W1Ytky1UP/ -bxCSW0mSWwCgqoJ5aXbAvrNRp6ArWu3LsTQIEcD3pEdrFIVQhYzWUs9fXqPyI9k+ -QNNQ+MRFKeGteTPYwF2eVEtPzUHU5ws3+OKp1m6MCLkwAG3RBFUAfddUnLvGoZiT -pd8/eNabhgHvdrCw+tYFCWvSjz7SluEVievpQehrSEPKe8DxJq/IM3tSl3tdylzT -zeiKNO7c7LuQrgjAfrZl7n2SriHIlNmqiDR/kdd8+TxBuxjFlcf2WyHCO3lIcIgH -KXTlhUCg50KfHaxHu05Qw0x8869yIzqbAgMBAAGjEDAOMAwGA1UdEwQFMAMBAf8w -DQYJKoZIhvcNAQELBQADggEBAEHuhTL8KQZcKCTSJbYA9MgZj7U32arMGBbc1hiq -VBREwvdVz4+9tIyWMzN9R/YCKmUTnCq8z3wTlC8kBtxYn/l4Tj8nJYcgLJjQ0Fwe -gT564CmvkUat8uXPz6olOCdwkMpJ9Sj62i0mpgXJdBfxKQ6TZ9yGz6m3jannjZpN -LchB7xSAEWtqUgvNusq0dApJsf4n7jZ+oBZVaQw2+tzaMfaLqHgMwcu1FzA8UKCD -sxCgIsZUs8DdxaD418Ot6nPfheOTqe24n+TTa+Z6O0W0QtnofJBx7tmAo1aEc57i -77s89pfwIJetpIlhzNSMKurCAocFCJMJLAASJFuu6dyDvPo= ------END CERTIFICATE----- \ No newline at end of file diff --git a/.evergreen/x509gen/altname.pem b/.evergreen/x509gen/altname.pem deleted file mode 100644 index ff0fd61e6..000000000 --- a/.evergreen/x509gen/altname.pem +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAgyOELJgWP2akoidBdtchvdRF8gZrR8rwORDmST1tmH5aKiH2 -e/lkWf+pxmXnvmLXoOKk3HHGgyZ7v1sDDB0z7/rAimECqxnqJ90GFq8rGR60jCL/ -hs+30m0U9CNAvjzD5yFruaisPeCZuZXEA06QbTbTaSD4u/n7fgZVGSnj2m+DFel5 -S7dgL4Pa7Vh2nua8QPfczLLQI/uP9Ma5ZXjk2C2V+QBkmK64OanGY6yXn8+m5Lp1 -cKhhQUiXVVO1BgFHw65FapTrhG2zgyuaqvb5F062V+XGIwZhWhDz4cTgCx0dFKU+ -WQGXuEDDY3EzaOd6Ds3h6WkCRDs9cn2i0j4taQIDAQABAoIBAHeCTXkKXPQIia6Q -0dMIuWIy6k9nVCtIIWYQJZ3HUnJva6IL84IFxFNUcBczVV+m2lVvVsjjEwMAdjPs -MDnA/00LGp7BS9o8Mq2DeoH/vuoUlntDhdUIxcAJ0teurNjxraKcTX0T32xAnDeJ -6ekNlwdAuKeM+cDtTykJglH9X/324eOT8sEkpohkTJaszs3PEqgN9jrHttVatmft -KGT06aANBrEH61xr/nfBehd3R7WyVsIUmlihlIIBwbxyycdMSxHIiE1Qno252Ek7 -GJp/dPqO2pwIH47cop48SsZLFVosqaZs3jkEIDkQkyd7tvmVG69aFBPz5+PTvdRv -fufuvXUCgYEA1gTnvln9/PmC9mKFTDGdKLhFIypyOhKl1lUoDgcmCencjwu28yTA -+A2fKZQFupiHYvSg5kbvmr7FGVtKLNPJWocvr7jqPvrVLCzvs6l94LhGCTVyOmgn -e09xyDx3xQTuJmpg+4LD1jImL3OLO3fplbslwisip2CWzHZR6h3QRVMCgYEAnNy5 -F81xbimMVcubQve6LPzZq1pYaUM5ppkejNdBoEKR28+GP0NQ7YbN6iu2LXlbpWk/ -IrAyUmDUpnXFsiRDDWnPol6JzYTovzeZG+NCMJWkaQEOzm8BpUsC2UBvsX55ddxt -WM4CkLOxo7KXfQwYAMKc/H8tFE7DXloH82U7jtMCgYB+PuiBFc7IYlrJgjZFSuL8 -+S33X3uAHC3tL9Bv7fGXWXd8fhmOdfjKmiZwPVvfxUffrJQZInEGpE/Z9EreBJQ7 -LZGIo5iyS/5hj6RaI7oYTDssBXX7VCMuDx/8UQcJli3xRUEuO+XPvUdfKFZSXxrP -81SDpDRN7aEmvQj3BF0t9wKBgCgX5ptl4HtG1V7MhufMB+Md0ckRc42cKC0j8AIR -tu1udneXiHm9C/9aOGGFQLBI15rk1sVYAdS6eT/+1EQfLqBMDk0zGsfUE+VkIZdW -NAHVDcvlAFLVXrdP/+9ln+bfK85rQ+ux5Ef2Fg6ARGYq5Cu1koibPPt20krYejXF -Bz8PAoGBAKbCmptnjdu4QF+rGLfYyVnrtyUuRgN+Q0MCIag1dBTag6rC17xDYJ6g -3Txzzb9xAZ35pSHroB7TSr32vRUQVrAcfldW4mousr9A0pDoc/E2axtE1YmzSYwk -jqgu3PeWrtwBthUEoRXbQAed97bKW+gUU677u9IFRCS2YIfwDV5R ------END RSA PRIVATE KEY----- ------BEGIN CERTIFICATE----- -MIIDnTCCAoWgAwIBAgIDCRkUMA0GCSqGSIb3DQEBCwUAMHkxGzAZBgNVBAMTEkRy -aXZlcnMgVGVzdGluZyBDQTEQMA4GA1UECxMHRHJpdmVyczEQMA4GA1UEChMHTW9u -Z29EQjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlvcmsx -CzAJBgNVBAYTAlVTMB4XDTE5MDUyMjIyMzQzNloXDTM5MDUyMjIyMzQzNlowcDES -MBAGA1UEAxMJbG9jYWxob3N0MRAwDgYDVQQLEwdEcml2ZXJzMRAwDgYDVQQKEwdN -b25nb0RCMRYwFAYDVQQHEw1OZXcgWW9yayBDaXR5MREwDwYDVQQIEwhOZXcgWW9y -azELMAkGA1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCD -I4QsmBY/ZqSiJ0F21yG91EXyBmtHyvA5EOZJPW2YfloqIfZ7+WRZ/6nGZee+Yteg -4qTcccaDJnu/WwMMHTPv+sCKYQKrGeon3QYWrysZHrSMIv+Gz7fSbRT0I0C+PMPn -IWu5qKw94Jm5lcQDTpBtNtNpIPi7+ft+BlUZKePab4MV6XlLt2Avg9rtWHae5rxA -99zMstAj+4/0xrlleOTYLZX5AGSYrrg5qcZjrJefz6bkunVwqGFBSJdVU7UGAUfD -rkVqlOuEbbODK5qq9vkXTrZX5cYjBmFaEPPhxOALHR0UpT5ZAZe4QMNjcTNo53oO -zeHpaQJEOz1yfaLSPi1pAgMBAAGjNzA1MDMGA1UdEQQsMCqCCWxvY2FsaG9zdIcE -fwAAAYIXYWx0ZXJuYXRpdmUubW9uZ29kYi5jb20wDQYJKoZIhvcNAQELBQADggEB -AADOro10g1QReF0QVX2w+yVwCWy8FUzuksX0RI0RCFRJPo79SH7o2IZFGbLlBL8K -MMsgSrzRW/HcyE91fv0R2b7kvqfD3Eo1W1ocufjVg+3e4uuwm9k9SLjSI6mE4hEf -H6BeFoZhUdbrq9l/ez+NK+3ToHAl1bGLkipfnB522gRO1CjkpiY2knaaNQtjd/a9 -7QXqUs+KMJx42yqjBbVE6MdA2ypNMMIc8AgI5kRKEBGHpS4Z6VNZN4Pus1atGlRW -OwkjHK5pnT1TAKSODjfFw5VlXGztGTPKuJhM2/X7Qi0bO8b7NmH7cjDBATmZF5O8 -FAxIQ8+3qUPMXYkb1ipLOdQ= ------END CERTIFICATE----- diff --git a/.evergreen/x509gen/ca.pem b/.evergreen/x509gen/ca.pem deleted file mode 100644 index 6ac86cfcc..000000000 --- a/.evergreen/x509gen/ca.pem +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDfzCCAmegAwIBAgIDB1MGMA0GCSqGSIb3DQEBCwUAMHkxGzAZBgNVBAMTEkRy -aXZlcnMgVGVzdGluZyBDQTEQMA4GA1UECxMHRHJpdmVyczEQMA4GA1UEChMHTW9u -Z29EQjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlvcmsx -CzAJBgNVBAYTAlVTMB4XDTE5MDUyMjIwMjMxMVoXDTM5MDUyMjIwMjMxMVoweTEb -MBkGA1UEAxMSRHJpdmVycyBUZXN0aW5nIENBMRAwDgYDVQQLEwdEcml2ZXJzMRAw -DgYDVQQKEwdNb25nb0RCMRYwFAYDVQQHEw1OZXcgWW9yayBDaXR5MREwDwYDVQQI -EwhOZXcgWW9yazELMAkGA1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw -ggEKAoIBAQCl7VN+WsQfHlwapcOpTLZVoeMAl1LTbWTFuXSAavIyy0W1Ytky1UP/ -bxCSW0mSWwCgqoJ5aXbAvrNRp6ArWu3LsTQIEcD3pEdrFIVQhYzWUs9fXqPyI9k+ -QNNQ+MRFKeGteTPYwF2eVEtPzUHU5ws3+OKp1m6MCLkwAG3RBFUAfddUnLvGoZiT -pd8/eNabhgHvdrCw+tYFCWvSjz7SluEVievpQehrSEPKe8DxJq/IM3tSl3tdylzT -zeiKNO7c7LuQrgjAfrZl7n2SriHIlNmqiDR/kdd8+TxBuxjFlcf2WyHCO3lIcIgH -KXTlhUCg50KfHaxHu05Qw0x8869yIzqbAgMBAAGjEDAOMAwGA1UdEwQFMAMBAf8w -DQYJKoZIhvcNAQELBQADggEBAEHuhTL8KQZcKCTSJbYA9MgZj7U32arMGBbc1hiq -VBREwvdVz4+9tIyWMzN9R/YCKmUTnCq8z3wTlC8kBtxYn/l4Tj8nJYcgLJjQ0Fwe -gT564CmvkUat8uXPz6olOCdwkMpJ9Sj62i0mpgXJdBfxKQ6TZ9yGz6m3jannjZpN -LchB7xSAEWtqUgvNusq0dApJsf4n7jZ+oBZVaQw2+tzaMfaLqHgMwcu1FzA8UKCD -sxCgIsZUs8DdxaD418Ot6nPfheOTqe24n+TTa+Z6O0W0QtnofJBx7tmAo1aEc57i -77s89pfwIJetpIlhzNSMKurCAocFCJMJLAASJFuu6dyDvPo= ------END CERTIFICATE----- \ No newline at end of file diff --git a/.evergreen/x509gen/client-private.pem b/.evergreen/x509gen/client-private.pem deleted file mode 100644 index 551a43a75..000000000 --- a/.evergreen/x509gen/client-private.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEAsNS8UEuin7/K29jXfIOLpIoh1jEyWVqxiie2Onx7uJJKcoKo -khA3XeUnVN0k6X5MwYWcN52xcns7LYtyt06nRpTG2/emoV44w9uKTuHsvUbiOwSV -m/ToKQQ4FUFZoqorXH+ZmJuIpJNfoW+3CkE1vEDCIecIq6BNg5ySsPtvSuSJHGjp -mc7/5ZUDvFE2aJ8QbJU3Ws0HXiEb6ymi048LlzEL2VKX3w6mqqh+7dcZGAy7qYk2 -5FZ9ktKvCeQau7mTyU1hsPrKFiKtMN8Q2ZAItX13asw5/IeSTq2LgLFHlbj5Kpq4 -GmLdNCshzH5X7Ew3IYM8EHmsX8dmD6mhv7vpVwIDAQABAoIBABOdpb4qhcG+3twA -c/cGCKmaASLnljQ/UU6IFTjrsjXJVKTbRaPeVKX/05sgZQXZ0t3s2mV5AsQ2U1w8 -Cd+3w+qaemzQThW8hAOGCROzEDX29QWi/o2sX0ydgTMqaq0Wv3SlWv6I0mGfT45y -/BURIsrdTCvCmz2erLqa1dL4MWJXRFjT9UTs5twlecIOM2IHKoGGagFhymRK4kDe -wTRC9fpfoAgyfus3pCO/wi/F8yKGPDEwY+zgkhrJQ+kSeki7oKdGD1H540vB8gRt -EIqssE0Y6rEYf97WssQlxJgvoJBDSftOijS6mwvoasDUwfFqyyPiirawXWWhHXkc -DjIi/XECgYEA5xfjilw9YyM2UGQNESbNNunPcj7gDZbN347xJwmYmi9AUdPLt9xN -3XaMqqR22k1DUOxC/5hH0uiXir7mDfqmC+XS/ic/VOsa3CDWejkEnyGLiwSHY502 -wD/xWgHwUiGVAG9HY64vnDGm6L3KGXA2oqxanL4V0+0+Ht49pZ16i8sCgYEAw+Ox -CHGtpkzjCP/z8xr+1VTSdpc/4CP2HONnYopcn48KfQnf7Nale69/1kZpypJlvQSG -eeA3jMGigNJEkb8/kaVoRLCisXcwLc0XIfCTeiK6FS0Ka30D/84Qm8UsHxRdpGkM -kYITAa2r64tgRL8as4/ukeXBKE+oOhX43LeEfyUCgYBkf7IX2Ndlhsm3GlvIarxy -NipeP9PGdR/hKlPbq0OvQf9R1q7QrcE7H7Q6/b0mYNV2mtjkOQB7S2WkFDMOP0P5 -BqDEoKLdNkV/F9TOYH+PCNKbyYNrodJOt0Ap6Y/u1+Xpw3sjcXwJDFrO+sKqX2+T -PStG4S+y84jBedsLbDoAEwKBgQCTz7/KC11o2yOFqv09N+WKvBKDgeWlD/2qFr3w -UU9K5viXGVhqshz0k5z25vL09Drowf1nAZVpFMO2SPOMtq8VC6b+Dfr1xmYIaXVH -Gu1tf77CM9Zk/VSDNc66e7GrUgbHBK2DLo+A+Ld9aRIfTcSsMbNnS+LQtCrQibvb -cG7+MQKBgQCY11oMT2dUekoZEyW4no7W5D74lR8ztMjp/fWWTDo/AZGPBY6cZoZF -IICrzYtDT/5BzB0Jh1f4O9ZQkm5+OvlFbmoZoSbMzHL3oJCBOY5K0/kdGXL46WWh -IRJSYakNU6VIS7SjDpKgm9D8befQqZeoSggSjIIULIiAtYgS80vmGA== ------END RSA PRIVATE KEY----- \ No newline at end of file diff --git a/.evergreen/x509gen/client-public.pem b/.evergreen/x509gen/client-public.pem deleted file mode 100644 index 53e4e034f..000000000 --- a/.evergreen/x509gen/client-public.pem +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDgzCCAmugAwIBAgIDAxOUMA0GCSqGSIb3DQEBCwUAMHkxGzAZBgNVBAMTEkRy -aXZlcnMgVGVzdGluZyBDQTEQMA4GA1UECxMHRHJpdmVyczEQMA4GA1UEChMHTW9u -Z29EQjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlvcmsx -CzAJBgNVBAYTAlVTMB4XDTE5MDUyMjIzNTU1NFoXDTM5MDUyMjIzNTU1NFowaTEP -MA0GA1UEAxMGY2xpZW50MRAwDgYDVQQLEwdEcml2ZXJzMQwwCgYDVQQKEwNNREIx -FjAUBgNVBAcTDU5ldyBZb3JrIENpdHkxETAPBgNVBAgTCE5ldyBZb3JrMQswCQYD -VQQGEwJVUzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDUvFBLop+/ -ytvY13yDi6SKIdYxMllasYontjp8e7iSSnKCqJIQN13lJ1TdJOl+TMGFnDedsXJ7 -Oy2LcrdOp0aUxtv3pqFeOMPbik7h7L1G4jsElZv06CkEOBVBWaKqK1x/mZibiKST -X6FvtwpBNbxAwiHnCKugTYOckrD7b0rkiRxo6ZnO/+WVA7xRNmifEGyVN1rNB14h -G+spotOPC5cxC9lSl98Opqqofu3XGRgMu6mJNuRWfZLSrwnkGru5k8lNYbD6yhYi -rTDfENmQCLV9d2rMOfyHkk6ti4CxR5W4+SqauBpi3TQrIcx+V+xMNyGDPBB5rF/H -Zg+pob+76VcCAwEAAaMkMCIwCwYDVR0PBAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUF -BwMCMA0GCSqGSIb3DQEBCwUAA4IBAQAqRcLAGvYMaGYOV4HJTzNotT2qE0I9THNQ -wOV1fBg69x6SrUQTQLjJEptpOA288Wue6Jt3H+p5qAGV5GbXjzN/yjCoItggSKxG -Xg7279nz6/C5faoIKRjpS9R+MsJGlttP9nUzdSxrHvvqm62OuSVFjjETxD39DupE -YPFQoHOxdFTtBQlc/zIKxVdd20rs1xJeeU2/L7jtRBSPuR/Sk8zot7G2/dQHX49y -kHrq8qz12kj1T6XDXf8KZawFywXaz0/Ur+fUYKmkVk1T0JZaNtF4sKqDeNE4zcns -p3xLVDSl1Q5Gwj7bgph9o4Hxs9izPwiqjmNaSjPimGYZ399zcurY ------END CERTIFICATE----- \ No newline at end of file diff --git a/.evergreen/x509gen/client.pem b/.evergreen/x509gen/client.pem deleted file mode 100644 index 5b0700109..000000000 --- a/.evergreen/x509gen/client.pem +++ /dev/null @@ -1,48 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEAsNS8UEuin7/K29jXfIOLpIoh1jEyWVqxiie2Onx7uJJKcoKo -khA3XeUnVN0k6X5MwYWcN52xcns7LYtyt06nRpTG2/emoV44w9uKTuHsvUbiOwSV -m/ToKQQ4FUFZoqorXH+ZmJuIpJNfoW+3CkE1vEDCIecIq6BNg5ySsPtvSuSJHGjp -mc7/5ZUDvFE2aJ8QbJU3Ws0HXiEb6ymi048LlzEL2VKX3w6mqqh+7dcZGAy7qYk2 -5FZ9ktKvCeQau7mTyU1hsPrKFiKtMN8Q2ZAItX13asw5/IeSTq2LgLFHlbj5Kpq4 -GmLdNCshzH5X7Ew3IYM8EHmsX8dmD6mhv7vpVwIDAQABAoIBABOdpb4qhcG+3twA -c/cGCKmaASLnljQ/UU6IFTjrsjXJVKTbRaPeVKX/05sgZQXZ0t3s2mV5AsQ2U1w8 -Cd+3w+qaemzQThW8hAOGCROzEDX29QWi/o2sX0ydgTMqaq0Wv3SlWv6I0mGfT45y -/BURIsrdTCvCmz2erLqa1dL4MWJXRFjT9UTs5twlecIOM2IHKoGGagFhymRK4kDe -wTRC9fpfoAgyfus3pCO/wi/F8yKGPDEwY+zgkhrJQ+kSeki7oKdGD1H540vB8gRt -EIqssE0Y6rEYf97WssQlxJgvoJBDSftOijS6mwvoasDUwfFqyyPiirawXWWhHXkc -DjIi/XECgYEA5xfjilw9YyM2UGQNESbNNunPcj7gDZbN347xJwmYmi9AUdPLt9xN -3XaMqqR22k1DUOxC/5hH0uiXir7mDfqmC+XS/ic/VOsa3CDWejkEnyGLiwSHY502 -wD/xWgHwUiGVAG9HY64vnDGm6L3KGXA2oqxanL4V0+0+Ht49pZ16i8sCgYEAw+Ox -CHGtpkzjCP/z8xr+1VTSdpc/4CP2HONnYopcn48KfQnf7Nale69/1kZpypJlvQSG -eeA3jMGigNJEkb8/kaVoRLCisXcwLc0XIfCTeiK6FS0Ka30D/84Qm8UsHxRdpGkM -kYITAa2r64tgRL8as4/ukeXBKE+oOhX43LeEfyUCgYBkf7IX2Ndlhsm3GlvIarxy -NipeP9PGdR/hKlPbq0OvQf9R1q7QrcE7H7Q6/b0mYNV2mtjkOQB7S2WkFDMOP0P5 -BqDEoKLdNkV/F9TOYH+PCNKbyYNrodJOt0Ap6Y/u1+Xpw3sjcXwJDFrO+sKqX2+T -PStG4S+y84jBedsLbDoAEwKBgQCTz7/KC11o2yOFqv09N+WKvBKDgeWlD/2qFr3w -UU9K5viXGVhqshz0k5z25vL09Drowf1nAZVpFMO2SPOMtq8VC6b+Dfr1xmYIaXVH -Gu1tf77CM9Zk/VSDNc66e7GrUgbHBK2DLo+A+Ld9aRIfTcSsMbNnS+LQtCrQibvb -cG7+MQKBgQCY11oMT2dUekoZEyW4no7W5D74lR8ztMjp/fWWTDo/AZGPBY6cZoZF -IICrzYtDT/5BzB0Jh1f4O9ZQkm5+OvlFbmoZoSbMzHL3oJCBOY5K0/kdGXL46WWh -IRJSYakNU6VIS7SjDpKgm9D8befQqZeoSggSjIIULIiAtYgS80vmGA== ------END RSA PRIVATE KEY----- ------BEGIN CERTIFICATE----- -MIIDgzCCAmugAwIBAgIDAxOUMA0GCSqGSIb3DQEBCwUAMHkxGzAZBgNVBAMTEkRy -aXZlcnMgVGVzdGluZyBDQTEQMA4GA1UECxMHRHJpdmVyczEQMA4GA1UEChMHTW9u -Z29EQjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlvcmsx -CzAJBgNVBAYTAlVTMB4XDTE5MDUyMjIzNTU1NFoXDTM5MDUyMjIzNTU1NFowaTEP -MA0GA1UEAxMGY2xpZW50MRAwDgYDVQQLEwdEcml2ZXJzMQwwCgYDVQQKEwNNREIx -FjAUBgNVBAcTDU5ldyBZb3JrIENpdHkxETAPBgNVBAgTCE5ldyBZb3JrMQswCQYD -VQQGEwJVUzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDUvFBLop+/ -ytvY13yDi6SKIdYxMllasYontjp8e7iSSnKCqJIQN13lJ1TdJOl+TMGFnDedsXJ7 -Oy2LcrdOp0aUxtv3pqFeOMPbik7h7L1G4jsElZv06CkEOBVBWaKqK1x/mZibiKST -X6FvtwpBNbxAwiHnCKugTYOckrD7b0rkiRxo6ZnO/+WVA7xRNmifEGyVN1rNB14h -G+spotOPC5cxC9lSl98Opqqofu3XGRgMu6mJNuRWfZLSrwnkGru5k8lNYbD6yhYi -rTDfENmQCLV9d2rMOfyHkk6ti4CxR5W4+SqauBpi3TQrIcx+V+xMNyGDPBB5rF/H -Zg+pob+76VcCAwEAAaMkMCIwCwYDVR0PBAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUF -BwMCMA0GCSqGSIb3DQEBCwUAA4IBAQAqRcLAGvYMaGYOV4HJTzNotT2qE0I9THNQ -wOV1fBg69x6SrUQTQLjJEptpOA288Wue6Jt3H+p5qAGV5GbXjzN/yjCoItggSKxG -Xg7279nz6/C5faoIKRjpS9R+MsJGlttP9nUzdSxrHvvqm62OuSVFjjETxD39DupE -YPFQoHOxdFTtBQlc/zIKxVdd20rs1xJeeU2/L7jtRBSPuR/Sk8zot7G2/dQHX49y -kHrq8qz12kj1T6XDXf8KZawFywXaz0/Ur+fUYKmkVk1T0JZaNtF4sKqDeNE4zcns -p3xLVDSl1Q5Gwj7bgph9o4Hxs9izPwiqjmNaSjPimGYZ399zcurY ------END CERTIFICATE----- diff --git a/.evergreen/x509gen/commonName.pem b/.evergreen/x509gen/commonName.pem deleted file mode 100644 index e8ebd4953..000000000 --- a/.evergreen/x509gen/commonName.pem +++ /dev/null @@ -1,48 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEArS94Vnpx+C+LwiCIyfZH45uwDbiEqCKr0hfWPVlJdoOQgaDO -av9nbxRvx+CnsiZ1yE6Kj1NYIX3FqOzO9YizwKtPaxCqFMjDzl1HZCJ8LTZZzMic -01K38wGfacsBwno/sNZn9jgnT+9JOasD6854IAs5T7dRCFH/nxV+RuZ4ueTWIcfH -jXzAZv9+wtu0sVmQKHV0J3S6ZdPqqDaYRdhOCyShBTO4RbUW1myIjooIqqy/xceV -TmXGWycqZjyDDronT1kj/yx6znqudOeDzj1PaEdnsqdXxQlI7MVdRf3nXdDXTpw5 -gPhqxqYc47vL6RvMxqief0BJnlc6PoZWoyTRPwIDAQABAoIBAQCYNMYwSsDrfO35 -mRpfVYHs+iGKjYaZNo+Hv8dcd6Jm9E4Gf0urIfjH2VA8fKclnUOa3dxNBtTH6n/T -bPyfMpu4U1cjI6w3RBNCxRw/V0eHfOMDZbTezS459k0ib3aGc2aShn0sGkICsKzM -cA6sKfPNRdACzXv8MgTUzdEDgv7LcGwNUKYzz/XWZxOX+XpeAGNSdXxv6ASvZNJ7 -u3Ba6LbOSAjxnKK24qdBDwCfuxRvD6ovenvI3+qIDSZSrEs/ofGhEEdKlQiyUAgS -m40kWqtoq9sC4/6cGxCLw9scuwXhwE0NNP19QRjh6Hsmr6qmu8LJAKugJi+5WyLg -1oHLs91xAoGBAO4oy6cdc57UdL7A2UbFDWJkBlySw0ChCK4I49Sfq/IISpd3mOfH -SxpZoh5IEnKTEYSqMi/kUUt8J/kQhjdAhqyA33GuNekfGPumUxyB8nKtowNNevyv -Ou6Y9FmzwEektvTLoku/4GxVbrgE262YEu/U1bMA700YK88knCtRWrtFAoGBALoo -qdUpb9s0NK0K4pGo8NYdtqVraOkXPAhKCCOY+hnl0yJERU7LLM9pYCMmR9m/TPcA -pXZTETPWcB6SDJoH3nCmje1Bt3xTxnSvt9P8lXYfvgVpKz8zBrvvnZqUDbMUjWe+ -vz9/jRKrarKgzG6KLnLgFV9sNbuSoOER4/h7MmCzAoGARP2qaUHd4Y/4Nd4V0yt4 -Qh1pvl2BlHJR2mCW51xN6jI+sXwi3lncRsjabt1AAtLZy02mdjs01aIkzkDcMJtP -qB85G2x1D5BDo3q+Ls7yFgh45ZcHXrXAY6gJeQbaV6a+nVF0NW9jKt7g0QwPO02H -htRoB4/owrOS1VHsr5vEpeUCgYAsWg/MZ2js8s0yBQvh5Dws5ztiwepmzlBRMUIr -KQE9NlJNMbLJiQKOD+8FsNMhf8BYgODrBfNtREPGJMm30PQgJq5dvnB2wIbhuhOz -/9OkJv/gziOtlPyfvgDwmSGCbv0ZoIp0GHGF5y0ujbznASj72YN+DovmupJ1zQth -YgionQKBgDGtSfvf3VpJxoabJ52tC0vJFDzkqdbOT0imuLjRHmUH4pSKuMvanvVk -kYcHXeQcfLOPjH18UUqTIgK5vXXjJraduq2bGyvdLcbd3xmj5guzfim3FP83Lh/U -OMAbRgBdq3rlylRqcZh0NqV05L0kJ0Wt1XIaV/eknpuFz5nD7O+y ------END RSA PRIVATE KEY----- ------BEGIN CERTIFICATE----- -MIIDcTCCAlmgAwIBAgIDB5VBMA0GCSqGSIb3DQEBCwUAMHkxGzAZBgNVBAMTEkRy -aXZlcnMgVGVzdGluZyBDQTEQMA4GA1UECxMHRHJpdmVyczEQMA4GA1UEChMHTW9u -Z29EQjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlvcmsx -CzAJBgNVBAYTAlVTMB4XDTE5MDUyMjIxMDUxNVoXDTM5MDUyMjIxMDUxNVowfTEf -MB0GA1UEAxMWY29tbW9uTmFtZS5tb25nb2RiLm9yZzEQMA4GA1UECxMHRHJpdmVy -czEQMA4GA1UEChMHTW9uZ29EQjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8G -A1UECBMITmV3IFlvcmsxCzAJBgNVBAYTAlVTMIIBIjANBgkqhkiG9w0BAQEFAAOC -AQ8AMIIBCgKCAQEArS94Vnpx+C+LwiCIyfZH45uwDbiEqCKr0hfWPVlJdoOQgaDO -av9nbxRvx+CnsiZ1yE6Kj1NYIX3FqOzO9YizwKtPaxCqFMjDzl1HZCJ8LTZZzMic -01K38wGfacsBwno/sNZn9jgnT+9JOasD6854IAs5T7dRCFH/nxV+RuZ4ueTWIcfH -jXzAZv9+wtu0sVmQKHV0J3S6ZdPqqDaYRdhOCyShBTO4RbUW1myIjooIqqy/xceV -TmXGWycqZjyDDronT1kj/yx6znqudOeDzj1PaEdnsqdXxQlI7MVdRf3nXdDXTpw5 -gPhqxqYc47vL6RvMxqief0BJnlc6PoZWoyTRPwIDAQABMA0GCSqGSIb3DQEBCwUA -A4IBAQA34DUMfx0YaxsXnNlCmbkncwgb69VfwWTqtON2MabOlw9fQ0Z5YlwduBSD -DxkRosVURdqV+EcGxei6opnPkdoJ+1mkCDo360q+R/bJUFqjj7djB7GCwwK/Eud4 -Jjn//eLBChU+DlTjO1yL8haEQR70LyVz37sh28oIRqoTS3Nk2SZg7Gnor1qHwd6j -OljaM1WiTJfq6XCSZ9/3C5Ix0Vr7xZaP9Dn5lgQ86du6N6tmaKqVobCw3vjITmnr -eZTC7dKU4/O52d6lHZ1vv8GyvqrRCeiolTVzhW47GvO/n+snC0NMkXvoo7Rzv1S/ -FxHvlhiH5wCbaGnBx4uF5/boedV+ ------END CERTIFICATE----- diff --git a/.evergreen/x509gen/crl.pem b/.evergreen/x509gen/crl.pem deleted file mode 100644 index 733a0acdc..000000000 --- a/.evergreen/x509gen/crl.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN X509 CRL----- -MIIB6jCB0wIBATANBgkqhkiG9w0BAQsFADB5MRswGQYDVQQDExJEcml2ZXJzIFRl -c3RpbmcgQ0ExEDAOBgNVBAsTB0RyaXZlcnMxEDAOBgNVBAoTB01vbmdvREIxFjAU -BgNVBAcTDU5ldyBZb3JrIENpdHkxETAPBgNVBAgTCE5ldyBZb3JrMQswCQYDVQQG -EwJVUxcNMTkwNTIyMjI0NTUzWhcNMTkwNjIxMjI0NTUzWjAVMBMCAncVFw0xOTA1 -MjIyMjQ1MzJaoA8wDTALBgNVHRQEBAICEAAwDQYJKoZIhvcNAQELBQADggEBACwQ -W9OF6ExJSzzYbpCRroznkfdLG7ghNSxIpBQUGtcnYbkP4em6TdtAj5K3yBjcKn4a -hnUoa5EJGr2Xgg0QascV/1GuWEJC9rsYYB9boVi95l1CrkS0pseaunM086iItZ4a -hRVza8qEMBc3rdsracA7hElYMKdFTRLpIGciJehXzv40yT5XFBHGy/HIT0CD50O7 -BDOHzA+rCFCvxX8UY9myDfb1r1zUW7Gzjn241VT7bcIJmhFE9oV0popzDyqr6GvP -qB2t5VmFpbnSwkuc4ie8Jizip1P8Hg73lut3oVAHACFGPpfaNIAp4GcSH61zJmff -9UBe3CJ1INwqyiuqGeA= ------END X509 CRL----- diff --git a/.evergreen/x509gen/expired.pem b/.evergreen/x509gen/expired.pem deleted file mode 100644 index 2d92be01a..000000000 --- a/.evergreen/x509gen/expired.pem +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEAw06nN1BoINnY/WJXvi+r0taDMphWQNoyeM85A6NIYKo+vWtN -fvf6f2JTpg/Q4NJ3txiZE/F6yZaMFC78l1KMoz+zIEPLpSJoIezCaXyl2+AQih8A -WmAOFAoiWYTiNfWoVM7t0Qzy6yS+rXifuET5Dg1mtWpA6xRFHZEqQTdKX4QzbT5G -RenoFIBT9wG7xUV+FG1/9s5nx4f5gZDbwMKA7mNq/Jr+rZZQV4lReeGtoYNx1I/Z -4yd4xswI3RfuB7QDZMNHWZazFxW1N6EP5NJBDZJkYLEkMX36r4Orr/73z4EA5GBx -zqdSKH9qHLRiBwesfZf7u8xb120u1S1X1J8a5QIDAQABAoIBAQC+Y9swWerYM2WL -RKYCWZhndQP6e3SBzfMrv951hGQXD38Pyh2Gq5h/O0wN8xcNQz6+t3TqcxnekCrH -tjI4FZnRvlQRHOXVeeAHSjUO/hr1Z8zXyHbgowi2Ula/64FVVr+cxQgiJTxdK7nR -g2g4Csy6/SdlrEnSoDTsKMoHPy36Q0GaLDBnthpKIc1Prhntf6vBCgQAHXVfLk6E -NwddYloL+mfEZESa3Qf2ZYeX/Ovq9agbuQ3cRE7M5FunSo9E7eXt+D+Ntk0usTKV -BaUEHLRYXV827fMDGc1vBN6WFVfthhYviIEgDdkALwOw4lfIiA2WM3fhCF6Ow9hJ -as3dpEHBAoGBAO+l4PdUXypWBYQNZKggH79kAFuAOWtLsMqEBO0ZaXXdvFdwdzhR -jbL7mhRrghgGYpXWIUaNkcbX0XPlkWl2dRzYQqRNjUSEGFabVAxdGZPfiYoupXVl -Lz/FIG3P6BnEYmczh9MxRpJyk4wlUCKppYPiBrR0Ei/qcbGvciOwLq5VAoGBANCi -PWG2izO2HuBFgZTuVIvnl7ixQXgG/tvbiEmYvDNYy1E+w1MWY10Ve/JtIncBIVHk -fEgJPL3hvipAez5ir9Qa1D4PlWxsIrbjuNcLaj+IsRhWBDjMKwRWgmTvvsimcyF5 -39Vs4FujR8cgXy8UnZhYDVRC13PyxmYfJrp4QCpRAoGAKV8nsUsdir+DAEMXp3a0 -RGRNM361avKMOMoF17DVZgW7qBTAYDakEcwh03ij4uXnSxrGb9ms2vkTLcDqE5zh -pvMmvhqtUrDDSuBR6DiCW+bxZaub4OJw/79WU97aoOgoXMymnC0bk9i35C/k37cN -3fC9W5XWNfNxYU16lPKrfGkCgYA14hD0UY72Fg03YvwqmLshPvkCbFU6SKQ96B70 -0wuYP1CTdSBBL0EOY2QVonYKQjJ20gn/GNOlPs48X1b1L8u1fhBezuuKiwsULRAq -Cfqw2f7TCDQi7ygVALrAkuK1M7f8Z1uV5X60bCE3nna21B43oFYg8vpuKb9v1I/O -DQyVYQKBgQCH/Kxq+7Or/5ciq15Vy6z+PJdsGV9FV9S7zkQOZqJ4PXJn0wG9PXnp -ugjvmU1iLx0bXs5llByRx792Q/QmdWnwMCohs6bkWaBCf36JJfTkDTzzbez43cCK -HcYi6gtbiBznWiLWekudRkWdhIFEGU6cSjimy1i4yvwIw85PlEQt/Q== ------END RSA PRIVATE KEY----- ------BEGIN CERTIFICATE----- -MIIDljCCAn6gAwIBAgIDAYZJMA0GCSqGSIb3DQEBCwUAMHkxGzAZBgNVBAMTEkRy -aXZlcnMgVGVzdGluZyBDQTEQMA4GA1UECxMHRHJpdmVyczEQMA4GA1UEChMHTW9u -Z29EQjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlvcmsx -CzAJBgNVBAYTAlVTMB4XDTE5MDUyMDIyMzYzNVoXDTE5MDUyMTIyMzYzNVowcDES -MBAGA1UEAxMJbG9jYWxob3N0MRAwDgYDVQQLEwdEcml2ZXJzMRAwDgYDVQQKEwdN -b25nb0RCMRYwFAYDVQQHEw1OZXcgWW9yayBDaXR5MREwDwYDVQQIEwhOZXcgWW9y -azELMAkGA1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDD -Tqc3UGgg2dj9Yle+L6vS1oMymFZA2jJ4zzkDo0hgqj69a01+9/p/YlOmD9Dg0ne3 -GJkT8XrJlowULvyXUoyjP7MgQ8ulImgh7MJpfKXb4BCKHwBaYA4UCiJZhOI19ahU -zu3RDPLrJL6teJ+4RPkODWa1akDrFEUdkSpBN0pfhDNtPkZF6egUgFP3AbvFRX4U -bX/2zmfHh/mBkNvAwoDuY2r8mv6tllBXiVF54a2hg3HUj9njJ3jGzAjdF+4HtANk -w0dZlrMXFbU3oQ/k0kENkmRgsSQxffqvg6uv/vfPgQDkYHHOp1Iof2octGIHB6x9 -l/u7zFvXbS7VLVfUnxrlAgMBAAGjMDAuMCwGA1UdEQQlMCOCCWxvY2FsaG9zdIcE -fwAAAYcQAAAAAAAAAAAAAAAAAAAAATANBgkqhkiG9w0BAQsFAAOCAQEAgPh9C6Yi -6ykJYfaOETPEkggI9LlLQyQ0VhSJGrcw8DXGuPEkyd2xtczYoh0ijtYD3nlTQnh1 -u+5mEEP05nuMMURzG+v7WzZG8Qfz/SDBY1Lfvb/waI3w3RT/dcZ6jwz39jQhV+rU -o2F1vr37Hnh1Ehoa2igjKL1w1LmWdoFgHb0p09qQDAGtkP0gxl0t7iujDDRStLQn -OpWwfOpCaYhtzWwONJn/JIG+JCE/szcRbmc4XKw8t06ffS0mKR/yZBCoekZinnPD -XRVWAH/UF5XPs0mUlrvhFcT/vjgXSZvpi+UuVv3XL56xwPmXAgKsYUpqLlgbrVxv -jY93LTJ1azg+Sw== ------END CERTIFICATE----- diff --git a/.evergreen/x509gen/password_protected.pem b/.evergreen/x509gen/password_protected.pem deleted file mode 100644 index cc9e12470..000000000 --- a/.evergreen/x509gen/password_protected.pem +++ /dev/null @@ -1,51 +0,0 @@ ------BEGIN ENCRYPTED PRIVATE KEY----- -MIIFHzBJBgkqhkiG9w0BBQ0wPDAbBgkqhkiG9w0BBQwwDgQIC8as6PDVhwECAggA -MB0GCWCGSAFlAwQBAgQQTYOgCJcRqUI7dsgqNojv/ASCBNCG9fiu642V4AuFK34c -Q42lvy/cR0CIXLq/rDXN1L685kdeKex7AfDuRtnjY2+7CLJiJimgQNJXDJPHab/k -MBHbwbBs38fg6eSYX8V08/IyyTege5EJMhYxmieHDC3DXKt0gyHk6hA/r5+Mr49h -HeVGwqBLJEQ3gVIeHaOleZYspsXXWqOPHnFiqnk/biaJS0+LkDDEiQgTLEYSnOjP -lexxUc4BV/TN0Z920tZCMfwx7IXD/C+0AkV/Iqq4LALmT702EccB3indaIJ8biGR -radqDLR32Q+vT9uZHgT8EFiUsISMqhob2mnyTfFV/s9ghWwogjSz0HrRcq6fxdg7 -oeyT9K0ET53AGTGmV0206byPu6qCj1eNvtn+t1Ob+d5hecaTugRMVheWPlc5frsz -AcewDNa0pv4pZItjAGMqOPJHfzEDnzTJXpLqGYhg044H1+OCY8+1YK7U0u8dO+/3 -f5AoDMq18ipDVTFTooJURej4/Wjbrfad3ZFjp86nxfHPeWM1YjC9+IlLtK1wr0/U -V8TjGqCkw8yHayz01A86iA8X53YQBg+tyMGjxmivo6LgFGKa9mXGvDkN+B+0+OcA -PqldAuH/TJhnkqzja767e4n9kcr+TmV19Hn1hcJPTDrRU8+sSqQFsWN4pvHazAYB -UdWie+EXI0eU2Av9JFgrVcpRipXjB48BaPwuBw8hm+VStCH7ynF4lJy6/3esjYwk -Mx+NUf8+pp1DRzpzuJa2vAutzqia5r58+zloQMxkgTZtJkQU6OCRoUhHGVk7WNb1 -nxsibOSzyVSP9ZNbHIHAn43vICFGrPubRs200Kc4CdXsOSEWoP0XYebhiNJgGtQs -KoISsV4dFRLwhaJhIlayTBQz6w6Ph87WbtuiAqoLiuqdXhUGz/79j/6JZqCH8t/H -eZs4Dhu+HdD/wZKJDYAS+JBsiwYWnI3y/EowZYgLdOMI4u6xYDejhxwEw20LW445 -qjJ7pV/iX2uavazHgC91Bfd4zodfXIQ1IDyTmb51UFwx0ARzG6enntduO6xtcYU9 -MXwfrEpuZ/MkWTLkR0PHPbIPcR1MiVwPKdvrLk42Bzj/urtXYrAFUckMFMzEh+uv -0lix2hbq/Xwj4dXcY4w9hnC6QQDCJTf9S6MU6OisrZHKk0qZ2Vb4aU/eBcBsHBwo -X/QGcDHneHxlrrs2eLX26Vh8Odc5h8haeIxnfaa1t+Yv56OKHuAztPMnJOUL7KtQ -A556LxT0b5IGx0RcfUcbG8XbxEHseACptoDOoguh9923IBI0uXmpi8q0P815LPUu -0AsE47ATDMGPnXbopejRDicfgMGjykJn8vKO8r/Ia3Fpnomx4iJNCXGqomL+GMpZ -IhQbKNrRG6XZMlx5kVCT0Qr1nOWMiOTSDCQ5vrG3c1Viu+0bctvidEvs+LCm98tb -7ty8F0uOno0rYGNQz18OEE1Tj+E19Vauz1U35Z5SsgJJ/GfzhSJ79Srmdg2PsAzk -AUNTKXux1GLf1cMjTiiU5g+tCEtUL9Me7lsv3L6aFdrCyRbhXUQfJh4NAG8+3Pvh -EaprThBzKsVvbOfU81mOaH9YMmUgmxG86vxDiNtaWd4v6c1k+HGspJr/q49pcXZP -ltBMuS9AihstZ1sHJsyQCmNXkA== ------END ENCRYPTED PRIVATE KEY----- ------BEGIN CERTIFICATE----- -MIIDgzCCAmugAwIBAgIDBXUHMA0GCSqGSIb3DQEBCwUAMHkxGzAZBgNVBAMTEkRy -aXZlcnMgVGVzdGluZyBDQTEQMA4GA1UECxMHRHJpdmVyczEQMA4GA1UEChMHTW9u -Z29EQjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlvcmsx -CzAJBgNVBAYTAlVTMB4XDTE5MDUyMzAwMDEyOVoXDTM5MDUyMzAwMDEyOVowaTEP -MA0GA1UEAxMGY2xpZW50MRAwDgYDVQQLEwdEcml2ZXJzMQwwCgYDVQQKEwNNREIx -FjAUBgNVBAcTDU5ldyBZb3JrIENpdHkxETAPBgNVBAgTCE5ldyBZb3JrMQswCQYD -VQQGEwJVUzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOqCb0Lo4XsV -W327Wlnqc5rwWa5Elw0rFuehSfViRIcYfuFWAPXoOj3fIDsYz6d41G8hp6tkF88p -swlbzDF8Fc7mXDhauwwl2F/NrWYUXwCT8fKju4DtGd2JlDMi1TRDeofkYCGVPp70 -vNqd0H8iDWWs8OmiNrdBLJwNiGaf9y15ena4ImQGitXLFn+qNSXYJ1Rs8p7Y2PTr -L+dff5gJCVbANwGII1rjMAsrMACPVmr8c1Lxoq4fSdJiLweosrv2Lk0WWGsO0Seg -ZY71dNHEyNjItE+VtFEtslJ5L261i3BfF/FqNnH2UmKXzShwfwxyHT8o84gSAltQ -5/lVJ4QQKosCAwEAAaMkMCIwCwYDVR0PBAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUF -BwMCMA0GCSqGSIb3DQEBCwUAA4IBAQBOAlKxIMFcTZ+4k8NJv97RSf+zOb5Wu2ct -uxSZxzgKTxLFUuEM8XQiEz1iHQ3XG+uV1fzA74YLQiKjjLrU0mx54eM1vaRtOXvF -sJlzZU8Z2+523FVPx4HBPyObQrfXmIoAiHoQ4VUeepkPRpXxpifgWd/OCWhLDr2/ -0Kgcb0ybaGVDpA0UD9uVIwgFjRu6id7wG+lVcdRxJYskTOOaN2o1hMdAKkrpFQbd -zNRfEoBPUYR3QAmAKP2HBjpgp4ktOHoOKMlfeAuuMCUocSnmPKc3xJaH/6O7rHcf -/Rm0X411RH8JfoXYsSiPsd601kZefhuWvJH0sJLibRDvT7zs8C1v ------END CERTIFICATE----- diff --git a/.evergreen/x509gen/server.pem b/.evergreen/x509gen/server.pem deleted file mode 100644 index 7480f9644..000000000 --- a/.evergreen/x509gen/server.pem +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEogIBAAKCAQEAhNrB0E6GY/kFSd8/vNpu/t952tbnOsD5drV0XPvmuy7SgKDY -a/S+xb/jPnlZKKehdBnH7qP/gYbv34ZykzcDFZscjPLiGc2cRGP+NQCSFK0d2/7d -y15zSD3zhj14G8+MkpAejTU+0/qFNZMc5neDvGanTe0+8aWa0DXssM0MuTxIv7j6 -CtsMWeqLLofN7a1Kw2UvmieCHfHMuA/08pJwRnV/+5T9WONBPJja2ZQRrG1BjpI4 -81zSPUZesIqi8yDlExdvgNaRZIEHi/njREqwVgJOZomUY57zmKypiMzbz48dDTsV -gUStxrEqbaP+BEjQYPX5+QQk4GdMjkLf52LR6QIDAQABAoIBAHSs+hHLJNOf2zkp -S3y8CUblVMsQeTpsR6otaehPgi9Zy50TpX4KD5D0GMrBH8BIl86y5Zd7h+VlcDzK -gs0vPxI2izhuBovKuzaE6rf5rFFkSBjxGDCG3o/PeJOoYFdsS3RcBbjVzju0hFCs -xnDQ/Wz0anJRrTnjyraY5SnQqx/xuhLXkj/lwWoWjP2bUqDprnuLOj16soNu60Um -JziWbmWx9ty0wohkI/8DPBl9FjSniEEUi9pnZXPElFN6kwPkgdfT5rY/TkMH4lsu -ozOUc5xgwlkT6kVjXHcs3fleuT/mOfVXLPgNms85JKLucfd6KiV7jYZkT/bXIjQ+ -7CZEn0ECgYEA5QiKZgsfJjWvZpt21V/i7dPje2xdwHtZ8F9NjX7ZUFA7mUPxUlwe -GiXxmy6RGzNdnLOto4SF0/7ebuF3koO77oLup5a2etL+y/AnNAufbu4S5D72sbiz -wdLzr3d5JQ12xeaEH6kQNk2SD5/ShctdS6GmTgQPiJIgH0MIdi9F3v0CgYEAlH84 -hMWcC+5b4hHUEexeNkT8kCXwHVcUjGRaYFdSHgovvWllApZDHSWZ+vRcMBdlhNPu -09Btxo99cjOZwGYJyt20QQLGc/ZyiOF4ximQzabTeFgLkTH3Ox6Mh2Rx9yIruYoX -nE3UfMDkYELanEJUv0zenKpZHw7tTt5yXXSlEF0CgYBSsEOvVcKYO/eoluZPYQAA -F2jgzZ4HeUFebDoGpM52lZD+463Dq2hezmYtPaG77U6V3bUJ/TWH9VN/Or290vvN -v83ECcC2FWlSXdD5lFyqYx/E8gqE3YdgqfW62uqM+xBvoKsA9zvYLydVpsEN9v8m -6CSvs/2btA4O21e5u5WBTQKBgGtAb6vFpe0gHRDs24SOeYUs0lWycPhf+qFjobrP -lqnHpa9iPeheat7UV6BfeW3qmBIVl/s4IPE2ld4z0qqZiB0Tf6ssu/TpXNPsNXS6 -dLFz+myC+ufFdNEoQUtQitd5wKbjTCZCOGRaVRgJcSdG6Tq55Fa22mOKPm+mTmed -ZdKpAoGAFsTYBAHPxs8nzkCJCl7KLa4/zgbgywO6EcQgA7tfelB8bc8vcAMG5o+8 -YqAfwxrzhVSVbJx0fibTARXROmbh2pn010l2wj3+qUajM8NiskCPFbSjGy7HSUze -P8Kt1uMDJdj55gATzn44au31QBioZY2zXleorxF21cr+BZCJgfA= ------END RSA PRIVATE KEY----- ------BEGIN CERTIFICATE----- -MIIDlTCCAn2gAwIBAgICdxUwDQYJKoZIhvcNAQELBQAweTEbMBkGA1UEAxMSRHJp -dmVycyBUZXN0aW5nIENBMRAwDgYDVQQLEwdEcml2ZXJzMRAwDgYDVQQKEwdNb25n -b0RCMRYwFAYDVQQHEw1OZXcgWW9yayBDaXR5MREwDwYDVQQIEwhOZXcgWW9yazEL -MAkGA1UEBhMCVVMwHhcNMTkwNTIyMjIzMjU2WhcNMzkwNTIyMjIzMjU2WjBwMRIw -EAYDVQQDEwlsb2NhbGhvc3QxEDAOBgNVBAsTB0RyaXZlcnMxEDAOBgNVBAoTB01v -bmdvREIxFjAUBgNVBAcTDU5ldyBZb3JrIENpdHkxETAPBgNVBAgTCE5ldyBZb3Jr -MQswCQYDVQQGEwJVUzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAITa -wdBOhmP5BUnfP7zabv7fedrW5zrA+Xa1dFz75rsu0oCg2Gv0vsW/4z55WSinoXQZ -x+6j/4GG79+GcpM3AxWbHIzy4hnNnERj/jUAkhStHdv+3ctec0g984Y9eBvPjJKQ -Ho01PtP6hTWTHOZ3g7xmp03tPvGlmtA17LDNDLk8SL+4+grbDFnqiy6Hze2tSsNl -L5ongh3xzLgP9PKScEZ1f/uU/VjjQTyY2tmUEaxtQY6SOPNc0j1GXrCKovMg5RMX -b4DWkWSBB4v540RKsFYCTmaJlGOe85isqYjM28+PHQ07FYFErcaxKm2j/gRI0GD1 -+fkEJOBnTI5C3+di0ekCAwEAAaMwMC4wLAYDVR0RBCUwI4IJbG9jYWxob3N0hwR/ -AAABhxAAAAAAAAAAAAAAAAAAAAABMA0GCSqGSIb3DQEBCwUAA4IBAQBol8+YH7MA -HwnIh7KcJ8h87GkCWsjOJCDJWiYBJArQ0MmgDO0qdx+QEtvLMn3XNtP05ZfK0WyX -or4cWllAkMFYaFbyB2hYazlD1UAAG+22Rku0UP6pJMLbWe6pnqzx+RL68FYdbZhN -fCW2xiiKsdPoo2VEY7eeZKrNr/0RFE5EKXgzmobpTBQT1Dl3Ve4aWLoTy9INlQ/g -z40qS7oq1PjjPLgxINhf4ncJqfmRXugYTOnyFiVXLZTys5Pb9SMKdToGl3NTYWLL -2AZdjr6bKtT+WtXyHqO0cQ8CkAW0M6VOlMluACllcJxfrtdlQS2S4lUIj76QKBdZ -khBHXq/b8MFX ------END CERTIFICATE----- diff --git a/.evergreen/x509gen/wild.pem b/.evergreen/x509gen/wild.pem deleted file mode 100644 index d41800748..000000000 --- a/.evergreen/x509gen/wild.pem +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAlenyliMpkLM9aR51iOO7hdLS66pwgafsJlIbtsKAy6WxlcKA -yecs0yCQfw5z5j3BFgv88dzAFEF+jFG6o/EmAzqmK5uRCQX1EJbl2p8detbzToj9 -Ys1Z1peWE8FkJtZMKUdLdlRQQ57v2VUr0kwtFEUGlSNyVwf4pJ5coyqpukmoUdko -zrKeclshjydDVo44Ln6WYvN6odz/CZT808fHZ0CXcIEKyDV8zXIcHGX2OUL/ajtZ -+C2pIbAx64nin1BLtHGvDT0Pan1xKDiMCkOdc7va0gLh0qtPjGLsI4vc8iByviGJ -Kw7hVaj7ym0r2DFzeqghfvNNNHisGXSf+6EcPQIDAQABAoIBAGq/PVefDhfVKaNS -ZwrkbkDqT/ozUQ1hzwuyZ72JXkCkaYFkEGS0Ufy8MWfnmKuXyYezXZezQqqpwDyW -bboTGqgt+OkQSwQL0+bOLDmyF0HDEVkYvqS96HyfT+QdTv1AltbFx3woqUadQ9iT -hzKlv2uxgvBrXx2NtYUypnAhDt5wQQ4n1w46Kl1USb983qWDWyFtHfIQo6vF1JK/ -s6I6oA2tmORPTD3A7E2xT98UMM8B1c/v1F+owAiD+KNmgAN4oWSWBfRGEKg59fZA -aGWjQrwoWmQQJnMnTsHZc+2hT7waKnyOwOFq1NPXyfCw+4cSeI3B3rPxPyShBM4O -ZKfajIECgYEAz555nPHhk5GmMpXprryCODy66ChHWulA3fM9r0k/ObBgKqTirAOA -y0PmA8OxR8acV0V2lZImdwF5Lvnj+c8+fTFSnPKSQHpcZ/lbxo+m2rYwv7+BxUP9 -GJAWzA6xqBde6hNPULml8cNOqT7jwRnLt/DkwY+94Oeh3H5CRYb90Y0CgYEAuNkR -EieGwCn+TjgatkhMLhYqr234544p3ofL82CFlCcsOXtWqCma6POOi038eBlZiHV9 -EPBq4qQHCZMAPeApTZbiZ+Z8ezC3IxjGSX0jP5QK+gBrkk7nbp24nRMlHOrwizsL -/Sxu4Y6puZk5aTUZVufPLXokY6Iez0Kd07vyUXECgYBqWHFQi7EQ5nzr0lAVOee1 -qJ3QRrlt/qZESdCh1XH2Obq4fSbCFzVEaK4L5ZQMANaZ+TGpoWfkczPAdS1qCtam -R7paPAHf1w04EMkKpxA/XS0ROqXdBltA1qVmtmwXfokWeveYkM9IS9Mh6927TlxE -BrcV0mvfJKaLC30koeWnDQKBgEn1oBzxb7sHklbdn+J7Pu/Zsq6Kg+KyQRJmpzXz -0r6ahdlh/iQ+sVqvyML4KyIqkmZFDAtxBnM0ShSMmrYnMJ941ZHY6Mmpjj0etofE -6AuSQmoRLPlXVMYvmSRP+rN9VU2ADKX510usd0BpjE0KD99z1LNPgavTvBwVfWyw -cJ4hAoGBALgyVPMBPv1d8irbM1WHFe/I3vxjb4DWOY9xclbRWjkW69oZmkouGP07 -52ehzfBtBC87VPLwTEr/ERZqfICBqZvXYFypd2ydGhbDKjDswiUd6nACNKAx5ZPo -OVwQjVfjGqkKNThoHhvE1YU//+WtCe0YVUGqMA9dyZe1QO3HcqI8 ------END RSA PRIVATE KEY----- ------BEGIN CERTIFICATE----- -MIIDkzCCAnugAwIBAgIDCRU4MA0GCSqGSIb3DQEBCwUAMHkxGzAZBgNVBAMTEkRy -aXZlcnMgVGVzdGluZyBDQTEQMA4GA1UECxMHRHJpdmVyczEQMA4GA1UEChMHTW9u -Z29EQjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlvcmsx -CzAJBgNVBAYTAlVTMB4XDTE5MDUyMjIyMzgxOVoXDTM5MDUyMjIyMzgxOVowcDES -MBAGA1UEAxMJbG9jYWxob3N0MRAwDgYDVQQLEwdEcml2ZXJzMRAwDgYDVQQKEwdN -b25nb0RCMRYwFAYDVQQHEw1OZXcgWW9yayBDaXR5MREwDwYDVQQIEwhOZXcgWW9y -azELMAkGA1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV -6fKWIymQsz1pHnWI47uF0tLrqnCBp+wmUhu2woDLpbGVwoDJ5yzTIJB/DnPmPcEW -C/zx3MAUQX6MUbqj8SYDOqYrm5EJBfUQluXanx161vNOiP1izVnWl5YTwWQm1kwp -R0t2VFBDnu/ZVSvSTC0URQaVI3JXB/iknlyjKqm6SahR2SjOsp5yWyGPJ0NWjjgu -fpZi83qh3P8JlPzTx8dnQJdwgQrINXzNchwcZfY5Qv9qO1n4LakhsDHrieKfUEu0 -ca8NPQ9qfXEoOIwKQ51zu9rSAuHSq0+MYuwji9zyIHK+IYkrDuFVqPvKbSvYMXN6 -qCF+8000eKwZdJ/7oRw9AgMBAAGjLTArMCkGA1UdEQQiMCCCCWxvY2FsaG9zdIcE -fwAAAYINKi5tb25nb2RiLm9yZzANBgkqhkiG9w0BAQsFAAOCAQEAMCENVK+w+wP7 -T1XBytsScn7+Bh33sn+A+c7H/6BNOEdTxCQ67L3zBc0XrBFYtiHcAppNBKvvM8cV -ERWjXlU2nZ+A0WKOZE2nXYQL5lBnnXoIMwcdtJuTJuWw8r3MlVXDcP6bK8tNSQMG -WYK7PHQ3RNiWNABZejJV9GVP25nO6Wr2gt2xnEwYvUXTnCJtT+NsTE/fU4MlGuUL -a93Cec86Ij0XTMTcnj4nfZhct30nuqiU4wWBPHCN7BXxRQzIHu68aVHBpwDEAf6j -PAOKhucGY6DW+dyrW/1BjW6+ZOmJWxJ7GB+x0gjprQbGH67gIvRvTa9wW7NqWyS3 -Go/qT7H6FQ== ------END CERTIFICATE----- diff --git a/.gitattributes b/.gitattributes index 6a04e7492..7309afd20 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,6 +4,7 @@ tests export-ignore benchmark export-ignore docs export-ignore examples export-ignore +generator export-ignore mongo-orchestration export-ignore stubs export-ignore tools export-ignore @@ -14,6 +15,13 @@ phpunit.evergreen.xml export-ignore phpunit.xml.dist export-ignore psalm.xml.dist export-ignore psalm-baseline.xml export-ignore +rector.php export-ignore # Prevent generated build files from showing diffs in pull requests .evergreen/config/generated/** linguist-generated=true +/src/Builder/Accumulator/*.php linguist-generated=true +/src/Builder/Expression/*.php linguist-generated=true +/src/Builder/Query/*.php linguist-generated=true +/src/Builder/Search/*.php linguist-generated=true +/src/Builder/Stage/*.php linguist-generated=true +/tests/Builder/*/Pipelines.php linguist-generated=true diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index ba987c7e5..f85a72de2 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -11,6 +11,13 @@ inputs: description: "INI values to pass along to setup-php action" required: false default: "" + working-directory: + description: "The directory where composer.json is located, if it is not in the repository root." + required: false + ignore-platform-req: + description: "Whether to ignore platform requirements when installing dependencies with Composer." + required: false + default: "false" runs: using: composite @@ -21,7 +28,7 @@ runs: with: php-version: ${{ inputs.php-version }} extensions: "mongodb-${{ inputs.driver-version }}" - key: "extcache-v1" + key: "extcache-${{ inputs.driver-version }}" - name: Cache extensions uses: actions/cache@v4 @@ -33,7 +40,7 @@ runs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - coverage: none + coverage: xdebug extensions: "mongodb-${{ inputs.driver-version }}" php-version: "${{ inputs.php-version }}" tools: cs2pr @@ -46,6 +53,5 @@ runs: - name: Install dependencies with Composer uses: ramsey/composer-install@3.0.0 with: - # Revert when psalm supports PHP 8.4 - # composer-options: "--no-suggest" - composer-options: "--no-suggest ${{ inputs.php-version == '8.4' && '--ignore-platform-req=php+' || '' }}" + composer-options: "--no-suggest ${{ inputs.ignore-platform-req == 'true' && '--ignore-platform-req=php+' || '' }}" + working-directory: "${{ inputs.working-directory }}" diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5ace4600a..d771b123a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,3 +4,7 @@ updates: directory: "/" schedule: interval: "weekly" + - package-ecosystem: "gitsubmodule" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 000000000..34064499c --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,5 @@ +changelog: + exclude: + authors: + - mongodb-php-bot + - dependabot diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 9fe30fbb0..22e97cb1c 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -5,26 +5,26 @@ on: pull_request: branches: - "v*.*" - - "master" - "feature/*" push: branches: - "v*.*" - - "master" - "feature/*" env: PHP_VERSION: "8.2" - DRIVER_VERSION: "stable" + # TODO: change to "stable" once 2.0.0 is released + # DRIVER_VERSION: "stable" + DRIVER_VERSION: "mongodb/mongo-php-driver@v2.x" jobs: phpcs: name: "phpcs" - runs-on: "ubuntu-22.04" + runs-on: "ubuntu-24.04" steps: - name: "Checkout" - uses: "actions/checkout@v4" + uses: "actions/checkout@v5" - name: "Setup" uses: "./.github/actions/setup" @@ -38,11 +38,11 @@ jobs: rector: name: "Rector" - runs-on: "ubuntu-22.04" + runs-on: "ubuntu-24.04" steps: - name: "Checkout" - uses: "actions/checkout@v4" + uses: "actions/checkout@v5" - name: "Setup" uses: "./.github/actions/setup" diff --git a/.github/workflows/generator.yml b/.github/workflows/generator.yml new file mode 100644 index 000000000..f9650fc1f --- /dev/null +++ b/.github/workflows/generator.yml @@ -0,0 +1,40 @@ +name: "Generator" + +on: + merge_group: + pull_request: + branches: + - "v*.*" + - "feature/*" + push: + branches: + - "v*.*" + - "feature/*" + +env: + PHP_VERSION: "8.2" + # TODO: change to "stable" once 2.0.0 is released + # DRIVER_VERSION: "stable" + DRIVER_VERSION: "mongodb/mongo-php-driver@v2.x" + +jobs: + diff: + name: "Diff check" + runs-on: "ubuntu-24.04" + + steps: + - name: "Checkout" + uses: "actions/checkout@v5" + + - name: "Setup" + uses: "./.github/actions/setup" + with: + php-version: ${{ env.PHP_VERSION }} + driver-version: ${{ env.DRIVER_VERSION }} + working-directory: "generator" + + - name: "Run Generator" + run: "generator/generate" + + - name: "Check file diff" + run: git add . -N && git diff --exit-code diff --git a/.github/workflows/merge-up.yml b/.github/workflows/merge-up.yml index 03f3065bb..f8de9e676 100644 --- a/.github/workflows/merge-up.yml +++ b/.github/workflows/merge-up.yml @@ -3,7 +3,7 @@ name: Merge up on: push: branches: - - "v[0-9]+.[0-9]+" + - "v[0-9]+.[0-9x]+" env: GH_TOKEN: ${{ secrets.MERGE_UP_TOKEN }} @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout id: checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: # fetch-depth 0 is required to fetch all branches, not just the branch being built fetch-depth: 0 @@ -24,9 +24,10 @@ jobs: - name: Create pull request id: create-pull-request - uses: alcaeus/automatic-merge-up-action@main + uses: alcaeus/automatic-merge-up-action@1.0.1 with: ref: ${{ github.ref_name }} branchNamePattern: 'v.' devBranchNamePattern: 'v.x' + ignoredBranches: ${{ vars.IGNORED_MERGE_UP_BRANCHES }} enableAutoMerge: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7d22c6c6c..37bb2ed3f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,7 +49,7 @@ jobs: run: echo '🎬 Release process for version ${{ inputs.version }} started by @${{ github.triggering_actor }}' >> $GITHUB_STEP_SUMMARY - name: "Generate token and checkout repository" - uses: mongodb-labs/drivers-github-tools/secure-checkout@v2 + uses: mongodb-labs/drivers-github-tools/secure-checkout@v3 with: app_id: ${{ vars.APP_ID }} private_key: ${{ secrets.APP_PRIVATE_KEY }} @@ -57,7 +57,9 @@ jobs: - name: "Store version numbers in env variables" run: | echo RELEASE_VERSION=${{ inputs.version }} >> $GITHUB_ENV + echo RELEASE_VERSION_WITHOUT_STABILITY=$(echo ${{ inputs.version }} | awk -F- '{print $1}') >> $GITHUB_ENV echo RELEASE_BRANCH=v$(echo ${{ inputs.version }} | cut -d '.' -f-2) >> $GITHUB_ENV + echo DEV_BRANCH=v$(echo ${{ inputs.version }} | cut -d '.' -f-1).x >> $GITHUB_ENV - name: "Ensure release tag does not already exist" run: | @@ -66,18 +68,37 @@ jobs: exit 1 fi - - name: "Fail if branch names don't match" - if: ${{ github.ref_name != env.RELEASE_BRANCH }} + # For patch releases (A.B.C where C != 0), we expect the release to be + # triggered from the A.B maintenance branch + - name: "Fail if patch release is created from wrong release branch" + if: ${{ !endsWith(env.RELEASE_VERSION_WITHOUT_STABILITY, '.0') && env.RELEASE_BRANCH != github.ref_name }} run: | echo '❌ Release failed due to branch mismatch: expected ${{ inputs.version }} to be released from ${{ env.RELEASE_BRANCH }}, got ${{ github.ref_name }}' >> $GITHUB_STEP_SUMMARY exit 1 + # For non-patch releases (A.B.C where C == 0), we expect the release to + # be triggered from the A.B maintenance branch or A.x development branch + - name: "Fail if non-patch release is created from wrong release branch" + if: ${{ endsWith(env.RELEASE_VERSION_WITHOUT_STABILITY, '.0') && env.RELEASE_BRANCH != github.ref_name && env.DEV_BRANCH != github.ref_name }} + run: | + echo '❌ Release failed due to branch mismatch: expected ${{ inputs.version }} to be released from ${{ env.RELEASE_BRANCH }} or ${{ env.DEV_BRANCH }}, got ${{ github.ref_name }}' >> $GITHUB_STEP_SUMMARY + exit 1 + + # If a non-patch release is created from its A.x development branch, + # create the A.B maintenance branch from the current one and push it + - name: "Create and push new release branch for non-patch release" + if: ${{ endsWith(env.RELEASE_VERSION_WITHOUT_STABILITY, '.0') && env.DEV_BRANCH == github.ref_name }} + run: | + echo '🆕 Creating new release branch ${{ env.RELEASE_BRANCH }} from ${{ github.ref_name }}' >> $GITHUB_STEP_SUMMARY + git checkout -b ${RELEASE_BRANCH} + git push origin ${RELEASE_BRANCH} + # # Preliminary checks done - commence the release process # - name: "Set up drivers-github-tools" - uses: mongodb-labs/drivers-github-tools/setup@v2 + uses: mongodb-labs/drivers-github-tools/setup@v3 with: aws_role_arn: ${{ secrets.AWS_ROLE_ARN }} aws_region_name: ${{ vars.AWS_REGION_NAME }} @@ -90,10 +111,10 @@ jobs: EOL - name: "Create draft release" - run: echo "RELEASE_URL=$(gh release create ${{ inputs.version }} --target ${{ github.ref_name }} --title "${{ inputs.version }}" --notes-file release-message --draft)" >> "$GITHUB_ENV" + run: echo "RELEASE_URL=$(gh release create ${{ inputs.version }} --target ${{ env.RELEASE_BRANCH }} --title "${{ inputs.version }}" --notes-file release-message --draft)" >> "$GITHUB_ENV" - name: "Create release tag" - uses: mongodb-labs/drivers-github-tools/tag-version@v2 + uses: mongodb-labs/drivers-github-tools/tag-version@v3 with: version: ${{ inputs.version }} tag_message_template: 'Release ${VERSION}' @@ -132,7 +153,7 @@ jobs: steps: - name: "Generate token and checkout repository" - uses: mongodb-labs/drivers-github-tools/secure-checkout@v2 + uses: mongodb-labs/drivers-github-tools/secure-checkout@v3 with: app_id: ${{ vars.APP_ID }} private_key: ${{ secrets.APP_PRIVATE_KEY }} @@ -140,14 +161,14 @@ jobs: # Sets the S3_ASSETS environment variable used later - name: "Set up drivers-github-tools" - uses: mongodb-labs/drivers-github-tools/setup@v2 + uses: mongodb-labs/drivers-github-tools/setup@v3 with: aws_role_arn: ${{ secrets.AWS_ROLE_ARN }} aws_region_name: ${{ vars.AWS_REGION_NAME }} aws_secret_id: ${{ secrets.AWS_SECRET_ID }} - name: "Generate SSDLC Reports" - uses: mongodb-labs/drivers-github-tools/full-report@v2 + uses: mongodb-labs/drivers-github-tools/full-report@v3 with: product_name: "MongoDB PHP Driver (library)" release_version: ${{ inputs.version }} @@ -158,7 +179,7 @@ jobs: continue-on-error: true - name: Upload S3 assets - uses: mongodb-labs/drivers-github-tools/upload-s3-assets@v2 + uses: mongodb-labs/drivers-github-tools/upload-s3-assets@v3 with: version: ${{ inputs.version }} product_name: mongo-php-library diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 7a634683b..440d1d6c4 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -5,12 +5,10 @@ on: pull_request: branches: - "v*.*" - - "master" - "feature/*" push: branches: - "v*.*" - - "master" - "feature/*" workflow_call: inputs: @@ -21,16 +19,18 @@ on: env: PHP_VERSION: "8.2" - DRIVER_VERSION: "stable" + # TODO: change to "stable" once 2.0.0 is released + # DRIVER_VERSION: "stable" + DRIVER_VERSION: "mongodb/mongo-php-driver@v2.x" jobs: psalm: name: "Psalm" - runs-on: "ubuntu-22.04" + runs-on: "ubuntu-24.04" steps: - name: "Checkout" - uses: "actions/checkout@v4" + uses: "actions/checkout@v5" with: ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref }} @@ -50,13 +50,13 @@ jobs: - name: "Upload SARIF report" if: ${{ github.event_name != 'workflow_dispatch' }} - uses: "github/codeql-action/upload-sarif@v3" + uses: "github/codeql-action/upload-sarif@v4" with: sarif_file: psalm.sarif - name: "Upload SARIF report" if: ${{ github.event_name == 'workflow_dispatch' }} - uses: "github/codeql-action/upload-sarif@v3" + uses: "github/codeql-action/upload-sarif@v4" with: sarif_file: psalm.sarif ref: ${{ inputs.ref }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2ac3b72e4..9b6ac37d9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,16 +5,16 @@ on: pull_request: branches: - "v*.*" - - "master" - "feature/*" push: branches: - "v*.*" - - "master" - "feature/*" env: - DRIVER_VERSION: "stable" + # TODO: change to "stable" once 2.0.0 is released + # DRIVER_VERSION: "stable" + DRIVER_VERSION: "mongodb/mongo-php-driver@v2.x" jobs: phpunit: @@ -25,61 +25,85 @@ jobs: fail-fast: true matrix: os: - - "ubuntu-20.04" + - "ubuntu-24.04" php-version: - - "7.4" - - "8.0" - "8.1" - "8.2" - "8.3" - "8.4" + - "8.5" mongodb-version: - - "4.4" + - "8.0" topology: - - "server" + - "replica_set" include: - - os: "ubuntu-20.04" - php-version: "8.0" - mongodb-version: "6.0" - topology: "replica_set" - - os: "ubuntu-20.04" - php-version: "8.0" - mongodb-version: "6.0" + # Test additional topologies for MongoDB 8.0 + - os: "ubuntu-24.04" + php-version: "8.4" + mongodb-version: "8.0" + topology: "server" + - os: "ubuntu-24.04" + php-version: "8.4" + mongodb-version: "8.0" topology: "sharded_cluster" - - os: "ubuntu-20.04" - php-version: "8.0" - mongodb-version: "5.0" + # Test lowest server/php versions + - os: "ubuntu-22.04" + php-version: "8.1" + mongodb-version: "6.0" topology: "server" - - os: "ubuntu-20.04" - php-version: "8.0" - mongodb-version: "4.4" + - os: "ubuntu-22.04" + php-version: "8.1" + mongodb-version: "6.0" topology: "replica_set" - - os: "ubuntu-20.04" - php-version: "8.0" - mongodb-version: "4.4" + - os: "ubuntu-22.04" + php-version: "8.1" + mongodb-version: "6.0" topology: "sharded_cluster" steps: - name: "Checkout" - uses: "actions/checkout@v4" + uses: "actions/checkout@v5" with: fetch-depth: 2 + submodules: true + + - uses: actions/setup-python@v6 + with: + python-version: '3.13' - - id: setup-mongodb - uses: mongodb-labs/drivers-evergreen-tools@master + - name: "Set up MongoDB" + id: setup-mongodb + uses: ./tests/drivers-evergreen-tools with: version: ${{ matrix.mongodb-version }} topology: ${{ matrix.topology }} - - name: "Setup" + - name: "Setup PHP" uses: "./.github/actions/setup" with: php-version: ${{ matrix.php-version }} driver-version: ${{ env.DRIVER_VERSION }} php-ini-values: "zend.assertions=1" + ignore-platform-req: ${{ matrix.php-version == '8.5' && 'true' || 'false' }} - name: "Run PHPUnit" - run: "vendor/bin/simple-phpunit -v" + run: "vendor/bin/phpunit --configuration phpunit.evergreen.xml --coverage-clover coverage.xml" env: - SYMFONY_DEPRECATIONS_HELPER: 999999 + XDEBUG_MODE: "coverage" MONGODB_URI: ${{ steps.setup-mongodb.outputs.cluster-uri }} + + - name: "Upload coverage report" + uses: codecov/codecov-action@v5 + with: + disable_search: true + files: coverage.xml + flags: "${{ matrix.mongodb-version }}-${{ matrix.topology }}" + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Upload test results to Codecov + uses: codecov/test-results-action@v1 + with: + disable_search: true + files: test-results.xml + flags: "${{ matrix.mongodb-version }}-${{ matrix.topology }}" + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..9aaaaeb89 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "drivers-evergreen-tools"] + path = tests/drivers-evergreen-tools + url = https://github.com/mongodb-labs/drivers-evergreen-tools +[submodule "specifications"] + path = tests/specifications + url = https://github.com/mongodb/specifications diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 9cdc381ea..000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,7 +0,0 @@ -# CHANGELOG - - -## 1.18.0 (unreleased) - - * Add `addSubscriber` and `removeSubscriber` methods to the `Client` class to ease dependency injection configuration - * Fix GridFS stream closing when the PHP script ends diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ee5ee3a3e..1aa330118 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,6 +14,7 @@ $ composer update In addition to installing project dependencies, Composer will check that the required extension version is installed. Directions for installing the extension may be found [here](https://php.net/manual/en/mongodb.installation.php). +Composer will also install the submodule required for running spec tests. Installation directions for Composer may be found in its [Getting Started](https://getcomposer.org/doc/00-intro.md) guide. @@ -34,8 +35,7 @@ The `phpunit.xml.dist` file is used as the default configuration file for the test suite. In addition to various PHPUnit options, it defines environment variables such as `MONGODB_URI` and `MONGODB_DATABASE`. You may customize this configuration by creating your own `phpunit.xml` file based on the -`phpunit.xml.dist` file we provide. To run the tests in serverless mode, set the -`MONGODB_IS_SERVERLESS` environment variable to `on`. +`phpunit.xml.dist` file we provide. To run tests against a cluster that requires authentication, either include the credentials in the connection string (i.e. `MONGODB_URI`) or set the @@ -43,14 +43,6 @@ credentials in the connection string (i.e. `MONGODB_URI`) or set the Note that `MONGODB_USERNAME` and `MONGODB_PASSWORD` will override any credentials present in the connection string. -By default, the `simple-phpunit` binary chooses the correct PHPUnit version for -the PHP version you are running. To run tests against a specific PHPUnit -version, use the `SYMFONY_PHPUNIT_VERSION` environment variable: - -```console -$ SYMFONY_PHPUNIT_VERSION=8.5 vendor/bin/simple-phpunit -``` - ### Environment Variables The test suite references the following environment variables: @@ -66,27 +58,21 @@ The test suite references the following environment variables: `username` URI option for clients constructed by the test suite, which will override any credentials in the connection string itself. -The following environment variable is used for [stable API testing](https://github.com/mongodb/specifications/blob/master/source/versioned-api/tests/README.rst): +The following environment variable is used for [stable API testing](https://github.com/mongodb/specifications/blob/master/source/versioned-api/tests/README.md): * `API_VERSION`: If defined, this value will be used to construct a [`MongoDB\Driver\ServerApi`](https://www.php.net/manual/en/mongodb-driver-serverapi.construct.php), which will then be specified as the `serverApi` driver option for clients created by the test suite. -The following environment variable is used for [serverless testing](https://github.com/mongodb/specifications/blob/master/source/serverless-testing/README.rst): - - * `MONGODB_IS_SERVERLESS`: Specify a true boolean string - (see: [`FILTER_VALIDATE_BOOLEAN`](https://www.php.net/manual/en/filter.filters.validate.php)) - if `MONGODB_URI` points to a serverless instance. Defaults to false. - -The following environment variables are used for [load balancer testing](https://github.com/mongodb/specifications/blob/master/source/load-balancers/tests/README.rst): +The following environment variables are used for [load balancer testing](https://github.com/mongodb/specifications/blob/master/source/load-balancers/tests/README.md): * `MONGODB_SINGLE_MONGOS_LB_URI`: Connection string to a load balancer backed by a single mongos host. * `MONGODB_MULTI_MONGOS_LB_URI`: Connection string to a load balancer backed by multiple mongos hosts. -The following environment variables are used for [CSFLE testing](https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst): +The following environment variables are used for [CSFLE testing](https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md): * `AWS_ACCESS_KEY_ID` * `AWS_SECRET_ACCESS_KEY` @@ -108,6 +94,44 @@ The following environment variables are used for [CSFLE testing](https://github. * `KMS_TLS_CA_FILE` * `KMS_TLS_CERTIFICATE_KEY_FILE` +### Updating spec tests + +Tests from the MongoDB Specifications repository are included through a +submodule and updated automatically through Dependabot. To update tests +manually, switch to the `tests/specifications` directory and update the +repository to the appropriate commit. Remember to commit this change to the +library repository. + +#### Handling test failures on updates + +Failures on updates can occur for multiple reasons, and the remedy to this will +depend on the type of failure. Note that only tests for implemented +specifications are run in the test runner. + + * If a specification is not fully implemented (e.g. a recent change to the spec + has not been applied yet), skip the test in question with a reference to the + ticket that covers the change + * If a test fails because it uses features not yet implemented in the unified + test runner, skip the corresponding test with a reference to the ticket that + covers implementing the new features + * If the test failure points to a bug in the spec, consider the effort required + to fix the failure. If it's a small change, commit and push the fix directly + to the pull request. Otherwise, skip the test with a reference to a ticket to + fix the failing test. + +The goal is that the library passes tests with the latest spec version at all +times, either by implementing small changes quickly, or by skipping tests as +necessary. + +## Backward compatibility + +When submitting a PR, be mindful of our backward compatibility guarantees. Our +BC policy follows [Symfony's Backward Compatibility Promise](https://symfony.com/doc/current/contributing/code/bc.html). + +In short, this means we use semantic versioning and guarantee backward +compatibility on all minor releases. For a more detailed definition, refer to +the Symfony docs linked above. + ## Code quality Before submitting a pull request, please ensure that your code adheres to the diff --git a/README.md b/README.md index 59d532195..643e539e2 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # MongoDB PHP Library -![Tests](https://github.com/mongodb/mongo-php-library/workflows/Tests/badge.svg) -![Coding Standards](https://github.com/mongodb/mongo-php-library/workflows/Coding%20Standards/badge.svg) +![Tests](https://github.com/mongodb/mongo-php-library/actions/workflows/tests.yml/badge.svg) +![Coding Standards](https://github.com/mongodb/mongo-php-library/actions/workflows/coding-standards.yml/badge.svg) This library provides a high-level abstraction around the lower-level [PHP driver](https://github.com/mongodb/mongo-php-driver) (`mongodb` extension). @@ -22,7 +22,7 @@ extension may be found in ## Documentation - https://www.mongodb.com/docs/php-library/current/ - - https://www.mongodb.com/docs/drivers/php/ + - https://www.mongodb.com/docs/drivers/php-drivers/ ## Installation diff --git a/RELEASING.md b/RELEASING.md index 2b0e35bb0..19506007a 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -192,7 +192,7 @@ New major and minor releases will also require documentation updates to other projects: * Create a DOCSP ticket to add the new version to PHP's server and language - [compatibility tables](https://mongodb.com/docs/drivers/php/#compatibility) + [compatibility tables](https://www.mongodb.com/docs/drivers/php-drivers/#compatibility) in the driver docs portal. See [mongodb/docs-ecosystem#642](https://github.com/mongodb/docs-ecosystem/pull/642) for an example. diff --git a/UPGRADE-2.0.md b/UPGRADE-2.0.md new file mode 100644 index 000000000..516b57929 --- /dev/null +++ b/UPGRADE-2.0.md @@ -0,0 +1,83 @@ +UPGRADE FROM 1.x to 2.0 +======================== + + * Classes in the namespace `MongoDB\Operation\` are `final`. + * All methods in interfaces and classes now define a return type. + * The `MongoDB\ChangeStream::CURSOR_NOT_FOUND` constant is now private. + * The `MongoDB\Operation\Watch::FULL_DOCUMENT_DEFAULT` constant has been + removed. + * The `getNamespace` and `isGeoHaystack` methods have been removed from the + `MongoDB\Model\IndexInfo` class. + * The `maxScan`, `modifiers`, `oplogReplay`, and `snapshot` options for `find` + and `findOne` operations have been removed. + * The `MongoDB\Collection::mapReduce` method has been removed. Use + [aggregation pipeline](https://www.mongodb.com/docs/manual/reference/map-reduce-to-aggregation-pipeline/) + instead. + * The following classes and interfaces have been removed without replacement: + * `MongoDB\MapReduceResult` + * `MongoDB\Model\CollectionInfoCommandIterator` + * `MongoDB\Model\CollectionInfoIterator` + * `MongoDB\Model\DatabaseInfoIterator` + * `MongoDB\Model\DatabaseInfoLegacyIterator` + * `MongoDB\Model\IndexInfoIterator` + * `MongoDB\Model\IndexInfoIteratorIterator` + * `MongoDB\Operation\Executable` + * The `flags` and `autoIndexId` options for + `MongoDB\Database::createCollection()` have been removed. Additionally, the + `USE_POWER_OF_2_SIZES` and `NO_PADDING` constants in + `MongoDB\Operation\CreateCollection` have been removed. + +Operations with no result +------------------------- + +The following operations no longer return the raw command result. The return +type changed to `void`. In case of an error, an exception is thrown. + + * `MongoDB\Client`: `dropDatabase` + * `MongoDB\Collection`: `drop`, `dropIndex`, `dropIndexes`, `dropSearchIndex`, `rename` + * `MongoDB\Database`: `createCollection`, `drop`, `dropCollection`, `renameCollection` + * `MongoDB\Database::createEncryptedCollection()` returns the list of encrypted fields + +If you still need to access the raw command result, you can use a +[`CommandSubscriber`](https://www.php.net/manual/en/class.mongodb-driver-monitoring-commandsubscriber.php). + +GridFS +------ + + * The `md5` is no longer calculated when a file is uploaded to GridFS. + Applications that require a file digest should implement it outside GridFS + and store in metadata. + + ```php + $hash = hash_file('sha256', $filename); + $bucket->openUploadStream($fileId, ['metadata' => ['hash' => $hash]]); + ``` + + * The fields `contentType` and `aliases` are no longer stored in the `files` + collection. Applications that require this information should store it in + metadata. + + **Before:** + ```php + $bucket->openUploadStream($fileId, ['contentType' => 'image/png']); + ``` + + **After:** + ```php + $bucket->openUploadStream($fileId, ['metadata' => ['contentType' => 'image/png']]); + ``` + +UnsupportedException method removals +------------------------------------ + +The following methods have been removed from the +`MongoDB\Exception\UnsupportedException` class: + * `allowDiskUseNotSupported` + * `arrayFiltersNotSupported` + * `collationNotSupported` + * `explainNotSupported` + * `readConcernNotSupported` + * `writeConcernNotSupported` + +The remaining methods have been marked as internal and may be removed in a +future minor version. Only the class itself is covered by the BC promise. diff --git a/benchmark/src/DriverBench/MultiDocBench.php b/benchmark/src/DriverBench/MultiDocBench.php index 22c6edba6..b569f9ca5 100644 --- a/benchmark/src/DriverBench/MultiDocBench.php +++ b/benchmark/src/DriverBench/MultiDocBench.php @@ -20,7 +20,7 @@ final class MultiDocBench { /** - * @see https://github.com/mongodb/specifications/blob/master/source/benchmarking/benchmarking.rst#find-many-and-empty-the-cursor + * @see https://github.com/mongodb/specifications/blob/master/source/benchmarking/benchmarking.md#find-many-and-empty-the-cursor * @param array{options: array} $params */ #[BeforeMethods('beforeFindMany')] diff --git a/benchmark/src/Extension/EnvironmentProvider.php b/benchmark/src/Extension/EnvironmentProvider.php index a587fead3..c313fab4d 100644 --- a/benchmark/src/Extension/EnvironmentProvider.php +++ b/benchmark/src/Extension/EnvironmentProvider.php @@ -62,7 +62,7 @@ private function getBuildInfo(Manager $manager): array $buildInfo = $manager->executeCommand( Utils::getDatabaseName(), new Command(['buildInfo' => 1]), - new ReadPreference(ReadPreference::PRIMARY), + ['readPreference' => new ReadPreference(ReadPreference::PRIMARY)], )->toArray()[0]; return [ diff --git a/benchmark/src/Fixtures/PassThruCodec.php b/benchmark/src/Fixtures/PassThruCodec.php index 7a8846cc6..fe4c725b0 100644 --- a/benchmark/src/Fixtures/PassThruCodec.php +++ b/benchmark/src/Fixtures/PassThruCodec.php @@ -13,20 +13,17 @@ final class PassThruCodec implements DocumentCodec use DecodeIfSupported; use EncodeIfSupported; - /** @param mixed $value */ - public function canDecode($value): bool + public function canDecode(mixed $value): bool { return $value instanceof Document; } - /** @param mixed $value */ - public function canEncode($value): bool + public function canEncode(mixed $value): bool { return $value instanceof Document; } - /** @param mixed $value */ - public function decode($value): Document + public function decode(mixed $value): Document { if (! $value instanceof Document) { throw UnsupportedValueException::invalidDecodableValue($value); @@ -35,8 +32,7 @@ public function decode($value): Document return $value; } - /** @param mixed $value */ - public function encode($value): Document + public function encode(mixed $value): Document { if (! $value instanceof Document) { throw UnsupportedValueException::invalidEncodableValue($value); diff --git a/benchmark/src/Fixtures/ToObjectCodec.php b/benchmark/src/Fixtures/ToObjectCodec.php index c212302ab..a193d58a4 100644 --- a/benchmark/src/Fixtures/ToObjectCodec.php +++ b/benchmark/src/Fixtures/ToObjectCodec.php @@ -15,20 +15,17 @@ final class ToObjectCodec implements DocumentCodec use DecodeIfSupported; use EncodeIfSupported; - /** @param mixed $value */ - public function canDecode($value): bool + public function canDecode(mixed $value): bool { return $value instanceof Document; } - /** @param mixed $value */ - public function canEncode($value): bool + public function canEncode(mixed $value): bool { return is_object($value); } - /** @param mixed $value */ - public function decode($value): object + public function decode(mixed $value): object { if (! $value instanceof Document) { throw UnsupportedValueException::invalidDecodableValue($value); @@ -37,8 +34,7 @@ public function decode($value): object return $value->toPHP(['root' => 'stdClass', 'array' => 'array', 'document' => 'stdClass']); } - /** @param mixed $value */ - public function encode($value): Document + public function encode(mixed $value): Document { if (! is_object($value)) { throw UnsupportedValueException::invalidEncodableValue($value); diff --git a/benchmark/src/ReadLargeDocumentBench.php b/benchmark/src/ReadLargeDocumentBench.php index de7d3ad02..bdf5b021d 100644 --- a/benchmark/src/ReadLargeDocumentBench.php +++ b/benchmark/src/ReadLargeDocumentBench.php @@ -129,8 +129,7 @@ public function benchAccessLastField(array $params): void } } - /** @param array|object $document */ - private function accessId($document, string $accessor): void + private function accessId(array|object $document, string $accessor): void { switch ($accessor) { case 'array': @@ -153,8 +152,7 @@ private function accessId($document, string $accessor): void } } - /** @param array|object $document */ - private function accessLastField($document, string $accessor): void + private function accessLastField(array|object $document, string $accessor): void { switch ($accessor) { case 'array': @@ -178,8 +176,7 @@ private function accessLastField($document, string $accessor): void } } - /** @param array|object $document */ - private function accessFirstField($document, string $accessor): void + private function accessFirstField(array|object $document, string $accessor): void { switch ($accessor) { case 'array': diff --git a/benchmark/src/ReadMultipleDocumentsBench.php b/benchmark/src/ReadMultipleDocumentsBench.php index 64c6ef7e3..74dbafe13 100644 --- a/benchmark/src/ReadMultipleDocumentsBench.php +++ b/benchmark/src/ReadMultipleDocumentsBench.php @@ -116,8 +116,7 @@ public function benchAccessNestedItem(array $params): void } } - /** @param array|object $document */ - private function accessId($document, string $accessor): void + private function accessId(array|object $document, string $accessor): void { switch ($accessor) { case 'array': @@ -140,8 +139,7 @@ private function accessId($document, string $accessor): void } } - /** @param array|object $document */ - private function accessNestedItem($document, string $accessor): void + private function accessNestedItem(array|object $document, string $accessor): void { switch ($accessor) { case 'array': diff --git a/composer.json b/composer.json index fceee1108..285255e48 100644 --- a/composer.json +++ b/composer.json @@ -10,21 +10,21 @@ { "name": "Jérôme Tamarelle", "email": "jerome.tamarelle@mongodb.com" } ], "require": { - "php": "^7.4 || ^8.0", - "ext-hash": "*", - "ext-json": "*", - "ext-mongodb": "^1.20.0", + "php": "^8.1", + "ext-mongodb": "^2.1", "composer-runtime-api": "^2.0", "psr/log": "^1.1.4|^2|^3", - "symfony/polyfill-php80": "^1.27", - "symfony/polyfill-php81": "^1.27" + "symfony/polyfill-php85": "^1.32" }, "require-dev": { "doctrine/coding-standard": "^12.0", - "rector/rector": "^1.1", + "phpunit/phpunit": "^10.5.35", + "rector/rector": "^2.1.4", "squizlabs/php_codesniffer": "^3.7", - "symfony/phpunit-bridge": "^5.2", - "vimeo/psalm": "^5.13" + "vimeo/psalm": "6.5.*" + }, + "replace": { + "mongodb/builder": "*" }, "autoload": { "psr-4": { "MongoDB\\": "src/" }, @@ -33,10 +33,11 @@ "autoload-dev": { "psr-4": { "MongoDB\\Tests\\": "tests/" - }, - "files": [ "tests/PHPUnit/Functions.php" ] + } }, "scripts": { + "pre-install-cmd": "git submodule update --init", + "pre-update-cmd": "git submodule update --init", "bench": "cd benchmark && composer update && vendor/bin/phpbench run --report=aggregate", "checks": [ "@check:cs", @@ -49,7 +50,7 @@ "fix:cs": "phpcbf", "fix:psalm:baseline": "psalm --set-baseline=psalm-baseline.xml", "fix:rector": "rector process --ansi", - "test": "simple-phpunit" + "test": "phpunit" }, "extra": { "branch-alias": { diff --git a/examples/atlas_search.php b/examples/atlas_search.php index c08cf7dab..eca894d4a 100644 --- a/examples/atlas_search.php +++ b/examples/atlas_search.php @@ -2,7 +2,7 @@ /** * This example demonstrates how to create an Atlas Search index and perform a search query. - * It requires a MongoDB Atlas M10+ cluster with Sample Dataset loaded. + * It requires a MongoDB Atlas cluster with Sample Dataset loaded. * * Use the MONGODB_URI environment variable to specify the connection string from the Atlas UI. */ diff --git a/examples/command_logger.php b/examples/command_logger.php index 7fd932dac..41ead8496 100644 --- a/examples/command_logger.php +++ b/examples/command_logger.php @@ -3,6 +3,8 @@ namespace MongoDB\Examples\CommandLogger; +use Closure; +use Exception; use MongoDB\BSON\Document; use MongoDB\Client; use MongoDB\Driver\Monitoring\CommandFailedEvent; @@ -11,7 +13,6 @@ use MongoDB\Driver\Monitoring\CommandSucceededEvent; use function assert; -use function get_class; use function getenv; use function is_object; use function printf; @@ -25,37 +26,56 @@ function toJSON(object $document): string class CommandLogger implements CommandSubscriber { - public function commandStarted(CommandStartedEvent $event): void + /** @param Closure(object):void $handleOutput */ + public function __construct(private readonly Closure $handleOutput) { - printf("%s command started\n", $event->getCommandName()); + } - printf("command: %s\n", toJson($event->getCommand())); - echo "\n"; + public function commandStarted(CommandStartedEvent $event): void + { + $this->handleOutput->__invoke($event); } public function commandSucceeded(CommandSucceededEvent $event): void { - printf("%s command succeeded\n", $event->getCommandName()); - printf("reply: %s\n", toJson($event->getReply())); - echo "\n"; + $this->handleOutput->__invoke($event); } public function commandFailed(CommandFailedEvent $event): void { - printf("%s command failed\n", $event->getCommandName()); - printf("reply: %s\n", toJson($event->getReply())); - - $exception = $event->getError(); - printf("exception: %s\n", get_class($exception)); - printf("exception.code: %d\n", $exception->getCode()); - printf("exception.message: %s\n", $exception->getMessage()); - echo "\n"; + $this->handleOutput->__invoke($event); } } $client = new Client(getenv('MONGODB_URI') ?: 'mongodb://127.0.0.1/'); -$client->addSubscriber(new CommandLogger()); +$handleOutput = function (object $event): void { + switch ($event::class) { + case CommandStartedEvent::class: + printf("%s command started\n", $event->getCommandName()); + printf("command: %s\n", toJson($event->getCommand())); + break; + case CommandSucceededEvent::class: + printf("%s command succeeded\n", $event->getCommandName()); + printf("reply: %s\n", toJson($event->getReply())); + break; + case CommandFailedEvent::class: + printf("%s command failed\n", $event->getCommandName()); + printf("reply: %s\n", toJson($event->getReply())); + + $exception = $event->getError(); + printf("exception: %s\n", $exception::class); + printf("exception.code: %d\n", $exception->getCode()); + printf("exception.message: %s\n", $exception->getMessage()); + break; + default: + throw new Exception('Event type not supported'); + } + + echo "\n"; +}; + +$client->addSubscriber(new CommandLogger($handleOutput)); $collection = $client->test->command_logger; $collection->drop(); diff --git a/examples/persistable.php b/examples/persistable.php index c7aa5617d..2a4c3614e 100644 --- a/examples/persistable.php +++ b/examples/persistable.php @@ -19,15 +19,12 @@ class PersistableEntry implements Persistable { private ObjectId $id; - public string $name; - /** @var array */ public array $emails = []; - public function __construct(string $name) + public function __construct(public string $name) { $this->id = new ObjectId(); - $this->name = $name; } public function getId(): ObjectId @@ -64,14 +61,8 @@ public function bsonUnserialize(array $data): void class PersistableEmail implements Persistable { - public string $type; - - public string $address; - - public function __construct(string $type, string $address) + public function __construct(public string $type, public string $address) { - $this->type = $type; - $this->address = $address; } public function bsonSerialize(): stdClass diff --git a/examples/sdam_logger.php b/examples/sdam_logger.php index 974e11dfb..fe4d02ea6 100644 --- a/examples/sdam_logger.php +++ b/examples/sdam_logger.php @@ -3,6 +3,8 @@ namespace MongoDB\Examples; +use Closure; +use Exception; use MongoDB\BSON\Document; use MongoDB\Client; use MongoDB\Driver\Monitoring\SDAMSubscriber; @@ -16,116 +18,66 @@ use MongoDB\Driver\Monitoring\TopologyClosedEvent; use MongoDB\Driver\Monitoring\TopologyOpeningEvent; -use function get_class; use function getenv; use function printf; require __DIR__ . '/../vendor/autoload.php'; -/** @param array|object $document */ -function toJSON($document): string +function toJSON(array|object $document): string { return Document::fromPHP($document)->toRelaxedExtendedJSON(); } class SDAMLogger implements SDAMSubscriber { + /** @param Closure(object):void $handleOutput */ + public function __construct(private readonly Closure $handleOutput) + { + } + public function serverChanged(ServerChangedEvent $event): void { - printf( - "serverChanged: %s:%d changed from %s to %s\n", - $event->getHost(), - $event->getPort(), - $event->getPreviousDescription()->getType(), - $event->getNewDescription()->getType(), - ); - - printf("previous hello response: %s\n", toJson($event->getPreviousDescription()->getHelloResponse())); - printf("new hello response: %s\n", toJson($event->getNewDescription()->getHelloResponse())); - echo "\n"; + $this->handleOutput->__invoke($event); } public function serverClosed(ServerClosedEvent $event): void { - printf( - "serverClosed: %s:%d was removed from topology %s\n", - $event->getHost(), - $event->getPort(), - (string) $event->getTopologyId(), - ); - echo "\n"; + $this->handleOutput->__invoke($event); } public function serverHeartbeatFailed(ServerHeartbeatFailedEvent $event): void { - printf( - "serverHeartbeatFailed: %s:%d heartbeat failed after %dµs\n", - $event->getHost(), - $event->getPort(), - $event->getDurationMicros(), - ); - - $error = $event->getError(); - - printf("error: %s(%d): %s\n", get_class($error), $error->getCode(), $error->getMessage()); - echo "\n"; + $this->handleOutput->__invoke($event); } public function serverHeartbeatStarted(ServerHeartbeatStartedEvent $event): void { - printf( - "serverHeartbeatStarted: %s:%d heartbeat started\n", - $event->getHost(), - $event->getPort(), - ); - echo "\n"; + $this->handleOutput->__invoke($event); } public function serverHeartbeatSucceeded(ServerHeartbeatSucceededEvent $event): void { - printf( - "serverHeartbeatSucceeded: %s:%d heartbeat succeeded after %dµs\n", - $event->getHost(), - $event->getPort(), - $event->getDurationMicros(), - ); - - printf("reply: %s\n", toJson($event->getReply())); - echo "\n"; + $this->handleOutput->__invoke($event); } public function serverOpening(ServerOpeningEvent $event): void { - printf( - "serverOpening: %s:%d was added to topology %s\n", - $event->getHost(), - $event->getPort(), - (string) $event->getTopologyId(), - ); - echo "\n"; + $this->handleOutput->__invoke($event); } public function topologyChanged(TopologyChangedEvent $event): void { - printf( - "topologyChanged: %s changed from %s to %s\n", - (string) $event->getTopologyId(), - $event->getPreviousDescription()->getType(), - $event->getNewDescription()->getType(), - ); - echo "\n"; + $this->handleOutput->__invoke($event); } public function topologyClosed(TopologyClosedEvent $event): void { - printf("topologyClosed: %s was closed\n", (string) $event->getTopologyId()); - echo "\n"; + $this->handleOutput->__invoke($event); } public function topologyOpening(TopologyOpeningEvent $event): void { - printf("topologyOpening: %s was opened\n", (string) $event->getTopologyId()); - echo "\n"; + $this->handleOutput->__invoke($event); } } @@ -134,7 +86,87 @@ public function topologyOpening(TopologyOpeningEvent $event): void * (including subscribers) are freed. */ $client = new Client(getenv('MONGODB_URI') ?: 'mongodb://127.0.0.1/', [], ['disableClientPersistence' => true]); -$client->getManager()->addSubscriber(new SDAMLogger()); +$handleOutput = function (object $event): void { + switch ($event::class) { + case ServerChangedEvent::class: + printf( + "serverChanged: %s:%d changed from %s to %s\n", + $event->getHost(), + $event->getPort(), + $event->getPreviousDescription()->getType(), + $event->getNewDescription()->getType(), + ); + + printf("previous hello response: %s\n", toJson($event->getPreviousDescription()->getHelloResponse())); + printf("new hello response: %s\n", toJson($event->getNewDescription()->getHelloResponse())); + break; + case ServerClosedEvent::class: + printf( + "serverClosed: %s:%d was removed from topology %s\n", + $event->getHost(), + $event->getPort(), + $event->getTopologyId()->__toString(), + ); + break; + case ServerHeartbeatFailedEvent::class: + printf( + "serverHeartbeatFailed: %s:%d heartbeat failed after %dµs\n", + $event->getHost(), + $event->getPort(), + $event->getDurationMicros(), + ); + + $error = $event->getError(); + + printf("error: %s(%d): %s\n", $error::class, $error->getCode(), $error->getMessage()); + break; + case ServerHeartbeatStartedEvent::class: + printf( + "serverHeartbeatStarted: %s:%d heartbeat started\n", + $event->getHost(), + $event->getPort(), + ); + break; + case ServerHeartbeatSucceededEvent::class: + printf( + "serverHeartbeatSucceeded: %s:%d heartbeat succeeded after %dµs\n", + $event->getHost(), + $event->getPort(), + $event->getDurationMicros(), + ); + + printf("reply: %s\n", toJson($event->getReply())); + break; + case ServerOpeningEvent::class: + printf( + "serverOpening: %s:%d was added to topology %s\n", + $event->getHost(), + $event->getPort(), + $event->getTopologyId()->__toString(), + ); + break; + case TopologyChangedEvent::class: + printf( + "topologyChanged: %s changed from %s to %s\n", + $event->getTopologyId()->__toString(), + $event->getPreviousDescription()->getType(), + $event->getNewDescription()->getType(), + ); + break; + case TopologyClosedEvent::class: + printf("topologyClosed: %s was closed\n", $event->getTopologyId()->__toString()); + break; + case TopologyOpeningEvent::class: + printf("topologyOpening: %s was opened\n", $event->getTopologyId()->__toString()); + break; + default: + throw new Exception('Event type not supported'); + } + + echo "\n"; +}; + +$client->getManager()->addSubscriber(new SDAMLogger($handleOutput)); $client->test->command(['ping' => 1]); diff --git a/generator/README.md b/generator/README.md new file mode 100644 index 000000000..02a3be4ec --- /dev/null +++ b/generator/README.md @@ -0,0 +1,49 @@ +# Code Generator for MongoDB PHP Library + +This subproject is used to generate the code that is committed to the repository. +The `generator` directory is not included in `mongodb/mongodb` package and is not installed by Composer. + +## Contributing + +Updating the generated code can be done only by modifying the code generator, or its configuration. + +To run the generator, you need to have PHP 8.1+ installed and Composer. + +1. Move to the `generator` directory: `cd generator` +2. Install dependencies: `composer install` +3. Run the generator: `./generate` + +## Configuration + +The `generator/config/*.yaml` files contains the list of operators and stages that are supported by the library. + +### Arguments + +| Field | Type | Description | +|---------------|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `name` | `string` | The name of the argument. If it starts with `$`, the dollar is trimmed from the class property name | +| `type` | list of `string` | The list of accepted types | +| `description` | `string` | The description of the argument from MongoDB's documentation | +| `optional` | `boolean` | Whether the argument is optional or not | +| `valueMin` | `number` | The minimum value for a numeric argument | +| `valueMax` | `number` | The maximum value for a numeric argument | +| `variadic` | `string` | If sent, the argument is variadic. Defines the format `array` for a list or `object` for a map | +| `variadicMin` | `integer` | The minimum number of arguments for a variadic parameter | +| `default` | `scalar` or `array` | The default value for the argument | +| `mergeObject` | `bool` | Default `false`. If `true`, the value must be an object and the properties of the value object are merged into the parent operator. `$group` stage uses it for the fields | + +### Test pipelines + +Each operator can contain a `tests` section with a list if pipelines. To represent specific BSON objects, it is necessary to use Yaml tags: + +| BSON Type | Example | +|-------------|--------------------------------------------------------| +| Regex | `!bson_regex '^abc'`
`!bson_regex ['^abc', 'i']` | +| Int64 | `!bson_int64 '123456789'` | +| Decimal128 | `!bson_decimal128 '0.9'` | +| UTCDateTime | `!bson_utcdatetime 0` | +| ObjectId | `!bson_ObjectId '5a9427648b0beebeb69589a1` | +| Binary | `!bson_binary 'IA=='` | +| Binary UUID | `!bson_uuid 'fac32260-b511-4c69-8485-a2be5b7dda9e'` | + +To add new test cases to operators, you can get inspiration from the official MongoDB documentation and use the `generator/js2yaml.html` web page to manually convert a pipeline array from JS to Yaml. diff --git a/generator/composer.json b/generator/composer.json new file mode 100644 index 000000000..c4dedcfb7 --- /dev/null +++ b/generator/composer.json @@ -0,0 +1,32 @@ +{ + "name": "mongodb/code-generator", + "type": "project", + "repositories": [ + { + "type": "path", + "url": "..", + "symlink": true + } + ], + "replace": { + "symfony/polyfill-php80": "*", + "symfony/polyfill-php81": "*" + }, + "require": { + "mongodb/mongodb": "@dev", + "nette/php-generator": "^4.1.5", + "nikic/php-parser": "^5", + "symfony/console": "^7", + "symfony/finder": "^7", + "symfony/yaml": "^7" + }, + "license": "Apache-2.0", + "autoload": { + "psr-4": { + "MongoDB\\CodeGenerator\\": "src/" + } + }, + "config": { + "sort-packages": true + } +} diff --git a/generator/config/accumulator/accumulator.yaml b/generator/config/accumulator/accumulator.yaml new file mode 100644 index 000000000..9cfdb6b53 --- /dev/null +++ b/generator/config/accumulator/accumulator.yaml @@ -0,0 +1,132 @@ +# $schema: ../schema.json +name: $accumulator +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/accumulator/' +type: + - accumulator +encode: object +description: | + Defines a custom accumulator function. + New in MongoDB 4.4. +arguments: + - + name: init + type: + - javascript + description: | + Function used to initialize the state. The init function receives its arguments from the initArgs array expression. You can specify the function definition as either BSON type Code or String. + - + name: initArgs + type: + - resolvesToArray + optional: true + description: | + Arguments passed to the init function. + - + name: accumulate + type: + - javascript + description: | + Function used to accumulate documents. The accumulate function receives its arguments from the current state and accumulateArgs array expression. The result of the accumulate function becomes the new state. You can specify the function definition as either BSON type Code or String. + - + name: accumulateArgs + type: + - resolvesToArray + description: | + Arguments passed to the accumulate function. You can use accumulateArgs to specify what field value(s) to pass to the accumulate function. + - + name: merge + type: + - javascript + description: | + Function used to merge two internal states. merge must be either a String or Code BSON type. merge returns the combined result of the two merged states. For information on when the merge function is called, see Merge Two States with $merge. + - + name: finalize + type: + - javascript + optional: true + description: | + Function used to update the result of the accumulation. + - + name: lang + type: + - string + description: | + The language used in the $accumulator code. + +tests: + - + name: 'Use $accumulator to Implement the $avg Operator' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/accumulator/#use--accumulator-to-implement-the--avg-operator' + pipeline: + - + $group: + _id: '$author' + avgCopies: + $accumulator: + init: + $code: |- + function() { + return { count: 0, sum: 0 } + } + accumulate: + $code: |- + function(state, numCopies) { + return { count: state.count + 1, sum: state.sum + numCopies } + } + accumulateArgs: [ "$copies" ] + merge: + $code: |- + function(state1, state2) { + return { + count: state1.count + state2.count, + sum: state1.sum + state2.sum + } + } + finalize: + $code: |- + function(state) { + return (state.sum / state.count) + } + lang: 'js' + + - + name: 'Use initArgs to Vary the Initial State by Group' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/accumulator/#use-initargs-to-vary-the-initial-state-by-group' + pipeline: + - + $group: + _id: + city: '$city' + restaurants: + $accumulator: + init: + $code: |- + function(city, userProfileCity) { + return { max: city === userProfileCity ? 3 : 1, restaurants: [] } + } + initArgs: + - '$city' + - 'Bettles' + accumulate: + $code: |- + function(state, restaurantName) { + if (state.restaurants.length < state.max) { + state.restaurants.push(restaurantName); + } + return state; + } + accumulateArgs: ['$name'] + merge: + $code: |- + function(state1, state2) { + return { + max: state1.max, + restaurants: state1.restaurants.concat(state2.restaurants).slice(0, state1.max) + } + } + finalize: + $code: |- + function(state) { + return state.restaurants + } + lang: 'js' diff --git a/generator/config/accumulator/addToSet.yaml b/generator/config/accumulator/addToSet.yaml new file mode 100644 index 000000000..9566899eb --- /dev/null +++ b/generator/config/accumulator/addToSet.yaml @@ -0,0 +1,47 @@ +# $schema: ../schema.json +name: $addToSet +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/' +type: + - accumulator + - window +encode: single +description: | + Returns an array of unique expression values for each group. Order of the array elements is undefined. + Changed in MongoDB 5.0: Available in the $setWindowFields stage. +arguments: + - + name: expression + type: + - expression + +tests: + - + name: 'Use in $group Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/#use-in--group-stage' + pipeline: + - $group: + _id: + day: + $dayOfYear: + date: '$date' + year: + $year: + date: '$date' + itemsSold: + $addToSet: '$item' + - + name: 'Use in $setWindowFields Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/#use-in--setwindowfields-stage' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + cakeTypesForState: + $addToSet: '$type' + window: + documents: + - 'unbounded' + - 'current' diff --git a/generator/config/accumulator/avg.yaml b/generator/config/accumulator/avg.yaml new file mode 100644 index 000000000..3777bbf98 --- /dev/null +++ b/generator/config/accumulator/avg.yaml @@ -0,0 +1,45 @@ +# $schema: ../schema.json +name: $avg +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/' +type: + - accumulator + - window +encode: single +description: | + Returns an average of numerical values. Ignores non-numeric values. + Changed in MongoDB 5.0: Available in the $setWindowFields stage. +arguments: + - + name: expression + type: + - resolvesToNumber +tests: + - + name: 'Use in $group Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/#use-in--group-stage' + pipeline: + - $group: + _id: '$item' + avgAmount: + $avg: + $multiply: + - '$price' + - '$quantity' + avgQuantity: + $avg: '$quantity' + - + name: 'Use in $setWindowFields Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/#use-in--setwindowfields-stage' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + averageQuantityForState: + $avg: '$quantity' + window: + documents: + - 'unbounded' + - 'current' diff --git a/generator/config/accumulator/bottom.yaml b/generator/config/accumulator/bottom.yaml new file mode 100644 index 000000000..1e363d193 --- /dev/null +++ b/generator/config/accumulator/bottom.yaml @@ -0,0 +1,55 @@ +# $schema: ../schema.json +name: $bottom +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottom/' +type: + - accumulator + - window +encode: object +description: | + Returns the bottom element within a group according to the specified sort order. + New in MongoDB 5.2: Available in the $group and $setWindowFields stages. +arguments: + - + name: sortBy + type: + - sortBy + description: | + Specifies the order of results, with syntax similar to $sort. + - + name: output + type: + - expression + description: | + Represents the output for each element in the group and can be any expression. +tests: + - + name: 'Find the Bottom Score' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottom/#find-the-bottom-score' + pipeline: + - + $match: + gameId: 'G1' + - + $group: + _id: '$gameId' + playerId: + $bottom: + output: + - '$playerId' + - '$score' + sortBy: + score: -1 + - + name: 'Finding the Bottom Score Across Multiple Games' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottom/#finding-the-bottom-score-across-multiple-games' + pipeline: + - + $group: + _id: '$gameId' + playerId: + $bottom: + output: + - '$playerId' + - '$score' + sortBy: + score: -1 diff --git a/generator/config/accumulator/bottomN.yaml b/generator/config/accumulator/bottomN.yaml new file mode 100644 index 000000000..355d8e09a --- /dev/null +++ b/generator/config/accumulator/bottomN.yaml @@ -0,0 +1,85 @@ +# $schema: ../schema.json +name: $bottomN +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottomN/' +type: + - accumulator + - window +encode: object +description: | + Returns an aggregation of the bottom n elements within a group, according to the specified sort order. If the group contains fewer than n elements, $bottomN returns all elements in the group. + New in MongoDB 5.2. + Available in the $group and $setWindowFields stages. +arguments: + - + name: 'n' + type: + - resolvesToInt + description: | + Limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. + - + name: sortBy + type: + - sortBy + description: | + Specifies the order of results, with syntax similar to $sort. + - + name: output + type: + - expression + description: | + Represents the output for each element in the group and can be any expression. +tests: + - + name: 'Find the Three Lowest Scores' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottomN/#find-the-three-lowest-scores' + pipeline: + - + $match: + gameId: 'G1' + - + $group: + _id: '$gameId' + playerId: + $bottomN: + output: + - '$playerId' + - '$score' + sortBy: + score: -1 + n: 3 + - + name: 'Finding the Three Lowest Score Documents Across Multiple Games' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottomN/#finding-the-three-lowest-score-documents-across-multiple-games' + pipeline: + - + $group: + _id: '$gameId' + playerId: + $bottomN: + output: + - '$playerId' + - '$score' + sortBy: + score: -1 + n: 3 + - + name: 'Computing n Based on the Group Key for $group' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottomN/#computing-n-based-on-the-group-key-for--group' + pipeline: + - + $group: + _id: + gameId: '$gameId' + gamescores: + $bottomN: + output: '$score' + n: + $cond: + if: + $eq: + - '$gameId' + - 'G2' + then: 1 + else: 3 + sortBy: + score: -1 diff --git a/generator/config/accumulator/concatArrays.yaml b/generator/config/accumulator/concatArrays.yaml new file mode 100644 index 000000000..baf61b5e3 --- /dev/null +++ b/generator/config/accumulator/concatArrays.yaml @@ -0,0 +1,30 @@ +# $schema: ../schema.json +name: $concatArrays +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/concatArrays/' +type: + - accumulator + - window + - resolvesToArray +encode: single +description: | + Concatenates arrays to return the concatenated array. +arguments: + - + name: array + type: + - resolvesToArray # of arrays + variadic: array + description: | + An array of expressions that resolve to an array. + If any argument resolves to a value of null or refers to a field that is missing, `$concatArrays` returns `null`. +tests: + - + name: 'Warehouse collection' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/concatArrays/#example' + pipeline: + - + $project: + items: + $concatArrays: + - '$instock' + - '$ordered' diff --git a/generator/config/accumulator/count.yaml b/generator/config/accumulator/count.yaml new file mode 100644 index 000000000..d9819056d --- /dev/null +++ b/generator/config/accumulator/count.yaml @@ -0,0 +1,37 @@ +# $schema: ../schema.json +name: $count +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/count-accumulator/' +type: + - accumulator + - window +encode: object +description: | + Returns the number of documents in the group or window. + Distinct from the $count pipeline stage. + New in MongoDB 5.0. +tests: + - + name: 'Use in $group Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/count-accumulator/#use-in--group-stage' + pipeline: + - + $group: + _id: '$state' + countNumberOfDocumentsForState: + $count: {} + - + name: 'Use in $setWindowFields Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/count-accumulator/#use-in--setwindowfields-stage' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + countNumberOfDocumentsForState: + $count: {} + window: + documents: + - 'unbounded' + - 'current' diff --git a/generator/config/accumulator/covariancePop.yaml b/generator/config/accumulator/covariancePop.yaml new file mode 100644 index 000000000..b43a24022 --- /dev/null +++ b/generator/config/accumulator/covariancePop.yaml @@ -0,0 +1,41 @@ +# $schema: ../schema.json +name: $covariancePop +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/covariancePop/' +type: + - window +encode: array +description: | + Returns the population covariance of two numeric expressions. + New in MongoDB 5.0. +arguments: + - + name: expression1 + type: + - resolvesToNumber + - + name: expression2 + type: + - resolvesToNumber +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/covariancePop/#example' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + covariancePopForState: + $covariancePop: + - + # Example uses the short form, the builder always generates the verbose form + # $year: '$orderDate' + $year: + date: '$orderDate' + - '$quantity' + window: + documents: + - 'unbounded' + - 'current' diff --git a/generator/config/accumulator/covarianceSamp.yaml b/generator/config/accumulator/covarianceSamp.yaml new file mode 100644 index 000000000..b6cc529af --- /dev/null +++ b/generator/config/accumulator/covarianceSamp.yaml @@ -0,0 +1,41 @@ +# $schema: ../schema.json +name: $covarianceSamp +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/covarianceSamp/' +type: + - window +encode: array +description: | + Returns the sample covariance of two numeric expressions. + New in MongoDB 5.0. +arguments: + - + name: expression1 + type: + - resolvesToNumber + - + name: expression2 + type: + - resolvesToNumber +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/covarianceSamp/#example' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + covarianceSampForState: + $covarianceSamp: + - + # Example uses the short form, the builder always generates the verbose form + # $year: '$orderDate' + $year: + date: '$orderDate' + - '$quantity' + window: + documents: + - 'unbounded' + - 'current' diff --git a/generator/config/accumulator/denseRank.yaml b/generator/config/accumulator/denseRank.yaml new file mode 100644 index 000000000..0c50dd901 --- /dev/null +++ b/generator/config/accumulator/denseRank.yaml @@ -0,0 +1,34 @@ +# $schema: ../schema.json +name: $denseRank +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/denseRank/' +type: + - window +encode: object +description: | + Returns the document position (known as the rank) relative to other documents in the $setWindowFields stage partition. There are no gaps in the ranks. Ties receive the same rank. + New in MongoDB 5.0. +tests: + - + name: 'Dense Rank Partitions by an Integer Field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/denseRank/#dense-rank-partitions-by-an-integer-field' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + quantity: -1 + output: + denseRankQuantityForState: + $denseRank: {} + - + name: 'Dense Rank Partitions by a Date Field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/denseRank/#dense-rank-partitions-by-a-date-field' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + denseRankOrderDateForState: + $denseRank: {} diff --git a/generator/config/accumulator/derivative.yaml b/generator/config/accumulator/derivative.yaml new file mode 100644 index 000000000..5745e9380 --- /dev/null +++ b/generator/config/accumulator/derivative.yaml @@ -0,0 +1,47 @@ +# $schema: ../schema.json +name: $derivative +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/derivative/' +type: + - window +encode: object +description: | + Returns the average rate of change within the specified window. + New in MongoDB 5.0. +arguments: + - + name: input + type: + - resolvesToNumber + - resolvesToDate + - + name: unit + type: + - timeUnit + optional: true + description: | + A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond". + If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/derivative/#example' + pipeline: + - + $setWindowFields: + partitionBy: '$truckID' + sortBy: + timeStamp: 1 + output: + truckAverageSpeed: + $derivative: + input: '$miles' + unit: 'hour' + window: + range: + - -30 + - 0 + unit: 'second' + - + $match: + truckAverageSpeed: + $gt: 50 diff --git a/generator/config/accumulator/documentNumber.yaml b/generator/config/accumulator/documentNumber.yaml new file mode 100644 index 000000000..b810ccd44 --- /dev/null +++ b/generator/config/accumulator/documentNumber.yaml @@ -0,0 +1,22 @@ +# $schema: ../schema.json +name: $documentNumber +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/documentNumber/' +type: + - window +encode: object +description: | + Returns the position of a document (known as the document number) in the $setWindowFields stage partition. Ties result in different adjacent document numbers. + New in MongoDB 5.0. +tests: + - + name: 'Document Number for Each State' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/documentNumber/#document-number-for-each-state' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + quantity: -1 + output: + documentNumberForState: + $documentNumber: {} diff --git a/generator/config/accumulator/expMovingAvg.yaml b/generator/config/accumulator/expMovingAvg.yaml new file mode 100644 index 000000000..3009dd115 --- /dev/null +++ b/generator/config/accumulator/expMovingAvg.yaml @@ -0,0 +1,60 @@ +# $schema: ../schema.json +name: $expMovingAvg +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/expMovingAvg/' +type: + - window +encode: object +description: | + Returns the exponential moving average for the numeric expression. + New in MongoDB 5.0. +arguments: + - + name: input + type: + - resolvesToNumber + - + name: 'N' + type: + - int + optional: true + description: | + An integer that specifies the number of historical documents that have a significant mathematical weight in the exponential moving average calculation, with the most recent documents contributing the most weight. + You must specify either N or alpha. You cannot specify both. + The N value is used in this formula to calculate the current result based on the expression value from the current document being read and the previous result of the calculation: + - + name: alpha + type: + - double + optional: true + description: | + A double that specifies the exponential decay value to use in the exponential moving average calculation. A higher alpha value assigns a lower mathematical significance to previous results from the calculation. + You must specify either N or alpha. You cannot specify both. +tests: + - + name: 'Exponential Moving Average Using N' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/expMovingAvg/#exponential-moving-average-using-n' + pipeline: + - + $setWindowFields: + partitionBy: '$stock' + sortBy: + date: 1 + output: + expMovingAvgForStock: + $expMovingAvg: + input: '$price' + N: 2 + - + name: 'Exponential Moving Average Using alpha' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/expMovingAvg/#exponential-moving-average-using-alpha' + pipeline: + - + $setWindowFields: + partitionBy: '$stock' + sortBy: + date: 1 + output: + expMovingAvgForStock: + $expMovingAvg: + input: '$price' + alpha: 0.75 diff --git a/generator/config/accumulator/first.yaml b/generator/config/accumulator/first.yaml new file mode 100644 index 000000000..d82f831a0 --- /dev/null +++ b/generator/config/accumulator/first.yaml @@ -0,0 +1,45 @@ +# $schema: ../schema.json +name: $first +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/first/' +type: + - accumulator + - window +encode: single +description: | + Returns the result of an expression for the first document in a group or window. + Changed in MongoDB 5.0: Available in the $setWindowFields stage. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Use in $group Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/first/#use-in--group-stage' + pipeline: + - + $sort: + item: 1 + date: 1 + - + $group: + _id: '$item' + firstSale: + $first: '$date' + - + name: 'Use in $setWindowFields Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/first/#use-in--setwindowfields-stage' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + firstOrderTypeForState: + $first: '$type' + window: + documents: + - 'unbounded' + - 'current' diff --git a/generator/config/accumulator/firstN.yaml b/generator/config/accumulator/firstN.yaml new file mode 100644 index 000000000..cb7a6e96c --- /dev/null +++ b/generator/config/accumulator/firstN.yaml @@ -0,0 +1,122 @@ +# $schema: ../schema.json +name: $firstN +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN/' +type: + - accumulator + - window +encode: object +description: | + Returns an aggregation of the first n elements within a group. + The elements returned are meaningful only if in a specified sort order. + If the group contains fewer than n elements, $firstN returns all elements in the group. +arguments: + - + name: input + type: + - expression + description: | + An expression that resolves to the array from which to return n elements. + - + name: 'n' + type: + - resolvesToInt + description: | + A positive integral expression that is either a constant or depends on the _id value for $group. +tests: + - + name: 'Null and Missing Values' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN/#null-and-missing-values' + pipeline: + - + $documents: + - + playerId: 'PlayerA' + gameId: 'G1' + score: 1 + - + playerId: 'PlayerB' + gameId: 'G1' + score: 2 + - + playerId: 'PlayerC' + gameId: 'G1' + score: 3 + - + playerId: 'PlayerD' + gameId: 'G1' + - + playerId: 'PlayerE' + gameId: 'G1' + score: ~ + - + $group: + _id: '$gameId' + firstFiveScores: + $firstN: + input: '$score' + n: 5 + - + name: 'Find the First Three Player Scores for a Single Game' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN/#find-the-first-three-player-scores-for-a-single-game' + pipeline: + - + $match: + gameId: 'G1' + - + $group: + _id: '$gameId' + firstThreeScores: + $firstN: + input: + - '$playerId' + - '$score' + n: 3 + - + name: 'Finding the First Three Player Scores Across Multiple Games' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN/#finding-the-first-three-player-scores-across-multiple-games' + pipeline: + - + $group: + _id: '$gameId' + playerId: + $firstN: + input: + - '$playerId' + - '$score' + n: 3 + - + name: 'Using $sort With $firstN' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN/#using--sort-with--firstn' + pipeline: + - + $sort: + score: -1 + - + $group: + _id: '$gameId' + playerId: + $firstN: + input: + - '$playerId' + - '$score' + n: 3 + - + name: 'Computing n Based on the Group Key for $group' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN/#computing-n-based-on-the-group-key-for--group' + pipeline: + - + $group: + _id: + gameId: '$gameId' + gamescores: + $firstN: + input: '$score' + n: + $cond: + if: + $eq: + - '$gameId' + - 'G2' + then: 1 + else: 3 + diff --git a/generator/config/accumulator/integral.yaml b/generator/config/accumulator/integral.yaml new file mode 100644 index 000000000..efc803597 --- /dev/null +++ b/generator/config/accumulator/integral.yaml @@ -0,0 +1,43 @@ +# $schema: ../schema.json +name: $integral +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/integral/' +type: + - window +encode: object +description: | + Returns the approximation of the area under a curve. + New in MongoDB 5.0. +arguments: + - + name: input + type: + - resolvesToNumber + - resolvesToDate + - + name: unit + type: + - timeUnit + optional: true + description: | + A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond". + If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/integral/#example' + pipeline: + - + $setWindowFields: + partitionBy: '$powerMeterID' + sortBy: + timeStamp: 1 + output: + powerMeterKilowattHours: + $integral: + input: '$kilowatts' + unit: 'hour' + window: + range: + - 'unbounded' + - 'current' + unit: 'hour' diff --git a/generator/config/accumulator/last.yaml b/generator/config/accumulator/last.yaml new file mode 100644 index 000000000..969c05524 --- /dev/null +++ b/generator/config/accumulator/last.yaml @@ -0,0 +1,45 @@ +# $schema: ../schema.json +name: $last +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/last/' +type: + - accumulator + - window +encode: single +description: | + Returns the result of an expression for the last document in a group or window. + Changed in MongoDB 5.0: Available in the $setWindowFields stage. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Use in $group Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/last/' + pipeline: + - + $sort: + item: 1 + date: 1 + - + $group: + _id: '$item' + lastSalesDate: + $last: '$date' + - + name: 'Use in $setWindowFields Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/last/#use-in--setwindowfields-stage' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + lastOrderTypeForState: + $last: '$type' + window: + documents: + - 'current' + - 'unbounded' diff --git a/generator/config/accumulator/lastN.yaml b/generator/config/accumulator/lastN.yaml new file mode 100644 index 000000000..13c9b72bd --- /dev/null +++ b/generator/config/accumulator/lastN.yaml @@ -0,0 +1,89 @@ +# $schema: ../schema.json +name: $lastN +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN/' +type: + - accumulator + - window +encode: object +description: | + Returns an aggregation of the last n elements within a group. + The elements returned are meaningful only if in a specified sort order. + If the group contains fewer than n elements, $lastN returns all elements in the group. +arguments: + - + name: input + type: + - resolvesToArray + description: | + An expression that resolves to the array from which to return n elements. + - + name: 'n' + type: + - resolvesToInt + description: | + An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. +tests: + - + name: 'Find the Last Three Player Scores for a Single Game' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN/#find-the-last-three-player-scores-for-a-single-game' + pipeline: + - + $match: + gameId: 'G1' + - + $group: + _id: '$gameId' + lastThreeScores: + $lastN: + input: + - '$playerId' + - '$score' + n: 3 + - + name: 'Finding the Last Three Player Scores Across Multiple Games' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN/#finding-the-last-three-player-scores-across-multiple-games' + pipeline: + - + $group: + _id: '$gameId' + playerId: + $lastN: + input: + - '$playerId' + - '$score' + n: 3 + - + name: 'Using $sort With $lastN' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN/#using--sort-with--lastn' + pipeline: + - + $sort: + score: -1 + - + $group: + _id: '$gameId' + playerId: + $lastN: + input: + - '$playerId' + - '$score' + n: 3 + - + name: 'Computing n Based on the Group Key for $group' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN/#computing-n-based-on-the-group-key-for--group' + pipeline: + - + $group: + _id: + gameId: '$gameId' + gamescores: + $lastN: + input: '$score' + n: + $cond: + if: + $eq: + - '$gameId' + - 'G2' + then: 1 + else: 3 diff --git a/generator/config/accumulator/linearFill.yaml b/generator/config/accumulator/linearFill.yaml new file mode 100644 index 000000000..034e6ab9e --- /dev/null +++ b/generator/config/accumulator/linearFill.yaml @@ -0,0 +1,40 @@ +# $schema: ../schema.json +name: $linearFill +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/linearFill/' +type: + - window +encode: single +description: | + Fills null and missing fields in a window using linear interpolation based on surrounding field values. + Available in the $setWindowFields stage. + New in MongoDB 5.3. +arguments: + - + name: expression + type: + - resolvesToNumber +tests: + - + name: 'Fill Missing Values with Linear Interpolation' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/linearFill/#fill-missing-values-with-linear-interpolation' + pipeline: + - + $setWindowFields: + sortBy: + time: 1 + output: + price: + $linearFill: '$price' + - + name: 'Use Multiple Fill Methods in a Single Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/linearFill/#use-multiple-fill-methods-in-a-single-stage' + pipeline: + - + $setWindowFields: + sortBy: + time: 1 + output: + linearFillPrice: + $linearFill: '$price' + locfPrice: + $locf: '$price' diff --git a/generator/config/accumulator/locf.yaml b/generator/config/accumulator/locf.yaml new file mode 100644 index 000000000..63979bca4 --- /dev/null +++ b/generator/config/accumulator/locf.yaml @@ -0,0 +1,27 @@ +# $schema: ../schema.json +name: $locf +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/locf/' +type: + - window +encode: single +description: | + Last observation carried forward. Sets values for null and missing fields in a window to the last non-null value for the field. + Available in the $setWindowFields stage. + New in MongoDB 5.2. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Fill Missing Values with the Last Observed Value' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/locf/#fill-missing-values-with-the-last-observed-value' + pipeline: + - + $setWindowFields: + sortBy: + time: 1 + output: + price: + $locf: '$price' diff --git a/generator/config/accumulator/max.yaml b/generator/config/accumulator/max.yaml new file mode 100644 index 000000000..165cefc43 --- /dev/null +++ b/generator/config/accumulator/max.yaml @@ -0,0 +1,46 @@ +# $schema: ../schema.json +name: $max +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/max/' +type: + - accumulator + - window +encode: single +description: | + Returns the maximum value that results from applying an expression to each document. + Changed in MongoDB 5.0: Available in the $setWindowFields stage. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Use in $group Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/max/#use-in--group-stage' + pipeline: + - + $group: + _id: '$item' + maxTotalAmount: + $max: + $multiply: + - '$price' + - '$quantity' + maxQuantity: + $max: '$quantity' + - + name: 'Use in $setWindowFields Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/max/#use-in--setwindowfields-stage' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + maximumQuantityForState: + $max: '$quantity' + window: + documents: + - 'unbounded' + - 'current' diff --git a/generator/config/accumulator/maxN.yaml b/generator/config/accumulator/maxN.yaml new file mode 100644 index 000000000..4014782a8 --- /dev/null +++ b/generator/config/accumulator/maxN.yaml @@ -0,0 +1,73 @@ +# $schema: ../schema.json +name: $maxN +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/maxN/' +type: + - accumulator + - window +encode: object +description: | + Returns the n largest values in an array. Distinct from the $maxN accumulator. +arguments: + - + name: input + type: + - resolvesToArray + description: | + An expression that resolves to the array from which to return the maximal n elements. + - + name: 'n' + type: + - resolvesToInt + description: | + An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. +tests: + - + name: 'Find the Maximum Three Scores for a Single Game' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/maxN/#find-the-maximum-three-scores-for-a-single-game' + pipeline: + - + $match: + gameId: 'G1' + - + $group: + _id: '$gameId' + maxThreeScores: + $maxN: + input: + - '$score' + - '$playerId' + n: 3 + - + name: 'Finding the Maximum Three Scores Across Multiple Games' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/maxN/#finding-the-maximum-three-scores-across-multiple-games' + pipeline: + - + $group: + _id: '$gameId' + maxScores: + $maxN: + input: + - '$score' + - '$playerId' + n: 3 + - + name: 'Computing n Based on the Group Key for $group' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/maxN/#computing-n-based-on-the-group-key-for--group' + pipeline: + - + $group: + _id: + gameId: '$gameId' + gamescores: + $maxN: + input: + - '$score' + - '$playerId' + n: + $cond: + if: + $eq: + - '$gameId' + - 'G2' + then: 1 + else: 3 diff --git a/generator/config/accumulator/median.yaml b/generator/config/accumulator/median.yaml new file mode 100644 index 000000000..e743c6982 --- /dev/null +++ b/generator/config/accumulator/median.yaml @@ -0,0 +1,61 @@ +# $schema: ../schema.json +name: $median +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/median/' +type: + - accumulator + - window +encode: object +description: | + Returns an approximation of the median, the 50th percentile, as a scalar value. + New in MongoDB 7.0. + This operator is available as an accumulator in these stages: + $group + $setWindowFields + It is also available as an aggregation expression. +arguments: + - + name: input + type: + - resolvesToNumber + description: | + $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. + - + name: method + type: + - accumulatorPercentile + description: | + The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. +tests: + - + name: 'Use $median as an Accumulator' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/median/#use-operatorname-as-an-accumulator' + pipeline: + - + $group: + _id: ~ + test01_median: + $median: + input: '$test01' + method: 'approximate' + - + name: 'Use $median in a $setWindowField Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/median/#use-operatorname-in-a--setwindowfield-stage' + pipeline: + - + $setWindowFields: + sortBy: + test01: 1 + output: + test01_median: + $median: + input: '$test01' + method: 'approximate' + window: + range: + - -3 + - 3 + - + $project: + _id: 0 + studentId: 1 + test01_median: 1 diff --git a/generator/config/accumulator/mergeObjects.yaml b/generator/config/accumulator/mergeObjects.yaml new file mode 100644 index 000000000..d68728001 --- /dev/null +++ b/generator/config/accumulator/mergeObjects.yaml @@ -0,0 +1,25 @@ +# $schema: ../schema.json +name: $mergeObjects +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/mergeObjects/' +type: + - accumulator +encode: single +description: | + Combines multiple documents into a single document. +arguments: + - + name: document + type: + - resolvesToObject + description: | + Any valid expression that resolves to a document. +tests: + - + name: '$mergeObjects as an Accumulator' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/mergeObjects/#-mergeobjects-as-an-accumulator' + pipeline: + - + $group: + _id: '$item' + mergedSales: + $mergeObjects: '$quantity' diff --git a/generator/config/accumulator/min.yaml b/generator/config/accumulator/min.yaml new file mode 100644 index 000000000..226d56ec8 --- /dev/null +++ b/generator/config/accumulator/min.yaml @@ -0,0 +1,41 @@ +# $schema: ../schema.json +name: $min +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/min/' +type: + - accumulator + - window +encode: single +description: | + Returns the minimum value that results from applying an expression to each document. + Changed in MongoDB 5.0: Available in the $setWindowFields stage. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Use in $group Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/min/#use-in--group-stage' + pipeline: + - + $group: + _id: '$item' + minQuantity: + $min: '$quantity' + - + name: 'Use in $setWindowFields Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/min/#use-in--setwindowfields-stage' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + minimumQuantityForState: + $min: '$quantity' + window: + documents: + - 'unbounded' + - 'current' diff --git a/generator/config/accumulator/minN.yaml b/generator/config/accumulator/minN.yaml new file mode 100644 index 000000000..24719a22a --- /dev/null +++ b/generator/config/accumulator/minN.yaml @@ -0,0 +1,73 @@ +# $schema: ../schema.json +name: $minN +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/minN/' +type: + - accumulator + - window +encode: object +description: | + Returns the n smallest values in an array. Distinct from the $minN accumulator. +arguments: + - + name: input + type: + - resolvesToArray + description: | + An expression that resolves to the array from which to return the maximal n elements. + - + name: 'n' + type: + - resolvesToInt + description: | + An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. +tests: + - + name: 'Find the Minimum Three Scores for a Single Game' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/minN/#find-the-minimum-three-scores-for-a-single-game' + pipeline: + - + $match: + gameId: 'G1' + - + $group: + _id: '$gameId' + minScores: + $minN: + input: + - '$score' + - '$playerId' + n: 3 + - + name: 'Finding the Minimum Three Documents Across Multiple Games' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/minN/#finding-the-minimum-three-documents-across-multiple-games' + pipeline: + - + $group: + _id: '$gameId' + minScores: + $minN: + input: + - '$score' + - '$playerId' + n: 3 + - + name: 'Computing n Based on the Group Key for $group' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/minN/#computing-n-based-on-the-group-key-for--group' + pipeline: + - + $group: + _id: + gameId: '$gameId' + gamescores: + $minN: + input: + - '$score' + - '$playerId' + n: + $cond: + if: + $eq: + - '$gameId' + - 'G2' + then: 1 + else: 3 diff --git a/generator/config/accumulator/percentile.yaml b/generator/config/accumulator/percentile.yaml new file mode 100644 index 000000000..b3c41b0e4 --- /dev/null +++ b/generator/config/accumulator/percentile.yaml @@ -0,0 +1,102 @@ +# $schema: ../schema.json +name: $percentile +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/percentile/' +type: + - accumulator + - window +encode: object +description: | + Returns an array of scalar values that correspond to specified percentile values. + New in MongoDB 7.0. + + This operator is available as an accumulator in these stages: + $group + + $setWindowFields + + It is also available as an aggregation expression. +arguments: + - + name: input + type: + - resolvesToNumber + description: | + $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. + - + name: p + type: + - resolvesToArray # of resolvesToNumber + description: | + $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. + $percentile returns results in the same order as the elements in p. + - + name: method + type: + - accumulatorPercentile + description: | + The method that mongod uses to calculate the percentile value. The method must be 'approximate'. +tests: + - + name: 'Calculate a Single Value as an Accumulator' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/percentile/#calculate-a-single-value-as-an-accumulator' + pipeline: + - + $group: + _id: ~ + test01_percentiles: + $percentile: + input: '$test01' + p: + - 0.95 + method: 'approximate' + - + name: 'Calculate Multiple Values as an Accumulator' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/percentile/#calculate-multiple-values-as-an-accumulator' + pipeline: + - + $group: + _id: ~ + test01_percentiles: + $percentile: + input: '$test01' + p: [0.5, 0.75, 0.9, 0.95] + method: 'approximate' + test02_percentiles: + $percentile: + input: '$test02' + p: [0.5, 0.75, 0.9, 0.95] + method: 'approximate' + test03_percentiles: + $percentile: + input: '$test03' + p: [0.5, 0.75, 0.9, 0.95] + method: 'approximate' + test03_percent_alt: + $percentile: + input: '$test03' + p: [0.9, 0.5, 0.75, 0.95] + method: 'approximate' + - + name: 'Use $percentile in a $setWindowField Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/percentile/#use-operatorname-in-a--setwindowfield-stage' + pipeline: + - + $setWindowFields: + sortBy: + test01: 1 + output: + test01_95percentile: + $percentile: + input: '$test01' + p: + - 0.95 + method: 'approximate' + window: + range: + - -3 + - 3 + - + $project: + _id: 0 + studentId: 1 + test01_95percentile: 1 diff --git a/generator/config/accumulator/push.yaml b/generator/config/accumulator/push.yaml new file mode 100644 index 000000000..3fc367c59 --- /dev/null +++ b/generator/config/accumulator/push.yaml @@ -0,0 +1,55 @@ +# $schema: ../schema.json +name: $push +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/push/' +type: + - accumulator + - window +encode: single +description: | + Returns an array of values that result from applying an expression to each document. + Changed in MongoDB 5.0: Available in the $setWindowFields stage. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Use in $group Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/push/#use-in--group-stage' + pipeline: + - + $sort: + date: 1 + item: 1 + - + $group: + _id: + day: + # Example uses the short form, the builder always generates the verbose form + # $dayOfYear: '$date' + $dayOfYear: + date: '$date' + year: + # Example uses the short form, the builder always generates the verbose form + # $year: '$date' + $year: + date: '$date' + itemsSold: + $push: + item: '$item' + quantity: '$quantity' + - + name: 'Use in $setWindowFields Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/push/#use-in--setwindowfields-stage' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + quantitiesForState: + $push: '$quantity' + window: + documents: ['unbounded', 'current'] diff --git a/generator/config/accumulator/rank.yaml b/generator/config/accumulator/rank.yaml new file mode 100644 index 000000000..8b8fd041b --- /dev/null +++ b/generator/config/accumulator/rank.yaml @@ -0,0 +1,34 @@ +# $schema: ../schema.json +name: $rank +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/rank/' +type: + - window +encode: object +description: | + Returns the document position (known as the rank) relative to other documents in the $setWindowFields stage partition. + New in MongoDB 5.0. +tests: + - + name: 'Rank Partitions by an Integer Field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/rank/#rank-partitions-by-an-integer-field' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + quantity: -1 + output: + rankQuantityForState: + $rank: {} + - + name: 'Rank Partitions by a Date Field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/rank/#rank-partitions-by-a-date-field' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + rankOrderDateForState: + $rank: {} diff --git a/generator/config/accumulator/setUnion.yaml b/generator/config/accumulator/setUnion.yaml new file mode 100644 index 000000000..8c8419f9e --- /dev/null +++ b/generator/config/accumulator/setUnion.yaml @@ -0,0 +1,32 @@ +# $schema: ../schema.json +name: $setUnion +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setUnion/' +type: + - accumulator + - window + - resolvesToArray +encode: single +description: | + Takes two or more arrays and returns an array containing the elements that appear in any input array. +arguments: + - + name: array + type: + - resolvesToArray # of arrays + variadic: array + description: | + An array of expressions that resolve to an array. +tests: + - + name: 'Flowers collection' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setUnion/#example' + pipeline: + - + $project: + flowerFieldA: 1 + flowerFieldB: 1 + allValues: + $setUnion: + - "$flowerFieldA" + - "$flowerFieldB" + _id: 0 diff --git a/generator/config/accumulator/shift.yaml b/generator/config/accumulator/shift.yaml new file mode 100644 index 000000000..f4984f056 --- /dev/null +++ b/generator/config/accumulator/shift.yaml @@ -0,0 +1,65 @@ +# $schema: ../schema.json +name: $shift +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/shift/' +type: + - window +encode: object +description: | + Returns the value from an expression applied to a document in a specified position relative to the current document in the $setWindowFields stage partition. + New in MongoDB 5.0. +arguments: + - + name: output + type: + - expression + description: | + Specifies an expression to evaluate and return in the output. + - + name: by + type: + - int + description: | + Specifies an integer with a numeric document position relative to the current document in the output. + For example: + 1 specifies the document position after the current document. + -1 specifies the document position before the current document. + -2 specifies the document position that is two positions before the current document. + - + name: default + type: + - expression + description: | + Specifies an optional default expression to evaluate if the document position is outside of the implicit $setWindowFields stage window. The implicit window contains all the documents in the partition. + The default expression must evaluate to a constant value. + If you do not specify a default expression, $shift returns null for documents whose positions are outside of the implicit $setWindowFields stage window. +tests: + - + name: 'Shift Using a Positive Integer' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/shift/#shift-using-a-positive-integer' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + quantity: -1 + output: + shiftQuantityForState: + $shift: + output: '$quantity' + by: 1 + default: 'Not available' + - + name: 'Shift Using a Negative Integer' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/shift/#shift-using-a-negative-integer' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + quantity: -1 + output: + shiftQuantityForState: + $shift: + output: '$quantity' + by: -1 + default: 'Not available' diff --git a/generator/config/accumulator/stdDevPop.yaml b/generator/config/accumulator/stdDevPop.yaml new file mode 100644 index 000000000..8916456d4 --- /dev/null +++ b/generator/config/accumulator/stdDevPop.yaml @@ -0,0 +1,40 @@ +# $schema: ../schema.json +name: $stdDevPop +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/' +type: + - accumulator + - window +encode: single +description: | + Calculates the population standard deviation of the input values. Use if the values encompass the entire population of data you want to represent and do not wish to generalize about a larger population. $stdDevPop ignores non-numeric values. + If the values represent only a sample of a population of data from which to generalize about the population, use $stdDevSamp instead. + Changed in MongoDB 5.0: Available in the $setWindowFields stage. +arguments: + - + name: expression + type: + - resolvesToNumber +tests: + - + name: 'Use in $group Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/#use-in--group-stage' + pipeline: + - + $group: + _id: '$quiz' + stdDev: + $stdDevPop: '$score' + - + name: 'Use in $setWindowFields Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/#use-in--setwindowfields-stage' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + stdDevPopQuantityForState: + $stdDevPop: '$quantity' + window: + documents: ['unbounded', 'current'] diff --git a/generator/config/accumulator/stdDevSamp.yaml b/generator/config/accumulator/stdDevSamp.yaml new file mode 100644 index 000000000..94ac33d15 --- /dev/null +++ b/generator/config/accumulator/stdDevSamp.yaml @@ -0,0 +1,43 @@ +# $schema: ../schema.json +name: $stdDevSamp +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/' +type: + - accumulator + - window +encode: single +description: | + Calculates the sample standard deviation of the input values. Use if the values encompass a sample of a population of data from which to generalize about the population. $stdDevSamp ignores non-numeric values. + If the values represent the entire population of data or you do not wish to generalize about a larger population, use $stdDevPop instead. + Changed in MongoDB 5.0: Available in the $setWindowFields stage. +arguments: + - + name: expression + type: + - resolvesToNumber +tests: + - + name: 'Use in $group Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/#use-in--group-stage' + pipeline: + - + $sample: + size: 100 + - + $group: + _id: ~ + ageStdDev: + $stdDevSamp: '$age' + - + name: 'Use in $setWindowFields Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/#use-in--setwindowfields-stage' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + stdDevSampQuantityForState: + $stdDevSamp: '$quantity' + window: + documents: ['unbounded', 'current'] diff --git a/generator/config/accumulator/sum.yaml b/generator/config/accumulator/sum.yaml new file mode 100644 index 000000000..c40417ef4 --- /dev/null +++ b/generator/config/accumulator/sum.yaml @@ -0,0 +1,56 @@ +# $schema: ../schema.json +name: $sum +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/' +type: + - accumulator + - window +encode: single +description: | + Returns a sum of numerical values. Ignores non-numeric values. + Changed in MongoDB 5.0: Available in the $setWindowFields stage. +arguments: + - + name: expression + type: + - resolvesToNumber +tests: + - + name: 'Use in $group Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/#use-in--group-stage' + pipeline: + - + $group: + _id: + day: + # Example uses the short form, the builder always generates the verbose form + # $dayOfYear: '$date' + $dayOfYear: + date: '$date' + year: + # Example uses the short form, the builder always generates the verbose form + # $year: '$date' + $year: + date: '$date' + totalAmount: + $sum: + $multiply: + - '$price' + - '$quantity' + count: + $sum: 1 + - + name: 'Use in $setWindowFields Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/#use-in--setwindowfields-stage' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + sumQuantityForState: + $sum: '$quantity' + window: + documents: + - 'unbounded' + - 'current' diff --git a/generator/config/accumulator/top.yaml b/generator/config/accumulator/top.yaml new file mode 100644 index 000000000..94923cccd --- /dev/null +++ b/generator/config/accumulator/top.yaml @@ -0,0 +1,56 @@ +# $schema: ../schema.json +name: $top +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/top/' +type: + - accumulator +encode: object +description: | + Returns the top element within a group according to the specified sort order. + New in MongoDB 5.2. + + Available in the $group and $setWindowFields stages. +arguments: + - + name: sortBy + type: + - sortBy + description: | + Specifies the order of results, with syntax similar to $sort. + - + name: output + type: + - expression + description: | + Represents the output for each element in the group and can be any expression. +tests: + - + name: 'Find the Top Score' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/top/#find-the-top-score' + pipeline: + - + $match: + gameId: 'G1' + - + $group: + _id: '$gameId' + playerId: + $top: + output: + - '$playerId' + - '$score' + sortBy: + score: -1 + - + name: 'Find the Top Score Across Multiple Games' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/top/#find-the-top-score-across-multiple-games' + pipeline: + - + $group: + _id: '$gameId' + playerId: + $top: + output: + - '$playerId' + - '$score' + sortBy: + score: -1 diff --git a/generator/config/accumulator/topN.yaml b/generator/config/accumulator/topN.yaml new file mode 100644 index 000000000..c5eff6056 --- /dev/null +++ b/generator/config/accumulator/topN.yaml @@ -0,0 +1,85 @@ +# $schema: ../schema.json +name: $topN +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/topN/' +type: + - accumulator +encode: object +description: | + Returns an aggregation of the top n fields within a group, according to the specified sort order. + New in MongoDB 5.2. + + Available in the $group and $setWindowFields stages. +arguments: + - + name: 'n' + type: + - resolvesToInt + description: | + limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. + - + name: sortBy + type: + - sortBy + description: | + Specifies the order of results, with syntax similar to $sort. + - + name: output + type: + - expression + description: | + Represents the output for each element in the group and can be any expression. +tests: + - + name: 'Find the Three Highest Scores' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/topN/#find-the-three-highest-scores' + pipeline: + - + $match: + gameId: 'G1' + - + $group: + _id: '$gameId' + playerId: + $topN: + output: + - '$playerId' + - '$score' + sortBy: + score: -1 + n: 3 + - + name: 'Finding the Three Highest Score Documents Across Multiple Games' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/topN/#finding-the-three-highest-score-documents-across-multiple-games' + pipeline: + - + $group: + _id: '$gameId' + playerId: + $topN: + output: + - '$playerId' + - '$score' + sortBy: + score: -1 + n: 3 + - + name: 'Computing n Based on the Group Key for $group' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/topN/#computing-n-based-on-the-group-key-for--group' + pipeline: + - + $group: + _id: + gameId: '$gameId' + gamescores: + $topN: + output: '$score' + n: + $cond: + if: + $eq: + - '$gameId' + - 'G2' + then: 1 + else: 3 + sortBy: + score: -1 diff --git a/generator/config/definitions.php b/generator/config/definitions.php new file mode 100644 index 000000000..06d9b44ed --- /dev/null +++ b/generator/config/definitions.php @@ -0,0 +1,73 @@ + __DIR__ . '/stage', + 'namespace' => 'MongoDB\\Builder\\Stage', + 'classNameSuffix' => 'Stage', + 'generators' => [ + OperatorClassGenerator::class, + OperatorFactoryGenerator::class, + OperatorTestGenerator::class, + FluentStageFactoryGenerator::class, + ], + ], + + // Aggregation Pipeline Accumulator and Window Operators + [ + 'configFiles' => __DIR__ . '/accumulator', + 'namespace' => 'MongoDB\\Builder\\Accumulator', + 'classNameSuffix' => 'Accumulator', + 'generators' => [ + OperatorClassGenerator::class, + OperatorFactoryGenerator::class, + OperatorTestGenerator::class, + ], + ], + + // Aggregation Pipeline Expression + [ + 'configFiles' => __DIR__ . '/expression', + 'namespace' => 'MongoDB\\Builder\\Expression', + 'classNameSuffix' => 'Operator', + 'generators' => [ + OperatorClassGenerator::class, + OperatorFactoryGenerator::class, + OperatorTestGenerator::class, + ], + ], + + // Query Operators + [ + 'configFiles' => __DIR__ . '/query', + 'namespace' => 'MongoDB\\Builder\\Query', + 'classNameSuffix' => 'Operator', + 'generators' => [ + OperatorClassGenerator::class, + OperatorFactoryGenerator::class, + OperatorTestGenerator::class, + ], + ], + + // Search Operators + [ + 'configFiles' => __DIR__ . '/search', + 'namespace' => 'MongoDB\\Builder\\Search', + 'classNameSuffix' => 'Operator', + 'generators' => [ + OperatorClassGenerator::class, + OperatorFactoryGenerator::class, + OperatorTestGenerator::class, + ], + ], +]; diff --git a/generator/config/expression/abs.yaml b/generator/config/expression/abs.yaml new file mode 100644 index 000000000..fe29e44e3 --- /dev/null +++ b/generator/config/expression/abs.yaml @@ -0,0 +1,25 @@ +# $schema: ../schema.json +name: $abs +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/abs/' +type: + - resolvesToNumber +encode: single +description: | + Returns the absolute value of a number. +arguments: + - + name: value + type: + - resolvesToNumber +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/abs/#example' + pipeline: + - + $project: + delta: + $abs: + $subtract: + - '$startTemp' + - '$endTemp' diff --git a/generator/config/expression/acos.yaml b/generator/config/expression/acos.yaml new file mode 100644 index 000000000..7deca736d --- /dev/null +++ b/generator/config/expression/acos.yaml @@ -0,0 +1,31 @@ +# $schema: ../schema.json +name: $acos +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/acos/' +type: + - resolvesToDouble + - resolvesToDecimal +encode: single +description: | + Returns the inverse cosine (arc cosine) of a value in radians. +arguments: + - + name: expression + type: + - resolvesToNumber + description: | + $acos takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + $acos returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + By default $acos returns values as a double. $acos can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/acos/#example' + pipeline: + - + $addFields: + angle_a: + $radiansToDegrees: + $acos: + $divide: + - '$side_b' + - '$hypotenuse' diff --git a/generator/config/expression/acosh.yaml b/generator/config/expression/acosh.yaml new file mode 100644 index 000000000..ce575e317 --- /dev/null +++ b/generator/config/expression/acosh.yaml @@ -0,0 +1,28 @@ +# $schema: ../schema.json +name: $acosh +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/acosh/' +type: + - resolvesToDouble + - resolvesToDecimal +encode: single +description: | + Returns the inverse hyperbolic cosine (hyperbolic arc cosine) of a value in radians. +arguments: + - + name: expression + type: + - resolvesToNumber + description: | + $acosh takes any valid expression that resolves to a number between 1 and +Infinity, e.g. 1 <= value <= +Infinity. + $acosh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + By default $acosh returns values as a double. $acosh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/acosh/#example' + pipeline: + - + $addFields: + y-coordinate: + $radiansToDegrees: + $acosh: '$x-coordinate' diff --git a/generator/config/expression/add.yaml b/generator/config/expression/add.yaml new file mode 100644 index 000000000..fa23253d0 --- /dev/null +++ b/generator/config/expression/add.yaml @@ -0,0 +1,44 @@ +# $schema: ../schema.json +name: $add +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/add/' +type: + - resolvesToInt + - resolvesToLong + - resolvesToDouble + - resolvesToDecimal + - resolvesToDate +encode: single +description: | + Adds numbers to return the sum, or adds numbers and a date to return a new date. If adding numbers and a date, treats the numbers as milliseconds. Accepts any number of argument expressions, but at most, one expression can resolve to a date. +arguments: + - + name: expression + type: + - resolvesToNumber + - resolvesToDate + variadic: array + description: | + The arguments can be any valid expression as long as they resolve to either all numbers or to numbers and a date. +tests: + - + name: 'Add Numbers' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/add/#add-numbers' + pipeline: + - + $project: + item: 1 + total: + $add: + - '$price' + - '$fee' + - + name: 'Perform Addition on a Date' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/add/#perform-addition-on-a-date' + pipeline: + - + $project: + item: 1 + billing_date: + $add: + - '$date' + - 259200000 diff --git a/generator/config/expression/allElementsTrue.yaml b/generator/config/expression/allElementsTrue.yaml new file mode 100644 index 000000000..7301f8d68 --- /dev/null +++ b/generator/config/expression/allElementsTrue.yaml @@ -0,0 +1,25 @@ +# $schema: ../schema.json +name: $allElementsTrue +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/allElementsTrue/' +type: + - resolvesToBool +encode: array +description: | + Returns true if no element of a set evaluates to false, otherwise, returns false. Accepts a single argument expression. +arguments: + - + name: expression + type: + - resolvesToArray +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/allElementsTrue/#example' + pipeline: + - + $project: + responses: 1 + isAllTrue: + $allElementsTrue: + - '$responses' + _id: 0 diff --git a/generator/config/expression/and.yaml b/generator/config/expression/and.yaml new file mode 100644 index 000000000..96057d249 --- /dev/null +++ b/generator/config/expression/and.yaml @@ -0,0 +1,37 @@ +# $schema: ../schema.json +name: $and +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/and/' +type: + - resolvesToBool +encode: single +description: | + Returns true only when all its expressions evaluate to true. Accepts any number of argument expressions. +arguments: + - + name: expression + type: + - expression + - resolvesToBool + - resolvesToNumber + - resolvesToString + - resolvesToNull + variadic: array +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/and/#example' + pipeline: + - + $project: + item: 1 + qty: 1 + result: + $and: + - + $gt: + - '$qty' + - 100 + - + $lt: + - '$qty' + - 250 diff --git a/generator/config/expression/anyElementTrue.yaml b/generator/config/expression/anyElementTrue.yaml new file mode 100644 index 000000000..50fe665b6 --- /dev/null +++ b/generator/config/expression/anyElementTrue.yaml @@ -0,0 +1,25 @@ +# $schema: ../schema.json +name: $anyElementTrue +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/anyElementTrue/' +type: + - resolvesToBool +encode: array +description: | + Returns true if any elements of a set evaluate to true; otherwise, returns false. Accepts a single argument expression. +arguments: + - + name: expression + type: + - resolvesToArray +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/anyElementTrue/#example' + pipeline: + - + $project: + responses: 1 + isAnyTrue: + $anyElementTrue: + - '$responses' + _id: 0 diff --git a/generator/config/expression/arrayElemAt.yaml b/generator/config/expression/arrayElemAt.yaml new file mode 100644 index 000000000..09fe9dae1 --- /dev/null +++ b/generator/config/expression/arrayElemAt.yaml @@ -0,0 +1,33 @@ +# $schema: ../schema.json +name: $arrayElemAt +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/arrayElemAt/' +type: + - resolvesToAny +encode: array +description: | + Returns the element at the specified array index. +arguments: + - + name: array + type: + - resolvesToArray + - + name: idx + type: + - resolvesToInt +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/arrayElemAt/#example' + pipeline: + - + $project: + name: 1 + first: + $arrayElemAt: + - '$favorites' + - 0 + last: + $arrayElemAt: + - '$favorites' + - -1 diff --git a/generator/config/expression/arrayToObject.yaml b/generator/config/expression/arrayToObject.yaml new file mode 100644 index 000000000..87026f7a7 --- /dev/null +++ b/generator/config/expression/arrayToObject.yaml @@ -0,0 +1,50 @@ +# $schema: ../schema.json +name: $arrayToObject +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/arrayToObject/' +type: + - resolvesToObject +encode: array +description: | + Converts an array of key value pairs to a document. +arguments: + - + name: array + type: + - resolvesToArray +tests: + - + name: '$arrayToObject Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/arrayToObject/#-arraytoobject--example' + pipeline: + - + $project: + item: 1 + dimensions: + # Example uses the short form, the builder always generates the verbose form + # $arrayToObject: '$dimensions' + $arrayToObject: + - '$dimensions' + - + name: '$objectToArray and $arrayToObject Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/arrayToObject/#-objecttoarray----arraytoobject-example' + pipeline: + - + $addFields: + instock: + $objectToArray: '$instock' + - + $addFields: + instock: + $concatArrays: + - '$instock' + - + - + k: 'total' + v: + $sum: + - '$instock.v' + - + $addFields: + instock: + $arrayToObject: + - '$instock' diff --git a/generator/config/expression/asin.yaml b/generator/config/expression/asin.yaml new file mode 100644 index 000000000..43e2832a2 --- /dev/null +++ b/generator/config/expression/asin.yaml @@ -0,0 +1,31 @@ +# $schema: ../schema.json +name: $asin +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/asin/' +type: + - resolvesToDouble + - resolvesToDecimal +encode: single +description: | + Returns the inverse sin (arc sine) of a value in radians. +arguments: + - + name: expression + type: + - resolvesToNumber + description: | + $asin takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + $asin returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + By default $asin returns values as a double. $asin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/asin/#example' + pipeline: + - + $addFields: + angle_a: + $radiansToDegrees: + $asin: + $divide: + - '$side_a' + - '$hypotenuse' diff --git a/generator/config/expression/asinh.yaml b/generator/config/expression/asinh.yaml new file mode 100644 index 000000000..6d45c14fa --- /dev/null +++ b/generator/config/expression/asinh.yaml @@ -0,0 +1,28 @@ +# $schema: ../schema.json +name: $asinh +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/asinh/' +type: + - resolvesToDouble + - resolvesToDecimal +encode: single +description: | + Returns the inverse hyperbolic sine (hyperbolic arc sine) of a value in radians. +arguments: + - + name: expression + type: + - resolvesToNumber + description: | + $asinh takes any valid expression that resolves to a number. + $asinh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + By default $asinh returns values as a double. $asinh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/asinh/#example' + pipeline: + - + $addFields: + y-coordinate: + $radiansToDegrees: + $asinh: '$x-coordinate' diff --git a/generator/config/expression/atan.yaml b/generator/config/expression/atan.yaml new file mode 100644 index 000000000..a8bb1674f --- /dev/null +++ b/generator/config/expression/atan.yaml @@ -0,0 +1,31 @@ +# $schema: ../schema.json +name: $atan +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/atan/' +type: + - resolvesToDouble + - resolvesToDecimal +encode: single +description: | + Returns the inverse tangent (arc tangent) of a value in radians. +arguments: + - + name: expression + type: + - resolvesToNumber + description: | + $atan takes any valid expression that resolves to a number. + $atan returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + By default $atan returns values as a double. $atan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/atan/#example' + pipeline: + - + $addFields: + angle_a: + $radiansToDegrees: + $atan: + $divide: + - '$side_b' + - '$side_a' diff --git a/generator/config/expression/atan2.yaml b/generator/config/expression/atan2.yaml new file mode 100644 index 000000000..1abc55e6a --- /dev/null +++ b/generator/config/expression/atan2.yaml @@ -0,0 +1,34 @@ +# $schema: ../schema.json +name: $atan2 +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/atan2/' +type: + - resolvesToDouble + - resolvesToDecimal +encode: array +description: | + Returns the inverse tangent (arc tangent) of y / x in radians, where y and x are the first and second values passed to the expression respectively. +arguments: + - + name: 'y' + type: + - resolvesToNumber + description: | + $atan2 takes any valid expression that resolves to a number. + $atan2 returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + By default $atan returns values as a double. $atan2 can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + - + name: x + type: + - resolvesToNumber +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/atan2/#example' + pipeline: + - + $addFields: + angle_a: + $radiansToDegrees: + $atan2: + - '$side_b' + - '$side_a' diff --git a/generator/config/expression/atanh.yaml b/generator/config/expression/atanh.yaml new file mode 100644 index 000000000..501fba2bf --- /dev/null +++ b/generator/config/expression/atanh.yaml @@ -0,0 +1,28 @@ +# $schema: ../schema.json +name: $atanh +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/atanh/' +type: + - resolvesToDouble + - resolvesToDecimal +encode: single +description: | + Returns the inverse hyperbolic tangent (hyperbolic arc tangent) of a value in radians. +arguments: + - + name: expression + type: + - resolvesToNumber + description: | + $atanh takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + $atanh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + By default $atanh returns values as a double. $atanh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/atanh/#example' + pipeline: + - + $addFields: + y-coordinate: + $radiansToDegrees: + $atanh: '$x-coordinate' diff --git a/generator/config/expression/avg.yaml b/generator/config/expression/avg.yaml new file mode 100644 index 000000000..3bb771936 --- /dev/null +++ b/generator/config/expression/avg.yaml @@ -0,0 +1,35 @@ +# $schema: ../schema.json +name: $avg +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/' +type: + - resolvesToNumber +encode: single +description: | + Returns an average of numerical values. Ignores non-numeric values. + Changed in MongoDB 5.0: Available in the $setWindowFields stage. +arguments: + - + name: expression + type: + - resolvesToNumber + variadic: array +tests: + - + name: 'Use in $project Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/#use-in--project-stage' + pipeline: + - + $project: + quizAvg: + # Example uses the short form, the builder always generates the verbose form + # $avg: '$quizzes' + $avg: + - '$quizzes' + labAvg: + # $avg: '$labs' + $avg: + - '$labs' + examAvg: + $avg: + - '$final' + - '$midterm' diff --git a/generator/config/expression/binarySize.yaml b/generator/config/expression/binarySize.yaml new file mode 100644 index 000000000..eb0146f8c --- /dev/null +++ b/generator/config/expression/binarySize.yaml @@ -0,0 +1,25 @@ +# $schema: ../schema.json +name: $binarySize +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/binarySize/' +type: + - resolvesToInt +encode: single +description: | + Returns the size of a given string or binary data value's content in bytes. +arguments: + - + name: expression + type: + - resolvesToString + - resolvesToBinData + - resolvesToNull +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/binarySize/#example' + pipeline: + - + $project: + name: '$name' + imageSize: + $binarySize: '$binary' diff --git a/generator/config/expression/bitAnd.yaml b/generator/config/expression/bitAnd.yaml new file mode 100644 index 000000000..271cc0973 --- /dev/null +++ b/generator/config/expression/bitAnd.yaml @@ -0,0 +1,38 @@ +# $schema: ../schema.json +name: $bitAnd +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitAnd/' +type: + - resolvesToInt + - resolvesToLong +encode: single +description: | + Returns the result of a bitwise and operation on an array of int or long values. + New in MongoDB 6.3. +arguments: + - + name: expression + type: + - resolvesToInt + - resolvesToLong + variadic: array +tests: + - + name: 'Bitwise AND with Two Integers' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitAnd/#bitwise-and-with-two-integers' + pipeline: + - + $project: + result: + $bitAnd: + - '$a' + - '$b' + - + name: 'Bitwise AND with a Long and Integer' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitAnd/#bitwise-and-with-a-long-and-integer' + pipeline: + - + $project: + result: + $bitAnd: + - '$a' + - { "$numberLong": "63" } diff --git a/generator/config/expression/bitNot.yaml b/generator/config/expression/bitNot.yaml new file mode 100644 index 000000000..5211fa42a --- /dev/null +++ b/generator/config/expression/bitNot.yaml @@ -0,0 +1,25 @@ +# $schema: ../schema.json +name: $bitNot +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitNot/' +type: + - resolvesToInt + - resolvesToLong +encode: single +description: | + Returns the result of a bitwise not operation on a single argument or an array that contains a single int or long value. + New in MongoDB 6.3. +arguments: + - + name: expression + type: + - resolvesToInt + - resolvesToLong +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitNot/#example' + pipeline: + - + $project: + result: + $bitNot: '$a' diff --git a/generator/config/expression/bitOr.yaml b/generator/config/expression/bitOr.yaml new file mode 100644 index 000000000..084ac224c --- /dev/null +++ b/generator/config/expression/bitOr.yaml @@ -0,0 +1,38 @@ +# $schema: ../schema.json +name: $bitOr +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitOr/' +type: + - resolvesToInt + - resolvesToLong +encode: single +description: | + Returns the result of a bitwise or operation on an array of int or long values. + New in MongoDB 6.3. +arguments: + - + name: expression + type: + - resolvesToInt + - resolvesToLong + variadic: array +tests: + - + name: 'Bitwise OR with Two Integers' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitOr/#bitwise-or-with-two-integers' + pipeline: + - + $project: + result: + $bitOr: + - '$a' + - '$b' + - + name: 'Bitwise OR with a Long and Integer' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitOr/#bitwise-or-with-a-long-and-integer' + pipeline: + - + $project: + result: + $bitOr: + - '$a' + - { "$numberLong": "63" } diff --git a/generator/config/expression/bitXor.yaml b/generator/config/expression/bitXor.yaml new file mode 100644 index 000000000..f4acc4df4 --- /dev/null +++ b/generator/config/expression/bitXor.yaml @@ -0,0 +1,28 @@ +# $schema: ../schema.json +name: $bitXor +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitXor/' +type: + - resolvesToInt + - resolvesToLong +encode: single +description: | + Returns the result of a bitwise xor (exclusive or) operation on an array of int and long values. + New in MongoDB 6.3. +arguments: + - + name: expression + type: + - resolvesToInt + - resolvesToLong + variadic: array +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitXor/#example' + pipeline: + - + $project: + result: + $bitXor: + - '$a' + - '$b' diff --git a/generator/config/expression/bsonSize.yaml b/generator/config/expression/bsonSize.yaml new file mode 100644 index 000000000..712188c52 --- /dev/null +++ b/generator/config/expression/bsonSize.yaml @@ -0,0 +1,48 @@ +# $schema: ../schema.json +name: $bsonSize +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bsonSize/' +type: + - resolvesToInt +encode: single +description: | + Returns the size in bytes of a given document (i.e. BSON type Object) when encoded as BSON. +arguments: + - + name: object + type: + - resolvesToObject + - resolvesToNull +tests: + - + name: 'Return Sizes of Documents' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bsonSize/#return-sizes-of-documents' + pipeline: + - + $project: + name: 1 + object_size: + $bsonSize: '$$ROOT' + - + name: 'Return Combined Size of All Documents in a Collection' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bsonSize/#return-combined-size-of-all-documents-in-a-collection' + pipeline: + - + $group: + _id: ~ + combined_object_size: + $sum: + $bsonSize: '$$ROOT' + - + name: 'Return Document with Largest Specified Field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bsonSize/#return-document-with-largest-specified-field' + pipeline: + - + $project: + name: '$name' + task_object_size: + $bsonSize: '$current_task' + - + $sort: + task_object_size: -1 + - + $limit: 1 diff --git a/generator/config/expression/case.yaml b/generator/config/expression/case.yaml new file mode 100644 index 000000000..ccf463c90 --- /dev/null +++ b/generator/config/expression/case.yaml @@ -0,0 +1,22 @@ +# $schema: ../schema.json +name: $case +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/switch/' +type: + - switchBranch +encode: object +wrapObject: false +description: | + Represents a single case in a $switch expression +arguments: + - + name: case + type: + - resolvesToBool + description: | + Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. + - + name: then + type: + - expression + description: | + Can be any valid expression. diff --git a/generator/config/expression/ceil.yaml b/generator/config/expression/ceil.yaml new file mode 100644 index 000000000..73c31ddb7 --- /dev/null +++ b/generator/config/expression/ceil.yaml @@ -0,0 +1,25 @@ +# $schema: ../schema.json +name: $ceil +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/ceil/' +type: + - resolvesToInt +encode: single +description: | + Returns the smallest integer greater than or equal to the specified number. +arguments: + - + name: expression + type: + - resolvesToNumber + description: | + If the argument resolves to a value of null or refers to a field that is missing, $ceil returns null. If the argument resolves to NaN, $ceil returns NaN. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/ceil/#example' + pipeline: + - + $project: + value: 1 + ceilingValue: + $ceil: '$value' diff --git a/generator/config/expression/cmp.yaml b/generator/config/expression/cmp.yaml new file mode 100644 index 000000000..dd24f9839 --- /dev/null +++ b/generator/config/expression/cmp.yaml @@ -0,0 +1,31 @@ +# $schema: ../schema.json +name: $cmp +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/cmp/' +type: + - resolvesToInt +encode: array +description: | + Returns 0 if the two values are equivalent, 1 if the first value is greater than the second, and -1 if the first value is less than the second. +arguments: + - + name: expression1 + type: + - expression + - + name: expression2 + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/cmp/#example' + pipeline: + - + $project: + item: 1 + qty: 1 + cmpTo250: + $cmp: + - '$qty' + - 250 + _id: 0 diff --git a/generator/config/expression/concat.yaml b/generator/config/expression/concat.yaml new file mode 100644 index 000000000..e8b218d82 --- /dev/null +++ b/generator/config/expression/concat.yaml @@ -0,0 +1,26 @@ +# $schema: ../schema.json +name: $concat +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/concat/' +type: + - resolvesToString +encode: single +description: | + Concatenates any number of strings. +arguments: + - + name: expression + type: + - resolvesToString + variadic: array +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/concat/#examples' + pipeline: + - + $project: + itemDescription: + $concat: + - '$item' + - ' - ' + - '$description' diff --git a/generator/config/expression/concatArrays.yaml b/generator/config/expression/concatArrays.yaml new file mode 100644 index 000000000..026541092 --- /dev/null +++ b/generator/config/expression/concatArrays.yaml @@ -0,0 +1,25 @@ +# $schema: ../schema.json +name: $concatArrays +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/concatArrays/' +type: + - resolvesToArray +encode: single +description: | + Concatenates arrays to return the concatenated array. +arguments: + - + name: array + type: + - resolvesToArray + variadic: array +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/concatArrays/#example' + pipeline: + - + $project: + items: + $concatArrays: + - '$instock' + - '$ordered' diff --git a/generator/config/expression/cond.yaml b/generator/config/expression/cond.yaml new file mode 100644 index 000000000..e2fd66ad7 --- /dev/null +++ b/generator/config/expression/cond.yaml @@ -0,0 +1,37 @@ +# $schema: ../schema.json +name: $cond +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/cond/' +type: + - resolvesToAny +encode: object +description: | + A ternary operator that evaluates one expression, and depending on the result, returns the value of one of the other two expressions. Accepts either three expressions in an ordered list or three named parameters. +arguments: + - + name: if + type: + - resolvesToBool + - + name: then + type: + - expression + - + name: else + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/cond/#example' + pipeline: + - + $project: + item: 1 + discount: + $cond: + if: + $gte: + - '$qty' + - 250 + then: 30 + else: 20 diff --git a/generator/config/expression/convert.yaml b/generator/config/expression/convert.yaml new file mode 100644 index 000000000..a76311ed5 --- /dev/null +++ b/generator/config/expression/convert.yaml @@ -0,0 +1,82 @@ +# $schema: ../schema.json +name: $convert +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/convert/' +type: + - resolvesToAny +encode: object +description: | + Converts a value to a specified type. + New in MongoDB 4.0. +arguments: + - + name: input + type: + - expression + - + name: to + type: + - resolvesToString + - resolvesToInt + - + name: onError + type: + - expression + optional: true + description: | + The value to return on encountering an error during conversion, including unsupported type conversions. The arguments can be any valid expression. + If unspecified, the operation throws an error upon encountering an error and stops. + - + name: onNull + type: + - expression + optional: true + description: | + The value to return if the input is null or missing. The arguments can be any valid expression. + If unspecified, $convert returns null if the input is null or missing. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/convert/#example' + pipeline: + - + $addFields: + convertedPrice: + $convert: + input: '$price' + to: 'decimal' + onError: 'Error' + onNull: !bson_decimal128 '0' + convertedQty: + $convert: + input: '$qty' + to: 'int' + onError: + $concat: + - 'Could not convert ' + - + $toString: '$qty' + - ' to type integer.' + onNull: 0 + - + $project: + totalPrice: + $switch: + branches: + - + case: + $eq: + - + $type: '$convertedPrice' + - 'string' + then: 'NaN' + - + case: + $eq: + - + $type: '$convertedQty' + - 'string' + then: 'NaN' + default: + $multiply: + - '$convertedPrice' + - '$convertedQty' diff --git a/generator/config/expression/cos.yaml b/generator/config/expression/cos.yaml new file mode 100644 index 000000000..0b47670cf --- /dev/null +++ b/generator/config/expression/cos.yaml @@ -0,0 +1,30 @@ +# $schema: ../schema.json +name: $cos +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/cos/' +type: + - resolvesToDouble + - resolvesToDecimal +encode: single +description: | + Returns the cosine of a value that is measured in radians. +arguments: + - + name: expression + type: + - resolvesToNumber + description: | + $cos takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + By default $cos returns values as a double. $cos can also return values as a 128-bit decimal as long as the resolves to a 128-bit decimal value. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/cos/#example' + pipeline: + - + $addFields: + side_a: + $multiply: + - + $cos: + $degreesToRadians: '$angle_a' + - '$hypotenuse' diff --git a/generator/config/expression/cosh.yaml b/generator/config/expression/cosh.yaml new file mode 100644 index 000000000..419fa8caa --- /dev/null +++ b/generator/config/expression/cosh.yaml @@ -0,0 +1,27 @@ +# $schema: ../schema.json +name: $cosh +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/cosh/' +type: + - resolvesToDouble + - resolvesToDecimal +encode: single +description: | + Returns the hyperbolic cosine of a value that is measured in radians. +arguments: + - + name: expression + type: + - resolvesToNumber + description: | + $cosh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + By default $cosh returns values as a double. $cosh can also return values as a 128-bit decimal if the resolves to a 128-bit decimal value. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/cosh/#example' + pipeline: + - + $addFields: + cosh_output: + $cosh: + $degreesToRadians: '$angle' diff --git a/generator/config/expression/createObjectId.yaml b/generator/config/expression/createObjectId.yaml new file mode 100644 index 000000000..bab85d7f7 --- /dev/null +++ b/generator/config/expression/createObjectId.yaml @@ -0,0 +1,17 @@ +# $schema: ../schema.json +name: $createObjectId +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/createObjectId/' +type: + - resolvesToObjectId +encode: object +description: | + Returns a random object ID +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/createObjectId/#example' + pipeline: + - + $project: + objectId: + $createObjectId: {} diff --git a/generator/config/expression/dateAdd.yaml b/generator/config/expression/dateAdd.yaml new file mode 100644 index 000000000..c7d85d571 --- /dev/null +++ b/generator/config/expression/dateAdd.yaml @@ -0,0 +1,133 @@ +# $schema: ../schema.json +name: $dateAdd +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateAdd/' +type: + - resolvesToDate +encode: object +description: | + Adds a number of time units to a date object. +arguments: + - + name: startDate + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: unit + type: + - timeUnit + description: | + The unit used to measure the amount of time added to the startDate. + - + name: amount + type: + - resolvesToInt + - resolvesToLong + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Add a Future Date' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateAdd/#add-a-future-date' + pipeline: + - + $project: + expectedDeliveryDate: + $dateAdd: + startDate: '$purchaseDate' + unit: 'day' + amount: 3 + - + # Example uses the short form, the builder always generates the verbose form + # $merge: 'shipping' + $merge: + into: 'shipping' + - + name: 'Filter on a Date Range' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateAdd/#filter-on-a-date-range' + pipeline: + - + $match: + $expr: + $gt: + - '$deliveryDate' + - + $dateAdd: + startDate: '$purchaseDate' + unit: 'day' + amount: 5 + - + $project: + _id: 0 + custId: 1 + purchased: + $dateToString: + format: '%Y-%m-%d' + date: '$purchaseDate' + delivery: + $dateToString: + format: '%Y-%m-%d' + date: '$deliveryDate' + - + name: 'Adjust for Daylight Savings Time' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateAdd/#adjust-for-daylight-savings-time' + pipeline: + - + $project: + _id: 0 + location: 1 + start: + $dateToString: + format: '%Y-%m-%d %H:%M' + date: '$login' + days: + $dateToString: + format: '%Y-%m-%d %H:%M' + date: + $dateAdd: + startDate: '$login' + unit: 'day' + amount: 1 + timezone: '$location' + hours: + $dateToString: + format: '%Y-%m-%d %H:%M' + date: + $dateAdd: + startDate: '$login' + unit: 'hour' + amount: 24 + timezone: '$location' + startTZInfo: + $dateToString: + format: '%Y-%m-%d %H:%M' + date: '$login' + timezone: '$location' + daysTZInfo: + $dateToString: + format: '%Y-%m-%d %H:%M' + date: + $dateAdd: + startDate: '$login' + unit: 'day' + amount: 1 + timezone: '$location' + timezone: '$location' + hoursTZInfo: + $dateToString: + format: '%Y-%m-%d %H:%M' + date: + $dateAdd: + startDate: '$login' + unit: 'hour' + amount: 24 + timezone: '$location' + timezone: '$location' diff --git a/generator/config/expression/dateDiff.yaml b/generator/config/expression/dateDiff.yaml new file mode 100644 index 000000000..42cb55d15 --- /dev/null +++ b/generator/config/expression/dateDiff.yaml @@ -0,0 +1,114 @@ +# $schema: ../schema.json +name: $dateDiff +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateDiff/' +type: + - resolvesToInt +encode: object +description: | + Returns the difference between two dates. +arguments: + - + name: startDate + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The start of the time period. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: endDate + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The end of the time period. The endDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: unit + type: + - timeUnit + description: | + The time measurement unit between the startDate and endDate + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + - + name: startOfWeek + type: + - resolvesToString + optional: true + description: | + Used when the unit is equal to week. Defaults to Sunday. The startOfWeek parameter is an expression that resolves to a case insensitive string +tests: + - + name: 'Elapsed Time' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateDiff/#elapsed-time' + pipeline: + - + $group: + _id: ~ + averageTime: + $avg: + $dateDiff: + startDate: '$purchased' + endDate: '$delivered' + unit: 'day' + - + $project: + _id: 0 + numDays: + $trunc: + - '$averageTime' + - 1 + - + name: 'Result Precision' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateDiff/#result-precision' + pipeline: + - + $project: + Start: '$start' + End: '$end' + years: + $dateDiff: + startDate: '$start' + endDate: '$end' + unit: 'year' + months: + $dateDiff: + startDate: '$start' + endDate: '$end' + unit: 'month' + days: + $dateDiff: + startDate: '$start' + endDate: '$end' + unit: 'day' + _id: 0 + - + name: 'Weeks Per Month' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateDiff/#weeks-per-month' + pipeline: + - + $project: + wks_default: + $dateDiff: + startDate: '$start' + endDate: '$end' + unit: 'week' + wks_monday: + $dateDiff: + startDate: '$start' + endDate: '$end' + unit: 'week' + startOfWeek: 'Monday' + wks_friday: + $dateDiff: + startDate: '$start' + endDate: '$end' + unit: 'week' + startOfWeek: 'fri' + _id: 0 diff --git a/generator/config/expression/dateFromParts.yaml b/generator/config/expression/dateFromParts.yaml new file mode 100644 index 000000000..3ed35004e --- /dev/null +++ b/generator/config/expression/dateFromParts.yaml @@ -0,0 +1,114 @@ +# $schema: ../schema.json +name: $dateFromParts +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateFromParts/' +type: + - resolvesToDate +encode: object +description: | + Constructs a BSON Date object given the date's constituent parts. +arguments: + - + name: year + type: + - resolvesToNumber + optional: true + description: | + Calendar year. Can be any expression that evaluates to a number. + - + name: isoWeekYear + type: + - resolvesToNumber + optional: true + description: | + ISO Week Date Year. Can be any expression that evaluates to a number. + - + name: month + type: + - resolvesToNumber + optional: true + description: | + Month. Defaults to 1. + - + name: isoWeek + type: + - resolvesToNumber + optional: true + description: | + Week of year. Defaults to 1. + - + name: day + type: + - resolvesToNumber + optional: true + description: | + Day of month. Defaults to 1. + - + name: isoDayOfWeek + type: + - resolvesToNumber + optional: true + description: | + Day of week (Monday 1 - Sunday 7). Defaults to 1. + - + name: hour + type: + - resolvesToNumber + optional: true + description: | + Hour. Defaults to 0. + - + name: minute + type: + - resolvesToNumber + optional: true + description: | + Minute. Defaults to 0. + - + name: second + type: + - resolvesToNumber + optional: true + description: | + Second. Defaults to 0. + - + name: millisecond + type: + - resolvesToNumber + optional: true + description: | + Millisecond. Defaults to 0. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateFromParts/#example' + pipeline: + - + $project: + date: + $dateFromParts: + year: 2017 + month: 2 + day: 8 + hour: 12 + date_iso: + $dateFromParts: + isoWeekYear: 2017 + isoWeek: 6 + isoDayOfWeek: 3 + hour: 12 + date_timezone: + $dateFromParts: + year: 2016 + month: 12 + day: 31 + hour: 23 + minute: 46 + second: 12 + timezone: 'America/New_York' diff --git a/generator/config/expression/dateFromString.yaml b/generator/config/expression/dateFromString.yaml new file mode 100644 index 000000000..713200f5d --- /dev/null +++ b/generator/config/expression/dateFromString.yaml @@ -0,0 +1,80 @@ +# $schema: ../schema.json +name: $dateFromString +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateFromString/' +type: + - resolvesToDate +encode: object +description: | + Converts a date/time string to a date object. +arguments: + - + name: dateString + type: + - resolvesToString + description: | + The date/time string to convert to a date object. + - + name: format + type: + - resolvesToString + optional: true + description: | + The date format specification of the dateString. The format can be any expression that evaluates to a string literal, containing 0 or more format specifiers. + If unspecified, $dateFromString uses "%Y-%m-%dT%H:%M:%S.%LZ" as the default format but accepts a variety of formats and attempts to parse the dateString if possible. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The time zone to use to format the date. + - + name: onError + type: + - expression + optional: true + description: | + If $dateFromString encounters an error while parsing the given dateString, it outputs the result value of the provided onError expression. This result value can be of any type. + If you do not specify onError, $dateFromString throws an error if it cannot parse dateString. + - + name: onNull + type: + - expression + optional: true + description: | + If the dateString provided to $dateFromString is null or missing, it outputs the result value of the provided onNull expression. This result value can be of any type. + If you do not specify onNull and dateString is null or missing, then $dateFromString outputs null. +tests: + - + name: 'Converting Dates' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateFromString/#converting-dates' + pipeline: + - + $project: + date: + $dateFromString: + dateString: '$date' + timezone: 'America/New_York' + - + name: 'onError' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateFromString/#onerror' + pipeline: + - + $project: + date: + $dateFromString: + dateString: '$date' + timezone: '$timezone' + onError: '$date' + - + name: 'onNull' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateFromString/#onnull' + pipeline: + - + $project: + date: + $dateFromString: + dateString: '$date' + timezone: '$timezone' + onNull: !bson_utcdatetime 0 + diff --git a/generator/config/expression/dateSubtract.yaml b/generator/config/expression/dateSubtract.yaml new file mode 100644 index 000000000..e463fe8f8 --- /dev/null +++ b/generator/config/expression/dateSubtract.yaml @@ -0,0 +1,139 @@ +# $schema: ../schema.json +name: $dateSubtract +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateSubtract/' +type: + - resolvesToDate +encode: object +description: | + Subtracts a number of time units from a date object. +arguments: + - + name: startDate + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: unit + type: + - timeUnit + description: | + The unit used to measure the amount of time added to the startDate. + - + name: amount + type: + - resolvesToInt + - resolvesToLong + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Subtract A Fixed Amount' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateSubtract/#subtract-a-fixed-amount' + pipeline: + - + $match: + $expr: + $eq: + - + # Example uses the short form, the builder always generates the verbose form + # $month: '$logout' + $month: + date: '$logout' + - 1 + - + $project: + logoutTime: + $dateSubtract: + startDate: '$logout' + unit: 'hour' + amount: 3 + - + # Example uses the short form, the builder always generates the verbose form + # $merge: 'connectionTime' + $merge: + into: 'connectionTime' + - + name: 'Filter by Relative Dates' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateSubtract/#filter-by-relative-dates' + pipeline: + - + $match: + $expr: + $gt: + - '$logoutTime' + - + $dateSubtract: + startDate: '$$NOW' + unit: 'week' + amount: 1 + - + $project: + _id: 0 + custId: 1 + loggedOut: + $dateToString: + format: '%Y-%m-%d' + date: '$logoutTime' + - + name: 'Adjust for Daylight Savings Time' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateSubtract/#adjust-for-daylight-savings-time' + pipeline: + - + $project: + _id: 0 + location: 1 + start: + $dateToString: + format: '%Y-%m-%d %H:%M' + date: '$login' + days: + $dateToString: + format: '%Y-%m-%d %H:%M' + date: + $dateSubtract: + startDate: '$login' + unit: 'day' + amount: 1 + timezone: '$location' + hours: + $dateToString: + format: '%Y-%m-%d %H:%M' + date: + $dateSubtract: + startDate: '$login' + unit: 'hour' + amount: 24 + timezone: '$location' + startTZInfo: + $dateToString: + format: '%Y-%m-%d %H:%M' + date: '$login' + timezone: '$location' + daysTZInfo: + $dateToString: + format: '%Y-%m-%d %H:%M' + date: + $dateSubtract: + startDate: '$login' + unit: 'day' + amount: 1 + timezone: '$location' + timezone: '$location' + hoursTZInfo: + $dateToString: + format: '%Y-%m-%d %H:%M' + date: + $dateSubtract: + startDate: '$login' + unit: 'hour' + amount: 24 + timezone: '$location' + timezone: '$location' diff --git a/generator/config/expression/dateToParts.yaml b/generator/config/expression/dateToParts.yaml new file mode 100644 index 000000000..d250e052f --- /dev/null +++ b/generator/config/expression/dateToParts.yaml @@ -0,0 +1,49 @@ +# $schema: ../schema.json +name: $dateToParts +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateToParts/' +type: + - resolvesToObject +encode: object +description: | + Returns a document containing the constituent parts of a date. +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The input date for which to return parts. date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + - + name: iso8601 + type: + - bool + optional: true + description: | + If set to true, modifies the output document to use ISO week date fields. Defaults to false. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateToParts/#example' + pipeline: + - + $project: + date: + $dateToParts: + date: '$date' + date_iso: + $dateToParts: + date: '$date' + iso8601: true + date_timezone: + $dateToParts: + date: '$date' + timezone: 'America/New_York' diff --git a/generator/config/expression/dateToString.yaml b/generator/config/expression/dateToString.yaml new file mode 100644 index 000000000..29e0ea8c8 --- /dev/null +++ b/generator/config/expression/dateToString.yaml @@ -0,0 +1,81 @@ +# $schema: ../schema.json +name: $dateToString +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateToString/' +type: + - resolvesToString +encode: object +description: | + Returns the date as a formatted string. +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The date to convert to string. Must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: format + type: + - resolvesToString + optional: true + description: | + The date format specification of the dateString. The format can be any expression that evaluates to a string literal, containing 0 or more format specifiers. + If unspecified, $dateFromString uses "%Y-%m-%dT%H:%M:%S.%LZ" as the default format but accepts a variety of formats and attempts to parse the dateString if possible. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The time zone to use to format the date. + - + name: onNull + type: + - expression + optional: true + description: | + The value to return if the date is null or missing. + If unspecified, $dateToString returns null if the date is null or missing. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateToString/#example' + pipeline: + - + $project: + yearMonthDayUTC: + $dateToString: + format: '%Y-%m-%d' + date: '$date' + timewithOffsetNY: + $dateToString: + format: '%H:%M:%S:%L%z' + date: '$date' + timezone: 'America/New_York' + timewithOffset430: + $dateToString: + format: '%H:%M:%S:%L%z' + date: '$date' + timezone: '+04:30' + minutesOffsetNY: + $dateToString: + format: '%Z' + date: '$date' + timezone: 'America/New_York' + minutesOffset430: + $dateToString: + format: '%Z' + date: '$date' + timezone: '+04:30' + abbreviated_month: + $dateToString: + format: '%b' + date: '$date' + timezone: '+04:30' + full_month: + $dateToString: + format: '%B' + date: '$date' + timezone: '+04:30' diff --git a/generator/config/expression/dateTrunc.yaml b/generator/config/expression/dateTrunc.yaml new file mode 100644 index 000000000..aa3dcd6ca --- /dev/null +++ b/generator/config/expression/dateTrunc.yaml @@ -0,0 +1,77 @@ +# $schema: ../schema.json +name: $dateTrunc +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateTrunc/' +type: + - resolvesToDate +encode: object +description: | + Truncates a date. +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The date to truncate, specified in UTC. The date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: unit + type: + - timeUnit + description: | + The unit of time, specified as an expression that must resolve to one of these strings: year, quarter, week, month, day, hour, minute, second. + Together, binSize and unit specify the time period used in the $dateTrunc calculation. + - + name: binSize + type: + - resolvesToNumber + optional: true + description: | + The numeric time value, specified as an expression that must resolve to a positive non-zero number. Defaults to 1. + Together, binSize and unit specify the time period used in the $dateTrunc calculation. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + - + name: startOfWeek + type: + - string + optional: true + description: | + The start of the week. Used when + unit is week. Defaults to Sunday. +tests: + - + name: 'Truncate Order Dates in a $project Pipeline Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateTrunc/#truncate-order-dates-in-a--project-pipeline-stage' + pipeline: + - + $project: + _id: 1 + orderDate: 1 + truncatedOrderDate: + $dateTrunc: + date: '$orderDate' + unit: 'week' + binSize: 2 + timezone: 'America/Los_Angeles' + startOfWeek: 'Monday' + - + name: 'Truncate Order Dates and Obtain Quantity Sum in a $group Pipeline Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateTrunc/#truncate-order-dates-and-obtain-quantity-sum-in-a--group-pipeline-stage' + pipeline: + - + $group: + _id: + truncatedOrderDate: + $dateTrunc: + date: '$orderDate' + unit: 'month' + binSize: 6 + sumQuantity: + $sum: '$quantity' diff --git a/generator/config/expression/dayOfMonth.yaml b/generator/config/expression/dayOfMonth.yaml new file mode 100644 index 000000000..46a4de0b7 --- /dev/null +++ b/generator/config/expression/dayOfMonth.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $dayOfMonth +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfMonth/' +type: + - resolvesToInt +encode: object +description: | + Returns the day of the month for a date as a number between 1 and 31. +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfMonth/#example' + pipeline: + - + $project: + day: + # Example uses the short form, the builder always generates the verbose form + # $dayOfMonth: '$date' + $dayOfMonth: + date: '$date' diff --git a/generator/config/expression/dayOfWeek.yaml b/generator/config/expression/dayOfWeek.yaml new file mode 100644 index 000000000..27a6a809d --- /dev/null +++ b/generator/config/expression/dayOfWeek.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $dayOfWeek +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfWeek/' +type: + - resolvesToInt +encode: object +description: | + Returns the day of the week for a date as a number between 1 (Sunday) and 7 (Saturday). +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfWeek/#example' + pipeline: + - + $project: + dayOfWeek: + # Example uses the short form, the builder always generates the verbose form + # $dayOfWeek: '$date' + $dayOfWeek: + date: '$date' diff --git a/generator/config/expression/dayOfYear.yaml b/generator/config/expression/dayOfYear.yaml new file mode 100644 index 000000000..8caa0374d --- /dev/null +++ b/generator/config/expression/dayOfYear.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $dayOfYear +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfYear/' +type: + - resolvesToInt +encode: object +description: | + Returns the day of the year for a date as a number between 1 and 366 (leap year). +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfYear/#example' + pipeline: + - + $project: + dayOfYear: + # Example uses the short form, the builder always generates the verbose form + # $dayOfYear: '$date' + $dayOfYear: + date: '$date' diff --git a/generator/config/expression/degreesToRadians.yaml b/generator/config/expression/degreesToRadians.yaml new file mode 100644 index 000000000..59c18d2e3 --- /dev/null +++ b/generator/config/expression/degreesToRadians.yaml @@ -0,0 +1,30 @@ +# $schema: ../schema.json +name: $degreesToRadians +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/degreesToRadians/' +type: + - resolvesToDouble + - resolvesToDecimal +encode: single +description: | + Converts a value from degrees to radians. +arguments: + - + name: expression + type: + - resolvesToNumber + description: | + $degreesToRadians takes any valid expression that resolves to a number. + By default $degreesToRadians returns values as a double. $degreesToRadians can also return values as a 128-bit decimal as long as the resolves to a 128-bit decimal value. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/degreesToRadians/#example' + pipeline: + - + $addFields: + angle_a_rad: + $degreesToRadians: '$angle_a' + angle_b_rad: + $degreesToRadians: '$angle_b' + angle_c_rad: + $degreesToRadians: '$angle_c' diff --git a/generator/config/expression/divide.yaml b/generator/config/expression/divide.yaml new file mode 100644 index 000000000..3b69389d8 --- /dev/null +++ b/generator/config/expression/divide.yaml @@ -0,0 +1,31 @@ +# $schema: ../schema.json +name: $divide +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/divide/' +type: + - resolvesToDouble +encode: array +description: | + Returns the result of dividing the first number by the second. Accepts two argument expressions. +arguments: + - + name: dividend + type: + - resolvesToNumber + description: | + The first argument is the dividend, and the second argument is the divisor; i.e. the first argument is divided by the second argument. + - + name: divisor + type: + - resolvesToNumber +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/divide/#example' + pipeline: + - + $project: + city: 1 + workdays: + $divide: + - '$hours' + - 8 diff --git a/generator/config/expression/eq.yaml b/generator/config/expression/eq.yaml new file mode 100644 index 000000000..009280ba1 --- /dev/null +++ b/generator/config/expression/eq.yaml @@ -0,0 +1,31 @@ +# $schema: ../schema.json +name: $eq +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/eq/' +type: + - resolvesToBool +encode: array +description: | + Returns true if the values are equivalent. +arguments: + - + name: expression1 + type: + - expression + - + name: expression2 + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/eq/#example' + pipeline: + - + $project: + item: 1 + qty: 1 + qtyEq250: + $eq: + - '$qty' + - 250 + _id: 0 diff --git a/generator/config/expression/exp.yaml b/generator/config/expression/exp.yaml new file mode 100644 index 000000000..d1f6982a1 --- /dev/null +++ b/generator/config/expression/exp.yaml @@ -0,0 +1,25 @@ +# $schema: ../schema.json +name: $exp +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/exp/' +type: + - resolvesToDouble +encode: single +description: | + Raises e to the specified exponent. +arguments: + - + name: exponent + type: + - resolvesToNumber +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/exp/#example' + pipeline: + - + $project: + effectiveRate: + $subtract: + - + $exp: '$interestRate' + - 1 diff --git a/generator/config/expression/filter.yaml b/generator/config/expression/filter.yaml new file mode 100644 index 000000000..0b72f6d75 --- /dev/null +++ b/generator/config/expression/filter.yaml @@ -0,0 +1,94 @@ +# $schema: ../schema.json +name: $filter +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/filter/' +type: + - resolvesToArray +encode: object +description: | + Selects a subset of the array to return an array with only the elements that match the filter condition. +arguments: + - + name: input + type: + - resolvesToArray + - + name: cond + type: + - resolvesToBool + description: | + An expression that resolves to a boolean value used to determine if an element should be included in the output array. The expression references each element of the input array individually with the variable name specified in as. + - + name: as + type: + - string + optional: true + description: | + A name for the variable that represents each individual element of the input array. If no name is specified, the variable name defaults to this. + - + name: limit + type: + - resolvesToInt + optional: true + description: | + A number expression that restricts the number of matching array elements that $filter returns. You cannot specify a limit less than 1. The matching array elements are returned in the order they appear in the input array. + If the specified limit is greater than the number of matching array elements, $filter returns all matching array elements. If the limit is null, $filter returns all matching array elements. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/filter/#examples' + pipeline: + - + $project: + items: + $filter: + input: '$items' + as: 'item' + cond: + $gte: + - '$$item.price' + - 100 + - + name: 'Using the limit field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/filter/#using-the-limit-field' + pipeline: + - + $project: + items: + $filter: + input: '$items' + cond: + $gte: + - '$$item.price' + - 100 + as: 'item' + limit: 1 + - + name: 'limit as a Numeric Expression' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/filter/#limit-as-a-numeric-expression' + pipeline: + - + $project: + items: + $filter: + input: '$items' + cond: + $lte: + - '$$item.price' + - 150 + as: 'item' + limit: 2 + - + name: 'limit Greater than Possible Matches' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/filter/#limit-greater-than-possible-matches' + pipeline: + - + $project: + items: + $filter: + input: '$items' + cond: + $gte: + - '$$item.price' + - 100 + as: 'item' + limit: 5 diff --git a/generator/config/expression/first.yaml b/generator/config/expression/first.yaml new file mode 100644 index 000000000..262d340c3 --- /dev/null +++ b/generator/config/expression/first.yaml @@ -0,0 +1,21 @@ +# $schema: ../schema.json +name: $first +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/first/' +type: + - resolvesToAny +encode: single +description: | + Returns the result of an expression for the first document in an array. +arguments: + - + name: expression + type: + - resolvesToArray +tests: + - + name: 'Use in $addFields Stage' + pipeline: + - + $addFields: + firstItem: + $first: '$items' diff --git a/generator/config/expression/firstN.yaml b/generator/config/expression/firstN.yaml new file mode 100644 index 000000000..e914ff88c --- /dev/null +++ b/generator/config/expression/firstN.yaml @@ -0,0 +1,47 @@ +# $schema: ../schema.json +name: $firstN +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN-array-element/' +type: + - resolvesToArray +encode: object +description: | + Returns a specified number of elements from the beginning of an array. +arguments: + - + name: 'n' + type: + - resolvesToInt + description: | + An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. + - + name: input + type: + - resolvesToArray + description: | + An expression that resolves to the array from which to return n elements. + +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN-array-element/#example' + pipeline: + - + $addFields: + firstScores: + $firstN: + n: 3 + input: '$score' + - + name: 'Using $firstN as an Aggregation Expression' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN/#using--firstn-as-an-aggregation-expression' + pipeline: + - + $documents: + - + array: [10, 20, 30, 40] + - + $project: + firstThreeElements: + $firstN: + input: '$array' + n: 3 diff --git a/generator/config/expression/floor.yaml b/generator/config/expression/floor.yaml new file mode 100644 index 000000000..4c5856264 --- /dev/null +++ b/generator/config/expression/floor.yaml @@ -0,0 +1,23 @@ +# $schema: ../schema.json +name: $floor +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/floor/' +type: + - resolvesToInt +encode: single +description: | + Returns the largest integer less than or equal to the specified number. +arguments: + - + name: expression + type: + - resolvesToNumber +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/floor/#example' + pipeline: + - + $project: + value: 1 + floorValue: + $floor: '$value' diff --git a/generator/config/expression/function.yaml b/generator/config/expression/function.yaml new file mode 100644 index 000000000..fa4dba8b5 --- /dev/null +++ b/generator/config/expression/function.yaml @@ -0,0 +1,74 @@ +# $schema: ../schema.json +name: $function +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/function/' +type: + - resolvesToAny +encode: object +description: | + Defines a custom function. + New in MongoDB 4.4. +arguments: + - + name: body + type: + - javascript + description: | + The function definition. You can specify the function definition as either BSON\JavaScript or string. + function(arg1, arg2, ...) { ... } + - + name: args + type: + - array + description: | + Arguments passed to the function body. If the body function does not take an argument, you can specify an empty array [ ]. + default: [] + - + name: lang + type: + - string + default: js +tests: + - + name: 'Usage Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/function/#example-1--usage-example' + pipeline: + - + $addFields: + isFound: + $function: + body: + $code: |- + function(name) { + return hex_md5(name) == "15b0a220baa16331e8d80e15367677ad" + } + args: + - '$name' + lang: 'js' + message: + $function: + body: + $code: |- + function(name, scores) { + let total = Array.sum(scores); + return `Hello ${name}. Your total score is ${total}.` + } + args: + - '$name' + - '$scores' + lang: 'js' + - + name: 'Alternative to $where' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/function/#example-2--alternative-to--where' + pipeline: + - + $match: + $expr: + $function: + body: + $code: |- + function(name) { + return hex_md5(name) == "15b0a220baa16331e8d80e15367677ad"; + } + args: + - '$name' + lang: 'js' diff --git a/generator/config/expression/getField.yaml b/generator/config/expression/getField.yaml new file mode 100644 index 000000000..04b5d4ace --- /dev/null +++ b/generator/config/expression/getField.yaml @@ -0,0 +1,69 @@ +# $schema: ../schema.json +name: $getField +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/getField/' +type: + - resolvesToAny +encode: object +description: | + Returns the value of a specified field from a document. You can use $getField to retrieve the value of fields with names that contain periods (.) or start with dollar signs ($). + New in MongoDB 5.0. +arguments: + - + name: field + type: + - resolvesToString + description: | + Field in the input object for which you want to return a value. field can be any valid expression that resolves to a string constant. + If field begins with a dollar sign ($), place the field name inside of a $literal expression to return its value. + - + name: input + type: + - expression + optional: true + description: | + Default: $$CURRENT + A valid expression that contains the field for which you want to return a value. input must resolve to an object, missing, null, or undefined. If omitted, defaults to the document currently being processed in the pipeline ($$CURRENT). +tests: + - + name: 'Query Fields that Contain Periods' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/getField/#query-fields-that-contain-periods--.-' + pipeline: + - + $match: + $expr: + $gt: + - + # Example uses the short form, the builder always generates the verbose form + # $getField: 'price.usd' + $getField: + field: 'price.usd' + - 200 + - + name: 'Query Fields that Start with a Dollar Sign' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/getField/#query-fields-that-start-with-a-dollar-sign----' + pipeline: + - + $match: + $expr: + $gt: + - + $getField: + # Example uses the short form, the builder always generates the verbose form + # $literal: '$price' + field: + $literal: '$price' + - 200 + - + name: 'Query a Field in a Sub-document' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/getField/#query-a-field-in-a-sub-document' + pipeline: + - + $match: + $expr: + $lte: + - + $getField: + field: + $literal: '$small' + input: '$quantity' + - 20 diff --git a/generator/config/expression/gt.yaml b/generator/config/expression/gt.yaml new file mode 100644 index 000000000..ddd4dcdd0 --- /dev/null +++ b/generator/config/expression/gt.yaml @@ -0,0 +1,31 @@ +# $schema: ../schema.json +name: $gt +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/gt/' +type: + - resolvesToBool +encode: array +description: | + Returns true if the first value is greater than the second. +arguments: + - + name: expression1 + type: + - expression + - + name: expression2 + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/gt/#example' + pipeline: + - + $project: + item: 1 + qty: 1 + qtyGt250: + $gt: + - '$qty' + - 250 + _id: 0 diff --git a/generator/config/expression/gte.yaml b/generator/config/expression/gte.yaml new file mode 100644 index 000000000..6b456daf6 --- /dev/null +++ b/generator/config/expression/gte.yaml @@ -0,0 +1,31 @@ +# $schema: ../schema.json +name: $gte +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/gte/' +type: + - resolvesToBool +encode: array +description: | + Returns true if the first value is greater than or equal to the second. +arguments: + - + name: expression1 + type: + - expression + - + name: expression2 + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/gte/#example' + pipeline: + - + $project: + item: 1 + qty: 1 + qtyGte250: + $gte: + - '$qty' + - 250 + _id: 0 diff --git a/generator/config/expression/hour.yaml b/generator/config/expression/hour.yaml new file mode 100644 index 000000000..ebd62c3a0 --- /dev/null +++ b/generator/config/expression/hour.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $hour +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/hour/' +type: + - resolvesToInt +encode: object +description: | + Returns the hour for a date as a number between 0 and 23. +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/hour/#example' + pipeline: + - + $project: + hour: + # Example uses the short form, the builder always generates the verbose form + # $hour: '$date' + $hour: + date: '$date' diff --git a/generator/config/expression/ifNull.yaml b/generator/config/expression/ifNull.yaml new file mode 100644 index 000000000..9be8e9044 --- /dev/null +++ b/generator/config/expression/ifNull.yaml @@ -0,0 +1,38 @@ +# $schema: ../schema.json +name: $ifNull +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/ifNull/' +type: + - resolvesToAny +encode: single +description: | + Returns either the non-null result of the first expression or the result of the second expression if the first expression results in a null result. Null result encompasses instances of undefined values or missing fields. Accepts two expressions as arguments. The result of the second expression can be null. +arguments: + - + name: expression + type: + - expression + variadic: array +tests: + - + name: 'Single Input Expression' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/ifNull/#single-input-expression' + pipeline: + - + $project: + item: 1 + description: + $ifNull: + - '$description' + - 'Unspecified' + - + name: 'Multiple Input Expressions' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/ifNull/#multiple-input-expressions' + pipeline: + - + $project: + item: 1 + value: + $ifNull: + - '$description' + - '$quantity' + - 'Unspecified' diff --git a/generator/config/expression/in.yaml b/generator/config/expression/in.yaml new file mode 100644 index 000000000..7cef8c149 --- /dev/null +++ b/generator/config/expression/in.yaml @@ -0,0 +1,33 @@ +# $schema: ../schema.json +name: $in +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/in/' +type: + - resolvesToBool +encode: array +description: | + Returns a boolean indicating whether a specified value is in an array. +arguments: + - + name: expression + type: + - expression + description: | + Any valid expression expression. + - + name: array + type: + - resolvesToArray + description: | + Any valid expression that resolves to an array. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/in/#example' + pipeline: + - + $project: + store location: '$location' + has bananas: + $in: + - 'bananas' + - '$in_stock' diff --git a/generator/config/expression/indexOfArray.yaml b/generator/config/expression/indexOfArray.yaml new file mode 100644 index 000000000..5840ee0fa --- /dev/null +++ b/generator/config/expression/indexOfArray.yaml @@ -0,0 +1,48 @@ +# $schema: ../schema.json +name: $indexOfArray +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfArray/' +type: + - resolvesToInt +encode: array +description: | + Searches an array for an occurrence of a specified value and returns the array index of the first occurrence. Array indexes start at zero. +arguments: + - + name: array + type: + - resolvesToArray + description: | + Can be any valid expression as long as it resolves to an array. + If the array expression resolves to a value of null or refers to a field that is missing, $indexOfArray returns null. + If the array expression does not resolve to an array or null nor refers to a missing field, $indexOfArray returns an error. + - + name: search + type: + - expression + - + name: start + type: + - resolvesToInt + optional: true + description: | + An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + If unspecified, the starting index position for the search is the beginning of the string. + - + name: end + type: + - resolvesToInt + optional: true + description: | + An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + If unspecified, the ending index position for the search is the end of the string. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfArray/#example' + pipeline: + - + $project: + index: + $indexOfArray: + - '$items' + - 2 diff --git a/generator/config/expression/indexOfBytes.yaml b/generator/config/expression/indexOfBytes.yaml new file mode 100644 index 000000000..7fe890891 --- /dev/null +++ b/generator/config/expression/indexOfBytes.yaml @@ -0,0 +1,50 @@ +# $schema: ../schema.json +name: $indexOfBytes +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfBytes/' +type: + - resolvesToInt +encode: array +description: | + Searches a string for an occurrence of a substring and returns the UTF-8 byte index of the first occurrence. If the substring is not found, returns -1. +arguments: + - + name: string + type: + - resolvesToString + description: | + Can be any valid expression as long as it resolves to a string. + If the string expression resolves to a value of null or refers to a field that is missing, $indexOfBytes returns null. + If the string expression does not resolve to a string or null nor refers to a missing field, $indexOfBytes returns an error. + - + name: substring + type: + - resolvesToString + description: | + Can be any valid expression as long as it resolves to a string. + - + name: start + type: + - resolvesToInt + optional: true + description: | + An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + If unspecified, the starting index position for the search is the beginning of the string. + - + name: end + type: + - resolvesToInt + optional: true + description: | + An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + If unspecified, the ending index position for the search is the end of the string. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfBytes/#examples' + pipeline: + - + $project: + byteLocation: + $indexOfBytes: + - '$item' + - 'foo' diff --git a/generator/config/expression/indexOfCP.yaml b/generator/config/expression/indexOfCP.yaml new file mode 100644 index 000000000..88ed55ec6 --- /dev/null +++ b/generator/config/expression/indexOfCP.yaml @@ -0,0 +1,50 @@ +# $schema: ../schema.json +name: $indexOfCP +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfCP/' +type: + - resolvesToInt +encode: array +description: | + Searches a string for an occurrence of a substring and returns the UTF-8 code point index of the first occurrence. If the substring is not found, returns -1 +arguments: + - + name: string + type: + - resolvesToString + description: | + Can be any valid expression as long as it resolves to a string. + If the string expression resolves to a value of null or refers to a field that is missing, $indexOfCP returns null. + If the string expression does not resolve to a string or null nor refers to a missing field, $indexOfCP returns an error. + - + name: substring + type: + - resolvesToString + description: | + Can be any valid expression as long as it resolves to a string. + - + name: start + type: + - resolvesToInt + optional: true + description: | + An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + If unspecified, the starting index position for the search is the beginning of the string. + - + name: end + type: + - resolvesToInt + optional: true + description: | + An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + If unspecified, the ending index position for the search is the end of the string. +tests: + - + name: 'Examples' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfCP/#examples' + pipeline: + - + $project: + cpLocation: + $indexOfCP: + - '$item' + - 'foo' diff --git a/generator/config/expression/isArray.yaml b/generator/config/expression/isArray.yaml new file mode 100644 index 000000000..b9a5d5cb5 --- /dev/null +++ b/generator/config/expression/isArray.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $isArray +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/isArray/' +type: + - resolvesToBool +encode: array +description: | + Determines if the operand is an array. Returns a boolean. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/isArray/#example' + pipeline: + - + $project: + items: + $cond: + if: + $and: + # Example uses the short form, the builder always generates the verbose form + - + $isArray: + - '$instock' + - + $isArray: + - '$ordered' + then: + $concatArrays: + - '$instock' + - '$ordered' + else: 'One or more fields is not an array.' diff --git a/generator/config/expression/isNumber.yaml b/generator/config/expression/isNumber.yaml new file mode 100644 index 000000000..3bce99e99 --- /dev/null +++ b/generator/config/expression/isNumber.yaml @@ -0,0 +1,75 @@ +# $schema: ../schema.json +name: $isNumber +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/isNumber/' +type: + - resolvesToBool +encode: single +description: | + Returns boolean true if the specified expression resolves to an integer, decimal, double, or long. + Returns boolean false if the expression resolves to any other BSON type, null, or a missing field. + New in MongoDB 4.4. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Use $isNumber to Check if a Field is Numeric' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/isNumber/#use--isnumber-to-check-if-a-field-is-numeric' + pipeline: + - + $addFields: + isNumber: + $isNumber: '$reading' + hasType: + $type: '$reading' + - + name: 'Conditionally Modify Fields using $isNumber' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/isNumber/#conditionally-modify-fields-using--isnumber' + pipeline: + - + $addFields: + points: + $cond: + if: + $isNumber: '$grade' + then: '$grade' + else: + $switch: + branches: + - + case: + $eq: + - '$grade' + - 'A' + then: 4 + - + case: + $eq: + - '$grade' + - 'B' + then: 3 + - + case: + $eq: + - '$grade' + - 'C' + then: 2 + - + case: + $eq: + - '$grade' + - 'D' + then: 1 + - + case: + $eq: + - '$grade' + - 'F' + then: 0 + - + $group: + _id: '$student_id' + GPA: + $avg: '$points' diff --git a/generator/config/expression/isoDayOfWeek.yaml b/generator/config/expression/isoDayOfWeek.yaml new file mode 100644 index 000000000..1956ff5c4 --- /dev/null +++ b/generator/config/expression/isoDayOfWeek.yaml @@ -0,0 +1,38 @@ +# $schema: ../schema.json +name: $isoDayOfWeek +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoDayOfWeek/' +type: + - resolvesToInt +encode: object +description: | + Returns the weekday number in ISO 8601 format, ranging from 1 (for Monday) to 7 (for Sunday). +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoDayOfWeek/#example' + pipeline: + - + $project: + _id: 0 + name: '$name' + dayOfWeek: + # Example uses the short form, the builder always generates the verbose form + # $isoDayOfWeek: '$birthday' + $isoDayOfWeek: + date: '$birthday' diff --git a/generator/config/expression/isoWeek.yaml b/generator/config/expression/isoWeek.yaml new file mode 100644 index 000000000..2958a20c3 --- /dev/null +++ b/generator/config/expression/isoWeek.yaml @@ -0,0 +1,38 @@ +# $schema: ../schema.json +name: $isoWeek +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoWeek/' +type: + - resolvesToInt +encode: object +description: | + Returns the week number in ISO 8601 format, ranging from 1 to 53. Week numbers start at 1 with the week (Monday through Sunday) that contains the year's first Thursday. +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoWeek/#example' + pipeline: + - + $project: + _id: 0 + city: '$city' + weekNumber: + # Example uses the short form, the builder always generates the verbose form + # $isoWeek: '$date' + $isoWeek: + date: '$date' diff --git a/generator/config/expression/isoWeekYear.yaml b/generator/config/expression/isoWeekYear.yaml new file mode 100644 index 000000000..5dcefa7dd --- /dev/null +++ b/generator/config/expression/isoWeekYear.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $isoWeekYear +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoWeekYear/' +type: + - resolvesToInt +encode: object +description: | + Returns the year number in ISO 8601 format. The year starts with the Monday of week 1 (ISO 8601) and ends with the Sunday of the last week (ISO 8601). +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoWeekYear/#example' + pipeline: + - + $project: + yearNumber: + # Example uses the short form, the builder always generates the verbose form + # $isoWeekYear: '$date' + $isoWeekYear: + date: '$date' diff --git a/generator/config/expression/last.yaml b/generator/config/expression/last.yaml new file mode 100644 index 000000000..2bf18dc7b --- /dev/null +++ b/generator/config/expression/last.yaml @@ -0,0 +1,21 @@ +# $schema: ../schema.json +name: $last +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/last/' +type: + - resolvesToAny +encode: single +description: | + Returns the result of an expression for the last document in an array. +arguments: + - + name: expression + type: + - resolvesToArray +tests: + - + name: 'Use in $addFields Stage' + pipeline: + - + $addFields: + lastItem: + $last: '$items' diff --git a/generator/config/expression/lastN.yaml b/generator/config/expression/lastN.yaml new file mode 100644 index 000000000..0c29ad76e --- /dev/null +++ b/generator/config/expression/lastN.yaml @@ -0,0 +1,51 @@ +# $schema: ../schema.json +name: $lastN +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN-array-element/' +type: + - resolvesToArray +encode: object +description: | + Returns a specified number of elements from the end of an array. +arguments: + - + name: 'n' + type: + - resolvesToInt + description: | + An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. + - + name: input + type: + - resolvesToArray + description: | + An expression that resolves to the array from which to return n elements. +tests: + - + name: Example + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN-array-element/#example' + pipeline: + - + $addFields: + lastScores: + $lastN: + n: 3 + input: '$score' + + - + name: 'Using $lastN as an Aggregation Expression' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN/#using--lastn-as-an-aggregation-expression' + pipeline: + - + $documents: + - + array: + - 10 + - 20 + - 30 + - 40 + - + $project: + lastThreeElements: + $lastN: + input: '$array' + n: 3 diff --git a/generator/config/expression/let.yaml b/generator/config/expression/let.yaml new file mode 100644 index 000000000..7d3017282 --- /dev/null +++ b/generator/config/expression/let.yaml @@ -0,0 +1,46 @@ +# $schema: ../schema.json +name: $let +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/let/' +type: + - resolvesToAny +encode: object +description: | + Defines variables for use within the scope of a subexpression and returns the result of the subexpression. Accepts named parameters. + Accepts any number of argument expressions. +arguments: + - + name: vars + type: + - object # of expression + description: | + Assignment block for the variables accessible in the in expression. To assign a variable, specify a string for the variable name and assign a valid expression for the value. + The variable assignments have no meaning outside the in expression, not even within the vars block itself. + - + name: in + type: + - expression + description: | + The expression to evaluate. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/let/#example' + pipeline: + - + $project: + finalTotal: + $let: + vars: + total: + $add: + - '$price' + - '$tax' + discounted: + $cond: + if: '$applyDiscount' + then: 0.9 + else: 1 + in: + $multiply: + - '$$total' + - '$$discounted' diff --git a/generator/config/expression/literal.yaml b/generator/config/expression/literal.yaml new file mode 100644 index 000000000..dfae7bbb3 --- /dev/null +++ b/generator/config/expression/literal.yaml @@ -0,0 +1,15 @@ +# $schema: ../schema.json +name: $literal +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/literal/' +type: + - resolvesToAny +encode: single +description: | + Return a value without parsing. Use for values that the aggregation pipeline may interpret as an expression. For example, use a $literal expression to a string that starts with a dollar sign ($) to avoid parsing as a field path. +arguments: + - + name: value + type: + - any + description: | + If the value is an expression, $literal does not evaluate the expression but instead returns the unparsed expression. diff --git a/generator/config/expression/ln.yaml b/generator/config/expression/ln.yaml new file mode 100644 index 000000000..f7412aeb9 --- /dev/null +++ b/generator/config/expression/ln.yaml @@ -0,0 +1,26 @@ +# $schema: ../schema.json +name: $ln +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/ln/' +type: + - resolvesToDouble +encode: single +description: | + Calculates the natural log of a number. + $ln is equivalent to $log: [ , Math.E ] expression, where Math.E is a JavaScript representation for Euler's number e. +arguments: + - + name: number + type: + - resolvesToNumber + description: | + Any valid expression as long as it resolves to a non-negative number. For more information on expressions, see Expressions. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/ln/#example' + pipeline: + - + $project: + x: '$year' + y: + $ln: '$sales' diff --git a/generator/config/expression/log.yaml b/generator/config/expression/log.yaml new file mode 100644 index 000000000..462eb9492 --- /dev/null +++ b/generator/config/expression/log.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $log +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/log/' +type: + - resolvesToDouble +encode: array +description: | + Calculates the log of a number in the specified base. +arguments: + - + name: number + type: + - resolvesToNumber + description: | + Any valid expression as long as it resolves to a non-negative number. + - + name: base + type: + - resolvesToNumber + description: | + Any valid expression as long as it resolves to a positive number greater than 1. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/log/#example' + pipeline: + - + $project: + bitsNeeded: + $floor: + $add: + - 1 + - + $log: + - '$int' + - 2 diff --git a/generator/config/expression/log10.yaml b/generator/config/expression/log10.yaml new file mode 100644 index 000000000..77cab075a --- /dev/null +++ b/generator/config/expression/log10.yaml @@ -0,0 +1,27 @@ +# $schema: ../schema.json +name: $log10 +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/log10/' +type: + - resolvesToDouble +encode: single +description: | + Calculates the log base 10 of a number. +arguments: + - + name: number + type: + - resolvesToNumber + description: | + Any valid expression as long as it resolves to a non-negative number. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/log10/#example' + pipeline: + - + $project: + pH: + $multiply: + - -1 + - + $log10: '$H3O' diff --git a/generator/config/expression/lt.yaml b/generator/config/expression/lt.yaml new file mode 100644 index 000000000..4b7319b97 --- /dev/null +++ b/generator/config/expression/lt.yaml @@ -0,0 +1,31 @@ +# $schema: ../schema.json +name: $lt +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lt/' +type: + - resolvesToBool +encode: array +description: | + Returns true if the first value is less than the second. +arguments: + - + name: expression1 + type: + - expression + - + name: expression2 + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lt/#example' + pipeline: + - + $project: + item: 1 + qty: 1 + qtyLt250: + $lt: + - '$qty' + - 250 + _id: 0 diff --git a/generator/config/expression/lte.yaml b/generator/config/expression/lte.yaml new file mode 100644 index 000000000..91c7b1d88 --- /dev/null +++ b/generator/config/expression/lte.yaml @@ -0,0 +1,31 @@ +# $schema: ../schema.json +name: $lte +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lte/' +type: + - resolvesToBool +encode: array +description: | + Returns true if the first value is less than or equal to the second. +arguments: + - + name: expression1 + type: + - expression + - + name: expression2 + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lte/#example' + pipeline: + - + $project: + item: 1 + qty: 1 + qtyLte250: + $lte: + - '$qty' + - 250 + _id: 0 diff --git a/generator/config/expression/ltrim.yaml b/generator/config/expression/ltrim.yaml new file mode 100644 index 000000000..992b70616 --- /dev/null +++ b/generator/config/expression/ltrim.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $ltrim +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/ltrim/' +type: + - resolvesToString +encode: object +description: | + Removes whitespace or the specified characters from the beginning of a string. + New in MongoDB 4.0. +arguments: + - + name: input + type: + - resolvesToString + description: | + The string to trim. The argument can be any valid expression that resolves to a string. + - + name: chars + type: + - resolvesToString + optional: true + description: | + The character(s) to trim from the beginning of the input. + The argument can be any valid expression that resolves to a string. The $ltrim operator breaks down the string into individual UTF code point to trim from input. + If unspecified, $ltrim removes whitespace characters, including the null character. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/ltrim/#example' + pipeline: + - + $project: + item: 1 + description: + $ltrim: + input: '$description' diff --git a/generator/config/expression/map.yaml b/generator/config/expression/map.yaml new file mode 100644 index 000000000..11db40c24 --- /dev/null +++ b/generator/config/expression/map.yaml @@ -0,0 +1,76 @@ +# $schema: ../schema.json +name: $map +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/map/' +type: + - resolvesToArray +encode: object +description: | + Applies a subexpression to each element of an array and returns the array of resulting values in order. Accepts named parameters. +arguments: + - + name: input + type: + - resolvesToArray + description: | + An expression that resolves to an array. + - + name: as + type: + - resolvesToString + optional: true + description: | + A name for the variable that represents each individual element of the input array. If no name is specified, the variable name defaults to this. + - + name: in + type: + - expression + description: | + An expression that is applied to each element of the input array. The expression references each element individually with the variable name specified in as. +tests: + - + name: 'Add to Each Element of an Array' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/map/#add-to-each-element-of-an-array' + pipeline: + - + $project: + adjustedGrades: + $map: + input: '$quizzes' + as: 'grade' + in: + $add: + - '$$grade' + - 2 + - + name: 'Truncate Each Array Element' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/map/#truncate-each-array-element' + pipeline: + - + $project: + city: '$city' + integerValues: + $map: + input: '$distances' + as: 'decimalValue' + in: + # Example uses the short form, the builder always generates the verbose form + # $trunc: '$$decimalValue' + $trunc: + - '$$decimalValue' + - + name: 'Convert Celsius Temperatures to Fahrenheit' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/map/#convert-celsius-temperatures-to-fahrenheit' + pipeline: + - + $addFields: + tempsF: + $map: + input: '$tempsC' + as: 'tempInCelsius' + in: + $add: + - + $multiply: + - '$$tempInCelsius' + - 1.8 + - 32 diff --git a/generator/config/expression/max.yaml b/generator/config/expression/max.yaml new file mode 100644 index 000000000..b413679c5 --- /dev/null +++ b/generator/config/expression/max.yaml @@ -0,0 +1,35 @@ +# $schema: ../schema.json +name: $max +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/max/' +type: + - resolvesToAny +encode: single +description: | + Returns the maximum value that results from applying an expression to each document. + Changed in MongoDB 5.0: Available in the $setWindowFields stage. +arguments: + - + name: expression + type: + - expression + variadic: array +tests: + - + name: 'Use in $project Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/max/#use-in--project-stage' + pipeline: + - + $project: + quizMax: + # Example uses the short form, the builder always generates the verbose form + # $max: '$quizzes' + $max: + - '$quizzes' + labMax: + # $max: '$labs' + $max: + - '$labs' + examMax: + $max: + - '$final' + - '$midterm' diff --git a/generator/config/expression/maxN.yaml b/generator/config/expression/maxN.yaml new file mode 100644 index 000000000..e0d9d243e --- /dev/null +++ b/generator/config/expression/maxN.yaml @@ -0,0 +1,32 @@ +# $schema: ../schema.json +name: $maxN +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/maxN-array-element/' +type: + - resolvesToArray +encode: object +description: | + Returns the n largest values in an array. Distinct from the $maxN accumulator. +arguments: + - + name: input + type: + - resolvesToArray + description: | + An expression that resolves to the array from which to return the maximal n elements. + - + name: 'n' + type: + - resolvesToInt + description: | + An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/maxN-array-element/#example' + pipeline: + - + $addFields: + maxScores: + $maxN: + n: 2 + input: '$score' diff --git a/generator/config/expression/median.yaml b/generator/config/expression/median.yaml new file mode 100644 index 000000000..2aac26a1f --- /dev/null +++ b/generator/config/expression/median.yaml @@ -0,0 +1,43 @@ +# $schema: ../schema.json +name: $median +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/median/' +type: + - resolvesToDouble +encode: object +description: | + Returns an approximation of the median, the 50th percentile, as a scalar value. + New in MongoDB 7.0. + This operator is available as an accumulator in these stages: + $group + $setWindowFields + It is also available as an aggregation expression. +arguments: + - + name: input + type: + - resolvesToNumber + - array # of number + description: | + $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. + - + name: method + type: + - accumulatorPercentile + description: | + The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. +tests: + - + name: 'Use $median in a $project Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/median/#use-operatorname-in-a--project-stage' + pipeline: + - + $project: + _id: 0 + studentId: 1 + testMedians: + $median: + input: + - '$test01' + - '$test02' + - '$test03' + method: 'approximate' diff --git a/generator/config/expression/mergeObjects.yaml b/generator/config/expression/mergeObjects.yaml new file mode 100644 index 000000000..928166852 --- /dev/null +++ b/generator/config/expression/mergeObjects.yaml @@ -0,0 +1,39 @@ +# $schema: ../schema.json +name: $mergeObjects +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/mergeObjects/' +type: + - resolvesToObject +encode: single +description: | + Combines multiple documents into a single document. +arguments: + - + name: document + type: + - resolvesToObject + variadic: array + description: | + Any valid expression that resolves to a document. +tests: + - + name: '$mergeObjects' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/mergeObjects/#-mergeobjects' + pipeline: + - + $lookup: + from: 'items' + localField: 'item' + foreignField: 'item' + as: 'fromItems' + - + $replaceRoot: + newRoot: + $mergeObjects: + - + $arrayElemAt: + - '$fromItems' + - 0 + - '$$ROOT' + - + $project: + fromItems: 0 diff --git a/generator/config/expression/meta.yaml b/generator/config/expression/meta.yaml new file mode 100644 index 000000000..9a96f7aaf --- /dev/null +++ b/generator/config/expression/meta.yaml @@ -0,0 +1,39 @@ +# $schema: ../schema.json +name: $meta +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/meta/' +type: + - resolvesToAny +encode: single +description: | + Access available per-document metadata related to the aggregation operation. +arguments: + - + name: keyword + type: + - string +tests: + - + name: 'textScore' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/meta/#-meta---textscore-' + pipeline: + - + $match: + $text: + $search: 'cake' + - + $group: + _id: + $meta: 'textScore' + count: + $sum: 1 + - + name: 'indexKey' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/meta/#-meta---indexkey-' + pipeline: + - + $match: + type: 'apparel' + - + $addFields: + idxKey: + $meta: 'indexKey' diff --git a/generator/config/expression/millisecond.yaml b/generator/config/expression/millisecond.yaml new file mode 100644 index 000000000..af1d26e75 --- /dev/null +++ b/generator/config/expression/millisecond.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $millisecond +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/millisecond/' +type: + - resolvesToInt +encode: object +description: | + Returns the milliseconds of a date as a number between 0 and 999. +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/millisecond/#example' + pipeline: + - + $project: + milliseconds: + # Example uses the short form, the builder always generates the verbose form + # $millisecond: '$date' + $millisecond: + date: '$date' diff --git a/generator/config/expression/min.yaml b/generator/config/expression/min.yaml new file mode 100644 index 000000000..1212fd4f7 --- /dev/null +++ b/generator/config/expression/min.yaml @@ -0,0 +1,35 @@ +# $schema: ../schema.json +name: $min +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/min/' +type: + - resolvesToAny +encode: single +description: | + Returns the minimum value that results from applying an expression to each document. + Changed in MongoDB 5.0: Available in the $setWindowFields stage. +arguments: + - + name: expression + type: + - expression + variadic: array +tests: + - + name: 'Use in $project Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/min/#use-in--project-stage' + pipeline: + - + $project: + quizMin: + # Example uses the short form, the builder always generates the verbose form + # $min: '$quizzes' + $min: + - '$quizzes' + labMin: + # $min: '$labs' + $min: + - '$labs' + examMin: + $min: + - '$final' + - '$midterm' diff --git a/generator/config/expression/minN.yaml b/generator/config/expression/minN.yaml new file mode 100644 index 000000000..e7fa8cac1 --- /dev/null +++ b/generator/config/expression/minN.yaml @@ -0,0 +1,32 @@ +# $schema: ../schema.json +name: $minN +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/minN-array-element/' +type: + - resolvesToArray +encode: object +description: | + Returns the n smallest values in an array. Distinct from the $minN accumulator. +arguments: + - + name: input + type: + - resolvesToArray + description: | + An expression that resolves to the array from which to return the maximal n elements. + - + name: 'n' + type: + - resolvesToInt + description: | + An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/minN-array-element/#example' + pipeline: + - + $addFields: + minScores: + $minN: + n: 2 + input: '$score' diff --git a/generator/config/expression/minute.yaml b/generator/config/expression/minute.yaml new file mode 100644 index 000000000..109e87f6b --- /dev/null +++ b/generator/config/expression/minute.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $minute +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/minute/' +type: + - resolvesToInt +encode: object +description: | + Returns the minute for a date as a number between 0 and 59. +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/minute/#example' + pipeline: + - + $project: + minutes: + # Example uses the short form, the builder always generates the verbose form + # $minute: '$date' + $minute: + date: '$date' diff --git a/generator/config/expression/mod.yaml b/generator/config/expression/mod.yaml new file mode 100644 index 000000000..0ac48bd54 --- /dev/null +++ b/generator/config/expression/mod.yaml @@ -0,0 +1,30 @@ +# $schema: ../schema.json +name: $mod +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/mod/' +type: + - resolvesToInt +encode: array +description: | + Returns the remainder of the first number divided by the second. Accepts two argument expressions. +arguments: + - + name: dividend + type: + - resolvesToNumber + description: | + The first argument is the dividend, and the second argument is the divisor; i.e. first argument is divided by the second argument. + - + name: divisor + type: + - resolvesToNumber +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/mod/#example' + pipeline: + - + $project: + remainder: + $mod: + - '$hours' + - '$tasks' diff --git a/generator/config/expression/month.yaml b/generator/config/expression/month.yaml new file mode 100644 index 000000000..7bd383be9 --- /dev/null +++ b/generator/config/expression/month.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $month +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/month/' +type: + - resolvesToInt +encode: object +description: | + Returns the month for a date as a number between 1 (January) and 12 (December). +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/month/#example' + pipeline: + - + $project: + month: + # Example uses the short form, the builder always generates the verbose form + # $month: '$date' + $month: + date: '$date' diff --git a/generator/config/expression/multiply.yaml b/generator/config/expression/multiply.yaml new file mode 100644 index 000000000..5a069cc8c --- /dev/null +++ b/generator/config/expression/multiply.yaml @@ -0,0 +1,30 @@ +# $schema: ../schema.json +name: $multiply +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/multiply/' +type: + - resolvesToDecimal +encode: single +description: | + Multiplies numbers to return the product. Accepts any number of argument expressions. +arguments: + - + name: expression + type: + - resolvesToNumber + variadic: array + description: | + The arguments can be any valid expression as long as they resolve to numbers. + Starting in MongoDB 6.1 you can optimize the $multiply operation. To improve performance, group references at the end of the argument list. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/multiply/#example' + pipeline: + - + $project: + date: 1 + item: 1 + total: + $multiply: + - '$price' + - '$quantity' diff --git a/generator/config/expression/ne.yaml b/generator/config/expression/ne.yaml new file mode 100644 index 000000000..da92f1014 --- /dev/null +++ b/generator/config/expression/ne.yaml @@ -0,0 +1,31 @@ +# $schema: ../schema.json +name: $ne +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/ne/' +type: + - resolvesToBool +encode: array +description: | + Returns true if the values are not equivalent. +arguments: + - + name: expression1 + type: + - expression + - + name: expression2 + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/ne/#example' + pipeline: + - + $project: + item: 1 + qty: 1 + qtyNe250: + $ne: + - '$qty' + - 250 + _id: 0 diff --git a/generator/config/expression/not.yaml b/generator/config/expression/not.yaml new file mode 100644 index 000000000..d4e4c90ea --- /dev/null +++ b/generator/config/expression/not.yaml @@ -0,0 +1,28 @@ +# $schema: ../schema.json +name: $not +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/not/' +type: + - resolvesToBool +encode: array +description: | + Returns the boolean value that is the opposite of its argument expression. Accepts a single argument expression. +arguments: + - + name: expression + type: + - expression + - resolvesToBool +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/not/#example' + pipeline: + - + $project: + item: 1 + result: + $not: + - + $gt: + - '$qty' + - 250 diff --git a/generator/config/expression/objectToArray.yaml b/generator/config/expression/objectToArray.yaml new file mode 100644 index 000000000..460977f33 --- /dev/null +++ b/generator/config/expression/objectToArray.yaml @@ -0,0 +1,44 @@ +# $schema: ../schema.json +name: $objectToArray +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/objectToArray/' +type: + - resolvesToArray +encode: single +description: | + Converts a document to an array of documents representing key-value pairs. +arguments: + - + name: object + type: + - resolvesToObject + description: | + Any valid expression as long as it resolves to a document object. $objectToArray applies to the top-level fields of its argument. If the argument is a document that itself contains embedded document fields, the $objectToArray does not recursively apply to the embedded document fields. +tests: + # "$objectToArray and $arrayToObject Example" omitted as it's already in arrayToObject.yaml + - + name: '$objectToArray Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/objectToArray/#-objecttoarray-example' + pipeline: + - + $project: + item: 1 + dimensions: + $objectToArray: '$dimensions' + - + name: '$objectToArray to Sum Nested Fields' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/objectToArray/#-objecttoarray-to-sum-nested-fields' + pipeline: + - + $project: + warehouses: + $objectToArray: '$instock' + - + # Example uses the short form, the builder always generates the verbose form + # $unwind: '$warehouses' + $unwind: + path: '$warehouses' + - + $group: + _id: '$warehouses.k' + total: + $sum: '$warehouses.v' diff --git a/generator/config/expression/or.yaml b/generator/config/expression/or.yaml new file mode 100644 index 000000000..2bbce1910 --- /dev/null +++ b/generator/config/expression/or.yaml @@ -0,0 +1,33 @@ +# $schema: ../schema.json +name: $or +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/or/' +type: + - resolvesToBool +encode: single +description: | + Returns true when any of its expressions evaluates to true. Accepts any number of argument expressions. +arguments: + - + name: expression + type: + - expression + - resolvesToBool + variadic: array +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/or/#example' + pipeline: + - + $project: + item: 1 + result: + $or: + - + $gt: + - '$qty' + - 250 + - + $lt: + - '$qty' + - 200 diff --git a/generator/config/expression/percentile.yaml b/generator/config/expression/percentile.yaml new file mode 100644 index 000000000..b19fc1904 --- /dev/null +++ b/generator/config/expression/percentile.yaml @@ -0,0 +1,51 @@ +# $schema: ../schema.json +name: $percentile +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/percentile/' +type: + - resolvesToArray # of scalar +encode: object +description: | + Returns an array of scalar values that correspond to specified percentile values. + New in MongoDB 7.0. + + This operator is available as an accumulator in these stages: + $group + + $setWindowFields + + It is also available as an aggregation expression. +arguments: + - + name: input + type: + - resolvesToNumber + - array # of number + description: | + $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. + - + name: p + type: + - resolvesToArray # of resolvesToNumber + description: | + $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. + $percentile returns results in the same order as the elements in p. + - + name: method + type: + - accumulatorPercentile + description: | + The method that mongod uses to calculate the percentile value. The method must be 'approximate'. +tests: + - + name: 'Use $percentile in a $project Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/percentile/#use-operatorname-in-a--project-stage' + pipeline: + - + $project: + _id: 0 + studentId: 1 + testPercentiles: + $percentile: + input: ['$test01', '$test02', '$test03'] + p: [0.5, 0.95] + method: 'approximate' diff --git a/generator/config/expression/pow.yaml b/generator/config/expression/pow.yaml new file mode 100644 index 000000000..afab7f875 --- /dev/null +++ b/generator/config/expression/pow.yaml @@ -0,0 +1,31 @@ +# $schema: ../schema.json +name: $pow +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/pow/' +type: + - resolvesToNumber +encode: array +description: | + Raises a number to the specified exponent. +arguments: + - + name: number + type: + - resolvesToNumber + - + name: exponent + type: + - resolvesToNumber +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/pow/#example' + pipeline: + - + $project: + variance: + $pow: + - + # Example uses the short form, the builder always generates the verbose form + # $stdDevPop: '$scores.score' + $stdDevPop: ['$scores.score'] + - 2 diff --git a/generator/config/expression/radiansToDegrees.yaml b/generator/config/expression/radiansToDegrees.yaml new file mode 100644 index 000000000..be4dd1e1d --- /dev/null +++ b/generator/config/expression/radiansToDegrees.yaml @@ -0,0 +1,27 @@ +# $schema: ../schema.json +name: $radiansToDegrees +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/radiansToDegrees/' +type: + - resolvesToDouble + - resolvesToDecimal +encode: single +description: | + Converts a value from radians to degrees. +arguments: + - + name: expression + type: + - resolvesToNumber +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/radiansToDegrees/#example' + pipeline: + - + $addFields: + angle_a_deg: + $radiansToDegrees: '$angle_a' + angle_b_deg: + $radiansToDegrees: '$angle_b' + angle_c_deg: + $radiansToDegrees: '$angle_c' diff --git a/generator/config/expression/rand.yaml b/generator/config/expression/rand.yaml new file mode 100644 index 000000000..a19f3163e --- /dev/null +++ b/generator/config/expression/rand.yaml @@ -0,0 +1,48 @@ +# $schema: ../schema.json +name: $rand +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/rand/' +type: + - resolvesToDouble +encode: object +description: | + Returns a random float between 0 and 1 +tests: + - + name: 'Generate Random Data Points' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/rand/#generate-random-data-points' + pipeline: + - + $set: + amount: + $multiply: + - + $rand: {} + - 100 + - + $set: + amount: + $floor: '$amount' + - + # Example uses the short form, the builder always generates the verbose form + # $merge: 'donors' + $merge: + into: 'donors' + - + name: 'Select Random Items From a Collection' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/rand/#select-random-items-from-a-collection' + pipeline: + - + $match: + district: 3 + - + $match: + $expr: + $lt: + - 0.5 + - + $rand: {} + - + $project: + _id: 0 + name: 1 + registered: 1 diff --git a/generator/config/expression/range.yaml b/generator/config/expression/range.yaml new file mode 100644 index 000000000..5c78d8898 --- /dev/null +++ b/generator/config/expression/range.yaml @@ -0,0 +1,42 @@ +# $schema: ../schema.json +name: $range +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/range/' +type: + - resolvesToArray # of int +encode: array +description: | + Outputs an array containing a sequence of integers according to user-defined inputs. +arguments: + - + name: start + type: + - resolvesToInt + description: | + An integer that specifies the start of the sequence. Can be any valid expression that resolves to an integer. + - + name: end + type: + - resolvesToInt + description: | + An integer that specifies the exclusive upper limit of the sequence. Can be any valid expression that resolves to an integer. + - + name: step + type: + - resolvesToInt + optional: true + description: | + An integer that specifies the increment value. Can be any valid expression that resolves to a non-zero integer. Defaults to 1. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/range/#example' + pipeline: + - + $project: + _id: 0 + city: 1 + Rest stops: + $range: + - 0 + - '$distance' + - 25 diff --git a/generator/config/expression/reduce.yaml b/generator/config/expression/reduce.yaml new file mode 100644 index 000000000..bf51eabe3 --- /dev/null +++ b/generator/config/expression/reduce.yaml @@ -0,0 +1,134 @@ +# $schema: ../schema.json +name: $reduce +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/reduce/' +type: + - resolvesToAny +encode: object +description: | + Applies an expression to each element in an array and combines them into a single value. +arguments: + - + name: input + type: + - resolvesToArray + description: | + Can be any valid expression that resolves to an array. + If the argument resolves to a value of null or refers to a missing field, $reduce returns null. + If the argument does not resolve to an array or null nor refers to a missing field, $reduce returns an error. + - + name: initialValue + type: + - expression + description: | + The initial cumulative value set before in is applied to the first element of the input array. + - + name: in + type: + - expression + description: | + A valid expression that $reduce applies to each element in the input array in left-to-right order. Wrap the input value with $reverseArray to yield the equivalent of applying the combining expression from right-to-left. + During evaluation of the in expression, two variables will be available: + - value is the variable that represents the cumulative value of the expression. + - this is the variable that refers to the element being processed. +tests: + - + name: 'Multiplication' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/reduce/#multiplication' + pipeline: + - + $group: + _id: '$experimentId' + probabilityArr: + $push: '$probability' + - + $project: + description: 1 + results: + $reduce: + input: '$probabilityArr' + initialValue: 1 + in: + $multiply: + - '$$value' + - '$$this' + - + name: 'Discounted Merchandise' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/reduce/#discounted-merchandise' + pipeline: + - + $project: + discountedPrice: + $reduce: + input: '$discounts' + initialValue: '$price' + in: + $multiply: + - '$$value' + - + $subtract: + - 1 + - '$$this' + - + name: 'String Concatenation' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/reduce/#string-concatenation' + pipeline: + # Filter to return only non-empty arrays + - + $match: + hobbies: + $gt: [] + - + $project: + name: 1 + bio: + $reduce: + input: '$hobbies' + initialValue: 'My hobbies include:' + in: + $concat: + - '$$value' + - + $cond: + if: + $eq: + - '$$value' + - 'My hobbies include:' + then: ' ' + else: ', ' + - '$$this' + - + name: 'Array Concatenation' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/reduce/#array-concatenation' + pipeline: + - + $project: + collapsed: + $reduce: + input: '$arr' + initialValue: [] + in: + $concatArrays: + - '$$value' + - '$$this' + - + name: 'Computing a Multiple Reductions' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/reduce/#computing-a-multiple-reductions' + pipeline: + - + $project: + results: + $reduce: + input: '$arr' + initialValue: [] + in: + collapsed: + $concatArrays: + - '$$value.collapsed' + - '$$this' + firstValues: + $concatArrays: + - '$$value.firstValues' + - + $slice: + - '$$this' + - 1 diff --git a/generator/config/expression/regexFind.yaml b/generator/config/expression/regexFind.yaml new file mode 100644 index 000000000..d953a4ae6 --- /dev/null +++ b/generator/config/expression/regexFind.yaml @@ -0,0 +1,66 @@ +# $schema: ../schema.json +name: $regexFind +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/regexFind/' +type: + - resolvesToObject +encode: object +description: | + Applies a regular expression (regex) to a string and returns information on the first matched substring. + New in MongoDB 4.2. +arguments: + - + name: input + type: + - resolvesToString + description: | + The string on which you wish to apply the regex pattern. Can be a string or any valid expression that resolves to a string. + - + name: regex + type: + - resolvesToString + - regex + description: | + The regex pattern to apply. Can be any valid expression that resolves to either a string or regex pattern //. When using the regex //, you can also specify the regex options i and m (but not the s or x options) + - + name: options + type: + - string + optional: true +tests: + - + name: '$regexFind and Its Options' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/regexFind/#-regexfind-and-its-options' + pipeline: + - + $addFields: + returnObject: + $regexFind: + input: '$description' + regex: !bson_regex 'line' + - + name: 'i Option' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/regexFind/#i-option' + pipeline: + - + $addFields: + returnObject: + # Specify i as part of the Regex type + $regexFind: + input: '$description' + regex: !bson_regex ['line', 'i'] + - + $addFields: + returnObject: + # Specify i in the options field + $regexFind: + input: '$description' + regex: 'line' + options: 'i' + - + $addFields: + returnObject: + # Mix Regex type with options field + $regexFind: + input: '$description' + regex: !bson_regex 'line' + options: 'i' diff --git a/generator/config/expression/regexFindAll.yaml b/generator/config/expression/regexFindAll.yaml new file mode 100644 index 000000000..6aea184d7 --- /dev/null +++ b/generator/config/expression/regexFindAll.yaml @@ -0,0 +1,99 @@ +# $schema: ../schema.json +name: $regexFindAll +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/regexFindAll/' +type: + - resolvesToArray # of object +encode: object +description: | + Applies a regular expression (regex) to a string and returns information on the all matched substrings. + New in MongoDB 4.2. +arguments: + - + name: input + type: + - resolvesToString + description: | + The string on which you wish to apply the regex pattern. Can be a string or any valid expression that resolves to a string. + - + name: regex + type: + - resolvesToString + - regex + description: | + The regex pattern to apply. Can be any valid expression that resolves to either a string or regex pattern //. When using the regex //, you can also specify the regex options i and m (but not the s or x options) + - + name: options + type: + - string + optional: true +tests: + - + name: '$regexFindAll and Its Options' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/regexFindAll/#-regexfindall-and-its-options' + pipeline: + - + $addFields: + returnObject: + $regexFindAll: + input: '$description' + regex: !bson_regex 'line' + - + name: 'i Option' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/regexFindAll/#i-option' + pipeline: + - + $addFields: + returnObject: + # Specify i as part of the regex type + $regexFindAll: + input: '$description' + regex: !bson_regex ['line', 'i'] + - + $addFields: + returnObject: + # Specify i in the options field + $regexFindAll: + input: '$description' + regex: 'line' + options: 'i' + - + $addFields: + returnObject: + # Mix Regex type with options field + $regexFindAll: + input: '$description' + regex: !bson_regex 'line' + options: 'i' + - + name: 'Use $regexFindAll to Parse Email from String' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/regexFindAll/#use--regexfindall-to-parse-email-from-string' + pipeline: + - + $addFields: + email: + $regexFindAll: + input: '$comment' + regex: !bson_regex ['[a-z0-9_.+-]+@[a-z0-9_.+-]+\.[a-z0-9_.+-]+', 'i'] + - + $set: + email: '$email.match' + - + name: 'Use Captured Groupings to Parse User Name' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/regexFindAll/#use-captured-groupings-to-parse-user-name' + pipeline: + - + $addFields: + names: + $regexFindAll: + input: '$comment' + regex: !bson_regex ['([a-z0-9_.+-]+)@[a-z0-9_.+-]+\.[a-z0-9_.+-]+', 'i'] + - + $set: + names: + $reduce: + input: '$names.captures' + initialValue: [] + in: + $concatArrays: + - '$$value' + - '$$this' diff --git a/generator/config/expression/regexMatch.yaml b/generator/config/expression/regexMatch.yaml new file mode 100644 index 000000000..4ea9f0aab --- /dev/null +++ b/generator/config/expression/regexMatch.yaml @@ -0,0 +1,80 @@ +# $schema: ../schema.json +name: $regexMatch +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/regexMatch/' +type: + - resolvesToBool +encode: object +description: | + Applies a regular expression (regex) to a string and returns a boolean that indicates if a match is found or not. + New in MongoDB 4.2. +arguments: + - + name: input + type: + - resolvesToString + description: | + The string on which you wish to apply the regex pattern. Can be a string or any valid expression that resolves to a string. + - + name: regex + type: + - resolvesToString + - regex + description: | + The regex pattern to apply. Can be any valid expression that resolves to either a string or regex pattern //. When using the regex //, you can also specify the regex options i and m (but not the s or x options) + - + name: options + type: + - string + optional: true +tests: + - + name: '$regexMatch and Its Options' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/regexMatch/#-regexmatch-and-its-options' + pipeline: + - + $addFields: + result: + $regexMatch: + input: '$description' + regex: !bson_regex 'line' + - + name: 'i Option' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/regexMatch/#i-option' + pipeline: + - + $addFields: + result: + # Specify i as part of the Regex type + $regexMatch: + input: '$description' + regex: !bson_regex ['line', 'i'] + - + $addFields: + result: + # Specify i in the options field + $regexMatch: + input: '$description' + regex: 'line' + options: 'i' + - + $addFields: + result: + # Mix Regex type with options field + $regexMatch: + input: '$description' + regex: !bson_regex 'line' + options: 'i' + - + name: 'Use $regexMatch to Check Email Address' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/regexMatch/#use--regexmatch-to-check-email-address' + pipeline: + - + $addFields: + category: + $cond: + if: + $regexMatch: + input: '$comment' + regex: !bson_regex ['[a-z0-9_.+-]+@mongodb.com', 'i'] + then: 'Employee' + else: 'External' diff --git a/generator/config/expression/replaceAll.yaml b/generator/config/expression/replaceAll.yaml new file mode 100644 index 000000000..b13c58884 --- /dev/null +++ b/generator/config/expression/replaceAll.yaml @@ -0,0 +1,55 @@ +# $schema: ../schema.json +name: $replaceAll +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceAll/' +type: + - resolvesToString +encode: object +description: | + Replaces all instances of a search string in an input string with a replacement string. + $replaceAll is both case-sensitive and diacritic-sensitive, and ignores any collation present on a collection. + New in MongoDB 4.4. +arguments: + - + name: input + type: + - resolvesToString + - resolvesToNull + description: | + The string on which you wish to apply the find. Can be any valid expression that resolves to a string or a null. If input refers to a field that is missing, $replaceAll returns null. + - + name: find + type: + - resolvesToString + - resolvesToNull + - resolvesToRegex + description: | + The string to search for within the given input. Can be any valid expression that resolves to a string or a null. If find refers to a field that is missing, $replaceAll returns null. + - + name: replacement + type: + - resolvesToString + - resolvesToNull + description: | + The string to use to replace all matched instances of find in input. Can be any valid expression that resolves to a string or a null. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceAll/#example' + pipeline: + - + $project: + item: + $replaceAll: + input: '$item' + find: 'blue paint' + replacement: 'red paint' + - + name: 'Support regex search string' + pipeline: + - + $project: + item: + $replaceAll: + input: '123-456-7890' + find: !bson_regex '\d{3}' + replacement: 'xxx' diff --git a/generator/config/expression/replaceOne.yaml b/generator/config/expression/replaceOne.yaml new file mode 100644 index 000000000..0962cc6c5 --- /dev/null +++ b/generator/config/expression/replaceOne.yaml @@ -0,0 +1,43 @@ +# $schema: ../schema.json +name: $replaceOne +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceOne/' +type: + - resolvesToString +encode: object +description: | + Replaces the first instance of a matched string in a given input. + New in MongoDB 4.4. +arguments: + - + name: input + type: + - resolvesToString + - resolvesToNull + description: | + The string on which you wish to apply the find. Can be any valid expression that resolves to a string or a null. If input refers to a field that is missing, $replaceAll returns null. + - + name: find + type: + - resolvesToString + - resolvesToNull + description: | + The string to search for within the given input. Can be any valid expression that resolves to a string or a null. If find refers to a field that is missing, $replaceAll returns null. + - + name: replacement + type: + - resolvesToString + - resolvesToNull + description: | + The string to use to replace all matched instances of find in input. Can be any valid expression that resolves to a string or a null. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceOne/#example' + pipeline: + - + $project: + item: + $replaceOne: + input: '$item' + find: 'blue paint' + replacement: 'red paint' diff --git a/generator/config/expression/reverseArray.yaml b/generator/config/expression/reverseArray.yaml new file mode 100644 index 000000000..2cbe3f3cd --- /dev/null +++ b/generator/config/expression/reverseArray.yaml @@ -0,0 +1,25 @@ +# $schema: ../schema.json +name: $reverseArray +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/reverseArray/' +type: + - resolvesToArray +encode: single +description: | + Returns an array with the elements in reverse order. +arguments: + - + name: expression + type: + - resolvesToArray + description: | + The argument can be any valid expression as long as it resolves to an array. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/reverseArray/#example' + pipeline: + - + $project: + name: 1 + reverseFavorites: + $reverseArray: '$favorites' diff --git a/generator/config/expression/round.yaml b/generator/config/expression/round.yaml new file mode 100644 index 000000000..9bc6961c7 --- /dev/null +++ b/generator/config/expression/round.yaml @@ -0,0 +1,50 @@ +# $schema: ../schema.json +name: $round +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/round/' +type: + - resolvesToInt + - resolvesToDouble + - resolvesToDecimal + - resolvesToLong +encode: array +description: | + Rounds a number to a whole integer or to a specified decimal place. +arguments: + - + name: number + type: + - resolvesToNumber + description: | + Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. + $round returns an error if the expression resolves to a non-numeric data type. + - + name: place + type: + - resolvesToInt + optional: true + description: | + Can be any valid expression that resolves to an integer between -20 and 100, exclusive. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/round/#example' + pipeline: + - + $project: + roundedValue: + $round: + - '$value' + - 1 + - + name: 'Round Average Rating' + pipeline: + - + $project: + roundedAverageRating: + $avg: + - + $round: + - + $avg: + - '$averageRating' + - 2 diff --git a/generator/config/expression/rtrim.yaml b/generator/config/expression/rtrim.yaml new file mode 100644 index 000000000..a9d1974db --- /dev/null +++ b/generator/config/expression/rtrim.yaml @@ -0,0 +1,35 @@ +# $schema: ../schema.json +name: $rtrim +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/rtrim/' +type: + - resolvesToString +encode: object +description: | + Removes whitespace characters, including null, or the specified characters from the end of a string. +arguments: + - + name: input + type: + - resolvesToString + description: | + The string to trim. The argument can be any valid expression that resolves to a string. + - + name: chars + type: + - resolvesToString + optional: true + description: | + The character(s) to trim from the beginning of the input. + The argument can be any valid expression that resolves to a string. The $ltrim operator breaks down the string into individual UTF code point to trim from input. + If unspecified, $ltrim removes whitespace characters, including the null character. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/rtrim/#example' + pipeline: + - + $project: + item: 1 + description: + $rtrim: + input: '$description' diff --git a/generator/config/expression/second.yaml b/generator/config/expression/second.yaml new file mode 100644 index 000000000..83e7fd370 --- /dev/null +++ b/generator/config/expression/second.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $second +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/second/' +type: + - resolvesToInt +encode: object +description: | + Returns the seconds for a date as a number between 0 and 60 (leap seconds). +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/second/#example' + pipeline: + - + $project: + seconds: + # Example uses the short form, the builder always generates the verbose form + # $second: '$date' + $second: + date: '$date' diff --git a/generator/config/expression/setDifference.yaml b/generator/config/expression/setDifference.yaml new file mode 100644 index 000000000..69f448cb7 --- /dev/null +++ b/generator/config/expression/setDifference.yaml @@ -0,0 +1,35 @@ +# $schema: ../schema.json +name: $setDifference +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setDifference/' +type: + - resolvesToArray +encode: array +description: | + Returns a set with elements that appear in the first set but not in the second set; i.e. performs a relative complement of the second set relative to the first. Accepts exactly two argument expressions. +arguments: + - + name: expression1 + type: + - resolvesToArray + description: | + The arguments can be any valid expression as long as they each resolve to an array. + - + name: expression2 + type: + - resolvesToArray + description: | + The arguments can be any valid expression as long as they each resolve to an array. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setDifference/#example' + pipeline: + - + $project: + flowerFieldA: 1 + flowerFieldB: 1 + inBOnly: + $setDifference: + - '$flowerFieldB' + - '$flowerFieldA' + _id: 0 diff --git a/generator/config/expression/setEquals.yaml b/generator/config/expression/setEquals.yaml new file mode 100644 index 000000000..5194c9ae9 --- /dev/null +++ b/generator/config/expression/setEquals.yaml @@ -0,0 +1,28 @@ +# $schema: ../schema.json +name: $setEquals +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setEquals/' +type: + - resolvesToBool +encode: single +description: | + Returns true if the input sets have the same distinct elements. Accepts two or more argument expressions. +arguments: + - + name: expression + type: + - resolvesToArray + variadic: array +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setEquals/#example' + pipeline: + - + $project: + _id: 0 + cakes: 1 + cupcakes: 1 + sameFlavors: + $setEquals: + - '$cakes' + - '$cupcakes' diff --git a/generator/config/expression/setField.yaml b/generator/config/expression/setField.yaml new file mode 100644 index 000000000..b53cf6584 --- /dev/null +++ b/generator/config/expression/setField.yaml @@ -0,0 +1,109 @@ +# $schema: ../schema.json +name: $setField +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setField/' +type: + - resolvesToObject +encode: object +description: | + Adds, updates, or removes a specified field in a document. You can use $setField to add, update, or remove fields with names that contain periods (.) or start with dollar signs ($). + New in MongoDB 5.0. +arguments: + - + name: field + type: + - resolvesToString + description: | + Field in the input object that you want to add, update, or remove. field can be any valid expression that resolves to a string constant. + - + name: input + type: + - resolvesToObject + description: | + Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. + - + name: value + type: + - expression + description: | + The value that you want to assign to field. value can be any valid expression. + Set to $$REMOVE to remove field from the input document. +tests: + - + name: 'Add Fields that Contain Periods' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setField/#add-fields-that-contain-periods--.-' + pipeline: + - + $replaceWith: + $setField: + field: 'price.usd' + input: '$$ROOT' + value: '$price' + - + # Example uses the short form, the builder always generates the verbose form + # $unset: 'price' + $unset: + - 'price' + - + name: 'Add Fields that Start with a Dollar Sign' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setField/#add-fields-that-start-with-a-dollar-sign----' + pipeline: + - + $replaceWith: + $setField: + field: + $literal: '$price' + input: '$$ROOT' + value: '$price' + - + # Example uses the short form, the builder always generates the verbose form + # $unset: 'price' + $unset: + - 'price' + - + name: 'Update Fields that Contain Periods' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setField/#update-fields-that-contain-periods--.-' + pipeline: + - + $match: + _id: 1 + - + $replaceWith: + $setField: + field: 'price.usd' + input: '$$ROOT' + value: 49.99 + - + name: 'Update Fields that Start with a Dollar Sign' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setField/#update-fields-that-start-with-a-dollar-sign----' + pipeline: + - + $match: + _id: 1 + - + $replaceWith: + $setField: + field: + $literal: '$price' + input: '$$ROOT' + value: 49.99 + - + name: 'Remove Fields that Contain Periods' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setField/#remove-fields-that-contain-periods--.-' + pipeline: + - + $replaceWith: + $setField: + field: 'price.usd' + input: '$$ROOT' + value: '$$REMOVE' + - + name: 'Remove Fields that Start with a Dollar Sign' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setField/#remove-fields-that-start-with-a-dollar-sign----' + pipeline: + - + $replaceWith: + $setField: + field: + $literal: '$price' + input: '$$ROOT' + value: '$$REMOVE' diff --git a/generator/config/expression/setIntersection.yaml b/generator/config/expression/setIntersection.yaml new file mode 100644 index 000000000..8f03651d5 --- /dev/null +++ b/generator/config/expression/setIntersection.yaml @@ -0,0 +1,44 @@ +# $schema: ../schema.json +name: $setIntersection +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setIntersection/' +type: + - resolvesToArray +encode: single +description: | + Returns a set with elements that appear in all of the input sets. Accepts any number of argument expressions. +arguments: + - + name: expression + type: + - resolvesToArray + variadic: array +tests: + - + name: 'Elements Array Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setIntersection/#elements-array-example' + pipeline: + - + $project: + flowerFieldA: 1 + flowerFieldB: 1 + commonToBoth: + $setIntersection: + - '$flowerFieldA' + - '$flowerFieldB' + _id: 0 + - + name: 'Retrieve Documents for Roles Granted to the Current User' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setIntersection/#retrieve-documents-for-roles-granted-to-the-current-user' + pipeline: + - + $match: + $expr: + $not: + # the example doesn't use an array inside $not, but the documentation say it is necessary + - + $eq: + - + $setIntersection: + - '$allowedRoles' + - '$$USER_ROLES.role' + - [] diff --git a/generator/config/expression/setIsSubset.yaml b/generator/config/expression/setIsSubset.yaml new file mode 100644 index 000000000..fe7c9ed02 --- /dev/null +++ b/generator/config/expression/setIsSubset.yaml @@ -0,0 +1,32 @@ +# $schema: ../schema.json +name: $setIsSubset +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setIsSubset/' +type: + - resolvesToBool +encode: array +description: | + Returns true if all elements of the first set appear in the second set, including when the first set equals the second set; i.e. not a strict subset. Accepts exactly two argument expressions. +arguments: + - + name: expression1 + type: + - resolvesToArray + - + name: expression2 + type: + - resolvesToArray +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setIsSubset/#example' + pipeline: + - + $project: + flowerFieldA: 1 + flowerFieldB: 1 + AisSubset: + $setIsSubset: + - '$flowerFieldA' + - '$flowerFieldB' + _id: 0 + diff --git a/generator/config/expression/setUnion.yaml b/generator/config/expression/setUnion.yaml new file mode 100644 index 000000000..2cfca3e16 --- /dev/null +++ b/generator/config/expression/setUnion.yaml @@ -0,0 +1,28 @@ +# $schema: ../schema.json +name: $setUnion +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setUnion/' +type: + - resolvesToArray +encode: single +description: | + Returns a set with elements that appear in any of the input sets. +arguments: + - + name: expression + type: + - resolvesToArray + variadic: array +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setUnion/#example' + pipeline: + - + $project: + flowerFieldA: 1 + flowerFieldB: 1 + allValues: + $setUnion: + - '$flowerFieldA' + - '$flowerFieldB' + _id: 0 diff --git a/generator/config/expression/sin.yaml b/generator/config/expression/sin.yaml new file mode 100644 index 000000000..fe02b4f28 --- /dev/null +++ b/generator/config/expression/sin.yaml @@ -0,0 +1,30 @@ +# $schema: ../schema.json +name: $sin +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sin/' +type: + - resolvesToDouble + - resolvesToDecimal +encode: single +description: | + Returns the sine of a value that is measured in radians. +arguments: + - + name: expression + type: + - resolvesToNumber + description: | + $sin takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + By default $sin returns values as a double. $sin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sin/#example' + pipeline: + - + $addFields: + side_b: + $multiply: + - + $sin: + $degreesToRadians: '$angle_a' + - '$hypotenuse' diff --git a/generator/config/expression/sinh.yaml b/generator/config/expression/sinh.yaml new file mode 100644 index 000000000..a5b446add --- /dev/null +++ b/generator/config/expression/sinh.yaml @@ -0,0 +1,27 @@ +# $schema: ../schema.json +name: $sinh +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sinh/' +type: + - resolvesToDouble + - resolvesToDecimal +encode: single +description: | + Returns the hyperbolic sine of a value that is measured in radians. +arguments: + - + name: expression + type: + - resolvesToNumber + description: | + $sinh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + By default $sinh returns values as a double. $sinh can also return values as a 128-bit decimal if the expression resolves to a 128-bit decimal value. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sinh/#example' + pipeline: + - + $addFields: + sinh_output: + $sinh: + $degreesToRadians: '$angle' diff --git a/generator/config/expression/size.yaml b/generator/config/expression/size.yaml new file mode 100644 index 000000000..ce4fe775e --- /dev/null +++ b/generator/config/expression/size.yaml @@ -0,0 +1,33 @@ +# $schema: ../schema.json +name: $size +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/size/' +type: + - resolvesToInt +encode: single +description: | + Returns the number of elements in the array. Accepts a single expression as argument. +arguments: + - + name: expression + type: + - resolvesToArray + description: | + The argument for $size can be any expression as long as it resolves to an array. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/size/#example' + pipeline: + - + $project: + item: 1 + numberOfColors: + $cond: + if: + # Example uses the short form, the builder always generates the verbose form + # $isArray: '$colors' + $isArray: + - '$colors' + then: + $size: '$colors' + else: 'NA' diff --git a/generator/config/expression/slice.yaml b/generator/config/expression/slice.yaml new file mode 100644 index 000000000..22cc287e1 --- /dev/null +++ b/generator/config/expression/slice.yaml @@ -0,0 +1,44 @@ +# $schema: ../schema.json +name: $slice +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/slice/' +type: + - resolvesToArray +encode: array +description: | + Returns a subset of an array. +arguments: + - + name: expression + type: + - resolvesToArray + description: | + Any valid expression as long as it resolves to an array. + - + name: position + type: + - resolvesToInt + optional: true + description: | + Any valid expression as long as it resolves to an integer. + If positive, $slice determines the starting position from the start of the array. If position is greater than the number of elements, the $slice returns an empty array. + If negative, $slice determines the starting position from the end of the array. If the absolute value of the is greater than the number of elements, the starting position is the start of the array. + - + name: "n" + type: + - resolvesToInt + description: | + Any valid expression as long as it resolves to an integer. If position is specified, n must resolve to a positive integer. + If positive, $slice returns up to the first n elements in the array. If the position is specified, $slice returns the first n elements starting from the position. + If negative, $slice returns up to the last n elements in the array. n cannot resolve to a negative number if is specified. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/slice/#example' + pipeline: + - + $project: + name: 1 + threeFavorites: + $slice: + - '$favorites' + - 3 diff --git a/generator/config/expression/sortArray.yaml b/generator/config/expression/sortArray.yaml new file mode 100644 index 000000000..d558f2233 --- /dev/null +++ b/generator/config/expression/sortArray.yaml @@ -0,0 +1,108 @@ +# $schema: ../schema.json +name: $sortArray +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortArray/' +type: + - resolvesToArray +encode: object +description: | + Sorts the elements of an array. +arguments: + - + name: input + type: + - resolvesToArray + description: | + The array to be sorted. + The result is null if the expression: is missing, evaluates to null, or evaluates to undefined + If the expression evaluates to any other non-array value, the document returns an error. + - + name: sortBy + type: + - int + - sortSpec + - sortBy + description: | + The document specifies a sort ordering. +tests: + - + name: 'Sort on a Field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortArray/#sort-on-a-field' + pipeline: + - + $project: + _id: 0 + result: + $sortArray: + input: '$team' + sortBy: + name: 1 + - + name: 'Sort on a Subfield' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortArray/#sort-on-a-subfield' + pipeline: + - + $project: + _id: 0 + result: + $sortArray: + input: '$team' + sortBy: + address.city: -1 + - + name: 'Sort on Multiple Fields' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortArray/#sort-on-multiple-fields' + pipeline: + - + $project: + _id: 0 + result: + $sortArray: + input: '$team' + sortBy: + age: -1 + name: 1 + - + name: 'Sort an Array of Integers' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortArray/#sort-an-array-of-integers' + pipeline: + - + $project: + _id: 0 + result: + $sortArray: + input: + - 1 + - 4 + - 1 + - 6 + - 12 + - 5 + sortBy: 1 + - + name: 'Sort on Mixed Type Fields' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortArray/#sort-on-mixed-type-fields' + pipeline: + - + $project: + _id: 0 + result: + $sortArray: + input: + - 20 + - 4 + - + a: 'Free' + - 6 + - 21 + - 5 + - 'Gratis' + - + a: ~ + - + a: + sale: true + price: 19 + - !bson_decimal128 '10.23' + - + a: 'On sale' + sortBy: 1 diff --git a/generator/config/expression/split.yaml b/generator/config/expression/split.yaml new file mode 100644 index 000000000..98739c4ec --- /dev/null +++ b/generator/config/expression/split.yaml @@ -0,0 +1,58 @@ +# $schema: ../schema.json +name: $split +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/split/' +type: + - resolvesToArray # of string +encode: array +description: | + Splits a string into substrings based on a delimiter. Returns an array of substrings. If the delimiter is not found within the string, returns an array containing the original string. +arguments: + - + name: string + type: + - resolvesToString + description: | + The string to be split. string expression can be any valid expression as long as it resolves to a string. + - + name: delimiter + type: + - resolvesToString + - resolvesToRegex + description: | + The delimiter to use when splitting the string expression. delimiter can be any valid expression as long as it resolves to a string. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/split/#example' + pipeline: + - + $project: + city_state: + $split: + - '$city' + - ', ' + qty: 1 + - + $unwind: + path: '$city_state' + - + $match: + city_state: !bson_regex '[A-Z]{2}' + - + $group: + _id: + state: '$city_state' + total_qty: + $sum: '$qty' + - + $sort: + total_qty: -1 + - + name: 'Support regex delimiter' + pipeline: + - + $project: + split: + $split: + - 'abc' + - !bson_regex 'b' diff --git a/generator/config/expression/sqrt.yaml b/generator/config/expression/sqrt.yaml new file mode 100644 index 000000000..52f5bb7c2 --- /dev/null +++ b/generator/config/expression/sqrt.yaml @@ -0,0 +1,39 @@ +# $schema: ../schema.json +name: $sqrt +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sqrt/' +type: + - resolvesToDouble +encode: single +description: | + Calculates the square root. +arguments: + - + name: number + type: + - resolvesToNumber + description: | + The argument can be any valid expression as long as it resolves to a non-negative number. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sqrt/#example' + pipeline: + - + $project: + distance: + $sqrt: + $add: + - + $pow: + - + $subtract: + - '$p2.y' + - '$p1.y' + - 2 + - + $pow: + - + $subtract: + - '$p2.x' + - '$p1.x' + - 2 diff --git a/generator/config/expression/stdDevPop.yaml b/generator/config/expression/stdDevPop.yaml new file mode 100644 index 000000000..46641ebe8 --- /dev/null +++ b/generator/config/expression/stdDevPop.yaml @@ -0,0 +1,27 @@ +# $schema: ../schema.json +name: $stdDevPop +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/' +type: + - resolvesToDouble +encode: single +description: | + Calculates the population standard deviation of the input values. Use if the values encompass the entire population of data you want to represent and do not wish to generalize about a larger population. $stdDevPop ignores non-numeric values. + If the values represent only a sample of a population of data from which to generalize about the population, use $stdDevSamp instead. + Changed in MongoDB 5.0: Available in the $setWindowFields stage. +arguments: + - + name: expression + type: + - resolvesToNumber + variadic: array +tests: + - + name: 'Use in $project Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/#use-in--project-stage' + pipeline: + - + $project: + stdDev: + # Example uses the short form, the builder always generates the verbose form + # $stdDevPop: '$scores.score' + $stdDevPop: ['$scores.score'] diff --git a/generator/config/expression/stdDevSamp.yaml b/generator/config/expression/stdDevSamp.yaml new file mode 100644 index 000000000..84b35f52a --- /dev/null +++ b/generator/config/expression/stdDevSamp.yaml @@ -0,0 +1,15 @@ +# $schema: ../schema.json +name: $stdDevSamp +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/' +type: + - resolvesToDouble +encode: single +description: | + Calculates the sample standard deviation of the input values. Use if the values encompass a sample of a population of data from which to generalize about the population. $stdDevSamp ignores non-numeric values. + If the values represent the entire population of data or you do not wish to generalize about a larger population, use $stdDevPop instead. +arguments: + - + name: expression + type: + - resolvesToNumber + variadic: array diff --git a/generator/config/expression/strLenBytes.yaml b/generator/config/expression/strLenBytes.yaml new file mode 100644 index 000000000..301150d19 --- /dev/null +++ b/generator/config/expression/strLenBytes.yaml @@ -0,0 +1,23 @@ +# $schema: ../schema.json +name: $strLenBytes +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/strLenBytes/' +type: + - resolvesToInt +encode: single +description: | + Returns the number of UTF-8 encoded bytes in a string. +arguments: + - + name: expression + type: + - resolvesToString +tests: + - + name: 'Single-Byte and Multibyte Character Set' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/strLenBytes/#single-byte-and-multibyte-character-set' + pipeline: + - + $project: + name: 1 + length: + $strLenBytes: '$name' diff --git a/generator/config/expression/strLenCP.yaml b/generator/config/expression/strLenCP.yaml new file mode 100644 index 000000000..b852c80ec --- /dev/null +++ b/generator/config/expression/strLenCP.yaml @@ -0,0 +1,23 @@ +# $schema: ../schema.json +name: $strLenCP +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/strLenCP/' +type: + - resolvesToInt +encode: single +description: | + Returns the number of UTF-8 code points in a string. +arguments: + - + name: expression + type: + - resolvesToString +tests: + - + name: 'Single-Byte and Multibyte Character Set' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/strLenBytes/#single-byte-and-multibyte-character-set' + pipeline: + - + $project: + name: 1 + length: + $strLenCP: '$name' diff --git a/generator/config/expression/strcasecmp.yaml b/generator/config/expression/strcasecmp.yaml new file mode 100644 index 000000000..6775c44b1 --- /dev/null +++ b/generator/config/expression/strcasecmp.yaml @@ -0,0 +1,29 @@ +# $schema: ../schema.json +name: $strcasecmp +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/strcasecmp/' +type: + - resolvesToInt +encode: array +description: | + Performs case-insensitive string comparison and returns: 0 if two strings are equivalent, 1 if the first string is greater than the second, and -1 if the first string is less than the second. +arguments: + - + name: expression1 + type: + - resolvesToString + - + name: expression2 + type: + - resolvesToString +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/strcasecmp/#example' + pipeline: + - + $project: + item: 1 + comparisonResult: + $strcasecmp: + - '$quarter' + - '13q4' diff --git a/generator/config/expression/substr.yaml b/generator/config/expression/substr.yaml new file mode 100644 index 000000000..6bcf6143f --- /dev/null +++ b/generator/config/expression/substr.yaml @@ -0,0 +1,43 @@ +# $schema: ../schema.json +name: $substr +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/substr/' +type: + - resolvesToString +encode: array +description: | + Deprecated. Use $substrBytes or $substrCP. +arguments: + - + name: string + type: + - resolvesToString + - + name: start + type: + - resolvesToInt + description: | + If start is a negative number, $substr returns an empty string "". + - + name: length + type: + - resolvesToInt + description: | + If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/substr/#example' + pipeline: + - + $project: + item: 1 + yearSubstring: + $substr: + - '$quarter' + - 0 + - 2 + quarterSubtring: + $substr: + - '$quarter' + - 2 + - -1 diff --git a/generator/config/expression/substrBytes.yaml b/generator/config/expression/substrBytes.yaml new file mode 100644 index 000000000..fed7677c8 --- /dev/null +++ b/generator/config/expression/substrBytes.yaml @@ -0,0 +1,59 @@ +# $schema: ../schema.json +name: $substrBytes +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/substrBytes/' +type: + - resolvesToString +encode: array +description: | + Returns the substring of a string. Starts with the character at the specified UTF-8 byte index (zero-based) in the string and continues for the specified number of bytes. +arguments: + - + name: string + type: + - resolvesToString + - + name: start + type: + - resolvesToInt + description: | + If start is a negative number, $substr returns an empty string "". + - + name: length + type: + - resolvesToInt + description: | + If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. +tests: + - + name: 'Single-Byte Character Set' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/substrBytes/#single-byte-character-set' + pipeline: + - + $project: + item: 1 + yearSubstring: + $substrBytes: + - '$quarter' + - 0 + - 2 + quarterSubtring: + $substrBytes: + - '$quarter' + - 2 + - + $subtract: + - + $strLenBytes: '$quarter' + - 2 + - + name: 'Single-Byte and Multibyte Character Set' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/substrBytes/#single-byte-and-multibyte-character-set' + pipeline: + - + $project: + name: 1 + menuCode: + $substrBytes: + - '$name' + - 0 + - 3 diff --git a/generator/config/expression/substrCP.yaml b/generator/config/expression/substrCP.yaml new file mode 100644 index 000000000..843b2ca1a --- /dev/null +++ b/generator/config/expression/substrCP.yaml @@ -0,0 +1,59 @@ +# $schema: ../schema.json +name: $substrCP +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/substrCP/' +type: + - resolvesToString +encode: array +description: | + Returns the substring of a string. Starts with the character at the specified UTF-8 code point (CP) index (zero-based) in the string and continues for the number of code points specified. +arguments: + - + name: string + type: + - resolvesToString + - + name: start + type: + - resolvesToInt + description: | + If start is a negative number, $substr returns an empty string "". + - + name: length + type: + - resolvesToInt + description: | + If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. +tests: + - + name: 'Single-Byte Character Set' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/substrCP/#single-byte-character-set' + pipeline: + - + $project: + item: 1 + yearSubstring: + $substrCP: + - '$quarter' + - 0 + - 2 + quarterSubtring: + $substrCP: + - '$quarter' + - 2 + - + $subtract: + - + $strLenCP: '$quarter' + - 2 + - + name: 'Single-Byte and Multibyte Character Set' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/substrCP/#single-byte-and-multibyte-character-set' + pipeline: + - + $project: + name: 1 + menuCode: + $substrCP: + - '$name' + - 0 + - 3 diff --git a/generator/config/expression/subtract.yaml b/generator/config/expression/subtract.yaml new file mode 100644 index 000000000..b6db65ac9 --- /dev/null +++ b/generator/config/expression/subtract.yaml @@ -0,0 +1,60 @@ +# $schema: ../schema.json +name: $subtract +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/subtract/' +type: + - resolvesToInt + - resolvesToLong + - resolvesToDouble + - resolvesToDecimal + - resolvesToDate +encode: array +description: | + Returns the result of subtracting the second value from the first. If the two values are numbers, return the difference. If the two values are dates, return the difference in milliseconds. If the two values are a date and a number in milliseconds, return the resulting date. Accepts two argument expressions. If the two values are a date and a number, specify the date argument first as it is not meaningful to subtract a date from a number. +arguments: + - + name: expression1 + type: + - resolvesToNumber + - resolvesToDate + - + name: expression2 + type: + - resolvesToNumber + - resolvesToDate +tests: + - + name: 'Subtract Numbers' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/subtract/#subtract-numbers' + pipeline: + - + $project: + item: 1 + total: + $subtract: + - + $add: + - '$price' + - '$fee' + - '$discount' + - + name: 'Subtract Two Dates' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/subtract/#subtract-two-dates' + pipeline: + - + $project: + item: 1 + dateDifference: + $subtract: + - '$$NOW' + - '$date' + - + name: 'Subtract Milliseconds from a Date' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/subtract/#subtract-milliseconds-from-a-date' + pipeline: + - + $project: + item: 1 + dateDifference: + $subtract: + - '$date' + - 300000 diff --git a/generator/config/expression/sum.yaml b/generator/config/expression/sum.yaml new file mode 100644 index 000000000..25b323ab1 --- /dev/null +++ b/generator/config/expression/sum.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $sum +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/' +type: + - resolvesToNumber +encode: single +description: | + Returns a sum of numerical values. Ignores non-numeric values. + Changed in MongoDB 5.0: Available in the $setWindowFields stage. +arguments: + - + name: expression + type: + - resolvesToNumber + - resolvesToArray + variadic: array +tests: + - + name: 'Use in $project Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/#use-in--project-stage' + pipeline: + - + $project: + quizTotal: + # Example uses the short form, the builder always generates the verbose form + # $sum: '$quizzes' + $sum: + - '$quizzes' + labTotal: + # $sum: '$labs' + $sum: + - '$labs' + examTotal: + $sum: + - '$final' + - '$midterm' diff --git a/generator/config/expression/switch.yaml b/generator/config/expression/switch.yaml new file mode 100644 index 000000000..d668e3d94 --- /dev/null +++ b/generator/config/expression/switch.yaml @@ -0,0 +1,70 @@ +# $schema: ../schema.json +name: $switch +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/switch/' +type: + - resolvesToAny +encode: object +description: | + Evaluates a series of case expressions. When it finds an expression which evaluates to true, $switch executes a specified expression and breaks out of the control flow. +arguments: + - + name: branches + type: + - array # of CaseOperator + description: | + An array of control branch documents. Each branch is a document with the following fields: + - case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. + - then Can be any valid expression. + The branches array must contain at least one branch document. + - + name: default + type: + - expression + optional: true + description: | + The path to take if no branch case expression evaluates to true. + Although optional, if default is unspecified and no branch case evaluates to true, $switch returns an error. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/switch/#example' + pipeline: + - + $project: + name: 1 + summary: + $switch: + branches: + - + case: + $gte: + - + #$avg: '$scores' + $avg: [ '$scores' ] + - 90 + then: 'Doing great!' + - + case: + $and: + - + $gte: + - + #$avg: '$scores' + $avg: [ '$scores' ] + - 80 + - + $lt: + - + #$avg: '$scores' + $avg: [ '$scores' ] + - 90 + then: 'Doing pretty well.' + - + case: + $lt: + - + #$avg: '$scores' + $avg: [ '$scores' ] + - 80 + then: 'Needs improvement.' + default: 'No scores found.' diff --git a/generator/config/expression/tan.yaml b/generator/config/expression/tan.yaml new file mode 100644 index 000000000..17b11ee63 --- /dev/null +++ b/generator/config/expression/tan.yaml @@ -0,0 +1,30 @@ +# $schema: ../schema.json +name: $tan +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/tan/' +type: + - resolvesToDouble + - resolvesToDecimal +encode: single +description: | + Returns the tangent of a value that is measured in radians. +arguments: + - + name: expression + type: + - resolvesToNumber + description: | + $tan takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + By default $tan returns values as a double. $tan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/tan/#example' + pipeline: + - + $addFields: + side_b: + $multiply: + - + $tan: + $degreesToRadians: '$angle_a' + - '$side_a' diff --git a/generator/config/expression/tanh.yaml b/generator/config/expression/tanh.yaml new file mode 100644 index 000000000..364589452 --- /dev/null +++ b/generator/config/expression/tanh.yaml @@ -0,0 +1,27 @@ +# $schema: ../schema.json +name: $tanh +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/tanh/' +type: + - resolvesToDouble + - resolvesToDecimal +encode: single +description: | + Returns the hyperbolic tangent of a value that is measured in radians. +arguments: + - + name: expression + type: + - resolvesToNumber + description: | + $tanh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + By default $tanh returns values as a double. $tanh can also return values as a 128-bit decimal if the expression resolves to a 128-bit decimal value. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/tanh/#example' + pipeline: + - + $addFields: + tanh_output: + $tanh: + $degreesToRadians: '$angle' diff --git a/generator/config/expression/toBool.yaml b/generator/config/expression/toBool.yaml new file mode 100644 index 000000000..7f771ec8d --- /dev/null +++ b/generator/config/expression/toBool.yaml @@ -0,0 +1,41 @@ +# $schema: ../schema.json +name: $toBool +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toBool/' +type: + - resolvesToBool +encode: single +description: | + Converts value to a boolean. + New in MongoDB 4.0. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toBool/#example' + pipeline: + - + $addFields: + convertedShippedFlag: + $switch: + branches: + - + case: + $eq: + - '$shipped' + - 'false' + then: false + - + case: + $eq: + - '$shipped' + - '' + then: false + default: + $toBool: '$shipped' + - + $match: + convertedShippedFlag: false diff --git a/generator/config/expression/toDate.yaml b/generator/config/expression/toDate.yaml new file mode 100644 index 000000000..d9434a6bd --- /dev/null +++ b/generator/config/expression/toDate.yaml @@ -0,0 +1,26 @@ +# $schema: ../schema.json +name: $toDate +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toDate/' +type: + - resolvesToDate +encode: single +description: | + Converts value to a Date. + New in MongoDB 4.0. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toDate/#example' + pipeline: + - + $addFields: + convertedDate: + $toDate: '$order_date' + - + $sort: + convertedDate: 1 diff --git a/generator/config/expression/toDecimal.yaml b/generator/config/expression/toDecimal.yaml new file mode 100644 index 000000000..2f3588323 --- /dev/null +++ b/generator/config/expression/toDecimal.yaml @@ -0,0 +1,23 @@ +# $schema: ../schema.json +name: $toDecimal +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toDecimal/' +type: + - resolvesToDecimal +encode: single +description: | + Converts value to a Decimal128. + New in MongoDB 4.0. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toDecimal/#example' + pipeline: + - + $addFields: + convertedPrice: + $toDecimal: '$price' diff --git a/generator/config/expression/toDouble.yaml b/generator/config/expression/toDouble.yaml new file mode 100644 index 000000000..f34c36e9a --- /dev/null +++ b/generator/config/expression/toDouble.yaml @@ -0,0 +1,27 @@ +# $schema: ../schema.json +name: $toDouble +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toDouble/' +type: + - resolvesToDouble +encode: single +description: | + Converts value to a double. + New in MongoDB 4.0. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toDouble/#example' + pipeline: + - + $addFields: + degrees: + $toDouble: + $substrBytes: + - '$temp' + - 0 + - 4 diff --git a/generator/config/expression/toHashedIndexKey.yaml b/generator/config/expression/toHashedIndexKey.yaml new file mode 100644 index 000000000..f5811f56d --- /dev/null +++ b/generator/config/expression/toHashedIndexKey.yaml @@ -0,0 +1,28 @@ +# $schema: ../schema.json +name: $toHashedIndexKey +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toHashedIndexKey/' +type: + - resolvesToLong +encode: single +description: | + Computes and returns the hash value of the input expression using the same hash function that MongoDB uses to create a hashed index. A hash function maps a key or string to a fixed-size numeric value. +arguments: + - + name: value + type: + - expression + description: | + key or string to hash +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toHashedIndexKey/#example' + pipeline: + - + $documents: + - + val: 'string to hash' + - + $addFields: + hashedVal: + $toHashedIndexKey: '$val' diff --git a/generator/config/expression/toInt.yaml b/generator/config/expression/toInt.yaml new file mode 100644 index 000000000..2b0239955 --- /dev/null +++ b/generator/config/expression/toInt.yaml @@ -0,0 +1,23 @@ +# $schema: ../schema.json +name: $toInt +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toInt/' +type: + - resolvesToInt +encode: single +description: | + Converts value to an integer. + New in MongoDB 4.0. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toInt/#example' + pipeline: + - + $addFields: + convertedQty: + $toInt: '$qty' diff --git a/generator/config/expression/toLong.yaml b/generator/config/expression/toLong.yaml new file mode 100644 index 000000000..3168ad9ff --- /dev/null +++ b/generator/config/expression/toLong.yaml @@ -0,0 +1,26 @@ +# $schema: ../schema.json +name: $toLong +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toLong/' +type: + - resolvesToLong +encode: single +description: | + Converts value to a long. + New in MongoDB 4.0. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toLong/#example' + pipeline: + - + $addFields: + convertedQty: + $toLong: '$qty' + - + $sort: + convertedQty: -1 diff --git a/generator/config/expression/toLower.yaml b/generator/config/expression/toLower.yaml new file mode 100644 index 000000000..0d6176672 --- /dev/null +++ b/generator/config/expression/toLower.yaml @@ -0,0 +1,24 @@ +# $schema: ../schema.json +name: $toLower +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toLower/' +type: + - resolvesToString +encode: single +description: | + Converts a string to lowercase. Accepts a single argument expression. +arguments: + - + name: expression + type: + - resolvesToString +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toLower/#example' + pipeline: + - + $project: + item: + $toLower: '$item' + description: + $toLower: '$description' diff --git a/generator/config/expression/toObjectId.yaml b/generator/config/expression/toObjectId.yaml new file mode 100644 index 000000000..803f7cafa --- /dev/null +++ b/generator/config/expression/toObjectId.yaml @@ -0,0 +1,26 @@ +# $schema: ../schema.json +name: $toObjectId +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toObjectId/' +type: + - resolvesToObjectId +encode: single +description: | + Converts value to an ObjectId. + New in MongoDB 4.0. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toObjectId/#example' + pipeline: + - + $addFields: + convertedId: + $toObjectId: '$_id' + - + $sort: + convertedId: -1 diff --git a/generator/config/expression/toString.yaml b/generator/config/expression/toString.yaml new file mode 100644 index 000000000..0fd068562 --- /dev/null +++ b/generator/config/expression/toString.yaml @@ -0,0 +1,26 @@ +# $schema: ../schema.json +name: $toString +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toString/' +type: + - resolvesToString +encode: single +description: | + Converts value to a string. + New in MongoDB 4.0. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toString/#example' + pipeline: + - + $addFields: + convertedZipCode: + $toString: '$zipcode' + - + $sort: + convertedZipCode: 1 diff --git a/generator/config/expression/toUpper.yaml b/generator/config/expression/toUpper.yaml new file mode 100644 index 000000000..c2c71e1bc --- /dev/null +++ b/generator/config/expression/toUpper.yaml @@ -0,0 +1,24 @@ +# $schema: ../schema.json +name: $toUpper +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toUpper/' +type: + - resolvesToString +encode: single +description: | + Converts a string to uppercase. Accepts a single argument expression. +arguments: + - + name: expression + type: + - resolvesToString +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/toUpper/#example' + pipeline: + - + $project: + item: + $toUpper: '$item' + description: + $toUpper: '$description' diff --git a/generator/config/expression/trim.yaml b/generator/config/expression/trim.yaml new file mode 100644 index 000000000..d63423910 --- /dev/null +++ b/generator/config/expression/trim.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $trim +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/trim/' +type: + - resolvesToString +encode: object +description: | + Removes whitespace or the specified characters from the beginning and end of a string. + New in MongoDB 4.0. +arguments: + - + name: input + type: + - resolvesToString + description: | + The string to trim. The argument can be any valid expression that resolves to a string. + - + name: chars + type: + - resolvesToString + optional: true + description: | + The character(s) to trim from the beginning of the input. + The argument can be any valid expression that resolves to a string. The $ltrim operator breaks down the string into individual UTF code point to trim from input. + If unspecified, $ltrim removes whitespace characters, including the null character. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/trim/#example' + pipeline: + - + $project: + item: 1 + description: + $trim: + input: '$description' diff --git a/generator/config/expression/trunc.yaml b/generator/config/expression/trunc.yaml new file mode 100644 index 000000000..f930cf027 --- /dev/null +++ b/generator/config/expression/trunc.yaml @@ -0,0 +1,34 @@ +# $schema: ../schema.json +name: $trunc +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/trunc/' +type: + - resolvesToString +encode: array +description: | + Truncates a number to a whole integer or to a specified decimal place. +arguments: + - + name: number + type: + - resolvesToNumber + description: | + Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. + $trunc returns an error if the expression resolves to a non-numeric data type. + - + name: place + type: + - resolvesToInt + optional: true + description: | + Can be any valid expression that resolves to an integer between -20 and 100, exclusive. e.g. -20 < place < 100. Defaults to 0. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/trunc/#example' + pipeline: + - + $project: + truncatedValue: + $trunc: + - '$value' + - 1 diff --git a/generator/config/expression/tsIncrement.yaml b/generator/config/expression/tsIncrement.yaml new file mode 100644 index 000000000..9fded2143 --- /dev/null +++ b/generator/config/expression/tsIncrement.yaml @@ -0,0 +1,39 @@ +# $schema: ../schema.json +name: $tsIncrement +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/tsIncrement/' +type: + - resolvesToLong +encode: single +description: | + Returns the incrementing ordinal from a timestamp as a long. + New in MongoDB 5.1. +arguments: + - + name: expression + type: + - resolvesToTimestamp +tests: + - + name: 'Obtain the Incrementing Ordinal from a Timestamp Field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/tsIncrement/#obtain-the-incrementing-ordinal-from-a-timestamp-field' + pipeline: + - + $project: + _id: 0 + saleTimestamp: 1 + saleIncrement: + $tsIncrement: '$saleTimestamp' + - + name: 'Use $tsSecond in a Change Stream Cursor to Monitor Collection Changes' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/tsSecond/#use--tssecond-in-a-change-stream-cursor-to-monitor-collection-changes' + pipeline: + - + $match: + $expr: + $eq: + - + $mod: + - + $tsIncrement: '$clusterTime' + - 2 + - 0 diff --git a/generator/config/expression/tsSecond.yaml b/generator/config/expression/tsSecond.yaml new file mode 100644 index 000000000..20a84904b --- /dev/null +++ b/generator/config/expression/tsSecond.yaml @@ -0,0 +1,33 @@ +# $schema: ../schema.json +name: $tsSecond +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/tsSecond/' +type: + - resolvesToLong +encode: single +description: | + Returns the seconds from a timestamp as a long. + New in MongoDB 5.1. +arguments: + - + name: expression + type: + - resolvesToTimestamp +tests: + - + name: 'Obtain the Number of Seconds from a Timestamp Field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/tsSecond/#obtain-the-number-of-seconds-from-a-timestamp-field' + pipeline: + - + $project: + _id: 0 + saleTimestamp: 1 + saleSeconds: + $tsSecond: '$saleTimestamp' + - + name: 'Use $tsSecond in a Change Stream Cursor to Monitor Collection Changes' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/tsSecond/#use--tssecond-in-a-change-stream-cursor-to-monitor-collection-changes' + pipeline: + - + $addFields: + clusterTimeSeconds: + $tsSecond: '$clusterTime' diff --git a/generator/config/expression/type.yaml b/generator/config/expression/type.yaml new file mode 100644 index 000000000..c1f63db79 --- /dev/null +++ b/generator/config/expression/type.yaml @@ -0,0 +1,22 @@ +# $schema: ../schema.json +name: $type +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/type/' +type: + - resolvesToString +encode: single +description: | + Return the BSON data type of the field. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/type/#example' + pipeline: + - + $project: + a: + $type: '$a' diff --git a/generator/config/expression/unsetField.yaml b/generator/config/expression/unsetField.yaml new file mode 100644 index 000000000..a4365a646 --- /dev/null +++ b/generator/config/expression/unsetField.yaml @@ -0,0 +1,59 @@ +# $schema: ../schema.json +name: $unsetField +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unsetField/' +type: + - resolvesToObject +encode: object +description: | + You can use $unsetField to remove fields with names that contain periods (.) or that start with dollar signs ($). + $unsetField is an alias for $setField using $$REMOVE to remove fields. +arguments: + - + name: field + type: + - resolvesToString + description: | + Field in the input object that you want to add, update, or remove. field can be any valid expression that resolves to a string constant. + - + name: input + type: + - resolvesToObject + description: | + Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. +tests: + - + name: 'Remove Fields that Contain Periods' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unsetField/#remove-fields-that-contain-periods--.-' + pipeline: + - + $replaceWith: + $unsetField: + field: 'price.usd' + input: '$$ROOT' + - + name: 'Remove Fields that Start with a Dollar Sign' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unsetField/#remove-fields-that-start-with-a-dollar-sign----' + pipeline: + - + $replaceWith: + $unsetField: + field: + $literal: '$price' + input: '$$ROOT' + - + name: 'Remove A Subfield' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unsetField/#remove-a-subfield' + pipeline: + - + $replaceWith: + $setField: + field: 'price' + input: '$$ROOT' + value: + $unsetField: + field: 'euro' + input: + # Example uses the short form, the builder always generates the verbose form + # $getField: 'price' + $getField: + field: 'price' diff --git a/generator/config/expression/week.yaml b/generator/config/expression/week.yaml new file mode 100644 index 000000000..6086f57ee --- /dev/null +++ b/generator/config/expression/week.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $week +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/week/' +type: + - resolvesToInt +encode: object +description: | + Returns the week number for a date as a number between 0 (the partial week that precedes the first Sunday of the year) and 53 (leap year). +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/week/#example' + pipeline: + - + $project: + week: + # Example uses the short form, the builder always generates the verbose form + # $week: '$date' + $week: + date: '$date' diff --git a/generator/config/expression/year.yaml b/generator/config/expression/year.yaml new file mode 100644 index 000000000..3326e3495 --- /dev/null +++ b/generator/config/expression/year.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $year +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/year/' +type: + - resolvesToInt +encode: object +description: | + Returns the year for a date as a number (e.g. 2014). +arguments: + - + name: date + type: + - resolvesToDate + - resolvesToTimestamp + - resolvesToObjectId + description: | + The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + - + name: timezone + type: + - resolvesToString + optional: true + description: | + The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/year/#example' + pipeline: + - + $project: + year: + # Example uses the short form, the builder always generates the verbose form + # $year: '$date' + $year: + date: '$date' diff --git a/generator/config/expression/zip.yaml b/generator/config/expression/zip.yaml new file mode 100644 index 000000000..76402dac5 --- /dev/null +++ b/generator/config/expression/zip.yaml @@ -0,0 +1,87 @@ +# $schema: ../schema.json +name: $zip +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/zip/' +type: + - resolvesToArray # of array +encode: object +description: | + Merge two arrays together. +arguments: + - + name: inputs + type: + - resolvesToArray # of array + description: | + An array of expressions that resolve to arrays. The elements of these input arrays combine to form the arrays of the output array. + If any of the inputs arrays resolves to a value of null or refers to a missing field, $zip returns null. + If any of the inputs arrays does not resolve to an array or null nor refers to a missing field, $zip returns an error. + - + name: useLongestLength + type: + - bool + optional: true + description: | + A boolean which specifies whether the length of the longest array determines the number of arrays in the output array. + The default value is false: the shortest array length determines the number of arrays in the output array. + - + name: defaults + type: + - array + optional: true + description: | + An array of default element values to use if the input arrays have different lengths. You must specify useLongestLength: true along with this field, or else $zip will return an error. + If useLongestLength: true but defaults is empty or not specified, $zip uses null as the default value. + If specifying a non-empty defaults, you must specify a default for each input array or else $zip will return an error. +tests: + - + name: 'Matrix Transposition' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/zip/#matrix-transposition' + pipeline: + - + $project: + _id: false + transposed: + $zip: + inputs: + - + $arrayElemAt: + - '$matrix' + - 0 + - + $arrayElemAt: + - '$matrix' + - 1 + - + $arrayElemAt: + - '$matrix' + - 2 + - + name: 'Filtering and Preserving Indexes' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/zip/#filtering-and-preserving-indexes' + pipeline: + - + $project: + _id: false + pages: + $filter: + input: + $zip: + inputs: + - '$pages' + - + $range: + - 0 + - + $size: '$pages' + as: 'pageWithIndex' + cond: + $let: + vars: + page: + $arrayElemAt: + - '$$pageWithIndex' + - 0 + in: + $gte: + - '$$page.reviews' + - 1 diff --git a/generator/config/expressions.php b/generator/config/expressions.php new file mode 100644 index 000000000..9d8df47a6 --- /dev/null +++ b/generator/config/expressions.php @@ -0,0 +1,175 @@ + ['int', BSON\Int64::class, 'float'], + 'string' => ['string'], + 'object' => ['array', stdClass::class, BSON\Document::class, BSON\Serializable::class], + 'array' => ['array', BSONArray::class, BSON\PackedArray::class], + 'binData' => ['string', BSON\Binary::class], + 'objectId' => [BSON\ObjectId::class], + 'bool' => ['bool'], + 'date' => [BSON\UTCDateTime::class, DateTimeInterface::class], + 'null' => ['null'], + 'regex' => [BSON\Regex::class], + 'javascript' => ['string', BSON\Javascript::class], + 'int' => ['int'], + 'timestamp' => ['int', BSON\Timestamp::class], + 'long' => ['int', BSON\Int64::class], + 'decimal' => ['int', BSON\Int64::class, 'float', BSON\Decimal128::class], +]; + +// "any" accepts all the BSON types. No generic "object" or "mixed" +$bsonTypes['any'] = ['bool', 'int', 'float', 'string', 'array', 'null', stdClass::class, BSON\Type::class, DateTimeInterface::class]; + +// "number" accepts all the numeric types +$bsonTypes['number'] = ['int', 'float', BSON\Int64::class, BSON\Decimal128::class]; + +$expressions = []; +$resolvesToInterfaces = []; +foreach ($bsonTypes as $name => $acceptedTypes) { + $expressions[$name] = ['acceptedTypes' => $acceptedTypes]; + + $resolvesTo = 'resolvesTo' . ucfirst($name); + $resolvesToInterface = __NAMESPACE__ . '\\' . ucfirst($resolvesTo); + $expressions[$resolvesTo] = [ + 'generate' => PhpObject::PhpInterface, + 'implements' => [Type\ExpressionInterface::class], + 'returnType' => $resolvesToInterface, + 'acceptedTypes' => $acceptedTypes, + ]; + + $fieldPathName = $name . 'FieldPath'; + if ($name === 'any') { + $fieldPathName = 'fieldPath'; + } else { + $resolvesToInterfaces[] = $resolvesToInterface; + } + + $expressions[$fieldPathName] = [ + 'generate' => PhpObject::PhpClass, + 'implements' => [Type\FieldPathInterface::class, $resolvesToInterface], + 'acceptedTypes' => ['string'], + ]; +} + +$expressions['resolvesToLong']['implements'] = [ResolvesToInt::class]; +$expressions['resolvesToInt']['implements'] = [ResolvesToNumber::class]; +$expressions['resolvesToDecimal']['implements'] = [ResolvesToDouble::class]; +$expressions['resolvesToDouble']['implements'] = [ResolvesToNumber::class]; +$expressions['resolvesToAny']['implements'] = $resolvesToInterfaces; + +return $expressions + [ + 'expression' => [ + 'returnType' => Type\ExpressionInterface::class, + 'acceptedTypes' => [Type\ExpressionInterface::class, ...$bsonTypes['any']], + ], + 'fieldQuery' => [ + 'returnType' => Type\FieldQueryInterface::class, + 'acceptedTypes' => [Type\FieldQueryInterface::class, ...$bsonTypes['any']], + ], + 'query' => [ + 'returnType' => Type\QueryInterface::class, + 'acceptedTypes' => [Type\QueryInterface::class, 'array'], + ], + 'accumulator' => [ + 'returnType' => Type\AccumulatorInterface::class, + 'acceptedTypes' => [Type\AccumulatorInterface::class, ...$bsonTypes['object']], + ], + 'window' => [ + 'returnType' => Type\WindowInterface::class, + 'acceptedTypes' => [Type\WindowInterface::class, ...$bsonTypes['object']], + ], + 'stage' => [ + 'returnType' => Type\StageInterface::class, + 'acceptedTypes' => [Type\StageInterface::class, ...$bsonTypes['object']], + ], + 'pipeline' => [ + 'acceptedTypes' => [Pipeline::class, ...$bsonTypes['array']], + ], + 'variable' => [ + 'generate' => PhpObject::PhpClass, + 'implements' => [ResolvesToAny::class], + 'acceptedTypes' => ['string'], + ], + 'searchOperator' => [ + 'returnType' => Type\SearchOperatorInterface::class, + 'acceptedTypes' => [Type\SearchOperatorInterface::class, ...$bsonTypes['object']], + ], + 'geometry' => [ + 'returnType' => Type\GeometryInterface::class, + 'acceptedTypes' => [Type\GeometryInterface::class, ...$bsonTypes['object']], + ], + 'switchBranch' => [ + 'returnType' => Type\SwitchBranchInterface::class, + 'acceptedTypes' => [Type\SwitchBranchInterface::class, ...$bsonTypes['object']], + ], + 'timeUnit' => [ + 'returnType' => Type\TimeUnit::class, + 'acceptedTypes' => [Type\TimeUnit::class, ResolvesToString::class, ...$bsonTypes['string']], + ], + 'sortSpec' => [ + 'returnType' => Type\Sort::class, + 'acceptedTypes' => [Type\Sort::class], + ], + + // @todo add enum values + 'granularity' => [ + 'acceptedTypes' => [...$bsonTypes['string']], + ], + 'fullDocument' => [ + 'acceptedTypes' => [...$bsonTypes['string']], + ], + 'fullDocumentBeforeChange' => [ + 'acceptedTypes' => [...$bsonTypes['string']], + ], + 'accumulatorPercentile' => [ + 'acceptedTypes' => [...$bsonTypes['string']], + ], + 'whenMatched' => [ + 'acceptedTypes' => [...$bsonTypes['string']], + ], + 'whenNotMatched' => [ + 'acceptedTypes' => [...$bsonTypes['string']], + ], + + // @todo create specific model classes factories + 'outCollection' => [ + 'acceptedTypes' => [...$bsonTypes['object']], + ], + 'range' => [ + 'acceptedTypes' => [...$bsonTypes['object']], + ], + 'sortBy' => [ + 'acceptedTypes' => [...$bsonTypes['object']], + ], + 'geoPoint' => [ + 'acceptedTypes' => [...$bsonTypes['object']], + ], + + // Search + 'searchPath' => [ + 'acceptedTypes' => ['string', 'array'], + ], + 'searchScore' => [ + 'acceptedTypes' => [...$bsonTypes['object']], + ], +]; diff --git a/generator/config/query/all.yaml b/generator/config/query/all.yaml new file mode 100644 index 000000000..868e205e2 --- /dev/null +++ b/generator/config/query/all.yaml @@ -0,0 +1,43 @@ +# $schema: ../schema.json +name: $all +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/all/' +type: + - fieldQuery +encode: single +description: | + Matches arrays that contain all elements specified in the query. +arguments: + - + name: value + type: + - fieldQuery + variadic: array +tests: + - + name: 'Use $all to Match Values' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/all/#use--all-to-match-values' + pipeline: + - + $match: + tags: + $all: + - 'appliance' + - 'school' + - 'book' + - + name: 'Use $all with $elemMatch' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/all/#use--all-with--elemmatch' + pipeline: + - + $match: + qty: + $all: + - + $elemMatch: + size: 'M' + num: + $gt: 50 + - + $elemMatch: + num: 100 + color: 'green' diff --git a/generator/config/query/and.yaml b/generator/config/query/and.yaml new file mode 100644 index 000000000..74ebf506e --- /dev/null +++ b/generator/config/query/and.yaml @@ -0,0 +1,51 @@ +# $schema: ../schema.json +name: $and +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/and/' +type: + - query +encode: single +description: | + Joins query clauses with a logical AND returns all documents that match the conditions of both clauses. +arguments: + - + name: queries + type: + - query + variadic: array + variadicMin: 1 +tests: + - + name: 'AND Queries With Multiple Expressions Specifying the Same Field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/and/#and-queries-with-multiple-expressions-specifying-the-same-field' + pipeline: + - + $match: + $and: + - + price: + $ne: 1.99 + - + price: + $exists: true + - + name: 'AND Queries With Multiple Expressions Specifying the Same Operator' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/and/#and-queries-with-multiple-expressions-specifying-the-same-operator' + pipeline: + - + $match: + $and: + - + $or: + - + qty: + $lt: 10 + - + qty: + $gt: 50 + - + $or: + - + sale: true + - + price: + $lt: 5 diff --git a/generator/config/query/bitsAllClear.yaml b/generator/config/query/bitsAllClear.yaml new file mode 100644 index 000000000..48e98037d --- /dev/null +++ b/generator/config/query/bitsAllClear.yaml @@ -0,0 +1,38 @@ +# $schema: ../schema.json +name: $bitsAllClear +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllClear/' +type: + - fieldQuery +encode: single +description: | + Matches numeric or binary values in which a set of bit positions all have a value of 0. +arguments: + - + name: bitmask + type: + - int + - binData + - array # of int +tests: + - + name: 'Bit Position Array' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllClear/#bit-position-array' + pipeline: + - + $match: + a: + $bitsAllClear: [1, 5] + - + name: 'Integer Bitmask' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllClear/#integer-bitmask' + pipeline: + - $match: + a: + $bitsAllClear: 35 + - + name: 'BinData Bitmask' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllClear/#bindata-bitmask' + pipeline: + - $match: + a: + $bitsAllClear: !bson_binary 'IA==' diff --git a/generator/config/query/bitsAllSet.yaml b/generator/config/query/bitsAllSet.yaml new file mode 100644 index 000000000..25e2c6eb8 --- /dev/null +++ b/generator/config/query/bitsAllSet.yaml @@ -0,0 +1,38 @@ +# $schema: ../schema.json +name: $bitsAllSet +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllSet/' +type: + - fieldQuery +encode: single +description: | + Matches numeric or binary values in which a set of bit positions all have a value of 1. +arguments: + - + name: bitmask + type: + - int + - binData + - array # of int +tests: + - + name: 'Bit Position Array' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllSet/#bit-position-array' + pipeline: + - + $match: + a: + $bitsAllSet: [1, 5] + - + name: 'Integer Bitmask' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllSet/#integer-bitmask' + pipeline: + - $match: + a: + $bitsAllSet: 50 + - + name: 'BinData Bitmask' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllSet/#bindata-bitmask' + pipeline: + - $match: + a: + $bitsAllSet: !bson_binary 'MA==' diff --git a/generator/config/query/bitsAnyClear.yaml b/generator/config/query/bitsAnyClear.yaml new file mode 100644 index 000000000..a41260998 --- /dev/null +++ b/generator/config/query/bitsAnyClear.yaml @@ -0,0 +1,38 @@ +# $schema: ../schema.json +name: $bitsAnyClear +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnyClear/' +type: + - fieldQuery +encode: single +description: | + Matches numeric or binary values in which any bit from a set of bit positions has a value of 0. +arguments: + - + name: bitmask + type: + - int + - binData + - array # of int +tests: + - + name: 'Bit Position Array' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnyClear/#bit-position-array' + pipeline: + - + $match: + a: + $bitsAnyClear: [1, 5] + - + name: 'Integer Bitmask' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnyClear/#integer-bitmask' + pipeline: + - $match: + a: + $bitsAnyClear: 35 + - + name: 'BinData Bitmask' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnyClear/#bindata-bitmask' + pipeline: + - $match: + a: + $bitsAnyClear: !bson_binary 'MA==' diff --git a/generator/config/query/bitsAnySet.yaml b/generator/config/query/bitsAnySet.yaml new file mode 100644 index 000000000..95aae908a --- /dev/null +++ b/generator/config/query/bitsAnySet.yaml @@ -0,0 +1,38 @@ +# $schema: ../schema.json +name: $bitsAnySet +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnySet/' +type: + - fieldQuery +encode: single +description: | + Matches numeric or binary values in which any bit from a set of bit positions has a value of 1. +arguments: + - + name: bitmask + type: + - int + - binData + - array # of int +tests: + - + name: 'Bit Position Array' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnySet/#bit-position-array' + pipeline: + - + $match: + a: + $bitsAnySet: [1, 5] + - + name: 'Integer Bitmask' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnySet/#integer-bitmask' + pipeline: + - $match: + a: + $bitsAnySet: 35 + - + name: 'BinData Bitmask' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnySet/#bindata-bitmask' + pipeline: + - $match: + a: + $bitsAnySet: !bson_binary 'MA==' diff --git a/generator/config/query/box.yaml b/generator/config/query/box.yaml new file mode 100644 index 000000000..14043c4ae --- /dev/null +++ b/generator/config/query/box.yaml @@ -0,0 +1,13 @@ +# $schema: ../schema.json +name: $box +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/box/' +type: + - geometry +encode: single +description: | + Specifies a rectangular box using legacy coordinate pairs for $geoWithin queries. The 2d index supports $box. +arguments: + - + name: value + type: + - array diff --git a/generator/config/query/center.yaml b/generator/config/query/center.yaml new file mode 100644 index 000000000..c86215a52 --- /dev/null +++ b/generator/config/query/center.yaml @@ -0,0 +1,13 @@ +# $schema: ../schema.json +name: $center +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/center/' +type: + - geometry +encode: single +description: | + Specifies a circle using legacy coordinate pairs to $geoWithin queries when using planar geometry. The 2d index supports $center. +arguments: + - + name: value + type: + - array diff --git a/generator/config/query/centerSphere.yaml b/generator/config/query/centerSphere.yaml new file mode 100644 index 000000000..e3677dade --- /dev/null +++ b/generator/config/query/centerSphere.yaml @@ -0,0 +1,13 @@ +# $schema: ../schema.json +name: $centerSphere +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/centerSphere/' +type: + - geometry +encode: single +description: | + Specifies a circle using either legacy coordinate pairs or GeoJSON format for $geoWithin queries when using spherical geometry. The 2dsphere and 2d indexes support $centerSphere. +arguments: + - + name: value + type: + - array diff --git a/generator/config/query/comment.yaml b/generator/config/query/comment.yaml new file mode 100644 index 000000000..13a344613 --- /dev/null +++ b/generator/config/query/comment.yaml @@ -0,0 +1,31 @@ +# $schema: ../schema.json +name: $comment +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/comment/' +type: + - query +encode: single +description: | + Adds a comment to a query predicate. +arguments: + - + name: comment + type: + - string +tests: + - + name: 'Attach a Comment to an Aggregation Expression' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/comment/#attach-a-comment-to-an-aggregation-expression' + pipeline: + - + $match: + x: + $gt: 0 + $comment: 'Don''t allow negative inputs.' + - + $group: + _id: + $mod: + - '$x' + - 2 + total: + $sum: '$x' diff --git a/generator/config/query/elemMatch.yaml b/generator/config/query/elemMatch.yaml new file mode 100644 index 000000000..95db9572e --- /dev/null +++ b/generator/config/query/elemMatch.yaml @@ -0,0 +1,68 @@ +# $schema: ../schema.json +name: $elemMatch +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/elemMatch/' +type: + - fieldQuery +encode: single +description: | + The $elemMatch operator matches documents that contain an array field with at least one element that matches all the specified query criteria. +arguments: + - + name: query + type: + - query + - fieldQuery +tests: + - + name: 'Element Match' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/elemMatch/#element-match' + pipeline: + - + $match: + results: + $elemMatch: + $gte: 80 + $lt: 85 + - + name: 'Array of Embedded Documents' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/elemMatch/#array-of-embedded-documents' + pipeline: + - + $match: + results: + $elemMatch: + product: 'xyz' + score: + $gte: 8 + - + name: 'Single Query Condition' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/elemMatch/#single-query-condition' + pipeline: + - + $match: + results: + $elemMatch: + product: + $ne: 'xyz' + - + name: 'Using $or with $elemMatch' + pipeline: + - + $match: + game: + $elemMatch: + $or: + - + score: + $gt: 10 + - + score: + $lt: 5 + - + name: 'Single field operator' + pipeline: + - + $match: + results: + $elemMatch: + $gt: 10 diff --git a/generator/config/query/eq.yaml b/generator/config/query/eq.yaml new file mode 100644 index 000000000..5629114cc --- /dev/null +++ b/generator/config/query/eq.yaml @@ -0,0 +1,61 @@ +# $schema: ../schema.json +name: $eq +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/eq/' +type: + - fieldQuery +encode: single +description: | + Matches values that are equal to a specified value. +arguments: + - + name: value + type: + - any +tests: + - + name: 'Equals a Specified Value' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/eq/#equals-a-specified-value' + pipeline: + - + $match: + qty: + $eq: 20 + + - + name: 'Field in Embedded Document Equals a Value' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/eq/#field-in-embedded-document-equals-a-value' + pipeline: + - + $match: + 'item.name': + $eq: 'ab' + + - + name: 'Equals an Array Value' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/eq/#equals-an-array-value' + pipeline: + - + $match: + tags: + $eq: ['A', 'B'] + + - + name: 'Regex Match Behaviour' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/eq/#regex-match-behaviour' + pipeline: + - + $match: + company: 'MongoDB' + - + $match: + company: + $eq: 'MongoDB' + - + $match: + company: + !bson_regex '^MongoDB' + - + $match: + company: + $eq: + !bson_regex '^MongoDB' diff --git a/generator/config/query/exists.yaml b/generator/config/query/exists.yaml new file mode 100644 index 000000000..00d7ce2cb --- /dev/null +++ b/generator/config/query/exists.yaml @@ -0,0 +1,39 @@ +# $schema: ../schema.json +name: $exists +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/exists/' +type: + - fieldQuery +encode: single +description: | + Matches documents that have the specified field. +arguments: + - + name: exists + type: + - bool + default: true +tests: + - + name: 'Exists and Not Equal To' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/exists/#exists-and-not-equal-to' + pipeline: + - + $match: + qty: + $exists: true + $nin: [5, 15] + - + name: 'Null Values' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/exists/#null-values' + pipeline: + - + $match: + qty: + $exists: true + - + name: 'Missing Field' + pipeline: + - + $match: + qty: + $exists: false diff --git a/generator/config/query/expr.yaml b/generator/config/query/expr.yaml new file mode 100644 index 000000000..320c84507 --- /dev/null +++ b/generator/config/query/expr.yaml @@ -0,0 +1,47 @@ +# $schema: ../schema.json +name: $expr +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/expr/' +type: + - query +encode: single +description: | + Allows use of aggregation expressions within the query language. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Compare Two Fields from A Single Document' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/expr/#compare-two-fields-from-a-single-document' + pipeline: + - + $match: + $expr: + $gt: + - '$spent' + - '$budget' + - + name: 'Using $expr With Conditional Statements' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/expr/#using--expr-with-conditional-statements' + pipeline: + - + $match: + $expr: + $lt: + - + $cond: + if: + $gte: + - '$qty' + - 100 + then: + $multiply: + - '$price' + - 0.5 + else: + $multiply: + - '$price' + - 0.75 + - 5 diff --git a/generator/config/query/geoIntersects.yaml b/generator/config/query/geoIntersects.yaml new file mode 100644 index 000000000..4df3a43de --- /dev/null +++ b/generator/config/query/geoIntersects.yaml @@ -0,0 +1,53 @@ +# $schema: ../schema.json +name: $geoIntersects +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/geoIntersects/' +type: + - fieldQuery +encode: object +description: | + Selects geometries that intersect with a GeoJSON geometry. The 2dsphere index supports $geoIntersects. +arguments: + - + name: geometry + mergeObject: true + type: + - geometry +tests: + - + name: 'Intersects a Polygon' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/geoIntersects/#intersects-a-polygon' + pipeline: + - + $match: + loc: + $geoIntersects: + $geometry: + type: 'Polygon' + coordinates: + - + - [ 0, 0 ] + - [ 3, 6 ] + - [ 6, 1 ] + - [ 0, 0 ] + - + name: 'Intersects a Big Polygon' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/geoIntersects/#intersects-a--big--polygon' + pipeline: + - + $match: + loc: + $geoIntersects: + $geometry: + type: 'Polygon' + coordinates: + - + - [ -100, 60 ] + - [ -100, 0 ] + - [ -100, -60 ] + - [ 100, -60 ] + - [ 100, 60 ] + - [ -100, 60 ] + crs: + type: 'name' + properties: + name: 'urn:x-mongodb:crs:strictwinding:EPSG:4326' diff --git a/generator/config/query/geoWithin.yaml b/generator/config/query/geoWithin.yaml new file mode 100644 index 000000000..f9f6204d0 --- /dev/null +++ b/generator/config/query/geoWithin.yaml @@ -0,0 +1,53 @@ +# $schema: ../schema.json +name: $geoWithin +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/' +type: + - fieldQuery +encode: object +description: | + Selects geometries within a bounding GeoJSON geometry. The 2dsphere and 2d indexes support $geoWithin. +arguments: + - + name: geometry + mergeObject: true + type: + - geometry +tests: + - + name: 'Within a Polygon' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/#within-a-polygon' + pipeline: + - + $match: + loc: + $geoWithin: + $geometry: + type: 'Polygon' + coordinates: + - + - [ 0, 0 ] + - [ 3, 6 ] + - [ 6, 1 ] + - [ 0, 0 ] + - + name: 'Within a Big Polygon' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/#within-a--big--polygon' + pipeline: + - + $match: + loc: + $geoWithin: + $geometry: + type: 'Polygon' + coordinates: + - + - [ -100, 60 ] + - [ -100, 0 ] + - [ -100, -60 ] + - [ 100, -60 ] + - [ 100, 60 ] + - [ -100, 60 ] + crs: + type: 'name' + properties: + name: 'urn:x-mongodb:crs:strictwinding:EPSG:4326' diff --git a/generator/config/query/geometry.yaml b/generator/config/query/geometry.yaml new file mode 100644 index 000000000..40b18dc99 --- /dev/null +++ b/generator/config/query/geometry.yaml @@ -0,0 +1,22 @@ +# $schema: ../schema.json +name: $geometry +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/geometry/' +type: + - geometry +encode: object +description: | + Specifies a geometry in GeoJSON format to geospatial query operators. +arguments: + - + name: type + type: + - string + - + name: coordinates + type: + - array + - + name: crs + type: + - object + optional: true diff --git a/generator/config/query/gt.yaml b/generator/config/query/gt.yaml new file mode 100644 index 000000000..9914a5f34 --- /dev/null +++ b/generator/config/query/gt.yaml @@ -0,0 +1,22 @@ +# $schema: ../schema.json +name: $gt +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/gt/' +type: + - fieldQuery +encode: single +description: | + Matches values that are greater than a specified value. +arguments: + - + name: value + type: + - any +tests: + - + name: 'Match Document Fields' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/gt/#match-document-fields' + pipeline: + - + $match: + qty: + $gt: 20 diff --git a/generator/config/query/gte.yaml b/generator/config/query/gte.yaml new file mode 100644 index 000000000..d8617a7c6 --- /dev/null +++ b/generator/config/query/gte.yaml @@ -0,0 +1,22 @@ +# $schema: ../schema.json +name: $gte +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/gte/' +type: + - fieldQuery +encode: single +description: | + Matches values that are greater than or equal to a specified value. +arguments: + - + name: value + type: + - any +tests: + - + name: 'Match Document Fields' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/gte/#match-document-fields' + pipeline: + - + $match: + qty: + $gte: 20 diff --git a/generator/config/query/in.yaml b/generator/config/query/in.yaml new file mode 100644 index 000000000..67f069416 --- /dev/null +++ b/generator/config/query/in.yaml @@ -0,0 +1,32 @@ +# $schema: ../schema.json +name: $in +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/in/' +type: + - fieldQuery +encode: single +description: | + Matches any of the values specified in an array. +arguments: + - + name: value + type: + - array # of expression +tests: + - + name: 'Use the $in Operator to Match Values in an Array' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/in/#use-the--in-operator-to-match-values' + pipeline: + - + $match: + tags: + $in: ['home', 'school'] + - + name: 'Use the $in Operator with a Regular Expression' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/in/#use-the--in-operator-with-a-regular-expression' + pipeline: + - + $match: + tags: + $in: + - !bson_regex '^be' + - !bson_regex '^st' diff --git a/generator/config/query/jsonSchema.yaml b/generator/config/query/jsonSchema.yaml new file mode 100644 index 000000000..4c1dca6ad --- /dev/null +++ b/generator/config/query/jsonSchema.yaml @@ -0,0 +1,39 @@ +# $schema: ../schema.json +name: $jsonSchema +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/jsonSchema/' +type: + - query +encode: single +description: | + Validate documents against the given JSON Schema. +arguments: + - + name: schema + type: + - object +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/jsonSchema/#syntax' + pipeline: + - + $match: + $jsonSchema: + required: + - 'name' + - 'major' + - 'gpa' + - 'address' + properties: + name: + bsonType: 'string' + description: 'must be a string and is required' + address: + bsonType: 'object' + required: + - 'zipcode' + properties: + street: + bsonType: 'string' + zipcode: + bsonType: 'string' diff --git a/generator/config/query/lt.yaml b/generator/config/query/lt.yaml new file mode 100644 index 000000000..f1c996ded --- /dev/null +++ b/generator/config/query/lt.yaml @@ -0,0 +1,22 @@ +# $schema: ../schema.json +name: $lt +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/lt/' +type: + - fieldQuery +encode: single +description: | + Matches values that are less than a specified value. +arguments: + - + name: value + type: + - any +tests: + - + name: 'Match Document Fields' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/lt/#match-document-fields' + pipeline: + - + $match: + qty: + $lt: 20 diff --git a/generator/config/query/lte.yaml b/generator/config/query/lte.yaml new file mode 100644 index 000000000..e61d01b03 --- /dev/null +++ b/generator/config/query/lte.yaml @@ -0,0 +1,22 @@ +# $schema: ../schema.json +name: $lte +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/lte/' +type: + - fieldQuery +encode: single +description: | + Matches values that are less than or equal to a specified value. +arguments: + - + name: value + type: + - any +tests: + - + name: 'Match Document Fields' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/lte/#match-document-fields' + pipeline: + - + $match: + qty: + $lte: 20 diff --git a/generator/config/query/maxDistance.yaml b/generator/config/query/maxDistance.yaml new file mode 100644 index 000000000..e95212d23 --- /dev/null +++ b/generator/config/query/maxDistance.yaml @@ -0,0 +1,13 @@ +# $schema: ../schema.json +name: $maxDistance +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/maxDistance/' +type: + - fieldQuery +encode: single +description: | + Specifies a maximum distance to limit the results of $near and $nearSphere queries. The 2dsphere and 2d indexes support $maxDistance. +arguments: + - + name: value + type: + - number diff --git a/generator/config/query/minDistance.yaml b/generator/config/query/minDistance.yaml new file mode 100644 index 000000000..fd467a96f --- /dev/null +++ b/generator/config/query/minDistance.yaml @@ -0,0 +1,14 @@ +# $schema: ../schema.json +name: $minDistance +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/minDistance/' +type: + - fieldQuery +encode: single +description: | + Specifies a minimum distance to limit the results of $near and $nearSphere queries. For use with 2dsphere index only. +arguments: + - + name: value + type: + - int + - double diff --git a/generator/config/query/mod.yaml b/generator/config/query/mod.yaml new file mode 100644 index 000000000..04a187253 --- /dev/null +++ b/generator/config/query/mod.yaml @@ -0,0 +1,42 @@ +# $schema: ../schema.json +name: $mod +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/mod/' +type: + - fieldQuery +encode: array +description: | + Performs a modulo operation on the value of a field and selects documents with a specified result. +arguments: + - + name: divisor + type: + - number + - + name: remainder + type: + - number +tests: + - + name: 'Use $mod to Select Documents' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/mod/#use--mod-to-select-documents' + pipeline: + - + $match: + qty: + $mod: [4, 0] + - + name: 'Floating Point Arguments' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/mod/#floating-point-arguments' + pipeline: + - + $match: + qty: + $mod: [4.0, 0] + - + $match: + qty: + $mod: [4.5, 0] + - + $match: + qty: + $mod: [4.99, 0] diff --git a/generator/config/query/ne.yaml b/generator/config/query/ne.yaml new file mode 100644 index 000000000..a1f5a046b --- /dev/null +++ b/generator/config/query/ne.yaml @@ -0,0 +1,22 @@ +# $schema: ../schema.json +name: $ne +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/ne/' +type: + - fieldQuery +encode: single +description: | + Matches all values that are not equal to a specified value. +arguments: + - + name: value + type: + - any +tests: + - + name: 'Match Document Fields' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/ne/#match-document-fields' + pipeline: + - + $match: + quantity: + $ne: 20 diff --git a/generator/config/query/near.yaml b/generator/config/query/near.yaml new file mode 100644 index 000000000..89d7f511f --- /dev/null +++ b/generator/config/query/near.yaml @@ -0,0 +1,44 @@ +# $schema: ../schema.json +name: $near +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/near/' +type: + - fieldQuery +encode: object +description: | + Returns geospatial objects in proximity to a point. Requires a geospatial index. The 2dsphere and 2d indexes support $near. +arguments: + - + name: geometry + mergeObject: true + type: + - geometry + - + name: $maxDistance + type: + - number + optional: true + description: | + Distance in meters. Limits the results to those documents that are at most the specified distance from the center point. + - + name: $minDistance + type: + - number + optional: true + description: | + Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. +tests: + - + name: 'Query on GeoJSON Data' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/near/#query-on-geojson-data' + pipeline: + - + $match: + location: + $near: + $geometry: + type: 'Point' + coordinates: + - -73.9667 + - 40.78 + $minDistance: 1000 + $maxDistance: 5000 diff --git a/generator/config/query/nearSphere.yaml b/generator/config/query/nearSphere.yaml new file mode 100644 index 000000000..72e8e18e9 --- /dev/null +++ b/generator/config/query/nearSphere.yaml @@ -0,0 +1,42 @@ +# $schema: ../schema.json +name: $nearSphere +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/nearSphere/' +type: + - fieldQuery +encode: object +description: | + Returns geospatial objects in proximity to a point on a sphere. Requires a geospatial index. The 2dsphere and 2d indexes support $nearSphere. +arguments: + - + name: geometry + mergeObject: true + type: + - geometry + - + name: $maxDistance + type: + - number + optional: true + description: | + Distance in meters. + - + name: $minDistance + type: + - number + optional: true + description: | + Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. +tests: + - + name: 'Specify Center Point Using GeoJSON' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/nearSphere/#specify-center-point-using-geojson' + pipeline: + - + $match: + location: + $nearSphere: + $geometry: + type: 'Point' + coordinates: [-73.9667, 40.78] + $minDistance: 1000 + $maxDistance: 5000 diff --git a/generator/config/query/nin.yaml b/generator/config/query/nin.yaml new file mode 100644 index 000000000..4285e4fe7 --- /dev/null +++ b/generator/config/query/nin.yaml @@ -0,0 +1,30 @@ +# $schema: ../schema.json +name: $nin +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/nin/' +type: + - fieldQuery +encode: single +description: | + Matches none of the values specified in an array. +arguments: + - + name: value + type: + - array # of expression +tests: + - + name: 'Select on Unmatching Documents' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/nin/#select-on-unmatching-documents' + pipeline: + - + $match: + quantity: + $nin: [5, 15] + - + name: 'Select on Elements Not in an Array' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/nin/#select-on-elements-not-in-an-array' + pipeline: + - + $match: + tags: + $nin: ['school'] diff --git a/generator/config/query/nor.yaml b/generator/config/query/nor.yaml new file mode 100644 index 000000000..d1ad7159a --- /dev/null +++ b/generator/config/query/nor.yaml @@ -0,0 +1,58 @@ +# $schema: ../schema.json +name: $nor +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/nor/' +type: + - query +encode: single +description: | + Joins query clauses with a logical NOR returns all documents that fail to match both clauses. +arguments: + - + name: queries + type: + - query + variadic: array + variadicMin: 1 +tests: + - + name: 'Query with Two Expressions' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/nor/#-nor-query-with-two-expressions' + pipeline: + - + $match: + $nor: + - + price: 1.99 + - + sale: true + - + name: 'Additional Comparisons' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/nor/#-nor-and-additional-comparisons' + pipeline: + - + $match: + $nor: + - + price: 1.99 + - + qty: + $lt: 20 + - + sale: true + - + name: '$nor and $exists' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/nor/#-nor-and--exists' + pipeline: + - + $match: + $nor: + - + price: 1.99 + - + price: + $exists: false + - + sale: true + - + sale: + $exists: false diff --git a/generator/config/query/not.yaml b/generator/config/query/not.yaml new file mode 100644 index 000000000..eb2b43cdb --- /dev/null +++ b/generator/config/query/not.yaml @@ -0,0 +1,31 @@ +# $schema: ../schema.json +name: $not +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/not/' +type: + - fieldQuery +encode: single +description: | + Inverts the effect of a query expression and returns documents that do not match the query expression. +arguments: + - + name: expression + type: + - fieldQuery +tests: + - + name: 'Syntax' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/not/#syntax' + pipeline: + - + $match: + price: + $not: + $gt: 1.99 + - + name: 'Regular Expressions' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/not/#-not-and-regular-expressions' + pipeline: + - + $match: + price: + $not: !bson_regex '^p.*' diff --git a/generator/config/query/or.yaml b/generator/config/query/or.yaml new file mode 100644 index 000000000..ce2b7603c --- /dev/null +++ b/generator/config/query/or.yaml @@ -0,0 +1,47 @@ +# $schema: ../schema.json +name: $or +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/or/' +type: + - query +encode: single +description: | + Joins query clauses with a logical OR returns all documents that match the conditions of either clause. +arguments: + - + name: queries + type: + - query + variadic: array + variadicMin: 1 +tests: + - + name: '$or Clauses' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/or/#-or-clauses-and-indexes' + pipeline: + - + $match: + $or: + - + quantity: + $lt: 20 + - + price: 10 + + - + name: 'Error Handling' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/or/#error-handling' + pipeline: + - + $match: + $or: + - + x: + $eq: 0 + - + $expr: + $eq: + - + $divide: + - 1 + - '$x' + - 3 diff --git a/generator/config/query/polygon.yaml b/generator/config/query/polygon.yaml new file mode 100644 index 000000000..1a46f2bc4 --- /dev/null +++ b/generator/config/query/polygon.yaml @@ -0,0 +1,13 @@ +# $schema: ../schema.json +name: $polygon +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/polygon/' +type: + - geometry +encode: single +description: | + Specifies a polygon to using legacy coordinate pairs for $geoWithin queries. The 2d index supports $center. +arguments: + - + name: points + type: + - array diff --git a/generator/config/query/rand.yaml b/generator/config/query/rand.yaml new file mode 100644 index 000000000..6773ae0d5 --- /dev/null +++ b/generator/config/query/rand.yaml @@ -0,0 +1,26 @@ +# $schema: ../schema.json +name: $rand +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/rand/' +type: + - resolvesToDouble +encode: object +description: | + Generates a random float between 0 and 1. +tests: + - + name: 'Select Random Items From a Collection' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/rand/#select-random-items-from-a-collection' + pipeline: + - + $match: + district: 3 + $expr: + $lt: + - 0.5 + - + $rand: {} + - + $project: + _id: 0 + name: 1 + registered: 1 diff --git a/generator/config/query/regex.yaml b/generator/config/query/regex.yaml new file mode 100644 index 000000000..c7e378ddd --- /dev/null +++ b/generator/config/query/regex.yaml @@ -0,0 +1,33 @@ +# $schema: ../schema.json +name: $regex +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/regex/' +type: + - fieldQuery +encode: single +description: | + Selects documents where values match a specified regular expression. +arguments: + - + name: regex + type: + - regex + +tests: + - + name: 'Perform a LIKE Match' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/regex/#perform-a-like-match' + pipeline: + - + $match: + sku: + $regex: + !bson_regex '789$' + - + name: 'Perform Case-Insensitive Regular Expression Match' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/regex/#perform-case-insensitive-regular-expression-match' + pipeline: + - + $match: + sku: + $regex: + !bson_regex ['^ABC', 'i'] diff --git a/generator/config/query/sampleRate.yaml b/generator/config/query/sampleRate.yaml new file mode 100644 index 000000000..9995e2d8b --- /dev/null +++ b/generator/config/query/sampleRate.yaml @@ -0,0 +1,26 @@ +# $schema: ../schema.json +name: $sampleRate +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sampleRate/' +type: + - query +encode: single +description: | + Randomly select documents at a given rate. Although the exact number of documents selected varies on each run, the quantity chosen approximates the sample rate expressed as a percentage of the total number of documents. +arguments: + - + name: rate + type: + - resolvesToDouble + description: | + The selection process uses a uniform random distribution. The sample rate is a floating point number between 0 and 1, inclusive, which represents the probability that a given document will be selected as it passes through the pipeline. + For example, a sample rate of 0.33 selects roughly one document in three. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sampleRate/#examples' + pipeline: + - + $match: + $sampleRate: 0.33 + - + $count: 'numMatches' diff --git a/generator/config/query/size.yaml b/generator/config/query/size.yaml new file mode 100644 index 000000000..629de4035 --- /dev/null +++ b/generator/config/query/size.yaml @@ -0,0 +1,22 @@ +# $schema: ../schema.json +name: $size +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/size/' +type: + - fieldQuery +encode: single +description: | + Selects documents if the array field is a specified size. +arguments: + - + name: value + type: + - int +tests: + - + name: 'Query an Array by Array Length' + link: 'https://www.mongodb.com/docs/manual/tutorial/query-arrays/#query-an-array-by-array-length' + pipeline: + - + $match: + tags: + $size: 3 diff --git a/generator/config/query/text.yaml b/generator/config/query/text.yaml new file mode 100644 index 000000000..574ee4508 --- /dev/null +++ b/generator/config/query/text.yaml @@ -0,0 +1,114 @@ +# $schema: ../schema.json +name: $text +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/text/' +type: + - query +encode: object +description: | + Performs text search. +arguments: + - + name: $search + type: + - string + description: | + A string of terms that MongoDB parses and uses to query the text index. MongoDB performs a logical OR search of the terms unless specified as a phrase. + - + name: $language + type: + - string + optional: true + description: | + The language that determines the list of stop words for the search and the rules for the stemmer and tokenizer. If not specified, the search uses the default language of the index. + If you specify a default_language value of none, then the text index parses through each word in the field, including stop words, and ignores suffix stemming. + - + name: $caseSensitive + type: + - bool + optional: true + description: | + A boolean flag to enable or disable case sensitive search. Defaults to false; i.e. the search defers to the case insensitivity of the text index. + - + name: $diacriticSensitive + type: + - bool + optional: true + description: | + A boolean flag to enable or disable diacritic sensitive search against version 3 text indexes. Defaults to false; i.e. the search defers to the diacritic insensitivity of the text index. + Text searches against earlier versions of the text index are inherently diacritic sensitive and cannot be diacritic insensitive. As such, the $diacriticSensitive option has no effect with earlier versions of the text index. +tests: + - + name: 'Search for a Single Word' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/text/#search-for-a-single-word' + pipeline: + - + $match: + $text: + $search: 'coffee' + - + name: 'Match Any of the Search Terms' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/text/#search-for-a-single-word' + pipeline: + - + $match: + $text: + $search: 'bake coffee cake' + - + name: 'Search a Different Language' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/text/#search-a-different-language' + pipeline: + - + $match: + $text: + $search: 'leche' + $language: 'es' + - + name: 'Case and Diacritic Insensitive Search' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/text/#case-and-diacritic-insensitive-search' + pipeline: + - + $match: + $text: + $search: 'сы́рники CAFÉS' + - + name: 'Perform Case Sensitive Search' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/text/#perform-case-sensitive-search' + pipeline: + - + $match: + $text: + $search: 'Coffee' + $caseSensitive: true + - + $match: + $text: + $search: '\"Café Con Leche\"' + $caseSensitive: true + - + name: 'Diacritic Sensitive Search' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/text/#perform-case-sensitive-search' + pipeline: + - + $match: + $text: + $search: 'CAFÉ' + $diacriticSensitive: true + - + name: 'Text Search Score Examples' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/text/#perform-case-sensitive-search' + pipeline: + - + $match: + $text: + $search: 'CAFÉ' + $diacriticSensitive: true + - + $project: + score: + $meta: 'textScore' + - + $sort: + score: + $meta: 'textScore' + - + $limit: 5 diff --git a/generator/config/query/type.yaml b/generator/config/query/type.yaml new file mode 100644 index 000000000..d8cd7bc86 --- /dev/null +++ b/generator/config/query/type.yaml @@ -0,0 +1,88 @@ +# $schema: ../schema.json +name: $type +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/type/' +type: + - fieldQuery +encode: single +description: | + Selects documents if a field is of the specified type. +arguments: + - + name: type + type: + - int + - string + variadic: array +tests: + - + name: 'Querying by Data Type' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/type/#querying-by-data-type' + pipeline: + - + $match: + zipCode: + # Example uses the short form, the builder always generates the verbose form + # $type: 2 + $type: [2] + - + $match: + zipCode: + # Example uses the short form, the builder always generates the verbose form + # $type: 'string' + $type: ['string'] + - + $match: + zipCode: + # Example uses the short form, the builder always generates the verbose form + # $type: 1 + $type: [1] + - + $match: + zipCode: + # Example uses the short form, the builder always generates the verbose form + # $type: 'double' + $type: ['double'] + - + $match: + zipCode: + # Example uses the short form, the builder always generates the verbose form + # $type: 'number' + $type: ['number'] + - + name: 'Querying by Multiple Data Type' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/type/#querying-by-multiple-data-type' + pipeline: + - + $match: + zipCode: + $type: [2, 1] + - + $match: + zipCode: + $type: ['string', 'double'] + - + name: 'Querying by MinKey and MaxKey' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/type/#querying-by-minkey-and-maxkey' + pipeline: + - + $match: + zipCode: + # Example uses the short form, the builder always generates the verbose form + # $type: 'minKey' + $type: ['minKey'] + - + $match: + zipCode: + # Example uses the short form, the builder always generates the verbose form + # $type: 'maxKey' + $type: ['maxKey'] + - + name: 'Querying by Array Type' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/type/#querying-by-array-type' + pipeline: + - + $match: + zipCode: + # Example uses the short form, the builder always generates the verbose form + # $type: 'array' + $type: ['array'] diff --git a/generator/config/query/where.yaml b/generator/config/query/where.yaml new file mode 100644 index 000000000..5f5c974ab --- /dev/null +++ b/generator/config/query/where.yaml @@ -0,0 +1,36 @@ +# $schema: ../schema.json +name: $where +link: 'https://www.mongodb.com/docs/manual/reference/operator/query/where/' +type: + - query +encode: single +description: | + Matches documents that satisfy a JavaScript expression. +arguments: + - + name: function + type: + - javascript +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/query/where/#example' + pipeline: + - + $match: + $where: + $code: |- + function() { + return hex_md5(this.name) == "9b53e667f30cd329dca1ec9e6a83e994" + } + - + $match: + $expr: + $function: + body: + $code: |- + function(name) { + return hex_md5(name) == "9b53e667f30cd329dca1ec9e6a83e994"; + } + args: ['$name'] + lang: 'js' diff --git a/generator/config/schema.json b/generator/config/schema.json new file mode 100644 index 000000000..63739ebcb --- /dev/null +++ b/generator/config/schema.json @@ -0,0 +1,221 @@ +{ + "$schema": "http://json-schema.org/draft-06/schema#", + "$ref": "#/definitions/Operator", + "definitions": { + "Operator": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "$comment": "The name of the operator. Must start with a $", + "type": "string", + "pattern": "^\\$?[a-z][a-zA-Z0-9]*$" + }, + "link": { + "$comment": "The link to the operator's documentation on MongoDB's website.", + "type": "string", + "format": "uri", + "pattern": "^https://" + }, + "type": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "accumulator", + "stage", + "query", + "fieldQuery", + "filter", + "window", + "geometry", + "switchBranch", + "resolvesToAny", + "resolvesToNumber", + "resolvesToDouble", + "resolvesToString", + "resolvesToObject", + "resolvesToArray", + "resolvesToBinData", + "resolvesToObjectId", + "resolvesToBool", + "resolvesToDate", + "resolvesToNull", + "resolvesToRegex", + "resolvesToJavascript", + "resolvesToInt", + "resolvesToTimestamp", + "resolvesToLong", + "resolvesToDecimal", + "searchOperator" + ] + } + }, + "encode": { + "$comment": "Specifies how operator parameters are encoded.", + "$comment": "array: parameters are encoded as an array of values in the order they are defined by the spec", + "$comment": "object: parameters are encoded as an object with keys matching the parameter names", + "$comment": "single: get the single parameter value", + "$comment": "group: specific for $group stage", + "type": "string", + "enum": [ + "array", + "object", + "single", + "search" + ] + }, + "description": { + "$comment": "The description of the argument from MongoDB's documentation.", + "type": "string" + }, + "wrapObject": { + "$comment": "Wrap the properties in an object with the operator name", + "type": "boolean", + "default": true + }, + "arguments": { + "$comment": "An optional list of arguments for the operator.", + "type": "array", + "items": { + "$ref": "#/definitions/Argument" + } + }, + "tests": { + "$comment": "An optional list of examples for the operator.", + "type": "array", + "items": { + "$ref": "#/definitions/Test" + } + } + }, + "required": [ + "description", + "encode", + "link", + "name", + "type" + ], + "title": "Operator" + }, + "Argument": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "pattern": "^([_$]?[a-z][a-zA-Z0-9]*|N)$" + }, + "type": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "accumulator", + "query", + "fieldQuery", + "pipeline", + "window", + "expression", + "geometry", + "fieldPath", + "timeUnit", + "sortSpec", + "any", + "granularity", + "fullDocument", + "fullDocumentBeforeChange", + "accumulatorPercentile", + "whenMatched", + "whenNotMatched", + "outCollection", + "range", + "sortBy", + "geoPoint", + "resolvesToNumber", "numberFieldPath", "number", + "resolvesToDouble", "doubleFieldPath", "double", + "resolvesToString", "stringFieldPath", "string", + "resolvesToObject", "objectFieldPath", "object", + "resolvesToArray", "arrayFieldPath", "array", + "resolvesToBinData", "binDataFieldPath", "binData", + "resolvesToObjectId", "objectIdFieldPath", "objectId", + "resolvesToBool", "boolFieldPath", "bool", + "resolvesToDate", "dateFieldPath", "date", + "resolvesToNull", "nullFieldPath", "null", + "resolvesToRegex", "regexFieldPath", "regex", + "resolvesToJavascript", "javascriptFieldPath", "javascript", + "resolvesToInt", "intFieldPath", "int", + "resolvesToTimestamp", "timestampFieldPath", "timestamp", + "resolvesToLong", "longFieldPath", "long", + "resolvesToDecimal", "decimalFieldPath", "decimal", + "searchPath", "searchScore", "searchOperator" + ] + } + }, + "description": { + "$comment": "The description of the argument from MongoDB's documentation.", + "type": "string" + }, + "optional": { + "$comment": "Whether the argument is optional or not.", + "type": "boolean" + }, + "valueMin": { + "$comment": "The minimum value for a numeric argument.", + "type": "number" + }, + "valueMax": { + "$comment": "The maximum value for a numeric argument.", + "type": "number" + }, + "variadic": { + "$comment": "Whether the argument is variadic or not.", + "type": "string", + "enum": [ + "array", + "object" + ] + }, + "variadicMin": { + "$comment": "The minimum number of arguments for a variadic parameter.", + "type": "integer", + "minimum": 0 + }, + "default": { + "$comment": "The default value for the argument.", + "type": ["array", "boolean", "number", "string"] + }, + "mergeObject": { + "$comment": "Skip the name in object encoding and merge the properties of the value into the operator", + "type": "boolean", + "default": false + } + }, + "required": [ + "name", + "type" + ], + "title": "Argument" + }, + "Test": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "link": { + "type": "string", + "format": "uri", + "pattern": "^https://" + }, + "pipeline": { + "type": "array", + "items": { + "type": "object" + } + } + } + } + } +} diff --git a/generator/config/search/autocomplete.yaml b/generator/config/search/autocomplete.yaml new file mode 100644 index 000000000..a984b9a39 --- /dev/null +++ b/generator/config/search/autocomplete.yaml @@ -0,0 +1,152 @@ +# $schema: ../schema.json +name: autocomplete +link: 'https://www.mongodb.com/docs/atlas/atlas-search/autocomplete/' +type: + - searchOperator +encode: object +description: | + The autocomplete operator performs a search for a word or phrase that + contains a sequence of characters from an incomplete input string. The + fields that you intend to query with the autocomplete operator must be + indexed with the autocomplete data type in the collection's index definition. +arguments: + - + name: path + type: + - searchPath + - + name: query + type: + - string + - + name: tokenOrder + optional: true + type: + - string # any|sequential + - + name: fuzzy + optional: true + type: + - object + - + name: score + optional: true + type: + - searchScore +tests: + - + name: 'Basic' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/autocomplete/#basic-example' + pipeline: + - + $search: + autocomplete: + query: 'off' + path: 'title' + - + $limit: 10 + - + $project: + _id: 0 + title: 1 + + - + name: 'Fuzzy' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/autocomplete/#fuzzy-example' + pipeline: + - + $search: + autocomplete: + query: 'pre' + path: 'title' + fuzzy: + maxEdits: 1 + prefixLength: 1 + maxExpansions: 256 + - + $limit: 10 + - + $project: + _id: 0 + title: 1 + + - + name: 'Token Order any' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/autocomplete/#simple-any-example' + pipeline: + - + $search: + autocomplete: + query: 'men with' + path: 'title' + tokenOrder: 'any' + - + $limit: 4 + - + $project: + _id: 0 + title: 1 + + - + name: 'Token Order sequential' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/autocomplete/#simple-sequential-example' + pipeline: + - + $search: + autocomplete: + query: 'men with' + path: 'title' + tokenOrder: 'sequential' + - + $limit: 4 + - + $project: + _id: 0 + title: 1 + + - + name: 'Highlighting' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/autocomplete/#highlighting-example' + pipeline: + - + $search: + autocomplete: + query: 'ger' + path: 'title' + highlight: + path: 'title' + - + $limit: 5 + - + $project: + score: + $meta: 'searchScore' + _id: 0 + title: 1 + highlights: + $meta: 'searchHighlights' + + - + name: 'Across Multiple Fields' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/autocomplete/#search-across-multiple-fields' + pipeline: + - + $search: + compound: + should: + - + autocomplete: + query: 'inter' + path: 'title' + - + autocomplete: + query: 'inter' + path: 'plot' + minimumShouldMatch: 1 + - + $limit: 10 + - + $project: + _id: 0 + title: 1 + plot: 1 diff --git a/generator/config/search/compound.yaml b/generator/config/search/compound.yaml new file mode 100644 index 000000000..7a1d9f419 --- /dev/null +++ b/generator/config/search/compound.yaml @@ -0,0 +1,156 @@ +# $schema: ../schema.json +name: compound +link: 'https://www.mongodb.com/docs/atlas/atlas-search/compound/' +type: + - searchOperator +encode: object +description: | + The compound operator combines two or more operators into a single query. + Each element of a compound query is called a clause, and each clause + consists of one or more sub-queries. +arguments: + - + name: must + optional: true + type: + - searchOperator + - array # of searchOperator + - + name: mustNot + optional: true + type: + - searchOperator + - array # of searchOperator + - + name: should + optional: true + type: + - searchOperator + - array # of searchOperator + - + name: filter + optional: true + type: + - searchOperator + - array # of searchOperator + - + name: minimumShouldMatch + optional: true + type: + - int + - + name: score + optional: true + type: + - searchScore +tests: + - + name: 'must and mustNot' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/compound/#must-and-mustnot-example' + pipeline: + - + $search: + compound: + must: + - + text: + query: 'varieties' + path: 'description' + mustNot: + - + text: + query: 'apples' + path: 'description' + + - + name: 'must and should' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/compound/#must-and-should-example' + pipeline: + - + $search: + compound: + must: + - + text: + query: 'varieties' + path: 'description' + should: + - + text: + query: 'Fuji' + path: 'description' + - + $project: + score: + $meta: 'searchScore' + + - + name: 'minimumShouldMatch' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/compound/#minimumshouldmatch-example' + pipeline: + - + $search: + compound: + must: + - + text: + query: 'varieties' + path: 'description' + should: + - + text: + query: 'Fuji' + path: 'description' + - + text: + query: 'Golden Delicious' + path: 'description' + minimumShouldMatch: 1 + + - + name: 'Filter' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/compound/#filter-examples' + pipeline: + - + $search: + compound: + must: + - + text: + query: 'varieties' + path: 'description' + should: + - + text: + query: 'banana' + path: 'description' + filter: + - + text: + query: 'granny' + path: 'description' + + - + name: 'Nested' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/compound/#nested-example' + pipeline: + - + $search: + compound: + should: + - + text: + query: 'apple' + path: 'type' + - + compound: + must: + - + text: + query: 'organic' + path: 'category' + - + equals: + value: true + path: 'in_stock' + minimumShouldMatch: 1 diff --git a/generator/config/search/embeddedDocument.yaml b/generator/config/search/embeddedDocument.yaml new file mode 100644 index 000000000..19c804625 --- /dev/null +++ b/generator/config/search/embeddedDocument.yaml @@ -0,0 +1,155 @@ +# $schema: ../schema.json +name: embeddedDocument +link: 'https://www.mongodb.com/docs/atlas/atlas-search/embedded-document/' +type: + - searchOperator +encode: object +description: | + The embeddedDocument operator is similar to $elemMatch operator. + It constrains multiple query predicates to be satisfied from a single + element of an array of embedded documents. embeddedDocument can be used only + for queries over fields of the embeddedDocuments +arguments: + - + name: path + type: + - searchPath + - + name: operator + type: + - searchOperator + - + name: score + optional: true + type: + - searchScore +tests: + - + name: 'Basic' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/embedded-document/#index-definition' + pipeline: + - + $search: + embeddedDocument: + path: 'items' + operator: + compound: + must: + - + text: + path: 'items.tags' + query: 'school' + should: + - + text: + path: 'items.name' + query: 'backpack' + score: + embedded: + aggregate: 'mean' + - + $limit: 5 + - + $project: + _id: 0 + items.name: 1 + items.tags: 1 + score: + $meta: 'searchScore' + + - + name: 'Facet' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/embedded-document/#facet-query' + pipeline: + - + $searchMeta: + facet: + operator: + embeddedDocument: + path: 'items' + operator: + compound: + must: + - + text: + path: 'items.tags' + query: 'school' + should: + - + text: + path: 'items.name' + query: 'backpack' + facets: + purchaseMethodFacet: + type: 'string' + path: 'purchaseMethod' + + - + name: 'Query and Sort' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/embedded-document/#query-and-sort' + pipeline: + - + $search: + embeddedDocument: + path: 'items' + operator: + text: + path: 'items.name' + query: 'laptop' + sort: + items.tags: 1 + - + $limit: 5 + - + $project: + _id: 0 + items.name: 1 + items.tags: 1 + score: + $meta: 'searchScore' + + - + name: 'Query for Matching Embedded Documents Only' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/embedded-document/#query-for-matching-embedded-documents-only' + pipeline: + - + $search: + embeddedDocument: + path: 'items' + operator: + compound: + must: + - + range: + path: 'items.quantity' + gt: 2 + - + exists: + path: 'items.price' + - + text: + path: 'items.tags' + query: 'school' + - + $limit: 2 + - + $project: + _id: 0 + storeLocation: 1 + items: + $filter: + input: '$items' + cond: + $and: + - + $ifNull: + - '$$this.price' + - 'false' + - + $gt: + - '$$this.quantity' + - 2 + - + $in: + - 'office' + - '$$this.tags' diff --git a/generator/config/search/equals.yaml b/generator/config/search/equals.yaml new file mode 100644 index 000000000..b3e50c641 --- /dev/null +++ b/generator/config/search/equals.yaml @@ -0,0 +1,104 @@ +# $schema: ../schema.json +name: equals +link: 'https://www.mongodb.com/docs/atlas/atlas-search/equals/' +type: + - searchOperator +encode: object +description: | + The equals operator checks whether a field matches a value you specify. +arguments: + - + name: path + type: + - searchPath + - + name: value + type: + - binData + - bool + - date + - objectId + - 'null' + - number + - string + - + name: score + optional: true + type: + - searchScore +tests: + - + name: 'Boolean' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/equals/#boolean-examples' + pipeline: + - + $search: + equals: + path: 'verified_user' + value: true + - + $project: + name: 1 + _id: 0 + score: + $meta: 'searchScore' + + - + name: 'ObjectId' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/equals/#objectid-example' + pipeline: + - + $search: + equals: + path: 'teammates' + value: !bson_objectId '5a9427648b0beebeb69589a1' + + - + name: 'Date' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/equals/#date-example' + pipeline: + - + $search: + equals: + path: 'account_created' + value: !bson_utcdatetime '2022-05-04T05:01:08.000+00:00' + + - + name: 'Number' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/equals/#number-example' + pipeline: + - + $search: + equals: + path: 'employee_number' + value: 259 + + - + name: 'String' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/equals/#string-example' + pipeline: + - + $search: + equals: + path: 'name' + value: 'jim hall' + + - + name: 'UUID' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/equals/#uuid-example' + pipeline: + - + $search: + equals: + path: 'uuid' + value: !bson_uuid 'fac32260-b511-4c69-8485-a2be5b7dda9e' + + - + name: 'Null' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/equals/#null-example' + pipeline: + - + $search: + equals: + path: 'job_title' + value: ~ diff --git a/generator/config/search/exists.yaml b/generator/config/search/exists.yaml new file mode 100644 index 000000000..062e8ba59 --- /dev/null +++ b/generator/config/search/exists.yaml @@ -0,0 +1,56 @@ +# $schema: ../schema.json +name: exists +link: 'https://www.mongodb.com/docs/atlas/atlas-search/exists/' +type: + - searchOperator +encode: object +description: | + The exists operator tests if a path to a specified indexed field name exists in a document. +arguments: + - + name: path + type: + - searchPath + - + name: score + optional: true + type: + - searchScore +tests: + - + name: 'Basic' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/exists/#basic-example' + pipeline: + - + $search: + exists: + path: 'type' + + - + name: 'Embedded' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/exists/#embedded-example' + pipeline: + - + $search: + exists: + path: 'quantities.lemons' + + - + name: 'Compound' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/exists/#compound-example' + pipeline: + - + $search: + compound: + must: + - + exists: + path: 'type' + - + text: + query: 'apple' + path: 'type' + should: + text: + query: 'fuji' + path: 'description' diff --git a/generator/config/search/facet.yaml b/generator/config/search/facet.yaml new file mode 100644 index 000000000..53dc8cba9 --- /dev/null +++ b/generator/config/search/facet.yaml @@ -0,0 +1,56 @@ +# $schema: ../schema.json +name: facet +link: 'https://www.mongodb.com/docs/atlas/atlas-search/facet/' +type: + - searchOperator # should be searchCollector +encode: object +description: | + The facet collector groups results by values or ranges in the specified + faceted fields and returns the count for each of those groups. +arguments: + - + name: facets + type: + - object # map of facetDefinition + - + name: operator + optional: true + type: + - searchOperator +tests: + - + name: 'Facet' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/facet/#examples' + pipeline: + - + $search: + facet: + operator: + near: + path: 'released' + origin: !bson_utcdatetime '1999-07-01T00:00:00.000+00:00' + pivot: 7776000000 + facets: + genresFacet: + type: 'string' + path: 'genres' + - + $limit: 2 + - + $facet: + docs: + - + $project: + title: 1 + released: 1 + meta: + - + $replaceWith: '$$SEARCH_META' + - + $limit: 1 + - + $set: + meta: + $arrayElemAt: + - '$meta' + - 0 diff --git a/generator/config/search/geoShape.yaml b/generator/config/search/geoShape.yaml new file mode 100644 index 000000000..4da121e45 --- /dev/null +++ b/generator/config/search/geoShape.yaml @@ -0,0 +1,123 @@ +# $schema: ../schema.json +name: geoShape +link: 'https://www.mongodb.com/docs/atlas/atlas-search/geoShape/' +type: + - searchOperator +encode: object +description: | + The geoShape operator supports querying shapes with a relation to a given + geometry if indexShapes is set to true in the index definition. +arguments: + - + name: path + type: + - searchPath + - + name: relation + type: + - string # contains | disjoint | intersects | within + - + name: geometry + type: + - geometry + - + name: score + optional: true + type: + - searchScore +tests: + - + name: 'Disjoint' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/geoShape/#disjoint-example' + pipeline: + - + $search: + geoShape: + relation: 'disjoint' + geometry: + type: 'Polygon' + coordinates: + - + - [-161.323242, 22.512557] + - [-152.446289, 22.065278] + - [-156.09375, 17.811456] + - [-161.323242, 22.512557] + path: 'address.location' + - + $limit: 3 + - + $project: + _id: 0 + name: 1 + address: 1 + score: + $meta: 'searchScore' + + - + name: 'Intersect' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/geoShape/#intersects-example' + pipeline: + - + $search: + geoShape: + relation: 'intersects' + geometry: + type: 'MultiPolygon' + coordinates: + - + - + - [2.16942, 41.40082] + - [2.17963, 41.40087] + - [2.18146, 41.39716] + - [2.15533, 41.40686] + - [2.14596, 41.38475] + - [2.17519, 41.41035] + - [2.16942, 41.40082] + - + - + - [2.16365, 41.39416] + - [2.16963, 41.39726] + - [2.15395, 41.38005] + - [2.17935, 41.43038] + - [2.16365, 41.39416] + path: 'address.location' + - + $limit: 3 + - + $project: + _id: 0 + name: 1 + address: 1 + score: + $meta: 'searchScore' + + - + name: 'Within' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/geoShape/#within-example' + pipeline: + - + $search: + geoShape: + relation: 'within' + geometry: + type: 'Polygon' + coordinates: + - + - [-74.3994140625, 40.5305017757] + - [-74.7290039063, 40.5805846641] + - [-74.7729492188, 40.9467136651] + - [-74.0698242188, 41.1290213475] + - [-73.65234375, 40.9964840144] + - [-72.6416015625, 40.9467136651] + - [-72.3559570313, 40.7971774152] + - [-74.3994140625, 40.5305017757] + path: 'address.location' + - + $limit: 3 + - + $project: + _id: 0 + name: 1 + address: 1 + score: + $meta: 'searchScore' diff --git a/generator/config/search/geoWithin.yaml b/generator/config/search/geoWithin.yaml new file mode 100644 index 000000000..1739f1997 --- /dev/null +++ b/generator/config/search/geoWithin.yaml @@ -0,0 +1,103 @@ +# $schema: ../schema.json +name: geoWithin +link: 'https://www.mongodb.com/docs/atlas/atlas-search/geoWithin/' +type: + - searchOperator +encode: object +description: | + The geoWithin operator supports querying geographic points within a given + geometry. Only points are returned, even if indexShapes value is true in + the index definition. +arguments: + - + name: path + type: + - searchPath + - + name: box + optional: true + type: + - object + - + name: circle + optional: true + type: + - object + - + name: geometry + optional: true + type: + - geometry + - + name: score + optional: true + type: + - searchScore +tests: + - + name: 'box' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/geoWithin/#box-example' + pipeline: + - + $search: + geoWithin: + path: 'address.location' + box: + bottomLeft: + type: 'Point' + coordinates: [112.467, -55.05] + topRight: + type: 'Point' + coordinates: [168, -9.133] + - + $limit: 3 + - + $project: + _id: 0 + name: 1 + address: 1 + + - + name: 'circle' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/geoWithin/#circle-example' + pipeline: + - + $search: + geoWithin: + circle: + center: + type: 'Point' + coordinates: [-73.54, 45.54] + radius: 1600 + path: 'address.location' + - + $limit: 3 + - + $project: + _id: 0 + name: 1 + address: 1 + + - + name: 'geometry' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/geoWithin/#geometry-examples' + pipeline: + - + $search: + geoWithin: + geometry: + type: 'Polygon' + coordinates: + - + - [-161.323242, 22.512557] + - [-152.446289, 22.065278] + - [-156.09375, 17.811456] + - [-161.323242, 22.512557] + path: 'address.location' + - + $limit: 3 + - + $project: + _id: 0 + name: 1 + address: 1 diff --git a/generator/config/search/in.yaml b/generator/config/search/in.yaml new file mode 100644 index 000000000..cc1aa6c33 --- /dev/null +++ b/generator/config/search/in.yaml @@ -0,0 +1,89 @@ +# $schema: ../schema.json +name: in +link: 'https://www.mongodb.com/docs/atlas/atlas-search/in/' +type: + - searchOperator +encode: object +description: | + The in operator performs a search for an array of BSON values in a field. +arguments: + - + name: path + type: + - searchPath + - + name: value + type: + - any + - array # of any + - + name: score + optional: true + type: + - searchScore +tests: + - + name: 'Single Value Field Match' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/in/#examples' + pipeline: + - + $search: + in: + path: 'birthdate' + value: + - !bson_utcdatetime '1977-03-02T02:20:31.000+00:00' + - !bson_utcdatetime '1977-03-01T00:00:00.000+00:00' + - !bson_utcdatetime '1977-05-06T21:57:35.000+00:00' + - + $project: + _id: 0 + name: 1 + birthdate: 1 + + - + name: 'Array Value Field Match' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/in/#examples' + pipeline: + - + $search: + in: + path: 'accounts' + value: + - 371138 + - 371139 + - 371140 + - + $project: + _id: 0 + name: 1 + accounts: 1 + + - + name: 'Compound Query Match' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/in/#examples' + pipeline: + - + $search: + compound: + must: + - + in: + path: 'name' + value: + - 'james sanchez' + - 'jennifer lawrence' + should: + - + in: + path: '_id' + value: + - !bson_objectId '5ca4bbcea2dd94ee58162a72' + - !bson_objectId '5ca4bbcea2dd94ee58162a91' + - + $limit: 5 + - + $project: + _id: 1 + name: 1 + score: + $meta: 'searchScore' diff --git a/generator/config/search/moreLikeThis.yaml b/generator/config/search/moreLikeThis.yaml new file mode 100644 index 000000000..8c4803bdd --- /dev/null +++ b/generator/config/search/moreLikeThis.yaml @@ -0,0 +1,99 @@ +# $schema: ../schema.json +name: moreLikeThis +link: 'https://www.mongodb.com/docs/atlas/atlas-search/moreLikeThis/' +type: + - searchOperator +encode: object +description: | + The moreLikeThis operator returns documents similar to input documents. + The moreLikeThis operator allows you to build features for your applications + that display similar or alternative results based on one or more given documents. +arguments: + - + name: like + type: + - object + - array # of object + - + name: score + optional: true + type: + - searchScore +tests: + - + name: 'Single Document with Multiple Fields' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/morelikethis/#example-1--single-document-with-multiple-fields' + pipeline: + - + $search: + moreLikeThis: + like: + title: 'The Godfather' + genres: 'action' + - + $limit: 5 + - + $project: + _id: 0 + title: 1 + released: 1 + genres: 1 + + - + name: 'Input Document Excluded in Results' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/morelikethis/#example-2--input-document-excluded-in-results' + pipeline: + - + $search: + compound: + must: + - + moreLikeThis: + like: + _id: !bson_objectId '573a1396f29313caabce4a9a' + genres: + - 'Crime' + - 'Drama' + title: 'The Godfather' + mustNot: + - + equals: + path: '_id' + value: !bson_objectId '573a1396f29313caabce4a9a' + - + $limit: 5 + - + $project: + _id: 1 + title: 1 + released: 1 + genres: 1 + + - + name: 'Multiple Analyzers' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/morelikethis/#example-3--multiple-analyzers' + pipeline: + - + $search: + compound: + should: + - + moreLikeThis: + like: + _id: !bson_objectId '573a1396f29313caabce4a9a' + genres: + - 'Crime' + - 'Drama' + title: 'The Godfather' + mustNot: + - + equals: + path: '_id' + value: !bson_objectId '573a1394f29313caabcde9ef' + - + $limit: 10 + - + $project: + title: 1 + genres: 1 + _id: 1 diff --git a/generator/config/search/near.yaml b/generator/config/search/near.yaml new file mode 100644 index 000000000..bd4119cf9 --- /dev/null +++ b/generator/config/search/near.yaml @@ -0,0 +1,124 @@ +# $schema: ../schema.json +name: near +link: 'https://www.mongodb.com/docs/atlas/atlas-search/near/' +type: + - searchOperator +encode: object +description: | + The near operator supports querying and scoring numeric, date, and GeoJSON point values. +arguments: + - + name: path + type: + - searchPath + - + name: origin + type: + - date + - number + - geometry + - + name: pivot + type: + - number + - + name: score + optional: true + type: + - searchScore +tests: + - + name: 'Number' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/near/#number-example' + pipeline: + - + $search: + index: 'runtimes' + near: + path: 'runtime' + origin: 279 + pivot: 2 + - + $limit: 7 + - + $project: + _id: 0 + title: 1 + runtime: 1 + score: + $meta: 'searchScore' + + - + name: 'Date' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/near/#date-example' + pipeline: + - + $search: + index: 'releaseddate' + near: + path: 'released' + origin: !bson_utcdatetime '1915-09-13T00:00:00.000+00:00' + pivot: 7776000000 + - + $limit: 3 + - + $project: + _id: 0 + title: 1 + released: 1 + score: + $meta: 'searchScore' + + - + name: 'GeoJSON Point' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/near/#geojson-point-examples' + pipeline: + - + $search: + near: + origin: + type: 'Point' + coordinates: + - -8.61308 + - 41.1413 + pivot: 1000 + path: 'address.location' + - + $limit: 3 + - + $project: + _id: 0 + name: 1 + address: 1 + score: + $meta: 'searchScore' + + - + name: 'Compound' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/near/#compound-example' + pipeline: + - + $search: + compound: + must: + text: + query: 'Apartment' + path: 'property_type' + should: + near: + origin: + type: 'Point' + coordinates: + - 114.15027 + - 22.28158 + pivot: 1000 + path: 'address.location' + - + $limit: 3 + - + $project: + _id: 0 + property_type: 1 + address: 1 + score: + $meta: 'searchScore' diff --git a/generator/config/search/phrase.yaml b/generator/config/search/phrase.yaml new file mode 100644 index 000000000..4d9b75c4e --- /dev/null +++ b/generator/config/search/phrase.yaml @@ -0,0 +1,109 @@ +# $schema: ../schema.json +name: phrase +link: 'https://www.mongodb.com/docs/atlas/atlas-search/phrase/' +type: + - searchOperator +encode: object +description: | + The phrase operator performs search for documents containing an ordered sequence of terms using the analyzer specified in the index configuration. +arguments: + - + name: path + type: + - searchPath + - + name: query + type: + - string + - array # of string + - + name: slop + optional: true + type: + - int + - + name: synonyms + optional: true + type: + - string + - + name: score + optional: true + type: + - searchScore +tests: + - + name: 'Single Phrase' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/phrase/#single-phrase-example' + pipeline: + - + $search: + phrase: + path: 'title' + query: 'new york' + - + $limit: 10 + - + $project: + _id: 0 + title: 1 + score: + $meta: 'searchScore' + + - + name: 'Multiple Phrase' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/phrase/#multiple-phrases-example' + pipeline: + - + $search: + phrase: + path: 'title' + query: + - 'the man' + - 'the moon' + - + $limit: 10 + - + $project: + _id: 0 + title: 1 + score: + $meta: 'searchScore' + + - + name: 'Phrase Slop' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/phrase/#slop-example' + pipeline: + - + $search: + phrase: + path: 'title' + query: 'men women' + slop: 5 + - + $project: + _id: 0 + title: 1 + score: + $meta: 'searchScore' + + - + name: 'Phrase Synonyms' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/phrase/#synonyms-example' + pipeline: + - + $search: + phrase: + path: 'plot' + query: 'automobile race' + slop: 5 + synonyms: 'my_synonyms' + - + $limit: 5 + - + $project: + _id: 0 + plot: 1 + title: 1 + score: + $meta: 'searchScore' diff --git a/generator/config/search/queryString.yaml b/generator/config/search/queryString.yaml new file mode 100644 index 000000000..8202771c9 --- /dev/null +++ b/generator/config/search/queryString.yaml @@ -0,0 +1,35 @@ +# $schema: ../schema.json +name: queryString +link: 'https://www.mongodb.com/docs/atlas/atlas-search/queryString/' +type: + - searchOperator +encode: object +description: | + +arguments: + - + name: defaultPath + type: + - searchPath + - + name: query + type: + - string + +# The various example from the doc are variations of the "query" parameter +# this is not pertinent for testing the aggregation builder, unless we create +# a queryString builder. +tests: + - + name: 'Boolean Operator Queries' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/queryString/#boolean-operator-queries' + pipeline: + - + $search: + queryString: + defaultPath: 'title' + query: 'Rocky AND (IV OR 4 OR Four)' + - + $project: + _id: 0 + title: 1 diff --git a/generator/config/search/range.yaml b/generator/config/search/range.yaml new file mode 100644 index 000000000..f42c69176 --- /dev/null +++ b/generator/config/search/range.yaml @@ -0,0 +1,139 @@ +# $schema: ../schema.json +name: range +link: 'https://www.mongodb.com/docs/atlas/atlas-search/range/' +type: + - searchOperator +encode: object +description: | + The range operator supports querying and scoring numeric, date, and string values. + You can use this operator to find results that are within a given numeric, date, objectId, or letter (from the English alphabet) range. +arguments: + - + name: path + type: + - searchPath + - + name: gt + optional: true + type: + - date + - number + - string + - objectId + - + name: gte + optional: true + type: + - date + - number + - string + - objectId + - + name: lt + optional: true + type: + - date + - number + - string + - objectId + - + name: lte + optional: true + type: + - date + - number + - string + - objectId + - + name: score + optional: true + type: + - searchScore +tests: + - + name: 'Number gte lte' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/range/#number-example' + pipeline: + - + $search: + range: + path: 'runtime' + gte: 2 + lte: 3 + - + $limit: 5 + - + $project: + _id: 0 + title: 1 + runtime: 1 + + - + name: 'Number lte' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/range/#number-example' + pipeline: + - + $search: + range: + path: 'runtime' + lte: 2 + - + $limit: 5 + - + $project: + _id: 0 + title: 1 + runtime: 1 + score: + $meta: 'searchScore' + + - + name: 'Date' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/range/#date-example' + pipeline: + - + $search: + range: + path: 'released' + gt: !bson_utcdatetime '2010-01-01T00:00:00.000Z' + lt: !bson_utcdatetime '2015-01-01T00:00:00.000Z' + - + $limit: 5 + - + $project: + _id: 0 + title: 1 + released: 1 + + - + name: 'ObjectId' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/range/#objectid-example' + pipeline: + - + $search: + range: + path: '_id' + gte: !bson_objectId '573a1396f29313caabce4a9a' + lte: !bson_objectId '573a1396f29313caabce4ae7' + - + $project: + _id: 1 + title: 1 + released: 1 + + - + name: 'String' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/range/#string-example' + pipeline: + - + $search: + range: + path: 'title' + gt: 'city' + lt: 'country' + - + $limit: 5 + - + $project: + _id: 0 + title: 1 diff --git a/generator/config/search/regex.yaml b/generator/config/search/regex.yaml new file mode 100644 index 000000000..869ffabde --- /dev/null +++ b/generator/config/search/regex.yaml @@ -0,0 +1,42 @@ +# $schema: ../schema.json +name: regex +link: 'https://www.mongodb.com/docs/atlas/atlas-search/regex/' +type: + - searchOperator +encode: object +description: | + regex interprets the query field as a regular expression. + regex is a term-level operator, meaning that the query field isn't analyzed. +arguments: + - + name: path + type: + - searchPath + - + name: query + type: + - string + - + name: allowAnalyzedField + optional: true + type: + - bool + - + name: score + optional: true + type: + - searchScore +tests: + - + name: 'Regex' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/regex/#examples' + pipeline: + - + $search: + regex: + path: 'title' + query: '[0-9]{2} (.){4}s' + - + $project: + _id: 0 + title: 1 diff --git a/generator/config/search/text.yaml b/generator/config/search/text.yaml new file mode 100644 index 000000000..dbd48cdd0 --- /dev/null +++ b/generator/config/search/text.yaml @@ -0,0 +1,194 @@ +# $schema: ../schema.json +name: text +link: 'https://www.mongodb.com/docs/atlas/atlas-search/text/' +type: + - searchOperator +encode: object +description: | + The text operator performs a full-text search using the analyzer that you specify in the index configuration. + If you omit an analyzer, the text operator uses the default standard analyzer. +arguments: + - + name: path + type: + - searchPath + - + name: query + type: + - string + - + name: fuzzy + optional: true + type: + - object + - + name: matchCriteria + optional: true + type: + - string # "any" | "all" + - + name: synonyms + optional: true + type: + - string + - + name: score + optional: true + type: + - searchScore +tests: + - + name: 'Basic' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/text/#basic-example' + pipeline: + - + $search: + text: + path: 'title' + query: 'surfer' + - + $project: + _id: 0 + title: 1 + score: + $meta: 'searchScore' + - + name: 'Fuzzy Default' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/text/#fuzzy-examples' + pipeline: + - + $search: + text: + path: 'title' + query: 'naw yark' + fuzzy: {} + - + $limit: 10 + - + $project: + _id: 0 + title: 1 + score: + $meta: 'searchScore' + + - + name: 'Fuzzy maxExpansions' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/text/#fuzzy-examples' + pipeline: + - + $search: + text: + path: 'title' + query: 'naw yark' + fuzzy: + maxEdits: 1 + maxExpansions: 100 + - + $limit: 10 + - + $project: + _id: 0 + title: 1 + score: + $meta: 'searchScore' + + - + name: 'Fuzzy prefixLength' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/text/#fuzzy-examples' + pipeline: + - + $search: + text: + path: 'title' + query: 'naw yark' + fuzzy: + maxEdits: 1 + prefixLength: 2 + - + $limit: 8 + - + $project: + _id: 1 + title: 1 + score: + $meta: 'searchScore' + + - + name: 'Match any Using equivalent Mapping' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/text/#match-any-using-equivalent-mapping' + pipeline: + - + $search: + text: + path: 'plot' + query: 'attire' + synonyms: 'my_synonyms' + matchCriteria: 'any' + - + $limit: 5 + - + $project: + _id: 0 + plot: 1 + title: 1 + score: + $meta: 'searchScore' + + - + name: 'Match any Using explicit Mapping' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/text/#match-any-using-explicit-mapping' + pipeline: + - + $search: + text: + path: 'plot' + query: 'boat race' + synonyms: 'my_synonyms' + matchCriteria: 'any' + - + $limit: 10 + - + $project: + _id: 0 + plot: 1 + title: 1 + score: + $meta: 'searchScore' + + - + name: 'Match all Using Synonyms' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/text/#match-all-using-synonyms' + pipeline: + - + $search: + text: + path: 'plot' + query: 'automobile race' + matchCriteria: 'all' + synonyms: 'my_synonyms' + - + $limit: 20 + - + $project: + _id: 0 + plot: 1 + title: 1 + score: + $meta: 'searchScore' + + - + name: 'Wildcard Path' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/text/' + pipeline: + - + $search: + text: + path: + wildcard: '*' + query: 'surfer' + - + $project: + _id: 0 + title: 1 + score: + $meta: 'searchScore' diff --git a/generator/config/search/wildcard.yaml b/generator/config/search/wildcard.yaml new file mode 100644 index 000000000..d17fb4803 --- /dev/null +++ b/generator/config/search/wildcard.yaml @@ -0,0 +1,60 @@ +# $schema: ../schema.json +name: wildcard +link: 'https://www.mongodb.com/docs/atlas/atlas-search/wildcard/' +type: + - searchOperator +encode: object +description: | + The wildcard operator enables queries which use special characters in the search string that can match any character. +arguments: + - + name: path + type: + - searchPath + - + name: query + type: + - string + - + name: allowAnalyzedField + optional: true + type: + - bool + - + name: score + optional: true + type: + - searchScore +tests: + - + name: 'Wildcard Path' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/wildcard/#index-definition' + pipeline: + - + $search: + wildcard: + query: 'Wom?n *' + path: + wildcard: '*' + - + $limit: 5 + - + $project: + _id: 0 + title: 1 + + - + name: 'Escape Character Example' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/wildcard/#escape-character-example' + pipeline: + - + $search: + wildcard: + query: '*\?' + path: 'title' + - + $limit: 5 + - + $project: + _id: 0 + title: 1 diff --git a/generator/config/stage/addFields.yaml b/generator/config/stage/addFields.yaml new file mode 100644 index 000000000..e98f5de18 --- /dev/null +++ b/generator/config/stage/addFields.yaml @@ -0,0 +1,64 @@ +# $schema: ../schema.json +name: $addFields +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/addFields/' +type: + - stage +encode: single +description: | + Adds new fields to documents. Outputs documents that contain all existing fields from the input documents and newly added fields. +arguments: + - + name: expression + type: + - expression + variadic: object + description: | + Specify the name of each field to add and set its value to an aggregation expression or an empty object. +tests: + - + name: 'Using Two $addFields Stages' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/addFields/#using-two--addfields-stages' + pipeline: + - + $addFields: + totalHomework: + # The example renders a single value, but the builder generates an array for consistency + # $sum: '$homework' + $sum: ['$homework'] + totalQuiz: + # $sum: '$quiz' + $sum: ['$quiz'] + - + $addFields: + totalScore: + $add: + - '$totalHomework' + - '$totalQuiz' + - '$extraCredit' + - + name: 'Adding Fields to an Embedded Document' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/addFields/#adding-fields-to-an-embedded-document' + pipeline: + - + $addFields: + specs.fuel_type: 'unleaded' + - + name: 'Overwriting an existing field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/addFields/#overwriting-an-existing-field' + pipeline: + - + $addFields: + cats: 20 + - + name: 'Add Element to an Array' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/addFields/#add-element-to-an-array' + pipeline: + - + $match: + _id: 1 + - + $addFields: + homework: + $concatArrays: + - '$homework' + - [7] diff --git a/generator/config/stage/bucket.yaml b/generator/config/stage/bucket.yaml new file mode 100644 index 000000000..0cd65feac --- /dev/null +++ b/generator/config/stage/bucket.yaml @@ -0,0 +1,101 @@ +# $schema: ../schema.json +name: $bucket +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucket/' +type: + - stage +encode: object +description: | + Categorizes incoming documents into groups, called buckets, based on a specified expression and bucket boundaries. +arguments: + - + name: groupBy + type: + - expression # mainly fieldPath + description: | + An expression to group documents by. To specify a field path, prefix the field name with a dollar sign $ and enclose it in quotes. + Unless $bucket includes a default specification, each input document must resolve the groupBy field path or expression to a value that falls within one of the ranges specified by the boundaries. + - + name: boundaries + type: + - array # of expression + description: | + An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries. + The specified values must be in ascending order and all of the same type. The exception is if the values are of mixed numeric types, such as: + - + name: default + type: + - expression + optional: true + description: | + A literal that specifies the _id of an additional bucket that contains all documents whose groupBy expression result does not fall into a bucket specified by boundaries. + If unspecified, each input document must resolve the groupBy expression to a value within one of the bucket ranges specified by boundaries or the operation throws an error. + The default value must be less than the lowest boundaries value, or greater than or equal to the highest boundaries value. + The default value can be of a different type than the entries in boundaries. + - + name: output + type: + - object # of Accumulator + optional: true + description: | + A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + If you do not specify an output document, the operation returns a count field containing the number of documents in each bucket. + If you specify an output document, only the fields specified in the document are returned; i.e. the count field is not returned unless it is explicitly included in the output document. +tests: + - + name: 'Bucket by Year and Filter by Bucket Results' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucket/#bucket-by-year-and-filter-by-bucket-results' + pipeline: + - + $bucket: + groupBy: '$year_born' + boundaries: [1840, 1850, 1860, 1870, 1880] + default: 'Other' + output: + count: + $sum: 1 + artists: + $push: + name: + $concat: + - '$first_name' + - ' ' + - '$last_name' + year_born: '$year_born' + - + $match: + count: + $gt: 3 + - + name: 'Use $bucket with $facet to Bucket by Multiple Fields' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucket/#use--bucket-with--facet-to-bucket-by-multiple-fields' + pipeline: + - + $facet: + price: + - + $bucket: + groupBy: '$price' + boundaries: [0, 200, 400] + default: 'Other' + output: + count: + $sum: 1 + artwork: + $push: + title: '$title' + price: '$price' + averagePrice: + $avg: '$price' + year: + - + $bucket: + groupBy: '$year' + boundaries: [1890, 1910, 1920, 1940] + default: 'Unknown' + output: + count: + $sum: 1 + artwork: + $push: + title: '$title' + year: '$year' diff --git a/generator/config/stage/bucketAuto.yaml b/generator/config/stage/bucketAuto.yaml new file mode 100644 index 000000000..73775fde8 --- /dev/null +++ b/generator/config/stage/bucketAuto.yaml @@ -0,0 +1,46 @@ +# $schema: ../schema.json +name: $bucketAuto +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucketAuto/' +type: + - stage +encode: object +description: | + Categorizes incoming documents into a specific number of groups, called buckets, based on a specified expression. Bucket boundaries are automatically determined in an attempt to evenly distribute the documents into the specified number of buckets. +arguments: + - + name: groupBy + type: + - expression + description: | + An expression to group documents by. To specify a field path, prefix the field name with a dollar sign $ and enclose it in quotes. + - + name: buckets + type: + - int + description: | + A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. + - + name: output + type: + - object # of Accumulator + optional: true + description: | + A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + The default count field is not included in the output document when output is specified. Explicitly specify the count expression as part of the output document to include it. + - + name: granularity + type: + - granularity + optional: true + description: | + A string that specifies the preferred number series to use to ensure that the calculated boundary edges end on preferred round numbers or their powers of 10. + Available only if the all groupBy values are numeric and none of them are NaN. +tests: + - + name: 'Single Facet Aggregation' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucketAuto/#single-facet-aggregation' + pipeline: + - + $bucketAuto: + groupBy: '$price' + buckets: 4 diff --git a/generator/config/stage/changeStream.yaml b/generator/config/stage/changeStream.yaml new file mode 100644 index 000000000..be413ef5d --- /dev/null +++ b/generator/config/stage/changeStream.yaml @@ -0,0 +1,66 @@ +# $schema: ../schema.json +name: $changeStream +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/changeStream/' +type: + - stage +encode: object +description: | + Returns a Change Stream cursor for the collection or database. This stage can only occur once in an aggregation pipeline and it must occur as the first stage. +arguments: + - + name: allChangesForCluster + type: + - bool + optional: true + description: | + A flag indicating whether the stream should report all changes that occur on the deployment, aside from those on internal databases or collections. + - + name: fullDocument + type: + - fullDocument + optional: true + description: | + Specifies whether change notifications include a copy of the full document when modified by update operations. + - + name: fullDocumentBeforeChange + type: + - fullDocumentBeforeChange + optional: true + description: | + Valid values are "off", "whenAvailable", or "required". If set to "off", the "fullDocumentBeforeChange" field of the output document is always omitted. If set to "whenAvailable", the "fullDocumentBeforeChange" field will be populated with the pre-image of the document modified by the current change event if such a pre-image is available, and will be omitted otherwise. If set to "required", then the "fullDocumentBeforeChange" field is always populated and an exception is thrown if the pre-image is not available. + - + name: resumeAfter + type: + - int + optional: true + description: | + Specifies a resume token as the logical starting point for the change stream. Cannot be used with startAfter or startAtOperationTime fields. + - + name: showExpandedEvents + type: + - bool + optional: true + description: | + Specifies whether to include additional change events, such as such as DDL and index operations. + New in MongoDB 6.0. + - + name: startAfter + type: + - object + optional: true + description: | + Specifies a resume token as the logical starting point for the change stream. Cannot be used with resumeAfter or startAtOperationTime fields. + - + name: startAtOperationTime + type: + - timestamp + optional: true + description: | + Specifies a time as the logical starting point for the change stream. Cannot be used with resumeAfter or startAfter fields. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/changeStream/#examples' + pipeline: + - + $changeStream: {} diff --git a/generator/config/stage/changeStreamSplitLargeEvent.yaml b/generator/config/stage/changeStreamSplitLargeEvent.yaml new file mode 100644 index 000000000..208129346 --- /dev/null +++ b/generator/config/stage/changeStreamSplitLargeEvent.yaml @@ -0,0 +1,16 @@ +# $schema: ../schema.json +name: $changeStreamSplitLargeEvent +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/changeStreamSplitLargeEvent/' +type: + - stage +encode: object +description: | + Splits large change stream events that exceed 16 MB into smaller fragments returned in a change stream cursor. + You can only use $changeStreamSplitLargeEvent in a $changeStream pipeline and it must be the final stage in the pipeline. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/changeStreamSplitLargeEvent/#example' + pipeline: + - + $changeStreamSplitLargeEvent: {} diff --git a/generator/config/stage/collStats.yaml b/generator/config/stage/collStats.yaml new file mode 100644 index 000000000..26cbbc470 --- /dev/null +++ b/generator/config/stage/collStats.yaml @@ -0,0 +1,59 @@ +# $schema: ../schema.json +name: $collStats +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/collStats/' +type: + - stage +encode: object +description: | + Returns statistics regarding a collection or view. +arguments: + - + name: latencyStats + type: + - object + optional: true + - + name: storageStats + type: + - object + optional: true + - + name: count + type: + - object # empty object + optional: true + - + name: queryExecStats + type: + - object # empty object + optional: true +tests: + - + name: 'latencyStats Document' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/collStats/#latencystats-document' + pipeline: + - + $collStats: + latencyStats: + histograms: true + - + name: 'storageStats Document' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/collStats/#storagestats-document' + pipeline: + - + $collStats: + storageStats: {} + - + name: 'count Field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/collStats/#count-field' + pipeline: + - + $collStats: + count: {} + - + name: 'queryExecStats Document' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/collStats/#queryexecstats-document' + pipeline: + - + $collStats: + queryExecStats: {} diff --git a/generator/config/stage/count.yaml b/generator/config/stage/count.yaml new file mode 100644 index 000000000..a0fa3ba57 --- /dev/null +++ b/generator/config/stage/count.yaml @@ -0,0 +1,27 @@ +# $schema: ../schema.json +name: $count +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/count/' +type: + - stage +encode: single +description: | + Returns a count of the number of documents at this stage of the aggregation pipeline. + Distinct from the $count aggregation accumulator. +arguments: + - + name: field + type: + - string + description: | + Name of the output field which has the count as its value. It must be a non-empty string, must not start with $ and must not contain the . character. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/count/#example' + pipeline: + - + $match: + score: + $gt: 80 + - + $count: 'passing_scores' diff --git a/generator/config/stage/currentOp.yaml b/generator/config/stage/currentOp.yaml new file mode 100644 index 000000000..024c71318 --- /dev/null +++ b/generator/config/stage/currentOp.yaml @@ -0,0 +1,59 @@ +# $schema: ../schema.json +name: $currentOp +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/currentOp/' +type: + - stage +encode: object +description: | + Returns information on active and/or dormant operations for the MongoDB deployment. To run, use the db.aggregate() method. +arguments: + - + name: allUsers + type: + - bool + optional: true + - + name: idleConnections + type: + - bool + optional: true + - + name: idleCursors + type: + - bool + optional: true + - + name: idleSessions + type: + - bool + optional: true + - + name: localOps + type: + - bool + optional: true +tests: + - + name: 'Inactive Sessions' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/currentOp/#inactive-sessions' + pipeline: + - + $currentOp: + allUsers: true + idleSessions: true + - + $match: + active: false + transaction: + $exists: true + - + name: 'Sampled Queries' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/currentOp/#sampled-queries' + pipeline: + - + $currentOp: + allUsers: true + localOps: true + - + $match: + desc: 'query analyzer' diff --git a/generator/config/stage/densify.yaml b/generator/config/stage/densify.yaml new file mode 100644 index 000000000..46ccbd6dd --- /dev/null +++ b/generator/config/stage/densify.yaml @@ -0,0 +1,56 @@ +# $schema: ../schema.json +name: $densify +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/densify/' +type: + - stage +encode: object +description: | + Creates new documents in a sequence of documents where certain values in a field are missing. +arguments: + - + name: field + type: + - string # field name + description: | + The field to densify. The values of the specified field must either be all numeric values or all dates. + Documents that do not contain the specified field continue through the pipeline unmodified. + To specify a in an embedded document or in an array, use dot notation. + - + name: partitionByFields + type: + - array # of string + optional: true + description: | + The field(s) that will be used as the partition keys. + - + name: range + type: + - range + description: | + Specification for range based densification. +tests: + - + name: 'Densify Time Series Data' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/densify/#densify-time-series-data' + pipeline: + - + $densify: + field: 'timestamp' + range: + step: 1 + unit: 'hour' + bounds: + - !bson_utcdatetime '2021-05-18T00:00:00.000Z' + - !bson_utcdatetime '2021-05-18T08:00:00.000Z' + - + name: 'Densifiction with Partitions' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/densify/#densifiction-with-partitions' + pipeline: + - + $densify: + field: 'altitude' + partitionByFields: + - 'variety' + range: + bounds: 'full' + step: 200 diff --git a/generator/config/stage/documents.yaml b/generator/config/stage/documents.yaml new file mode 100644 index 000000000..666468da8 --- /dev/null +++ b/generator/config/stage/documents.yaml @@ -0,0 +1,53 @@ +# $schema: ../schema.json +name: $documents +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/documents/' +type: + - stage +encode: single +description: | + Returns literal documents from input values. +arguments: + - + name: documents + type: + - resolvesToArray # of object + description: | + $documents accepts any valid expression that resolves to an array of objects. This includes: + - system variables, such as $$NOW or $$SEARCH_META + - $let expressions + - variables in scope from $lookup expressions + Expressions that do not resolve to a current document, like $myField or $$ROOT, will result in an error. +tests: + - + name: 'Test a Pipeline Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/documents/#test-a-pipeline-stage' + pipeline: + - + $documents: + - { x: 10 } + - { x: 2 } + - { x: 5 } + - + $bucketAuto: + groupBy: '$x' + buckets: 4 + - + name: 'Use a $documents Stage in a $lookup Stage' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/documents/#use-a--documents-stage-in-a--lookup-stage' + pipeline: + - + $match: {} + - + $lookup: + localField: 'zip' + foreignField: 'zip_id' + as: 'city_state' + pipeline: + - + $documents: + - + zip_id: 94301 + name: 'Palo Alto, CA' + - + zip_id: 10019 + name: 'New York, NY' diff --git a/generator/config/stage/facet.yaml b/generator/config/stage/facet.yaml new file mode 100644 index 000000000..013163c2a --- /dev/null +++ b/generator/config/stage/facet.yaml @@ -0,0 +1,51 @@ +# $schema: ../schema.json +name: $facet +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/facet/' +type: + - stage +encode: single +description: | + Processes multiple aggregation pipelines within a single stage on the same set of input documents. Enables the creation of multi-faceted aggregations capable of characterizing data across multiple dimensions, or facets, in a single stage. +arguments: + - + name: facet + type: + - pipeline + variadic: object +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/facet/#example' + pipeline: + - + $facet: + categorizedByTags: + - + # The builder uses the verbose form of the $unwind operator + # $unwind: '$tags' + $unwind: + path: '$tags' + - + $sortByCount: '$tags' + categorizedByPrice: + - + $match: + price: + # The example uses an int, but the builder requires a bool + # $exists: 1 + $exists: true + - + $bucket: + groupBy: '$price' + boundaries: [0, 150, 200, 300, 400] + default: 'Other' + output: + count: + $sum: 1 + titles: + $push: '$title' + categorizedByYears(Auto): + - + $bucketAuto: + groupBy: '$year' + buckets: 4 diff --git a/generator/config/stage/fill.yaml b/generator/config/stage/fill.yaml new file mode 100644 index 000000000..2c98fac5c --- /dev/null +++ b/generator/config/stage/fill.yaml @@ -0,0 +1,110 @@ +# $schema: ../schema.json +name: $fill +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/fill/' +type: + - stage +encode: object +description: | + Populates null and missing field values within documents. +arguments: + - + name: partitionBy + type: + - object # of expression + - string + optional: true + description: | + Specifies an expression to group the documents. In the $fill stage, a group of documents is known as a partition. + If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. + partitionBy and partitionByFields are mutually exclusive. + - + name: partitionByFields + type: + - array # of string + optional: true + description: | + Specifies an array of fields as the compound key to group the documents. In the $fill stage, each group of documents is known as a partition. + If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. + partitionBy and partitionByFields are mutually exclusive. + - + name: sortBy + type: + - sortBy + optional: true + description: | + Specifies the field or fields to sort the documents within each partition. Uses the same syntax as the $sort stage. + - + name: output + type: + - object # of object{value:expression} or object{method:string}> + description: | + Specifies an object containing each field for which to fill missing values. You can specify multiple fields in the output object. + The object name is the name of the field to fill. The object value specifies how the field is filled. +tests: + - + name: 'Fill Missing Field Values with a Constant Value' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/fill/#fill-missing-field-values-with-a-constant-value' + pipeline: + - + $fill: + output: + bootsSold: + value: 0 + sandalsSold: + value: 0 + sneakersSold: + value: 0 + - + name: 'Fill Missing Field Values with Linear Interpolation' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/fill/#fill-missing-field-values-with-linear-interpolation' + pipeline: + - + $fill: + sortBy: + time: 1 + output: + price: + method: 'linear' + - + name: 'Fill Missing Field Values Based on the Last Observed Value' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/fill/#fill-missing-field-values-based-on-the-last-observed-value' + pipeline: + - + $fill: + sortBy: + date: 1 + output: + score: + method: 'locf' + - + name: 'Fill Data for Distinct Partitions' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/fill/#fill-data-for-distinct-partitions' + pipeline: + - + $fill: + sortBy: + date: 1 + partitionBy: + restaurant: '$restaurant' + output: + score: + method: 'locf' + - + name: 'Indicate if a Field was Populated Using $fill' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/fill/#indicate-if-a-field-was-populated-using--fill' + pipeline: + - + $set: + valueExisted: + $ifNull: + - + $toBool: + $toString: '$score' + - false + - + $fill: + sortBy: + date: 1 + output: + score: + method: 'locf' diff --git a/generator/config/stage/geoNear.yaml b/generator/config/stage/geoNear.yaml new file mode 100644 index 000000000..4967a0823 --- /dev/null +++ b/generator/config/stage/geoNear.yaml @@ -0,0 +1,161 @@ +# $schema: ../schema.json +name: $geoNear +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/geoNear/' +type: + - stage +encode: object +description: | + Returns an ordered stream of documents based on the proximity to a geospatial point. Incorporates the functionality of $match, $sort, and $limit for geospatial data. The output documents include an additional distance field and can include a location identifier field. +arguments: + - + name: distanceField + type: + - string + optional: true + description: | + The output field that contains the calculated distance. To specify a field within an embedded document, use dot notation. + - + name: distanceMultiplier + type: + - number + optional: true + description: | + The factor to multiply all distances returned by the query. For example, use the distanceMultiplier to convert radians, as returned by a spherical query, to kilometers by multiplying by the radius of the Earth. + - + name: includeLocs + type: + - string + optional: true + description: | + This specifies the output field that identifies the location used to calculate the distance. This option is useful when a location field contains multiple locations. To specify a field within an embedded document, use dot notation. + - + name: key + type: + - string + optional: true + description: | + Specify the geospatial indexed field to use when calculating the distance. + - + name: maxDistance + type: + - number + optional: true + description: | + The maximum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall within the specified distance from the center point. + Specify the distance in meters if the specified point is GeoJSON and in radians if the specified point is legacy coordinate pairs. + - + name: minDistance + type: + - number + optional: true + description: | + The minimum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall outside the specified distance from the center point. + Specify the distance in meters for GeoJSON data and in radians for legacy coordinate pairs. + - + name: near + type: + - geoPoint + - resolvesToObject + description: | + The point for which to find the closest documents. + - + name: query + type: + - query + optional: true + description: | + Limits the results to the documents that match the query. The query syntax is the usual MongoDB read operation query syntax. + You cannot specify a $near predicate in the query field of the $geoNear stage. + - + name: spherical + type: + - bool + optional: true + description: | + Determines how MongoDB calculates the distance between two points: + - When true, MongoDB uses $nearSphere semantics and calculates distances using spherical geometry. + - When false, MongoDB uses $near semantics: spherical geometry for 2dsphere indexes and planar geometry for 2d indexes. + Default: false. +tests: + - + name: 'Maximum Distance' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/geoNear/#maximum-distance' + pipeline: + - + $geoNear: + near: + type: 'Point' + coordinates: + - -73.99279 + - 40.719296 + distanceField: 'dist.calculated' + maxDistance: 2 + query: + category: 'Parks' + includeLocs: 'dist.location' + spherical: true + - + name: 'Minimum Distance' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/geoNear/#minimum-distance' + pipeline: + - + $geoNear: + near: + type: 'Point' + coordinates: + - -73.99279 + - 40.719296 + distanceField: 'dist.calculated' + minDistance: 2 + query: + category: 'Parks' + includeLocs: 'dist.location' + spherical: true + - + name: 'with the let option' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/geoNear/#-geonear-with-the-let-option' + pipeline: + - + $geoNear: + near: '$$pt' + distanceField: 'distance' + maxDistance: 2 + query: + category: 'Parks' + includeLocs: 'dist.location' + spherical: true + - + name: 'with Bound let Option' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/geoNear/#-geonear-with-bound-let-option' + pipeline: + - + $lookup: + from: 'places' + let: + pt: '$location' + pipeline: + - + $geoNear: + near: '$$pt' + distanceField: 'distance' + as: 'joinedField' + - + $match: + name: 'Sara D. Roosevelt Park' + - + name: 'Specify Which Geospatial Index to Use' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/geoNear/#specify-which-geospatial-index-to-use' + pipeline: + - + $geoNear: + near: + type: 'Point' + coordinates: + - -73.98142 + - 40.71782 + key: 'location' + distanceField: 'dist.calculated' + query: + category: 'Parks' + - + $limit: 5 diff --git a/generator/config/stage/graphLookup.yaml b/generator/config/stage/graphLookup.yaml new file mode 100644 index 000000000..ae220620b --- /dev/null +++ b/generator/config/stage/graphLookup.yaml @@ -0,0 +1,108 @@ +# $schema: ../schema.json +name: $graphLookup +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/graphLookup/' +type: + - stage +encode: object +description: | + Performs a recursive search on a collection. To each output document, adds a new array field that contains the traversal results of the recursive search for that document. +arguments: + - + name: from + type: + - string + description: | + Target collection for the $graphLookup operation to search, recursively matching the connectFromField to the connectToField. The from collection must be in the same database as any other collections used in the operation. + Starting in MongoDB 5.1, the collection specified in the from parameter can be sharded. + - + name: startWith + type: + - expression + - array + description: | + Expression that specifies the value of the connectFromField with which to start the recursive search. Optionally, startWith may be array of values, each of which is individually followed through the traversal process. + - + name: connectFromField + type: + - string + description: | + Field name whose value $graphLookup uses to recursively match against the connectToField of other documents in the collection. If the value is an array, each element is individually followed through the traversal process. + - + name: connectToField + type: + - string + description: | + Field name in other documents against which to match the value of the field specified by the connectFromField parameter. + - + name: as + type: + - string + description: | + Name of the array field added to each output document. Contains the documents traversed in the $graphLookup stage to reach the document. + - + name: maxDepth + type: + - int + optional: true + description: | + Non-negative integral number specifying the maximum recursion depth. + - + name: depthField + type: + - string + optional: true + description: | + Name of the field to add to each traversed document in the search path. The value of this field is the recursion depth for the document, represented as a NumberLong. Recursion depth value starts at zero, so the first lookup corresponds to zero depth. + - + name: restrictSearchWithMatch + type: + - query + optional: true + description: | + A document specifying additional conditions for the recursive search. The syntax is identical to query filter syntax. +tests: + - + name: 'Within a Single Collection' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/graphLookup/#within-a-single-collection' + pipeline: + - + $graphLookup: + from: 'employees' + startWith: '$reportsTo' + connectFromField: 'reportsTo' + connectToField: 'name' + as: 'reportingHierarchy' + - + name: 'Across Multiple Collections' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/graphLookup/#across-multiple-collections' + pipeline: + - + $graphLookup: + from: 'airports' + startWith: '$nearestAirport' + connectFromField: 'connects' + connectToField: 'airport' + maxDepth: 2 + depthField: 'numConnections' + as: 'destinations' + - + name: 'With a Query Filter' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/graphLookup/#with-a-query-filter' + pipeline: + - + $match: + name: 'Tanya Jordan' + - + $graphLookup: + from: 'people' + startWith: '$friends' + connectFromField: 'friends' + connectToField: 'name' + as: 'golfers' + restrictSearchWithMatch: + hobbies: 'golf' + - + $project: + name: 1 + friends: 1 + connections who play golf: '$golfers.name' diff --git a/generator/config/stage/group.yaml b/generator/config/stage/group.yaml new file mode 100644 index 000000000..a4bae60c2 --- /dev/null +++ b/generator/config/stage/group.yaml @@ -0,0 +1,123 @@ +# $schema: ../schema.json +name: $group +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/group/' +type: + - stage +encode: object +description: | + Groups input documents by a specified identifier expression and applies the accumulator expression(s), if specified, to each group. Consumes all input documents and outputs one document per each distinct group. The output documents only contain the identifier field and, if specified, accumulated fields. +arguments: + - + name: _id + type: + - expression + description: | + The _id expression specifies the group key. If you specify an _id value of null, or any other constant value, the $group stage returns a single document that aggregates values across all of the input documents. + - + name: field + mergeObject: true + type: + - accumulator + variadic: object + variadicMin: 0 + description: | + Computed using the accumulator operators. +tests: + - + name: 'Count the Number of Documents in a Collection' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/group/#count-the-number-of-documents-in-a-collection' + pipeline: + - + $group: + _id: ~ + count: + $count: {} + - + name: 'Retrieve Distinct Values' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/group/#retrieve-distinct-values' + pipeline: + - + $group: + _id: '$item' + - + name: 'Group by Item Having' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/group/#group-by-item-having' + pipeline: + - + $group: + _id: '$item' + totalSaleAmount: + $sum: + $multiply: + - '$price' + - '$quantity' + - + $match: + totalSaleAmount: + $gte: 100 + - + name: 'Calculate Count Sum and Average' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/group/#calculate-count--sum--and-average' + pipeline: + - + $match: + date: + $gte: !bson_utcdatetime '2014-01-01' + $lt: !bson_utcdatetime '2015-01-01' + - + $group: + _id: + $dateToString: + format: '%Y-%m-%d' + date: '$date' + totalSaleAmount: + $sum: + $multiply: + - '$price' + - '$quantity' + averageQuantity: + $avg: '$quantity' + count: + $sum: 1 + - + $sort: + totalSaleAmount: -1 + - + name: 'Group by null' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/group/#group-by-null' + pipeline: + - + $group: + _id: ~ + totalSaleAmount: + $sum: + $multiply: + - '$price' + - '$quantity' + averageQuantity: + $avg: '$quantity' + count: + $sum: 1 + - + name: 'Pivot Data' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/group/#pivot-data' + pipeline: + - + $group: + _id: '$author' + books: + $push: '$title' + - + name: 'Group Documents by author' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/group/#group-documents-by-author' + pipeline: + - + $group: + _id: '$author' + books: + $push: '$$ROOT' + - + $addFields: + totalCopies: + # $sum: '$books.copies' + $sum: ['$books.copies'] diff --git a/generator/config/stage/indexStats.yaml b/generator/config/stage/indexStats.yaml new file mode 100644 index 000000000..178b209d8 --- /dev/null +++ b/generator/config/stage/indexStats.yaml @@ -0,0 +1,15 @@ +# $schema: ../schema.json +name: $indexStats +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexStats/' +type: + - stage +encode: object +description: | + Returns statistics regarding the use of each index for the collection. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexStats/#example' + pipeline: + - + $indexStats: {} diff --git a/generator/config/stage/limit.yaml b/generator/config/stage/limit.yaml new file mode 100644 index 000000000..fff391a01 --- /dev/null +++ b/generator/config/stage/limit.yaml @@ -0,0 +1,20 @@ +# $schema: ../schema.json +name: $limit +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/limit/' +type: + - stage +encode: single +description: | + Passes the first n documents unmodified to the pipeline where n is the specified limit. For each input document, outputs either one document (for the first n documents) or zero documents (after the first n documents). +arguments: + - + name: limit + type: + - int +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/limit/#example' + pipeline: + - + $limit: 5 diff --git a/generator/config/stage/listLocalSessions.yaml b/generator/config/stage/listLocalSessions.yaml new file mode 100644 index 000000000..50dccc30e --- /dev/null +++ b/generator/config/stage/listLocalSessions.yaml @@ -0,0 +1,47 @@ +# $schema: ../schema.json +name: $listLocalSessions +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/listLocalSessions/' +type: + - stage +encode: object +description: | + Lists all active sessions recently in use on the currently connected mongos or mongod instance. These sessions may have not yet propagated to the system.sessions collection. +arguments: + - + name: users + type: + - array + optional: true + description: | + Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. + - + name: allUsers + type: + - bool + optional: true + description: | + Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. +tests: + - + name: 'List All Local Sessions' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/listLocalSessions/#list-all-local-sessions' + pipeline: + - + $listLocalSessions: + allUsers: true + - + name: 'List All Local Sessions for the Specified Users' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/listLocalSessions/#list-all-local-sessions-for-the-specified-users' + pipeline: + - + $listLocalSessions: + users: + - + user: 'myAppReader' + db: 'test' + - + name: 'List All Local Sessions for the Current User' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/listLocalSessions/#list-all-local-sessions-for-the-current-user' + pipeline: + - + $listLocalSessions: {} diff --git a/generator/config/stage/listSampledQueries.yaml b/generator/config/stage/listSampledQueries.yaml new file mode 100644 index 000000000..f767f0d04 --- /dev/null +++ b/generator/config/stage/listSampledQueries.yaml @@ -0,0 +1,29 @@ +# $schema: ../schema.json +name: $listSampledQueries +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSampledQueries/' +type: + - stage +encode: object +description: | + Lists sampled queries for all collections or a specific collection. +arguments: + - + name: namespace + type: + - string + optional: true +tests: + - + name: 'List Sampled Queries for All Collections' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSampledQueries/#list-sampled-queries-for-all-collections' + pipeline: + - + $listSampledQueries: {} + + - + name: 'List Sampled Queries for A Specific Collection' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSampledQueries/#list-sampled-queries-for-a-specific-collection' + pipeline: + - + $listSampledQueries: + namespace: 'social.post' diff --git a/generator/config/stage/listSearchIndexes.yaml b/generator/config/stage/listSearchIndexes.yaml new file mode 100644 index 000000000..afc4f6d05 --- /dev/null +++ b/generator/config/stage/listSearchIndexes.yaml @@ -0,0 +1,44 @@ +# $schema: ../schema.json +name: $listSearchIndexes +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSearchIndexes/' +type: + - stage +encode: object +description: | + Returns information about existing Atlas Search indexes on a specified collection. +arguments: + - + name: id + type: + - string + optional: true + description: | + The id of the index to return information about. + - + name: name + type: + - string + optional: true + description: | + The name of the index to return information about. +tests: + - + name: 'Return All Search Indexes' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSearchIndexes/#return-all-search-indexes' + pipeline: + - + $listSearchIndexes: {} + - + name: 'Return a Single Search Index by Name' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSearchIndexes/#return-a-single-search-index-by-name' + pipeline: + - + $listSearchIndexes: + name: 'synonym-mappings' + - + name: 'Return a Single Search Index by id' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSearchIndexes/#return-a-single-search-index-by-id' + pipeline: + - + $listSearchIndexes: + id: '6524096020da840844a4c4a7' diff --git a/generator/config/stage/listSessions.yaml b/generator/config/stage/listSessions.yaml new file mode 100644 index 000000000..efb56de05 --- /dev/null +++ b/generator/config/stage/listSessions.yaml @@ -0,0 +1,48 @@ +# $schema: ../schema.json +name: $listSessions +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSessions/' +type: + - stage +encode: object +description: | + Lists all sessions that have been active long enough to propagate to the system.sessions collection. +arguments: + - + name: users + type: + - array + optional: true + description: | + Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. + - + name: allUsers + type: + - bool + optional: true + description: | + Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. +tests: + - + name: 'List All Sessions' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSessions/#list-all-sessions' + pipeline: + - + $listSessions: + allUsers: true + - + name: 'List All Sessions for the Specified Users' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSessions/#list-all-sessions-for-the-specified-users' + pipeline: + - + $listSessions: + users: + - + user: 'myAppReader' + db: 'test' + - + name: 'List All Sessions for the Current User' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSessions/#list-all-sessions-for-the-current-user' + pipeline: + - + $listSessions: {} + diff --git a/generator/config/stage/lookup.yaml b/generator/config/stage/lookup.yaml new file mode 100644 index 000000000..b73770e47 --- /dev/null +++ b/generator/config/stage/lookup.yaml @@ -0,0 +1,165 @@ +# $schema: ../schema.json +name: $lookup +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lookup/' +type: + - stage +encode: object +description: | + Performs a left outer join to another collection in the same database to filter in documents from the "joined" collection for processing. +arguments: + - + name: from + type: + - string + optional: true + description: | + Specifies the collection in the same database to perform the join with. + from is optional, you can use a $documents stage in a $lookup stage instead. For an example, see Use a $documents Stage in a $lookup Stage. + Starting in MongoDB 5.1, the collection specified in the from parameter can be sharded. + - + name: localField + type: + - string + optional: true + description: | + Specifies the field from the documents input to the $lookup stage. $lookup performs an equality match on the localField to the foreignField from the documents of the from collection. If an input document does not contain the localField, the $lookup treats the field as having a value of null for matching purposes. + - + name: foreignField + type: + - string + optional: true + description: | + Specifies the field from the documents in the from collection. $lookup performs an equality match on the foreignField to the localField from the input documents. If a document in the from collection does not contain the foreignField, the $lookup treats the value as null for matching purposes. + - + name: let + type: + - object # of expression + optional: true + description: | + Specifies variables to use in the pipeline stages. Use the variable expressions to access the fields from the joined collection's documents that are input to the pipeline. + - + name: pipeline + type: + - pipeline + optional: true + description: | + Specifies the pipeline to run on the joined collection. The pipeline determines the resulting documents from the joined collection. To return all documents, specify an empty pipeline []. + The pipeline cannot include the $out stage or the $merge stage. Starting in v6.0, the pipeline can contain the Atlas Search $search stage as the first stage inside the pipeline. + The pipeline cannot directly access the joined document fields. Instead, define variables for the joined document fields using the let option and then reference the variables in the pipeline stages. + - + name: as + type: + - string + description: | + Specifies the name of the new array field to add to the input documents. The new array field contains the matching documents from the from collection. If the specified name already exists in the input document, the existing field is overwritten. +tests: + - + name: 'Perform a Single Equality Join with $lookup' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lookup/#perform-a-single-equality-join-with--lookup' + pipeline: + - + $lookup: + from: 'inventory' + localField: 'item' + foreignField: 'sku' + as: 'inventory_docs' + - + name: 'Use $lookup with an Array' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lookup/#use--lookup-with-an-array' + pipeline: + - + $lookup: + from: 'members' + localField: 'enrollmentlist' + foreignField: 'name' + as: 'enrollee_info' + - + name: 'Use $lookup with $mergeObjects' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lookup/#use--lookup-with--mergeobjects' + pipeline: + - + $lookup: + from: 'items' + localField: 'item' + foreignField: 'item' + as: 'fromItems' + - + $replaceRoot: + newRoot: + $mergeObjects: + - + $arrayElemAt: + - '$fromItems' + - 0 + - '$$ROOT' + - + $project: + fromItems: 0 + - + name: 'Perform Multiple Joins and a Correlated Subquery with $lookup' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lookup/#perform-multiple-joins-and-a-correlated-subquery-with--lookup' + pipeline: + - + $lookup: + from: 'warehouses' + let: + order_item: '$item' + order_qty: '$ordered' + pipeline: + - + $match: + $expr: + $and: + - + $eq: + - '$stock_item' + - '$$order_item' + - + $gte: + - '$instock' + - '$$order_qty' + - + $project: + stock_item: 0 + _id: 0 + as: 'stockdata' + - + name: 'Perform an Uncorrelated Subquery with $lookup' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lookup/#perform-an-uncorrelated-subquery-with--lookup' + pipeline: + - + $lookup: + from: 'holidays' + pipeline: + - + $match: + year: 2018 + - + $project: + _id: 0 + date: + name: '$name' + date: '$date' + - + $replaceRoot: + newRoot: '$date' + as: 'holidays' + - + name: 'Perform a Concise Correlated Subquery with $lookup' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/lookup/#perform-a-concise-correlated-subquery-with--lookup' + pipeline: + - + $lookup: + from: 'restaurants' + localField: 'restaurant_name' + foreignField: 'name' + let: + orders_drink: '$drink' + pipeline: + - + $match: + $expr: + $in: + - '$$orders_drink' + - '$beverages' + as: 'matches' diff --git a/generator/config/stage/match.yaml b/generator/config/stage/match.yaml new file mode 100644 index 000000000..ab0081fd0 --- /dev/null +++ b/generator/config/stage/match.yaml @@ -0,0 +1,40 @@ +# $schema: ../schema.json +name: $match +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/match/' +type: + - stage +encode: single +description: | + Filters the document stream to allow only matching documents to pass unmodified into the next pipeline stage. $match uses standard MongoDB queries. For each input document, outputs either one document (a match) or zero documents (no match). +arguments: + - + name: query + type: + - query +tests: + - + name: 'Equality Match' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/match/#equality-match' + pipeline: + - + $match: + author: 'dave' + - + name: 'Perform a Count' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/match/#perform-a-count' + pipeline: + - + $match: + $or: + - + score: + $gt: 70 + $lt: 90 + - + views: + $gte: 1000 + - + $group: + _id: ~ + count: + $sum: 1 diff --git a/generator/config/stage/merge.yaml b/generator/config/stage/merge.yaml new file mode 100644 index 000000000..766092d82 --- /dev/null +++ b/generator/config/stage/merge.yaml @@ -0,0 +1,180 @@ +# $schema: ../schema.json +name: $merge +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/' +type: + - stage +encode: object +description: | + Writes the resulting documents of the aggregation pipeline to a collection. The stage can incorporate (insert new documents, merge documents, replace documents, keep existing documents, fail the operation, process documents with a custom update pipeline) the results into an output collection. To use the $merge stage, it must be the last stage in the pipeline. + New in MongoDB 4.2. +arguments: + - + name: into + type: + - string + - outCollection + description: | + The output collection. + - + name: 'on' + type: + - string + - array # of string + optional: true + description: | + Field or fields that act as a unique identifier for a document. The identifier determines if a results document matches an existing document in the output collection. + - + name: let + type: + - object + optional: true + description: | + Specifies variables for use in the whenMatched pipeline. + - + name: whenMatched + type: + - whenMatched + - pipeline + optional: true + description: | + The behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s). + - + name: whenNotMatched + type: + - whenNotMatched + optional: true + description: | + The behavior of $merge if a result document does not match an existing document in the out collection. +tests: + - + name: 'On-Demand Materialized View Initial Creation' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/#on-demand-materialized-view--initial-creation' + pipeline: + - + $group: + _id: + fiscal_year: '$fiscal_year' + dept: '$dept' + salaries: + $sum: '$salary' + - + $merge: + into: + db: 'reporting' + coll: 'budgets' + on: '_id' + whenMatched: 'replace' + whenNotMatched: 'insert' + - + name: 'On-Demand Materialized View Update Replace Data' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/#on-demand-materialized-view--update-replace-data' + pipeline: + - + $match: + fiscal_year: + $gte: 2019 + - + $group: + _id: + fiscal_year: '$fiscal_year' + dept: '$dept' + salaries: + $sum: '$salary' + - + $merge: + into: + db: 'reporting' + coll: 'budgets' + on: '_id' + whenMatched: 'replace' + whenNotMatched: 'insert' + - + name: 'Only Insert New Data' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/#only-insert-new-data' + pipeline: + - + $match: + fiscal_year: 2019 + - + $group: + _id: + fiscal_year: '$fiscal_year' + dept: '$dept' + employees: + $push: '$employee' + - + $project: + _id: 0 + dept: '$_id.dept' + fiscal_year: '$_id.fiscal_year' + employees: 1 + - + $merge: + into: + db: 'reporting' + coll: 'orgArchive' + on: + - 'dept' + - 'fiscal_year' + whenMatched: 'fail' + - + name: 'Merge Results from Multiple Collections' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/#merge-results-from-multiple-collections' + pipeline: + - + $group: + _id: '$quarter' + purchased: + $sum: '$qty' + - + $merge: + into: 'quarterlyreport' + on: '_id' + whenMatched: 'merge' + whenNotMatched: 'insert' + - + name: 'Use the Pipeline to Customize the Merge' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/#use-the-pipeline-to-customize-the-merge' + pipeline: + - + $match: + date: + $gte: !bson_utcdatetime '2019-05-07' + $lt: !bson_utcdatetime '2019-05-08' + - + $project: + _id: + $dateToString: + format: '%Y-%m' + date: '$date' + thumbsup: 1 + thumbsdown: 1 + - + $merge: + into: 'monthlytotals' + on: '_id' + whenMatched: + - + $addFields: + thumbsup: + $add: + - '$thumbsup' + - '$$new.thumbsup' + thumbsdown: + $add: + - '$thumbsdown' + - '$$new.thumbsdown' + whenNotMatched: 'insert' + - + name: 'Use Variables to Customize the Merge' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/#use-variables-to-customize-the-merge' + pipeline: + - + $merge: + into: 'cakeSales' + let: + year: '2020' + whenMatched: + - + $addFields: + salesYear: '$$year' diff --git a/generator/config/stage/out.yaml b/generator/config/stage/out.yaml new file mode 100644 index 000000000..0c3597fdf --- /dev/null +++ b/generator/config/stage/out.yaml @@ -0,0 +1,40 @@ +# $schema: ../schema.json +name: $out +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/out/' +type: + - stage +encode: single +description: | + Writes the resulting documents of the aggregation pipeline to a collection. To use the $out stage, it must be the last stage in the pipeline. +arguments: + - name: coll + type: + - string + - outCollection + description: | + Target database name to write documents from $out to. +tests: + - + name: 'Output to Same Database' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/out/#output-to-same-database' + pipeline: + - + $group: + _id: '$author' + books: + $push: '$title' + - + $out: 'authors' + - + name: 'Output to a Different Database' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/out/#output-to-a-different-database' + pipeline: + - + $group: + _id: '$author' + books: + $push: '$title' + - + $out: + db: 'reporting' + coll: 'authors' diff --git a/generator/config/stage/planCacheStats.yaml b/generator/config/stage/planCacheStats.yaml new file mode 100644 index 000000000..995caa74e --- /dev/null +++ b/generator/config/stage/planCacheStats.yaml @@ -0,0 +1,24 @@ +# $schema: ../schema.json +name: $planCacheStats +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/planCacheStats/' +type: + - stage +encode: object +description: | + Returns plan cache information for a collection. +tests: + - + name: 'Return Information for All Entries in the Query Cache' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/planCacheStats/#return-information-for-all-entries-in-the-query-cache' + pipeline: + - + $planCacheStats: {} + - + name: 'Find Cache Entry Details for a Query Hash' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/planCacheStats/#find-cache-entry-details-for-a-query-hash' + pipeline: + - + $planCacheStats: {} + - + $match: + planCacheKey: 'B1435201' diff --git a/generator/config/stage/project.yaml b/generator/config/stage/project.yaml new file mode 100644 index 000000000..c7b0f7d59 --- /dev/null +++ b/generator/config/stage/project.yaml @@ -0,0 +1,124 @@ +# $schema: ../schema.json +name: $project +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/project/' +type: + - stage +encode: single +description: | + Reshapes each document in the stream, such as by adding new fields or removing existing fields. For each input document, outputs one document. +arguments: + - + name: specification + type: + - expression + variadic: object +tests: + - + name: 'Include Specific Fields in Output Documents' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/project/#include-specific-fields-in-output-documents' + pipeline: + - + $project: + title: 1 + author: 1 + - + name: 'Suppress id Field in the Output Documents' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/project/#suppress-_id-field-in-the-output-documents' + pipeline: + - + $project: + _id: 0 + title: 1 + author: 1 + - + name: 'Exclude Fields from Output Documents' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/project/#exclude-fields-from-output-documents' + pipeline: + - + $project: + lastModified: 0 + - + name: 'Exclude Fields from Embedded Documents' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/project/#exclude-fields-from-embedded-documents' + pipeline: + - + $project: + author.first: 0 + lastModified: 0 + - + $project: + author: + first: 0 + lastModified: 0 + - + name: 'Conditionally Exclude Fields' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/project/#conditionally-exclude-fields' + pipeline: + - + $project: + title: 1 + author.first: 1 + author.last: 1 + author.middle: + $cond: + if: + $eq: + - '' + - '$author.middle' + then: '$$REMOVE' + else: '$author.middle' + - + name: 'Include Specific Fields from Embedded Documents' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/project/#include-specific-fields-from-embedded-documents' + pipeline: + - + $project: + stop.title: 1 + - + $project: + stop: + title: 1 + - + name: 'Include Computed Fields' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/project/#include-computed-fields' + pipeline: + - + $project: + title: 1 + isbn: + prefix: + $substr: + - '$isbn' + - 0 + - 3 + group: + $substr: + - '$isbn' + - 3 + - 2 + publisher: + $substr: + - '$isbn' + - 5 + - 4 + title: + $substr: + - '$isbn' + - 9 + - 3 + checkDigit: + $substr: + - '$isbn' + - 12 + - 1 + lastName: '$author.last' + copiesSold: '$copies' + - + name: 'Project New Array Fields' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/project/#project-new-array-fields' + pipeline: + - + $project: + myArray: + - '$x' + - '$y' diff --git a/generator/config/stage/redact.yaml b/generator/config/stage/redact.yaml new file mode 100644 index 000000000..07698119c --- /dev/null +++ b/generator/config/stage/redact.yaml @@ -0,0 +1,52 @@ +# $schema: ../schema.json +name: $redact +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/redact/' +type: + - stage +encode: single +description: | + Reshapes each document in the stream by restricting the content for each document based on information stored in the documents themselves. Incorporates the functionality of $project and $match. Can be used to implement field level redaction. For each input document, outputs either one or zero documents. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Evaluate Access at Every Document Level' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/redact/#evaluate-access-at-every-document-level' + pipeline: + - + $match: + year: 2014 + - + $redact: + $cond: + if: + $gt: + - + $size: + $setIntersection: + - '$tags' + - + - 'STLW' + - 'G' + - 0 + then: '$$DESCEND' + else: '$$PRUNE' + - + name: 'Exclude All Fields at a Given Level' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/redact/#exclude-all-fields-at-a-given-level' + pipeline: + - + $match: + status: 'A' + - + $redact: + $cond: + if: + $eq: + - '$level' + - 5 + then: '$$PRUNE' + else: '$$DESCEND' diff --git a/generator/config/stage/replaceRoot.yaml b/generator/config/stage/replaceRoot.yaml new file mode 100644 index 000000000..4de474e00 --- /dev/null +++ b/generator/config/stage/replaceRoot.yaml @@ -0,0 +1,71 @@ +# $schema: ../schema.json +name: $replaceRoot +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceRoot/' +type: + - stage +encode: object +description: | + Replaces a document with the specified embedded document. The operation replaces all existing fields in the input document, including the _id field. Specify a document embedded in the input document to promote the embedded document to the top level. +arguments: + - + name: newRoot + type: + - resolvesToObject +tests: + - + name: 'with an Embedded Document Field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceRoot/#-replaceroot-with-an-embedded-document-field' + pipeline: + - + $replaceRoot: + newRoot: + $mergeObjects: + - + dogs: 0 + cats: 0 + birds: 0 + fish: 0 + - '$pets' + - + name: 'with a Document Nested in an Array' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceRoot/#-replaceroot-with-a-document-nested-in-an-array' + pipeline: + - + # The builder uses the verbose form of the $unwind operator + # $unwind: '$grades' + $unwind: + path: '$grades' + - + $match: + grades.grade: + $gte: 90 + - + $replaceRoot: + newRoot: '$grades' + - + name: 'with a newly created document' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceRoot/#-replaceroot-with-a-newly-created-document' + pipeline: + - + $replaceRoot: + newRoot: + full_name: + $concat: + - '$first_name' + - ' ' + - '$last_name' + - + name: 'with a New Document Created from $$ROOT and a Default Document' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceRoot/#-replaceroot-with-a-new-document-created-from---root-and-a-default-document' + pipeline: + - + $replaceRoot: + newRoot: + $mergeObjects: + - + _id: '' + name: '' + email: '' + cell: '' + home: '' + - '$$ROOT' diff --git a/generator/config/stage/replaceWith.yaml b/generator/config/stage/replaceWith.yaml new file mode 100644 index 000000000..10c5fa3a2 --- /dev/null +++ b/generator/config/stage/replaceWith.yaml @@ -0,0 +1,74 @@ +# $schema: ../schema.json +name: $replaceWith +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceWith/' +type: + - stage +encode: single +description: | + Replaces a document with the specified embedded document. The operation replaces all existing fields in the input document, including the _id field. Specify a document embedded in the input document to promote the embedded document to the top level. + Alias for $replaceRoot. +arguments: + - + name: expression + type: + - resolvesToObject +tests: + - + name: 'an Embedded Document Field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceWith/#-replacewith-an-embedded-document-field' + pipeline: + - + $replaceWith: + $mergeObjects: + - + dogs: 0 + cats: 0 + birds: 0 + fish: 0 + - '$pets' + - + name: 'a Document Nested in an Array' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceWith/#-replacewith-a-document-nested-in-an-array' + pipeline: + - + # The builder uses the verbose form of the $unwind operator + # $unwind: '$grades' + $unwind: + path: '$grades' + - + $match: + grades.grade: + $gte: 90 + - + $replaceWith: '$grades' + - + name: 'a Newly Created Document' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceWith/#-replacewith-a-newly-created-document' + pipeline: + - + $match: + status: 'C' + - + $replaceWith: + _id: '$_id' + item: '$item' + amount: + $multiply: + - '$price' + - '$quantity' + status: 'Complete' + asofDate: '$$NOW' + - + name: 'a New Document Created from $$ROOT and a Default Document' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceWith/#-replacewith-a-new-document-created-from---root-and-a-default-document' + pipeline: + - + $replaceWith: + $mergeObjects: + - + _id: '' + name: '' + email: '' + cell: '' + home: '' + - '$$ROOT' diff --git a/generator/config/stage/sample.yaml b/generator/config/stage/sample.yaml new file mode 100644 index 000000000..757382aaf --- /dev/null +++ b/generator/config/stage/sample.yaml @@ -0,0 +1,23 @@ +# $schema: ../schema.json +name: $sample +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sample/' +type: + - stage +encode: object +description: | + Randomly selects the specified number of documents from its input. +arguments: + - + name: size + type: + - int + description: | + The number of documents to randomly select. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sample/#example' + pipeline: + - + $sample: + size: 3 diff --git a/generator/config/stage/search.yaml b/generator/config/stage/search.yaml new file mode 100644 index 000000000..44756ce23 --- /dev/null +++ b/generator/config/stage/search.yaml @@ -0,0 +1,265 @@ +# $schema: ../schema.json +name: $search +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/search/' +type: + - stage +encode: object +description: | + Performs a full-text search of the field or fields in an Atlas collection. + NOTE: $search is only available for MongoDB Atlas clusters, and is not available for self-managed deployments. +arguments: + - + name: operator + mergeObject: true + type: + - searchOperator + description: | + Operator to search with. You can provide a specific operator or use + the compound operator to run a compound query with multiple operators. + - + name: index + optional: true + type: + - string + description: | + Name of the Atlas Search index to use. If omitted, defaults to "default". + - + name: highlight + optional: true + type: + # @todo support "highlight" type object + # https://www.mongodb.com/docs/atlas/atlas-search/highlighting/ + - object + description: | + Specifies the highlighting options for displaying search terms in their original context. + - + name: concurrent + optional: true + type: + - bool + description: | + Parallelize search across segments on dedicated search nodes. + If you don't have separate search nodes on your cluster, + Atlas Search ignores this flag. If omitted, defaults to false. + - + name: count + optional: true + type: + - object + description: | + Document that specifies the count options for retrieving a count of the results. + - + name: searchAfter + optional: true + type: + - string + description: | + Reference point for retrieving results. searchAfter returns documents starting immediately following the specified reference point. + - + name: searchBefore + optional: true + type: + - string + description: | + Reference point for retrieving results. searchBefore returns documents starting immediately before the specified reference point. + - + name: scoreDetails + optional: true + type: + - bool + description: | + Flag that specifies whether to retrieve a detailed breakdown of the score for the documents in the results. If omitted, defaults to false. + - + name: sort + optional: true + type: + - object + description: | + Document that specifies the fields to sort the Atlas Search results by in ascending or descending order. + - + name: returnStoredSource + optional: true + type: + - bool + description: | + Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search. + - + name: tracking + optional: true + type: + - object + description: | + Document that specifies the tracking option to retrieve analytics information on the search terms. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/query-syntax/#aggregation-variable' + pipeline: + - + $search: + near: + path: 'released' + origin: !bson_utcdatetime '2011-09-01T00:00:00.000+00:00' + pivot: 7776000000 + - + $project: + _id: 0 + title: 1 + released: 1 + - + $limit: 5 + - + $facet: + docs: [] + meta: + - + $replaceWith: '$$SEARCH_META' + - + $limit: 1 + - + name: 'Date Search and Sort' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/sort/#date-search-and-sort' + pipeline: + - + $search: + range: + path: 'released' + gt: !bson_utcdatetime '2010-01-01T00:00:00.000Z' + lt: !bson_utcdatetime '2015-01-01T00:00:00.000Z' + sort: + released: -1 + - + $limit: 5 + - + $project: + _id: 0 + title: 1 + released: 1 + - + name: 'Number Search and Sort' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/sort/#number-search-and-sort' + pipeline: + - + $search: + range: + path: 'awards.wins' + gt: 3 + sort: + awards.wins: -1 + - + $limit: 5 + - + $project: + _id: 0 + title: 1 + awards.wins: 1 + - + name: 'Sort by score' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/sort/#sort-by-score' + pipeline: + - + $search: + text: + path: 'title' + query: 'story' + sort: + score: + $meta: 'searchScore' + order: 1 + - + $limit: 5 + - + $project: + _id: 0 + title: 1 + score: + $meta: 'searchScore' + - + name: 'Paginate results after a token' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/paginate-results/#search-after-the-reference-point' + pipeline: + - + $search: + text: + path: 'title' + query: 'war' + sort: + score: + $meta: 'searchScore' + released: 1 + searchAfter: 'CMtJGgYQuq+ngwgaCSkAjBYH7AAAAA==' + - + name: 'Paginate results before a token' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/paginate-results/#search-before-the-reference-point' + pipeline: + - + $search: + text: + path: 'title' + query: 'war' + sort: + score: + $meta: 'searchScore' + released: 1 + searchBefore: 'CJ6kARoGELqvp4MIGgkpACDA3U8BAAA=' + - + name: 'Count results' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/counting/#count-results' + pipeline: + - + $search: + near: + path: 'released' + origin: !bson_utcdatetime '2011-09-01T00:00:00.000+00:00' + pivot: 7776000000 + count: + type: 'total' + - + $project: + meta: '$$SEARCH_META' + title: 1 + released: 1 + - + $limit: 2 + - + name: 'Track Search terms' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/tracking/#examples' + pipeline: + - + $search: + text: + query: 'summer' + path: 'title' + tracking: + searchTerms: 'summer' + - + $limit: 5 + - + $project: + _id: 0 + title: 1 + - + name: 'Return Stored Source Fields' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/return-stored-source/#examples' + pipeline: + - + $search: + text: + query: 'baseball' + path: 'title' + returnStoredSource: true + - + $match: + $or: + - + imdb.rating: + $gt: 8.2 + - + imdb.votes: + $gte: 4500 + - + $lookup: + from: 'movies' + localField: '_id' + foreignField: '_id' + as: 'document' diff --git a/generator/config/stage/searchMeta.yaml b/generator/config/stage/searchMeta.yaml new file mode 100644 index 000000000..a7d92c272 --- /dev/null +++ b/generator/config/stage/searchMeta.yaml @@ -0,0 +1,132 @@ +# $schema: ../schema.json +name: $searchMeta +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/searchMeta/' +type: + - stage +encode: object +description: | + Returns different types of metadata result documents for the Atlas Search query against an Atlas collection. + NOTE: $searchMeta is only available for MongoDB Atlas clusters running MongoDB v4.4.9 or higher, and is not available for self-managed deployments. +arguments: + - + name: operator + mergeObject: true + type: + - searchOperator + description: | + Operator to search with. You can provide a specific operator or use + the compound operator to run a compound query with multiple operators. + - + name: index + optional: true + type: + - string + description: | + Name of the Atlas Search index to use. If omitted, defaults to default. + + - + name: count + optional: true + type: + - object + description: | + Document that specifies the count options for retrieving a count of the results. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/query-syntax/#example' + pipeline: + - + $searchMeta: + range: + path: 'year' + gte: 1998 + lt: 1999 + count: + type: 'total' + + - + name: 'Year Facet' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/facet/#example-1' + pipeline: + - $searchMeta: + facet: + operator: + range: + path: 'year' + gte: 1980 + lte: 2000 + facets: + yearFacet: + type: 'number' + path: 'year' + boundaries: + - 1980 + - 1990 + - 2000 + default: 'other' + + - + name: 'Date Facet' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/facet/#example-2' + pipeline: + - + $searchMeta: + facet: + operator: + range: + path: 'released' + gte: !bson_utcdatetime '2000-01-01T00:00:00.000Z' + lte: !bson_utcdatetime '2015-01-31T00:00:00.000Z' + facets: + yearFacet: + type: 'date' + path: 'released' + boundaries: + - !bson_utcdatetime '2000-01-01' + - !bson_utcdatetime '2005-01-01' + - !bson_utcdatetime '2010-01-01' + - !bson_utcdatetime '2015-01-01' + default: 'other' + + - + name: 'Metadata Results' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/facet/#examples' + pipeline: + - + $searchMeta: + facet: + operator: + range: + path: 'released' + gte: !bson_utcdatetime '2000-01-01T00:00:00.000Z' + lte: !bson_utcdatetime '2015-01-31T00:00:00.000Z' + facets: + directorsFacet: + type: 'string' + path: 'directors' + numBuckets: 7 + yearFacet: + type: 'number' + path: 'year' + boundaries: + - 2000 + - 2005 + - 2010 + - 2015 + + - + name: 'Autocomplete Bucket Results through Facet Queries' + link: 'https://www.mongodb.com/docs/atlas/atlas-search/autocomplete/#bucket-results-through-facet-queries' + pipeline: + - + $searchMeta: + facet: + operator: + autocomplete: + path: 'title' + query: 'Gravity' + facets: + titleFacet: + type: 'string' + path: 'title' diff --git a/generator/config/stage/set.yaml b/generator/config/stage/set.yaml new file mode 100644 index 000000000..a5861aa29 --- /dev/null +++ b/generator/config/stage/set.yaml @@ -0,0 +1,73 @@ +# $schema: ../schema.json +name: $set +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/set/' +type: + - stage +encode: single +description: | + Adds new fields to documents. Outputs documents that contain all existing fields from the input documents and newly added fields. + Alias for $addFields. +arguments: + - + name: field + type: + - expression + variadic: object +tests: + - + name: 'Using Two $set Stages' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/set/#using-two--set-stages' + pipeline: + - + $set: + totalHomework: + # The $sum expression is always build as an array, even if the value is an array field name + # $sum: '$homework' + $sum: ['$homework'] + totalQuiz: + # $sum: '$quiz' + $sum: ['$quiz'] + - + $set: + totalScore: + $add: + - '$totalHomework' + - '$totalQuiz' + - '$extraCredit' + - + name: 'Adding Fields to an Embedded Document' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/set/#adding-fields-to-an-embedded-document' + pipeline: + - + $set: + specs.fuel_type: 'unleaded' + - + name: 'Overwriting an existing field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/set/#overwriting-an-existing-field' + pipeline: + - + $set: + cats: 20 + - + name: 'Add Element to an Array' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/set/#add-element-to-an-array' + pipeline: + - + $match: + _id: 1 + - + $set: + homework: + $concatArrays: + - '$homework' + - + - 7 + - + name: 'Creating a New Field with Existing Fields' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/set/#creating-a-new-field-with-existing-fields' + pipeline: + - + $set: + quizAverage: + # $avg: '$quiz' + $avg: ['$quiz'] diff --git a/generator/config/stage/setWindowFields.yaml b/generator/config/stage/setWindowFields.yaml new file mode 100644 index 000000000..6f86472d7 --- /dev/null +++ b/generator/config/stage/setWindowFields.yaml @@ -0,0 +1,144 @@ +# $schema: ../schema.json +name: $setWindowFields +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/' +type: + - stage +encode: object +description: | + Groups documents into windows and applies one or more operators to the documents in each window. + New in MongoDB 5.0. +arguments: + - + name: sortBy + type: + - sortBy + description: | + Specifies the field(s) to sort the documents by in the partition. Uses the same syntax as the $sort stage. Default is no sorting. + - + name: output + type: + - object + description: | + Specifies the field(s) to append to the documents in the output returned by the $setWindowFields stage. Each field is set to the result returned by the window operator. + A field can contain dots to specify embedded document fields and array fields. The semantics for the embedded document dotted notation in the $setWindowFields stage are the same as the $addFields and $set stages. + - + name: partitionBy + type: + - expression + description: | + Specifies an expression to group the documents. In the $setWindowFields stage, the group of documents is known as a partition. Default is one partition for the entire collection. + optional: true +tests: + - + name: 'Use Documents Window to Obtain Cumulative Quantity for Each State' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/#use-documents-window-to-obtain-cumulative-quantity-for-each-state' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + cumulativeQuantityForState: + $sum: '$quantity' + window: + documents: ['unbounded', 'current'] + - + name: 'Use Documents Window to Obtain Cumulative Quantity for Each Year' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/#use-documents-window-to-obtain-cumulative-quantity-for-each-year' + pipeline: + - + $setWindowFields: + partitionBy: + # $year: '$orderDate' + $year: + date: '$orderDate' + sortBy: + orderDate: 1 + output: + cumulativeQuantityForYear: + $sum: '$quantity' + window: + documents: ['unbounded', 'current'] + - + name: 'Use Documents Window to Obtain Moving Average Quantity for Each Year' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/#use-documents-window-to-obtain-moving-average-quantity-for-each-year' + pipeline: + - + $setWindowFields: + partitionBy: + # $year: '$orderDate' + $year: + date: '$orderDate' + sortBy: + orderDate: 1 + output: + averageQuantity: + $avg: '$quantity' + window: + documents: [-1, 0] + - + name: 'Use Documents Window to Obtain Cumulative and Maximum Quantity for Each Year' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/#use-documents-window-to-obtain-cumulative-and-maximum-quantity-for-each-year' + pipeline: + - + $setWindowFields: + partitionBy: + # $year: '$orderDate' + $year: + date: '$orderDate' + sortBy: + orderDate: 1 + output: + cumulativeQuantityForYear: + $sum: '$quantity' + window: + documents: ['unbounded', 'current'] + maximumQuantityForYear: + $max: '$quantity' + window: + documents: ['unbounded', 'unbounded'] + - + name: 'Range Window Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/#range-window-example' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + price: 1 + output: + quantityFromSimilarOrders: + $sum: '$quantity' + window: + range: [-10, 10] + - + name: 'Use a Time Range Window with a Positive Upper Bound' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/#use-a-time-range-window-with-a-positive-upper-bound' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + recentOrders: + $push: '$orderDate' + window: + range: ['unbounded', 10] + unit: 'month' + - + name: 'Use a Time Range Window with a Negative Upper Bound' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/#use-a-time-range-window-with-a-negative-upper-bound' + pipeline: + - + $setWindowFields: + partitionBy: '$state' + sortBy: + orderDate: 1 + output: + recentOrders: + $push: '$orderDate' + window: + range: ['unbounded', -10] + unit: 'month' diff --git a/generator/config/stage/shardedDataDistribution.yaml b/generator/config/stage/shardedDataDistribution.yaml new file mode 100644 index 000000000..2f298ca0f --- /dev/null +++ b/generator/config/stage/shardedDataDistribution.yaml @@ -0,0 +1,16 @@ +# $schema: ../schema.json +name: $shardedDataDistribution +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/shardedDataDistribution/' +type: + - stage +encode: object +description: | + Provides data and size distribution information on sharded collections. + New in MongoDB 6.0.3. +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/shardedDataDistribution/#examples' + pipeline: + - + $shardedDataDistribution: {} diff --git a/generator/config/stage/skip.yaml b/generator/config/stage/skip.yaml new file mode 100644 index 000000000..2128fe226 --- /dev/null +++ b/generator/config/stage/skip.yaml @@ -0,0 +1,20 @@ +# $schema: ../schema.json +name: $skip +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/skip/' +type: + - stage +encode: single +description: | + Skips the first n documents where n is the specified skip number and passes the remaining documents unmodified to the pipeline. For each input document, outputs either zero documents (for the first n documents) or one document (if after the first n documents). +arguments: + - + name: skip + type: + - int +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/skip/#example' + pipeline: + - + $skip: 5 diff --git a/generator/config/stage/sort.yaml b/generator/config/stage/sort.yaml new file mode 100644 index 000000000..d35e23b63 --- /dev/null +++ b/generator/config/stage/sort.yaml @@ -0,0 +1,37 @@ +# $schema: ../schema.json +name: $sort +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sort/' +type: + - stage +encode: single +description: | + Reorders the document stream by a specified sort key. Only the order changes; the documents remain unmodified. For each input document, outputs one document. +arguments: + - + name: sort + type: + - expression + - sortSpec + variadic: object +tests: + - + name: 'Ascending Descending Sort' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sort/#ascending-descending-sort' + pipeline: + - + $sort: + age: -1 + posts: 1 + - + name: 'Text Score Metadata Sort' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sort/#text-score-metadata-sort' + pipeline: + - + $match: + $text: + $search: 'operating' + - + $sort: + score: + $meta: 'textScore' + posts: -1 diff --git a/generator/config/stage/sortByCount.yaml b/generator/config/stage/sortByCount.yaml new file mode 100644 index 000000000..a32d7aff4 --- /dev/null +++ b/generator/config/stage/sortByCount.yaml @@ -0,0 +1,25 @@ +# $schema: ../schema.json +name: $sortByCount +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortByCount/' +type: + - stage +encode: single +description: | + Groups incoming documents based on the value of a specified expression, then computes the count of documents in each distinct group. +arguments: + - + name: expression + type: + - expression +tests: + - + name: 'Example' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortByCount/#example' + pipeline: + - + # The builder uses the verbose form of the $unwind operator + # $unwind: '$tags' + $unwind: + path: '$tags' + - + $sortByCount: '$tags' diff --git a/generator/config/stage/unionWith.yaml b/generator/config/stage/unionWith.yaml new file mode 100644 index 000000000..eafa44110 --- /dev/null +++ b/generator/config/stage/unionWith.yaml @@ -0,0 +1,83 @@ +# $schema: ../schema.json +name: $unionWith +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unionWith/' +type: + - stage +encode: object +description: | + Performs a union of two collections; i.e. combines pipeline results from two collections into a single result set. + New in MongoDB 4.4. +arguments: + - + name: coll + type: + - string + description: | + The collection or view whose pipeline results you wish to include in the result set. + - + name: pipeline + type: + - pipeline + optional: true + description: | + An aggregation pipeline to apply to the specified coll. + The pipeline cannot include the $out and $merge stages. Starting in v6.0, the pipeline can contain the Atlas Search $search stage as the first stage inside the pipeline. +tests: + - + name: 'Report 1 All Sales by Year and Stores and Items' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unionWith/#report-1--all-sales-by-year-and-stores-and-items' + pipeline: + - + $set: + _id: '2017' + - + $unionWith: + coll: 'sales_2018' + pipeline: + - + $set: + _id: '2018' + - + $unionWith: + coll: 'sales_2019' + pipeline: + - + $set: + _id: '2019' + - + $unionWith: + coll: 'sales_2020' + pipeline: + - + $set: + _id: '2020' + - + $sort: + _id: 1 + store: 1 + item: 1 + - + name: 'Report 2 Aggregated Sales by Items' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unionWith/#report-2--aggregated-sales-by-items' + pipeline: + - + # Example uses the short form, the builder always generates the verbose form + # $unionWith: 'sales_2018' + $unionWith: + coll: 'sales_2018' + - + # $unionWith: 'sales_2019' + $unionWith: + coll: 'sales_2019' + - + # $unionWith: 'sales_2020' + $unionWith: + coll: 'sales_2020' + - + $group: + _id: '$item' + total: + $sum: '$quantity' + - + $sort: + total: -1 diff --git a/generator/config/stage/unset.yaml b/generator/config/stage/unset.yaml new file mode 100644 index 000000000..cef9cdd6d --- /dev/null +++ b/generator/config/stage/unset.yaml @@ -0,0 +1,42 @@ +# $schema: ../schema.json +name: $unset +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unset/' +type: + - stage +encode: single +description: | + Removes or excludes fields from documents. + Alias for $project stage that removes or excludes fields. +arguments: + - + name: field + type: + - fieldPath + variadic: array +tests: + - + name: 'Remove a Single Field' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unset/#remove-a-single-field' + pipeline: + - + # The example in the docs uses the short syntax whereas + # the aggregation builder always uses the equivalent array syntax. + # $unset: 'copies' + $unset: ['copies'] + - + name: 'Remove Top-Level Fields' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unset/#remove-top-level-fields' + pipeline: + - + $unset: + - 'isbn' + - 'copies' + - + name: 'Remove Embedded Fields' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unset/#remove-embedded-fields' + pipeline: + - + $unset: + - 'isbn' + - 'author.first' + - 'copies.warehouse' diff --git a/generator/config/stage/unwind.yaml b/generator/config/stage/unwind.yaml new file mode 100644 index 000000000..a1f93edbc --- /dev/null +++ b/generator/config/stage/unwind.yaml @@ -0,0 +1,95 @@ +# $schema: ../schema.json +name: $unwind +link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unwind/' +type: + - stage +encode: object +description: | + Deconstructs an array field from the input documents to output a document for each element. Each output document replaces the array with an element value. For each input document, outputs n documents where n is the number of array elements and can be zero for an empty array. +arguments: + - + name: path + type: + - arrayFieldPath + description: | + Field path to an array field. + - + name: includeArrayIndex + type: + - string + optional: true + description: | + The name of a new field to hold the array index of the element. The name cannot start with a dollar sign $. + - + name: preserveNullAndEmptyArrays + type: + - bool + optional: true + description: | + If true, if the path is null, missing, or an empty array, $unwind outputs the document. + If false, if path is null, missing, or an empty array, $unwind does not output a document. + The default value is false. +tests: + - + name: 'Unwind Array' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unwind/#unwind-array' + pipeline: + - + # Example uses the short form, the builder always generates the verbose form + # $unwind: '$sizes' + $unwind: + path: '$sizes' + - + name: 'preserveNullAndEmptyArrays' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unwind/#preservenullandemptyarrays' + pipeline: + - + $unwind: + path: '$sizes' + preserveNullAndEmptyArrays: true + - + name: 'includeArrayIndex' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unwind/#includearrayindex' + pipeline: + - + $unwind: + path: '$sizes' + includeArrayIndex: 'arrayIndex' + - + name: 'Group by Unwound Values' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unwind/#group-by-unwound-values' + pipeline: + - + $unwind: + path: '$sizes' + preserveNullAndEmptyArrays: true + - + $group: + _id: '$sizes' + averagePrice: + $avg: '$price' + - + $sort: + averagePrice: -1 + - + name: 'Unwind Embedded Arrays' + link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/unwind/#unwind-embedded-arrays' + pipeline: + - + # Example uses the short form, the builder always generates the verbose form + # $unwind: '$items' + $unwind: + path: '$items' + - + # Example uses the short form, the builder always generates the verbose form + # $unwind: '$items.tags' + $unwind: + path: '$items.tags' + - + $group: + _id: '$items.tags' + totalSalesAmount: + $sum: + $multiply: + - '$items.price' + - '$items.quantity' diff --git a/generator/config/stage/vectorSearch.yaml b/generator/config/stage/vectorSearch.yaml new file mode 100644 index 000000000..bcd3c008a --- /dev/null +++ b/generator/config/stage/vectorSearch.yaml @@ -0,0 +1,119 @@ +# $schema: ../schema.json +name: $vectorSearch +link: 'https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/' +type: + - stage +encode: object +description: | + The $vectorSearch stage performs an ANN or ENN search on a vector in the specified field. +arguments: + - + name: index + type: + - string + description: | + Name of the Atlas Vector Search index to use. + - + name: limit + type: + - int + description: | + Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. + - + name: path + type: + - string + description: | + Indexed vector type field to search. + - + name: queryVector + type: + - array # of numbers + description: | + Array of numbers that represent the query vector. The number type must match the indexed field value type. + - + name: exact + optional: true + type: + - bool + description: | + This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. + - + name: filter + optional: true + type: + - query + description: | + Any match query that compares an indexed field with a boolean, date, objectId, number (not decimals), string, or UUID to use as a pre-filter. + - + name: numCandidates + optional: true + type: + - int + description: | + This field is required if exact is false or omitted. + Number of nearest neighbors to use during the search. Value must be less than or equal to (<=) 10000. You can't specify a number less than the number of documents to return (limit). + +tests: + - + name: 'ANN Basic' + link: 'https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/#ann-examples' + pipeline: + - + $vectorSearch: + index: 'vector_index' + path: 'plot_embedding' + queryVector: [-0.0016261312, -0.028070757, -0.011342932] # skip other numbers, not relevant to the test + numCandidates: 150 + limit: 10 + - + $project: + _id: 0 + plot: 1 + title: 1 + score: + $meta: 'vectorSearchScore' + + - + name: 'ANN Filter' + link: 'https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/#ann-examples' + pipeline: + - + $vectorSearch: + index: 'vector_index' + path: 'plot_embedding' + filter: + $and: + - + year: + $lt: 1975 + queryVector: [0.02421053, -0.022372592, -0.006231137] # skip other numbers, not relevant to the test + numCandidates: 150 + limit: 10 + - + $project: + _id: 0 + title: 1 + plot: 1 + year: 1 + score: + $meta: 'vectorSearchScore' + + - + name: 'ENN' + link: 'https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/#enn-examples' + pipeline: + - + $vectorSearch: + index: 'vector_index' + path: 'plot_embedding' + queryVector: [-0.006954097, -0.009932499, -0.001311474] # skip other numbers, not relevant to the test + exact: true + limit: 10 + - + $project: + _id: 0 + plot: 1 + title: 1 + score: + $meta: 'vectorSearchScore' diff --git a/generator/generate b/generator/generate new file mode 100755 index 000000000..d67515b70 --- /dev/null +++ b/generator/generate @@ -0,0 +1,17 @@ +#!/usr/bin/env php +add(new GenerateCommand(__DIR__ . '/../', __DIR__ . '/config')); +$application->setDefaultCommand('generate'); +$application->run(); diff --git a/generator/js2yaml.html b/generator/js2yaml.html new file mode 100644 index 000000000..31241adb1 --- /dev/null +++ b/generator/js2yaml.html @@ -0,0 +1,179 @@ + + +

Convert JS examples into Yaml

+ +
+ + +
+ +
+ + +
+ + + diff --git a/generator/src/AbstractGenerator.php b/generator/src/AbstractGenerator.php new file mode 100644 index 000000000..b0fef69aa --- /dev/null +++ b/generator/src/AbstractGenerator.php @@ -0,0 +1,111 @@ +printer = new PsrPrinter(); + } + + /** + * Split the namespace and class name from a fully qualified class name. + * + * @return array{0: string, 1: string} + */ + final protected function splitNamespaceAndClassName(string $fqcn): array + { + $parts = explode('\\', ltrim($fqcn, '\\')); + $className = array_pop($parts); + + return [implode('\\', $parts), $className]; + } + + final protected function writeFile(PhpNamespace $namespace, bool $autoGeneratedWarning = true): void + { + $classes = $namespace->getClasses(); + assert(count($classes) === 1, sprintf('Expected exactly one class in namespace "%s", got %d.', $namespace->getName(), count($classes))); + + $filename = $this->rootDir . $this->getFileName($namespace->getName(), current($classes)->getName()); + + $dirname = dirname($filename); + if (! is_dir($dirname)) { + mkdir($dirname, 0755, true); + } + + $file = new PhpFile(); + $file->setStrictTypes(); + if ($autoGeneratedWarning) { + $file->setComment('THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!'); + } + + $file->addNamespace($namespace); + + file_put_contents($filename, $this->printer->printFile($file)); + } + + final protected function readFile(string ...$fqcn): PhpFile|null + { + $filename = $this->rootDir . $this->getFileName(...$fqcn); + + if (! is_file($filename)) { + return null; + } + + return PhpFile::fromCode(file_get_contents($filename)); + } + + /** + * Thanks to PSR-4, the file name can be determined from the fully qualified class name. + * + * @param string ...$fqcn Fully qualified class name, merged if multiple parts + * + * @return string File name relative to the root directory + */ + private function getFileName(string ...$fqcn): string + { + $fqcn = implode('\\', $fqcn); + + // Config from composer.json autoload + $config = [ + 'MongoDB\\Tests\\' => 'tests/', + 'MongoDB\\' => 'src/', + ]; + foreach ($config as $namespace => $directory) { + if (str_starts_with($fqcn, $namespace)) { + return $directory . str_replace([$namespace, '\\'], ['', '/'], $fqcn) . '.php'; + } + } + + throw new InvalidArgumentException(sprintf('Could not determine file name for "%s"', $fqcn)); + } +} diff --git a/generator/src/Command/GenerateCommand.php b/generator/src/Command/GenerateCommand.php new file mode 100644 index 000000000..78482963e --- /dev/null +++ b/generator/src/Command/GenerateCommand.php @@ -0,0 +1,90 @@ +setName('generate'); + $this->setDescription('Generate code for mongodb/mongodb library'); + $this->setHelp('Generate code for mongodb/mongodb library'); + } + + public function execute(InputInterface $input, OutputInterface $output): int + { + $output->writeln('Generating code for mongodb/mongodb library'); + + $expressions = $this->generateExpressionClasses($output); + $this->generateOperatorClasses($expressions, $output); + + return Command::SUCCESS; + } + + /** @return array */ + private function generateExpressionClasses(OutputInterface $output): array + { + $output->writeln('Generating expression classes'); + + $config = require $this->configDir . '/expressions.php'; + assert(is_array($config)); + + $definitions = []; + $generator = new ExpressionClassGenerator($this->rootDir); + foreach ($config as $name => $def) { + assert(is_array($def)); + assert(! array_key_exists($name, $definitions), sprintf('Duplicate expression name "%s".', $name)); + $definitions[$name] = $def = new ExpressionDefinition($name, ...$def); + $generator->generate($def); + } + + $generator = new ExpressionFactoryGenerator($this->rootDir); + $generator->generate($definitions); + + return $definitions; + } + + /** @param array $expressions */ + private function generateOperatorClasses(array $expressions, OutputInterface $output): void + { + $config = require $this->configDir . '/definitions.php'; + assert(is_array($config)); + + foreach ($config as $def) { + assert(is_array($def)); + $definition = new GeneratorDefinition(...$def); + + foreach ($definition->generators as $generatorClass) { + $output->writeln(sprintf('Generating classes for %s with %s', basename($definition->configFiles), $generatorClass)); + assert(is_a($generatorClass, OperatorGenerator::class, true)); + $generator = new $generatorClass($this->rootDir, $expressions); + $generator->generate($definition); + } + } + } +} diff --git a/generator/src/Definition/ArgumentDefinition.php b/generator/src/Definition/ArgumentDefinition.php new file mode 100644 index 000000000..7cdd7d321 --- /dev/null +++ b/generator/src/Definition/ArgumentDefinition.php @@ -0,0 +1,54 @@ + */ + public array $type, + public string|null $description = null, + public bool $optional = false, + string|null $variadic = null, + int|null $variadicMin = null, + public mixed $default = null, + public bool $mergeObject = false, + ) { + assert($this->optional === false || $this->default === null, 'Optional arguments cannot have a default value'); + if (is_array($type)) { + assert(array_is_list($type), 'Type must be a list or a single string'); + foreach ($type as $t) { + assert(is_string($t), sprintf('Type must be a list of strings. Got %s', get_debug_type($type))); + } + } + + $this->propertyName = ltrim($this->name, '$'); + + if ($variadic) { + $this->variadic = VariadicType::from($variadic); + if ($variadicMin === null) { + $this->variadicMin = $optional ? 0 : 1; + } else { + $this->variadicMin = $variadicMin; + } + } else { + $this->variadic = null; + $this->variadicMin = null; + } + } +} diff --git a/generator/src/Definition/ExpressionDefinition.php b/generator/src/Definition/ExpressionDefinition.php new file mode 100644 index 000000000..cbe37febc --- /dev/null +++ b/generator/src/Definition/ExpressionDefinition.php @@ -0,0 +1,37 @@ + */ + public array $acceptedTypes, + /** Interface to implement for operators that resolve to this type. Generated class/enum/interface. */ + public string|null $returnType = null, + public string|null $extends = null, + /** @var list */ + public array $implements = [], + public array $values = [], + public PhpObject|null $generate = null, + ) { + assert($generate === PhpObject::PhpClass || ! $extends, $name . ': Cannot specify "extends" when "generate" is not "class"'); + assert($generate === PhpObject::PhpEnum || ! $this->values, $name . ': Cannot specify "values" when "generate" is not "enum"'); + //assert($returnType === null || interface_exists($returnType), $name . ': Return type must be an interface'); + + foreach ($acceptedTypes as $acceptedType) { + assert(is_string($acceptedType), $name . ': AcceptedTypes must be an array of strings.'); + } + + if ($generate) { + $this->returnType = 'MongoDB\\Builder\\Expression\\' . ucfirst($this->name); + } + } +} diff --git a/generator/src/Definition/GeneratorDefinition.php b/generator/src/Definition/GeneratorDefinition.php new file mode 100644 index 000000000..2faa2fac3 --- /dev/null +++ b/generator/src/Definition/GeneratorDefinition.php @@ -0,0 +1,42 @@ +> */ + public array $generators, + public string $namespace, + public string $classNameSuffix = '', + public array $interfaces = [], + public string|null $parentClass = null, + ) { + assert(str_starts_with($namespace, 'MongoDB\\'), sprintf('Namespace must start with "MongoDB\\". Got "%s"', $namespace)); + assert(! str_ends_with($namespace, '\\'), sprintf('Namespace must not end with "\\". Got "%s"', $namespace)); + + assert(array_is_list($interfaces), 'Generators must be a list of class names'); + foreach ($interfaces as $interface) { + assert(is_string($interface) && class_exists($interface), sprintf('Interface "%s" does not exist', $interface)); + } + + assert(array_is_list($generators), 'Generators must be a list of class names'); + foreach ($generators as $class) { + assert(is_string($class) && is_subclass_of($class, OperatorGenerator::class), sprintf('Generator class "%s" must extend "%s"', $class, OperatorGenerator::class)); + } + } +} diff --git a/generator/src/Definition/OperatorDefinition.php b/generator/src/Definition/OperatorDefinition.php new file mode 100644 index 000000000..5468b7917 --- /dev/null +++ b/generator/src/Definition/OperatorDefinition.php @@ -0,0 +1,75 @@ + */ + public readonly array $arguments; + + /** @var list */ + public readonly array $tests; + + public function __construct( + public string $name, + public string $link, + string $encode, + /** @var list */ + public array $type, + public string|null $description = null, + public bool $wrapObject = true, + array $arguments = [], + array $tests = [], + ) { + $this->encode = match ($encode) { + 'single' => Encode::Single, + 'array' => Encode::Array, + 'object' => Encode::Object, + default => throw new UnexpectedValueException(sprintf('Unexpected "encode" value for operator "%s". Got "%s"', $name, $encode)), + }; + + if (! $wrapObject && $this->encode !== Encode::Object) { + throw new UnexpectedValueException(sprintf('Operator "%s" cannot have wrapObject set to false when encode is not "object"', $name)); + } + + // Convert arguments to ArgumentDefinition objects + // Optional arguments must be after required arguments + $requiredArgs = $optionalArgs = []; + foreach ($arguments as $arg) { + $arg = new ArgumentDefinition(...get_object_vars($arg)); + if ($arg->optional) { + $optionalArgs[] = $arg; + } else { + $requiredArgs[] = $arg; + } + } + + // "single" encode operators must have one required argument + if ($this->encode === Encode::Single) { + assert(count($requiredArgs) === 1, sprintf('Single encode operator "%s" must have one argument', $name)); + assert(count($optionalArgs) === 0, sprintf('Single encode operator "%s" argument cannot be optional', $name)); + } + + $this->arguments = array_merge($requiredArgs, $optionalArgs); + + $this->tests = array_map( + static fn (object $test): TestDefinition => new TestDefinition(...get_object_vars($test)), + array_values($tests), + ); + } +} diff --git a/generator/src/Definition/PhpObject.php b/generator/src/Definition/PhpObject.php new file mode 100644 index 000000000..5e815e0b6 --- /dev/null +++ b/generator/src/Definition/PhpObject.php @@ -0,0 +1,15 @@ + */ + public array $pipeline, + public string|null $link = null, + ) { + assert(array_is_list($pipeline), sprintf('Argument "%s" pipeline must be a list', $name)); + } +} diff --git a/generator/src/Definition/VariadicType.php b/generator/src/Definition/VariadicType.php new file mode 100644 index 000000000..091f654c9 --- /dev/null +++ b/generator/src/Definition/VariadicType.php @@ -0,0 +1,11 @@ + */ + public function read(string $dirname): array + { + $finder = new Finder(); + $finder->files()->in($dirname)->name('*.yaml')->sortByName(); + + $definitions = []; + foreach ($finder as $file) { + $operator = Yaml::parseFile( + $file->getPathname(), + Yaml::PARSE_OBJECT | Yaml::PARSE_OBJECT_FOR_MAP | Yaml::PARSE_CUSTOM_TAGS, + ); + $definitions[] = new OperatorDefinition(...get_object_vars($operator)); + } + + return $definitions; + } +} diff --git a/generator/src/ExpressionClassGenerator.php b/generator/src/ExpressionClassGenerator.php new file mode 100644 index 000000000..fc9119364 --- /dev/null +++ b/generator/src/ExpressionClassGenerator.php @@ -0,0 +1,96 @@ +generate) { + return; + } + + try { + $this->writeFile($this->createClassOrInterface($definition)); + } catch (Throwable $e) { + throw new RuntimeException('Failed to generate expression class for ' . $definition->name, 0, $e); + } + } + + public function createClassOrInterface(ExpressionDefinition $definition): PhpNamespace + { + [$namespace, $className] = $this->splitNamespaceAndClassName($definition->returnType); + $namespace = new PhpNamespace($namespace); + foreach ($definition->implements as $interface) { + $namespace->addUse($interface); + } + + $types = array_map( + fn (string $type): string => match ($type) { + 'list' => 'array', + default => $type, + }, + $definition->acceptedTypes, + ); + + if ($definition->generate === PhpObject::PhpClass) { + $class = $namespace->addClass($className); + $class->setImplements($definition->implements); + $class->setExtends($definition->extends); + + // Replace with promoted property in PHP 8.1 + $propertyType = Type::union(...$types); + $class->addProperty('name') + ->setType($propertyType) + ->setReadOnly() + ->setPublic(); + + $constructor = $class->addMethod('__construct'); + $constructor->addParameter('name')->setType($propertyType); + + $namespace->addUse(InvalidArgumentException::class); + $namespace->addUseFunction('sprintf'); + $namespace->addUseFunction('str_starts_with'); + $constructor->addBody(<<addBody('$this->name = $name;'); + } elseif ($definition->generate === PhpObject::PhpInterface) { + $interface = $namespace->addInterface($className); + $interface->setExtends($definition->implements); + } elseif ($definition->generate === PhpObject::PhpEnum) { + $enum = $namespace->addEnum($className); + $enum->setType('string'); + array_map( + fn (string $case) => $enum->addCase(ucfirst($case), $case), + $definition->values, + ); + } else { + throw new LogicException('Unknown generate type: ' . var_export($definition->generate, true)); + } + + return $namespace; + } +} diff --git a/generator/src/ExpressionFactoryGenerator.php b/generator/src/ExpressionFactoryGenerator.php new file mode 100644 index 000000000..b1e84c5dd --- /dev/null +++ b/generator/src/ExpressionFactoryGenerator.php @@ -0,0 +1,49 @@ + $expressions */ + public function generate(array $expressions): void + { + $this->writeFile($this->createFactoryClass($expressions)); + } + + /** @param array $expressions */ + private function createFactoryClass(array $expressions): PhpNamespace + { + $namespace = new PhpNamespace('MongoDB\\Builder\\Expression'); + $trait = $namespace->addTrait('ExpressionFactoryTrait'); + $trait->addComment('@internal'); + + // Pedantry requires methods to be ordered alphabetically + usort($expressions, fn (ExpressionDefinition $a, ExpressionDefinition $b) => $a->name <=> $b->name); + + foreach ($expressions as $expression) { + if ($expression->generate !== PhpObject::PhpClass) { + continue; + } + + $namespace->addUse($expression->returnType); + $expressionShortClassName = $this->splitNamespaceAndClassName($expression->returnType)[1]; + + $method = $trait->addMethod(lcfirst($expressionShortClassName)); + $method->setStatic(); + $method->addParameter('name')->setType('string'); + $method->addBody('return new ' . $expressionShortClassName . '($name);'); + $method->setReturnType($expression->returnType); + } + + return $namespace; + } +} diff --git a/generator/src/FluentStageFactoryGenerator.php b/generator/src/FluentStageFactoryGenerator.php new file mode 100644 index 000000000..ff7010f15 --- /dev/null +++ b/generator/src/FluentStageFactoryGenerator.php @@ -0,0 +1,134 @@ +writeFile($this->createFluentFactoryTrait($definition)); + } + + private function createFluentFactoryTrait(GeneratorDefinition $definition): PhpNamespace + { + $namespace = new PhpNamespace($definition->namespace); + $trait = $namespace->addTrait('FluentFactoryTrait'); + + $namespace->addUse(self::FACTORY_CLASS); + $namespace->addUse(StageInterface::class); + $namespace->addUse(Pipeline::class); + $namespace->addUse(stdClass::class); + + $trait->addProperty('pipeline') + ->setType('array') + ->setComment('@var list|stdClass>') + ->setValue([]); + $trait->addMethod('getPipeline') + ->setReturnType(Pipeline::class) + ->setBody(<<<'PHP' + return new Pipeline(...$this->pipeline); + PHP); + + $this->addUsesFrom(self::FACTORY_CLASS, $namespace); + $staticFactory = ClassType::from(self::FACTORY_CLASS); + assert($staticFactory instanceof ClassType); + + // Import the methods customized in the factory class + foreach ($staticFactory->getMethods() as $method) { + $this->addMethod($method, $trait); + } + + // Import the other methods provided by the generated trait + foreach ($staticFactory->getTraits() as $usedTrait) { + $this->addUsesFrom($usedTrait->getName(), $namespace); + $staticFactory = TraitType::from($usedTrait->getName()); + assert($staticFactory instanceof TraitType); + foreach ($staticFactory->getMethods() as $method) { + $this->addMethod($method, $trait); + } + } + + return $namespace; + } + + private function addMethod(Method $factoryMethod, TraitType $trait): void + { + // Non-public methods are not part of the API + if (! $factoryMethod->isPublic()) { + return; + } + + // Some methods can be overridden in the class, so we skip them + // when importing the methods provided by the trait. + if ($trait->hasMethod($factoryMethod->getName())) { + return; + } + + $method = $trait->addMethod($factoryMethod->getName()); + + $method->setComment($factoryMethod->getComment()); + $method->setParameters($factoryMethod->getParameters()); + + $args = array_map( + fn (Parameter $param): string => '$' . $param->getName(), + $factoryMethod->getParameters(), + ); + + if ($factoryMethod->isVariadic()) { + $method->setVariadic(); + $args[array_key_last($args)] = '...' . $args[array_key_last($args)]; + } + + $method->setReturnType('static'); + $method->setBody(sprintf( + <<<'PHP' + $this->pipeline[] = %s::%s(%s); + + return $this; + PHP, + (new ReflectionClass(self::FACTORY_CLASS))->getShortName(), + $factoryMethod->getName(), + implode(', ', $args), + )); + } + + private static function addUsesFrom(string $classLike, PhpNamespace $namespace): void + { + $file = PhpFile::fromCode(file_get_contents((new ReflectionClass($classLike))->getFileName())); + + foreach ($file->getNamespaces() as $ns) { + foreach ($ns->getUses() as $use) { + $namespace->addUse($use); + } + } + } +} diff --git a/generator/src/OperatorClassGenerator.php b/generator/src/OperatorClassGenerator.php new file mode 100644 index 000000000..6fd80cc41 --- /dev/null +++ b/generator/src/OperatorClassGenerator.php @@ -0,0 +1,213 @@ +getOperators($definition) as $operator) { + try { + $this->writeFile($this->createClass($definition, $operator)); + } catch (Throwable $e) { + throw new RuntimeException(sprintf('Failed to generate class for operator "%s"', $operator->name), 0, $e); + } + } + } + + public function createClass(GeneratorDefinition $definition, OperatorDefinition $operator): PhpNamespace + { + $namespace = new PhpNamespace($definition->namespace); + + $interfaces = $this->getInterfaces($operator); + foreach ($interfaces as $interface) { + $namespace->addUse($interface); + } + + $class = $namespace->addClass($this->getOperatorClassName($definition, $operator)); + $class->setFinal(); + $class->setImplements($interfaces); + $namespace->addUse(OperatorInterface::class); + $class->addImplement(OperatorInterface::class); + + // Expose operator metadata as constants + // @todo move to encoder class + $class->addComment($operator->description); + $class->addComment('@see ' . $operator->link); + $class->addComment('@internal'); + $namespace->addUse(Encode::class); + $class->addConstant('ENCODE', new Literal('Encode::' . $operator->encode->name)); + $class->addConstant('NAME', $operator->wrapObject ? $operator->name : null); + + $encodeNames = []; + $constructor = $class->addMethod('__construct'); + foreach ($operator->arguments as $argument) { + $encodeNames[$argument->propertyName] = $argument->mergeObject ? null : $argument->name; + + $type = $this->getAcceptedTypes($argument); + foreach ($type->use as $use) { + $namespace->addUse($use); + } + + $property = $class->addProperty($argument->propertyName); + $property->setReadOnly(); + $constructorParam = $constructor->addParameter($argument->propertyName); + $constructorParam->setType($type->native); + + if ($argument->variadic) { + $constructor->setVariadic(); + $constructor->addComment('@param ' . $type->doc . ' ...$' . $argument->propertyName . rtrim(' ' . $argument->description)); + + if ($argument->variadicMin > 0) { + $namespace->addUse(InvalidArgumentException::class); + $constructor->addBody(<<propertyName}) < {$argument->variadicMin}) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for \${$argument->propertyName}, got %d.', {$argument->variadicMin}, \count(\${$argument->propertyName}))); + } + + PHP); + } + + if ($argument->variadic === VariadicType::Array) { + $property->setType('array'); + $property->addComment('@var list<' . $type->doc . '> $' . $argument->propertyName . rtrim(' ' . $argument->description)); + // Warn that named arguments are not supported + // @see https://psalm.dev/docs/running_psalm/issues/NamedArgumentNotAllowed/ + $constructor->addComment('@no-named-arguments'); + $namespace->addUseFunction('array_is_list'); + $namespace->addUse(InvalidArgumentException::class); + $constructor->addBody(<<propertyName})) { + throw new InvalidArgumentException('Expected \${$argument->propertyName} arguments to be a list (array), named arguments are not supported'); + } + + PHP); + } elseif ($argument->variadic === VariadicType::Object) { + $namespace->addUse(stdClass::class); + $property->setType(stdClass::class); + $property->addComment('@var stdClass<' . $type->doc . '> $' . $argument->propertyName . rtrim(' ' . $argument->description)); + $namespace->addUseFunction('is_string'); + $namespace->addUse(InvalidArgumentException::class); + $constructor->addBody(<<propertyName} as \$key => \$value) { + if (! is_string(\$key)) { + throw new InvalidArgumentException('Expected \${$argument->propertyName} arguments to be a map (object), named arguments (:) or array unpacking ...[\'\' => ] must be used'); + } + } + + \${$argument->propertyName} = (object) \${$argument->propertyName}; + PHP); + } + } else { + // Non-variadic arguments + $property->addComment('@var ' . $type->doc . ' $' . $argument->propertyName . rtrim(' ' . $argument->description)); + $property->setType($type->native); + $constructor->addComment('@param ' . $type->doc . ' $' . $argument->propertyName . rtrim(' ' . $argument->description)); + + if ($argument->optional) { + // We use a special Optional::Undefined type to differentiate between null and undefined + $constructorParam->setDefaultValue(new Literal('Optional::Undefined')); + } elseif ($argument->default !== null) { + $constructorParam->setDefaultValue($argument->default); + } + + if ($type->dollarPrefixedString) { + $namespace->addUseFunction('is_string'); + $namespace->addUseFunction('str_starts_with'); + $namespace->addUse(InvalidArgumentException::class); + $constructor->addBody(<<propertyName}) && ! str_starts_with(\${$argument->propertyName}, '$')) { + throw new InvalidArgumentException('Argument \${$argument->propertyName} can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + PHP); + } + + // List type must be validated with array_is_list() + if ($type->list) { + $namespace->addUseFunction('is_array'); + $namespace->addUseFunction('array_is_list'); + $namespace->addUse(InvalidArgumentException::class); + $constructor->addBody(<<propertyName}) && ! array_is_list(\${$argument->propertyName})) { + throw new InvalidArgumentException('Expected \${$argument->propertyName} argument to be a list, got an associative array.'); + } + + PHP); + } + + if ($type->query) { + $namespace->addUseFunction('is_array'); + $namespace->addUse(QueryObject::class); + $constructor->addBody(<<propertyName})) { + \${$argument->propertyName} = QueryObject::create(\${$argument->propertyName}); + } + + PHP); + } + + if ($type->javascript) { + $namespace->addUseFunction('is_string'); + $namespace->addUse(Javascript::class); + $constructor->addBody(<<propertyName})) { + \${$argument->propertyName} = new Javascript(\${$argument->propertyName}); + } + + PHP); + } + } + + // Set property from constructor argument + $constructor->addBody('$this->' . $argument->propertyName . ' = $' . $argument->propertyName . ';'); + } + + if ($encodeNames !== []) { + $class->addConstant('PROPERTIES', $encodeNames); + } + + return $namespace; + } + + /** + * Operator classes interfaces are defined by their return type as a MongoDB expression. + * + * @return list + */ + private function getInterfaces(OperatorDefinition $definition): array + { + $interfaces = []; + + foreach ($definition->type as $type) { + $interfaces[] = $interface = $this->getType($type)->returnType; + assert(interface_exists($interface), sprintf('"%s" is not an interface.', $interface)); + } + + return $interfaces; + } +} diff --git a/generator/src/OperatorFactoryGenerator.php b/generator/src/OperatorFactoryGenerator.php new file mode 100644 index 000000000..e60804ad8 --- /dev/null +++ b/generator/src/OperatorFactoryGenerator.php @@ -0,0 +1,96 @@ +writeFile($this->createFactoryTrait($definition)); + } + + private function createFactoryTrait(GeneratorDefinition $definition): PhpNamespace + { + $namespace = new PhpNamespace($definition->namespace); + $trait = $namespace->addTrait('FactoryTrait'); + $trait->addComment('@internal'); + + // Pedantry requires methods to be ordered alphabetically + $operators = $this->getOperators($definition); + usort($operators, fn (OperatorDefinition $a, OperatorDefinition $b) => strcasecmp($a->name, $b->name)); + + foreach ($operators as $operator) { + try { + $this->addMethod($definition, $operator, $namespace, $trait); + } catch (Throwable $e) { + throw new RuntimeException(sprintf('Failed to generate class for operator "%s"', $operator->name), 0, $e); + } + } + + return $namespace; + } + + private function addMethod(GeneratorDefinition $definition, OperatorDefinition $operator, PhpNamespace $namespace, TraitType $trait): void + { + $operatorClassName = '\\' . $definition->namespace . '\\' . $this->getOperatorClassName($definition, $operator); + $namespace->addUse($operatorClassName); + + $method = $trait->addMethod(ltrim($operator->name, '$')); + $method->setStatic(); + $method->addComment($operator->description); + $method->addComment('@see ' . $operator->link); + $args = []; + foreach ($operator->arguments as $argument) { + $type = $this->getAcceptedTypes($argument); + foreach ($type->use as $use) { + $namespace->addUse($use); + } + + $parameter = $method->addParameter($argument->propertyName); + $parameter->setType($type->native); + if ($argument->variadic) { + if ($argument->variadic === VariadicType::Array) { + // Warn that named arguments are not supported + // @see https://psalm.dev/docs/running_psalm/issues/NamedArgumentNotAllowed/ + $method->addComment('@no-named-arguments'); + } + + $method->setVariadic(); + $method->addComment('@param ' . $type->doc . ' ...$' . $argument->propertyName . rtrim(' ' . $argument->description)); + $args[] = '...$' . $argument->propertyName; + } else { + if ($argument->optional) { + $parameter->setDefaultValue(new Literal('Optional::Undefined')); + } elseif ($argument->default !== null) { + $parameter->setDefaultValue($argument->default); + } + + $method->addComment('@param ' . $type->doc . ' $' . $argument->propertyName . rtrim(' ' . $argument->description)); + $args[] = '$' . $argument->propertyName; + } + } + + $operatorShortClassName = ltrim(str_replace($definition->namespace, '', $operatorClassName), '\\'); + $method->addBody('return new ' . $operatorShortClassName . '(' . implode(', ', $args) . ');'); + $method->setReturnType($operatorClassName); + } +} diff --git a/generator/src/OperatorGenerator.php b/generator/src/OperatorGenerator.php new file mode 100644 index 000000000..ffe0bb369 --- /dev/null +++ b/generator/src/OperatorGenerator.php @@ -0,0 +1,170 @@ + */ + private array $expressions, + ) { + parent::__construct($rootDir); + + $this->yamlReader = new YamlReader(); + } + + abstract public function generate(GeneratorDefinition $definition): void; + + /** @return list */ + final protected function getOperators(GeneratorDefinition $definition): array + { + // Remove unsupported operators + return array_filter( + $this->yamlReader->read($definition->configFiles), + fn (OperatorDefinition $operator): bool => ! in_array($operator->name, ['$'], true), + ); + } + + final protected function getOperatorClassName(GeneratorDefinition $definition, OperatorDefinition $operator): string + { + return ucfirst(ltrim($operator->name, '$')) . $definition->classNameSuffix; + } + + final protected function getType(string $type): ExpressionDefinition + { + assert(array_key_exists($type, $this->expressions), sprintf('Invalid expression type "%s".', $type)); + + return $this->expressions[$type]; + } + + /** + * Expression types can contain class names, interface, native types or "list". + * PHPDoc types are more precise than native types, so we use them systematically even if redundant. + * + * @return object{native:string,doc:string,use:list,list:bool,query:bool,javascript:bool,dollarPrefixedString:bool} + */ + final protected function getAcceptedTypes(ArgumentDefinition $arg): stdClass + { + $nativeTypes = []; + + $dollarPrefixedString = false; + + foreach ($arg->type as $type) { + if (str_starts_with($type, 'resolvesTo')) { + $dollarPrefixedString = true; + } + + $type = $this->getType($type); + $nativeTypes = array_merge($nativeTypes, $type->acceptedTypes); + + if (isset($type->returnType)) { + $nativeTypes[] = $type->returnType; + } + } + + if ($arg->optional) { + $use[] = '\\' . Optional::class; + $nativeTypes[] = Optional::class; + } + + // If the argument accepts an expression, a $-prefixed string is accepted (field path or variable) + // Checked only if the argument does not already accept a string + if (in_array('string', $nativeTypes, true)) { + $dollarPrefixedString = false; + } elseif ($dollarPrefixedString) { + $nativeTypes[] = 'string'; + } + + $docTypes = $nativeTypes = array_unique($nativeTypes); + $use = []; + + foreach ($nativeTypes as $key => $typeName) { + if (interface_exists($typeName) || class_exists($typeName)) { + $use[] = $nativeTypes[$key] = '\\' . $typeName; + $docTypes[$key] = $this->splitNamespaceAndClassName($typeName)[1]; + // A union cannot contain both object and a class type + if (in_array('object', $nativeTypes, true)) { + unset($nativeTypes[$key]); + } + } + } + + // If an array is expected, but not an object, we can check for a list + $listCheck = in_array('\\' . PackedArray::class, $nativeTypes, true) + && ! in_array('\\' . Document::class, $nativeTypes, true); + + // If the argument is a query, we need to convert it to a QueryObject + $isQuery = in_array('query', $arg->type, true); + + // If the argument is code, we need to convert it to a Javascript object + $isJavascript = in_array('javascript', $arg->type, true); + + // mixed can only be used as a standalone type + if (in_array('mixed', $nativeTypes, true)) { + $nativeTypes = ['mixed']; + } + + usort($nativeTypes, self::sortTypesCallback(...)); + usort($docTypes, self::sortTypesCallback(...)); + sort($use); + + return (object) [ + 'native' => Type::union(...array_unique($nativeTypes)), + 'doc' => Type::union(...array_unique($docTypes)), + 'use' => array_unique($use), + 'list' => $listCheck, + 'query' => $isQuery, + 'javascript' => $isJavascript, + 'dollarPrefixedString' => $dollarPrefixedString, + ]; + } + + /** + * usort() callback for sorting types. + * "Optional" is always first, for documentation of optional parameters, + * then types are sorted alphabetically. + */ + private static function sortTypesCallback(string $type1, string $type2): int + { + if ($type1 === 'Optional' || $type1 === '\\' . Optional::class) { + return -1; + } + + if ($type2 === 'Optional' || $type2 === '\\' . Optional::class) { + return 1; + } + + return $type1 <=> $type2; + } +} diff --git a/generator/src/OperatorTestGenerator.php b/generator/src/OperatorTestGenerator.php new file mode 100644 index 000000000..f665b9210 --- /dev/null +++ b/generator/src/OperatorTestGenerator.php @@ -0,0 +1,175 @@ +createExpectedClass($definition); + + foreach ($this->getOperators($definition) as $operator) { + // Skip operators without tests + if (! $operator->tests) { + continue; + } + + try { + $this->writeFile($this->createClass($definition, $operator, $dataNamespace->getClasses()[self::DATA_ENUM]), false); + } catch (Throwable $e) { + throw new RuntimeException(sprintf('Failed to generate class for operator "%s"', $operator->name), 0, $e); + } + } + + $this->writeFile($dataNamespace); + } + + public function createExpectedClass(GeneratorDefinition $definition): PhpNamespace + { + $dataNamespace = str_replace('MongoDB', 'MongoDB\\Tests', $definition->namespace); + + $namespace = new PhpNamespace($dataNamespace); + $enum = $namespace->addEnum(self::DATA_ENUM); + $enum->setType('string'); + + return $namespace; + } + + public function createClass(GeneratorDefinition $definition, OperatorDefinition $operator, EnumType $dataEnum): PhpNamespace + { + $testNamespace = str_replace('MongoDB', 'MongoDB\\Tests', $definition->namespace); + $testClass = $this->getOperatorClassName($definition, $operator) . 'Test'; + + $namespace = $this->readFile($testNamespace, $testClass)?->getNamespaces()[$testNamespace] ?? null; + $namespace ??= new PhpNamespace($testNamespace); + + $class = $namespace->getClasses()[$testClass] ?? null; + $class ??= $namespace->addClass($testClass); + $namespace->addUse(PipelineTestCase::class); + $class->setExtends(PipelineTestCase::class); + $namespace->addUse(Pipeline::class); + $class->setComment('Test ' . $operator->name . ' ' . basename($definition->configFiles)); + + foreach ($operator->tests as $test) { + $testName = 'test' . str_replace([' ', '-'], '', ucwords(str_replace('$', '', $test->name))); + $caseName = str_replace([' ', '-'], '', ucwords(str_replace('$', '', $operator->name . ' ' . $test->name))); + + $pipeline = $this->convertYamlTaggedValues($test->pipeline); + + // Wrap the pipeline array into a document + $json = Document::fromPHP(['pipeline' => $pipeline])->toCanonicalExtendedJSON(); + // Unwrap the pipeline array and reformat for prettier JSON + $json = json_encode(json_decode($json)->pipeline, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); + $case = $dataEnum->addCase($caseName, new Literal('<<<\'JSON\'' . "\n" . $json . "\n" . 'JSON')); + $case->setComment($test->name); + if ($test->link) { + $case->addComment(''); + $case->addComment('@see ' . $test->link); + } + + $caseName = self::DATA_ENUM . '::' . $caseName; + + if ($class->hasMethod($testName)) { + $testMethod = $class->getMethod($testName); + } else { + $testMethod = $class->addMethod($testName); + $testMethod->setBody(<<assertSamePipeline({$caseName}, \$pipeline); + PHP); + } + + $testMethod->setPublic(); + $testMethod->setReturnType(Type::Void); + } + + $methods = $class->getMethods(); + ksort($methods); + $class->setMethods($methods); + + return $namespace; + } + + private function convertYamlTaggedValues(mixed $object): mixed + { + if ($object instanceof TaggedValue) { + $value = $object->getValue(); + + return match ($object->getTag()) { + 'bson_regex' => new Regex(...(array) $value), + 'bson_int128' => new Int64($value), + 'bson_decimal128' => new Decimal128($value), + 'bson_utcdatetime' => new UTCDateTime(is_numeric($value) ? $value : new DateTimeImmutable($value)), + 'bson_binary' => new Binary(base64_decode($value)), + 'bson_objectId' => new ObjectId($value), + 'bson_uuid' => new Binary(hex2bin(str_replace('-', '', $value)), Binary::TYPE_UUID), + default => throw new InvalidArgumentException(sprintf('Yaml tag "%s" is not supported.', $object->getTag())), + }; + } + + if (is_array($object)) { + foreach ($object as $key => $value) { + $object[$key] = $this->convertYamlTaggedValues($value); + } + + return $object; + } + + if (is_object($object)) { + $object = clone $object; + foreach (get_object_vars($object) as $key => $value) { + $object->{$key} = $this->convertYamlTaggedValues($value); + } + + return $object; + } + + return $object; + } +} diff --git a/phpcs.xml.dist b/phpcs.xml.dist index c01b7025d..fe0dc3819 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -12,12 +12,17 @@ benchmark/src src examples + generator/src + generator/config tests tools rector.php + + src/Builder/(Accumulator|Expression|Query|Projection|Search|Stage)/*\.php + - + @@ -40,6 +45,7 @@ + @@ -127,14 +133,6 @@ - - - - - src - - - @@ -154,4 +152,7 @@ /tests/SpecTests/*/Prose* + + src/Builder/Type/OperatorInterface.php + diff --git a/phpunit.evergreen.xml b/phpunit.evergreen.xml index dbf416407..42a1bfb41 100644 --- a/phpunit.evergreen.xml +++ b/phpunit.evergreen.xml @@ -25,7 +25,13 @@ + + + src + + + - + diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 78d53e4ef..4d99d5c0c 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,15 +1,11 @@ - + name]]> - - - - @@ -23,6 +19,9 @@ + + + @@ -41,21 +40,250 @@ - - - - - - - + + + encode($value)]]> + + + + + + + + + + + name]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + recursiveEncode($value)]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0]]> + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -69,6 +297,24 @@ + + + + + + + + + + + + + + + + + + @@ -119,6 +365,7 @@ getArrayCopy()]]> + getArrayCopy()]]> @@ -126,9 +373,24 @@ + + + + options['typeMap']]]> + + + + + + + ]]> + + + ]]> + cursor->nextBatch]]> @@ -144,39 +406,6 @@ current()]]> - - - - - - - - - - - - - - - - - - - - - - databases)]]> - - - - databases)]]> - - - - - - - index]]> @@ -248,8 +477,9 @@ - - + + + @@ -279,6 +509,7 @@ + @@ -289,6 +520,10 @@ + + + + @@ -297,9 +532,14 @@ + + + + + @@ -315,6 +555,14 @@ + + + + + + executeBulkWriteCommand($this->bulkWriteCommand, $options)]]> + + @@ -329,9 +577,6 @@ - - options['typeMap']]]> - @@ -340,7 +585,7 @@ - + options['encryptedFields']]]> options['encryptedFields']]]> @@ -403,9 +648,6 @@ - - options['typeMap']]]> - @@ -416,9 +658,6 @@ - - options['typeMap']]]> - @@ -431,9 +670,6 @@ - - options['typeMap']]]> - @@ -463,11 +699,7 @@ options['codec']]]> options['typeMap']]]> - - - - @@ -489,9 +721,6 @@ - - - @@ -503,18 +732,6 @@ value ?? null) : null]]> - - - - - - - - - - - - @@ -564,43 +781,11 @@ - - - listCollections->execute($server), $this->databaseName)]]> - - - - - listDatabases->execute($server))]]> - - - - - databaseName . '.' . $this->collectionName)]]> - - - - - - - - - - result->collection]]> - result->db]]> - options['typeMap']]]> - - - - - - - @@ -613,9 +798,6 @@ - - options['typeMap']]]> - @@ -657,9 +839,6 @@ postBatchResumeToken]]> - - - cursor->firstBatch]]> cursor->postBatchResumeToken]]> @@ -692,15 +871,12 @@ + - - - - diff --git a/psalm.xml.dist b/psalm.xml.dist index 83d825d51..28efbec86 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -2,6 +2,8 @@ - - - + + + + + + diff --git a/rector.php b/rector.php index 0a8995c7b..61fe76b6d 100644 --- a/rector.php +++ b/rector.php @@ -1,33 +1,50 @@ paths([ +return RectorConfig::configure() + ->withPaths([ __DIR__ . '/examples', __DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/tools', - ]); - - // Modernize code - $rectorConfig->sets([LevelSetList::UP_TO_PHP_74]); - + ]) + ->withPhpSets(php80: true) + ->withComposerBased(phpunit: true) + // All classes are public API by default, unless marked with @internal. + ->withConfiguredRule(RemoveAnnotationRector::class, ['api']) + // Fix PHP 8.5 deprecations + ->withConfiguredRule( + RenameCastRector::class, + [ + new RenameCast(Int_::class, Int_::KIND_INTEGER, Int_::KIND_INT), + new RenameCast(Bool_::class, Bool_::KIND_BOOLEAN, Bool_::KIND_BOOL), + new RenameCast(Double::class, Double::KIND_DOUBLE, Double::KIND_FLOAT), + ], + ) // phpcs:disable Squiz.Arrays.ArrayDeclaration.KeySpecified - $rectorConfig->skip([ + ->withSkip([ + RemoveExtraParametersRector::class, // Do not use ternaries extensively IfIssetToCoalescingRector::class, - // Not necessary in documentation examples - JsonThrowOnErrorRector::class => [ - __DIR__ . '/tests/DocumentationExamplesTest.php', + ChangeSwitchToMatchRector::class => [ + __DIR__ . '/tests/SpecTests/Operation.php', ], - ]); + ClassPropertyAssignToConstructorPromotionRector::class, + StringableForToStringRector::class => [ + __DIR__ . '/src/Model/IndexInput.php', + ], + ]) // phpcs:enable - - // All classes are public API by default, unless marked with @internal. - $rectorConfig->ruleWithConfiguration(RemoveAnnotationRector::class, ['api']); -}; + ->withImportNames(importNames: false, removeUnusedImports: true); diff --git a/src/Builder/Accumulator.php b/src/Builder/Accumulator.php new file mode 100644 index 000000000..75d460bd1 --- /dev/null +++ b/src/Builder/Accumulator.php @@ -0,0 +1,44 @@ +|stdClass $operator Window operator to use in the $setWindowFields stage. + * @param Optional|array{string|int,string|int} $documents A window where the lower and upper boundaries are specified relative to the position of the current document read from the collection. + * @param Optional|array{string|numeric,string|numeric} $range Arguments passed to the init function. + * @param Optional|non-empty-string $unit Specifies the units for time range window boundaries. If omitted, default numeric range window boundaries are used. + */ + public static function outputWindow( + Document|Serializable|WindowInterface|stdClass|array $operator, + Optional|array $documents = Optional::Undefined, + Optional|array $range = Optional::Undefined, + Optional|TimeUnit|string $unit = Optional::Undefined, + ): OutputWindow { + return new OutputWindow($operator, $documents, $range, $unit); + } + + private function __construct() + { + // This class cannot be instantiated + } +} diff --git a/src/Builder/Accumulator/AccumulatorAccumulator.php b/src/Builder/Accumulator/AccumulatorAccumulator.php new file mode 100644 index 000000000..f26e5f7da --- /dev/null +++ b/src/Builder/Accumulator/AccumulatorAccumulator.php @@ -0,0 +1,127 @@ + 'init', + 'accumulate' => 'accumulate', + 'accumulateArgs' => 'accumulateArgs', + 'merge' => 'merge', + 'lang' => 'lang', + 'initArgs' => 'initArgs', + 'finalize' => 'finalize', + ]; + + /** @var Javascript|string $init Function used to initialize the state. The init function receives its arguments from the initArgs array expression. You can specify the function definition as either BSON type Code or String. */ + public readonly Javascript|string $init; + + /** @var Javascript|string $accumulate Function used to accumulate documents. The accumulate function receives its arguments from the current state and accumulateArgs array expression. The result of the accumulate function becomes the new state. You can specify the function definition as either BSON type Code or String. */ + public readonly Javascript|string $accumulate; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $accumulateArgs Arguments passed to the accumulate function. You can use accumulateArgs to specify what field value(s) to pass to the accumulate function. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $accumulateArgs; + + /** @var Javascript|string $merge Function used to merge two internal states. merge must be either a String or Code BSON type. merge returns the combined result of the two merged states. For information on when the merge function is called, see Merge Two States with $merge. */ + public readonly Javascript|string $merge; + + /** @var string $lang The language used in the $accumulator code. */ + public readonly string $lang; + + /** @var Optional|BSONArray|PackedArray|ResolvesToArray|array|string $initArgs Arguments passed to the init function. */ + public readonly Optional|PackedArray|ResolvesToArray|BSONArray|array|string $initArgs; + + /** @var Optional|Javascript|string $finalize Function used to update the result of the accumulation. */ + public readonly Optional|Javascript|string $finalize; + + /** + * @param Javascript|string $init Function used to initialize the state. The init function receives its arguments from the initArgs array expression. You can specify the function definition as either BSON type Code or String. + * @param Javascript|string $accumulate Function used to accumulate documents. The accumulate function receives its arguments from the current state and accumulateArgs array expression. The result of the accumulate function becomes the new state. You can specify the function definition as either BSON type Code or String. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $accumulateArgs Arguments passed to the accumulate function. You can use accumulateArgs to specify what field value(s) to pass to the accumulate function. + * @param Javascript|string $merge Function used to merge two internal states. merge must be either a String or Code BSON type. merge returns the combined result of the two merged states. For information on when the merge function is called, see Merge Two States with $merge. + * @param string $lang The language used in the $accumulator code. + * @param Optional|BSONArray|PackedArray|ResolvesToArray|array|string $initArgs Arguments passed to the init function. + * @param Optional|Javascript|string $finalize Function used to update the result of the accumulation. + */ + public function __construct( + Javascript|string $init, + Javascript|string $accumulate, + PackedArray|ResolvesToArray|BSONArray|array|string $accumulateArgs, + Javascript|string $merge, + string $lang, + Optional|PackedArray|ResolvesToArray|BSONArray|array|string $initArgs = Optional::Undefined, + Optional|Javascript|string $finalize = Optional::Undefined, + ) { + if (is_string($init)) { + $init = new Javascript($init); + } + + $this->init = $init; + if (is_string($accumulate)) { + $accumulate = new Javascript($accumulate); + } + + $this->accumulate = $accumulate; + if (is_string($accumulateArgs) && ! str_starts_with($accumulateArgs, '$')) { + throw new InvalidArgumentException('Argument $accumulateArgs can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($accumulateArgs) && ! array_is_list($accumulateArgs)) { + throw new InvalidArgumentException('Expected $accumulateArgs argument to be a list, got an associative array.'); + } + + $this->accumulateArgs = $accumulateArgs; + if (is_string($merge)) { + $merge = new Javascript($merge); + } + + $this->merge = $merge; + $this->lang = $lang; + if (is_string($initArgs) && ! str_starts_with($initArgs, '$')) { + throw new InvalidArgumentException('Argument $initArgs can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($initArgs) && ! array_is_list($initArgs)) { + throw new InvalidArgumentException('Expected $initArgs argument to be a list, got an associative array.'); + } + + $this->initArgs = $initArgs; + if (is_string($finalize)) { + $finalize = new Javascript($finalize); + } + + $this->finalize = $finalize; + } +} diff --git a/src/Builder/Accumulator/AddToSetAccumulator.php b/src/Builder/Accumulator/AddToSetAccumulator.php new file mode 100644 index 000000000..7e29eed62 --- /dev/null +++ b/src/Builder/Accumulator/AddToSetAccumulator.php @@ -0,0 +1,44 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Accumulator/AvgAccumulator.php b/src/Builder/Accumulator/AvgAccumulator.php new file mode 100644 index 000000000..afbb1747b --- /dev/null +++ b/src/Builder/Accumulator/AvgAccumulator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Accumulator/BottomAccumulator.php b/src/Builder/Accumulator/BottomAccumulator.php new file mode 100644 index 000000000..8d4dd417a --- /dev/null +++ b/src/Builder/Accumulator/BottomAccumulator.php @@ -0,0 +1,52 @@ + 'sortBy', 'output' => 'output']; + + /** @var Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */ + public readonly Document|Serializable|stdClass|array $sortBy; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output; + + /** + * @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. + */ + public function __construct( + Document|Serializable|stdClass|array $sortBy, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, + ) { + $this->sortBy = $sortBy; + $this->output = $output; + } +} diff --git a/src/Builder/Accumulator/BottomNAccumulator.php b/src/Builder/Accumulator/BottomNAccumulator.php new file mode 100644 index 000000000..95f0d7555 --- /dev/null +++ b/src/Builder/Accumulator/BottomNAccumulator.php @@ -0,0 +1,68 @@ + 'n', 'sortBy' => 'sortBy', 'output' => 'output']; + + /** @var ResolvesToInt|int|string $n Limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. */ + public readonly ResolvesToInt|int|string $n; + + /** @var Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */ + public readonly Document|Serializable|stdClass|array $sortBy; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output; + + /** + * @param ResolvesToInt|int|string $n Limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. + * @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. + */ + public function __construct( + ResolvesToInt|int|string $n, + Document|Serializable|stdClass|array $sortBy, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, + ) { + if (is_string($n) && ! str_starts_with($n, '$')) { + throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->n = $n; + $this->sortBy = $sortBy; + $this->output = $output; + } +} diff --git a/src/Builder/Accumulator/ConcatArraysAccumulator.php b/src/Builder/Accumulator/ConcatArraysAccumulator.php new file mode 100644 index 000000000..90ab96fa9 --- /dev/null +++ b/src/Builder/Accumulator/ConcatArraysAccumulator.php @@ -0,0 +1,57 @@ + 'array']; + + /** + * @var list $array An array of expressions that resolve to an array. + * If any argument resolves to a value of null or refers to a field that is missing, `$concatArrays` returns `null`. + */ + public readonly array $array; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$array An array of expressions that resolve to an array. + * If any argument resolves to a value of null or refers to a field that is missing, `$concatArrays` returns `null`. + * @no-named-arguments + */ + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string ...$array) + { + if (\count($array) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $array, got %d.', 1, \count($array))); + } + + if (! array_is_list($array)) { + throw new InvalidArgumentException('Expected $array arguments to be a list (array), named arguments are not supported'); + } + + $this->array = $array; + } +} diff --git a/src/Builder/Accumulator/CountAccumulator.php b/src/Builder/Accumulator/CountAccumulator.php new file mode 100644 index 000000000..933d86c6d --- /dev/null +++ b/src/Builder/Accumulator/CountAccumulator.php @@ -0,0 +1,32 @@ + 'expression1', 'expression2' => 'expression2']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression1 */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression1; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression2 */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression2; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression1 + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression2 + */ + public function __construct( + Decimal128|Int64|ResolvesToNumber|float|int|string $expression1, + Decimal128|Int64|ResolvesToNumber|float|int|string $expression2, + ) { + if (is_string($expression1) && ! str_starts_with($expression1, '$')) { + throw new InvalidArgumentException('Argument $expression1 can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression1 = $expression1; + if (is_string($expression2) && ! str_starts_with($expression2, '$')) { + throw new InvalidArgumentException('Argument $expression2 can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression2 = $expression2; + } +} diff --git a/src/Builder/Accumulator/CovarianceSampAccumulator.php b/src/Builder/Accumulator/CovarianceSampAccumulator.php new file mode 100644 index 000000000..eacd66315 --- /dev/null +++ b/src/Builder/Accumulator/CovarianceSampAccumulator.php @@ -0,0 +1,60 @@ + 'expression1', 'expression2' => 'expression2']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression1 */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression1; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression2 */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression2; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression1 + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression2 + */ + public function __construct( + Decimal128|Int64|ResolvesToNumber|float|int|string $expression1, + Decimal128|Int64|ResolvesToNumber|float|int|string $expression2, + ) { + if (is_string($expression1) && ! str_starts_with($expression1, '$')) { + throw new InvalidArgumentException('Argument $expression1 can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression1 = $expression1; + if (is_string($expression2) && ! str_starts_with($expression2, '$')) { + throw new InvalidArgumentException('Argument $expression2 can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression2 = $expression2; + } +} diff --git a/src/Builder/Accumulator/DenseRankAccumulator.php b/src/Builder/Accumulator/DenseRankAccumulator.php new file mode 100644 index 000000000..c5bc4bee9 --- /dev/null +++ b/src/Builder/Accumulator/DenseRankAccumulator.php @@ -0,0 +1,30 @@ + 'input', 'unit' => 'unit']; + + /** @var DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input */ + public readonly DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input; + + /** + * @var Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond". + * If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field. + */ + public readonly Optional|ResolvesToString|TimeUnit|string $unit; + + /** + * @param DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input + * @param Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond". + * If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field. + */ + public function __construct( + DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input, + Optional|ResolvesToString|TimeUnit|string $unit = Optional::Undefined, + ) { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->input = $input; + $this->unit = $unit; + } +} diff --git a/src/Builder/Accumulator/DocumentNumberAccumulator.php b/src/Builder/Accumulator/DocumentNumberAccumulator.php new file mode 100644 index 000000000..a44f63475 --- /dev/null +++ b/src/Builder/Accumulator/DocumentNumberAccumulator.php @@ -0,0 +1,30 @@ + 'input', 'N' => 'N', 'alpha' => 'alpha']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $input */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $input; + + /** + * @var Optional|int $N An integer that specifies the number of historical documents that have a significant mathematical weight in the exponential moving average calculation, with the most recent documents contributing the most weight. + * You must specify either N or alpha. You cannot specify both. + * The N value is used in this formula to calculate the current result based on the expression value from the current document being read and the previous result of the calculation: + */ + public readonly Optional|int $N; + + /** + * @var Optional|Int64|float|int $alpha A double that specifies the exponential decay value to use in the exponential moving average calculation. A higher alpha value assigns a lower mathematical significance to previous results from the calculation. + * You must specify either N or alpha. You cannot specify both. + */ + public readonly Optional|Int64|float|int $alpha; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $input + * @param Optional|int $N An integer that specifies the number of historical documents that have a significant mathematical weight in the exponential moving average calculation, with the most recent documents contributing the most weight. + * You must specify either N or alpha. You cannot specify both. + * The N value is used in this formula to calculate the current result based on the expression value from the current document being read and the previous result of the calculation: + * @param Optional|Int64|float|int $alpha A double that specifies the exponential decay value to use in the exponential moving average calculation. A higher alpha value assigns a lower mathematical significance to previous results from the calculation. + * You must specify either N or alpha. You cannot specify both. + */ + public function __construct( + Decimal128|Int64|ResolvesToNumber|float|int|string $input, + Optional|int $N = Optional::Undefined, + Optional|Int64|float|int $alpha = Optional::Undefined, + ) { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->input = $input; + $this->N = $N; + $this->alpha = $alpha; + } +} diff --git a/src/Builder/Accumulator/FactoryTrait.php b/src/Builder/Accumulator/FactoryTrait.php new file mode 100644 index 000000000..486eb43a5 --- /dev/null +++ b/src/Builder/Accumulator/FactoryTrait.php @@ -0,0 +1,580 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Accumulator/FirstNAccumulator.php b/src/Builder/Accumulator/FirstNAccumulator.php new file mode 100644 index 000000000..03d412fd7 --- /dev/null +++ b/src/Builder/Accumulator/FirstNAccumulator.php @@ -0,0 +1,60 @@ + 'input', 'n' => 'n']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $input An expression that resolves to the array from which to return n elements. */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input; + + /** @var ResolvesToInt|int|string $n A positive integral expression that is either a constant or depends on the _id value for $group. */ + public readonly ResolvesToInt|int|string $n; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $input An expression that resolves to the array from which to return n elements. + * @param ResolvesToInt|int|string $n A positive integral expression that is either a constant or depends on the _id value for $group. + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input, + ResolvesToInt|int|string $n, + ) { + $this->input = $input; + if (is_string($n) && ! str_starts_with($n, '$')) { + throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->n = $n; + } +} diff --git a/src/Builder/Accumulator/IntegralAccumulator.php b/src/Builder/Accumulator/IntegralAccumulator.php new file mode 100644 index 000000000..3abe3ff9e --- /dev/null +++ b/src/Builder/Accumulator/IntegralAccumulator.php @@ -0,0 +1,66 @@ + 'input', 'unit' => 'unit']; + + /** @var DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input */ + public readonly DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input; + + /** + * @var Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond". + * If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field. + */ + public readonly Optional|ResolvesToString|TimeUnit|string $unit; + + /** + * @param DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input + * @param Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond". + * If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field. + */ + public function __construct( + DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input, + Optional|ResolvesToString|TimeUnit|string $unit = Optional::Undefined, + ) { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->input = $input; + $this->unit = $unit; + } +} diff --git a/src/Builder/Accumulator/LastAccumulator.php b/src/Builder/Accumulator/LastAccumulator.php new file mode 100644 index 000000000..5d7635d6e --- /dev/null +++ b/src/Builder/Accumulator/LastAccumulator.php @@ -0,0 +1,44 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Accumulator/LastNAccumulator.php b/src/Builder/Accumulator/LastNAccumulator.php new file mode 100644 index 000000000..45a2a0f95 --- /dev/null +++ b/src/Builder/Accumulator/LastNAccumulator.php @@ -0,0 +1,69 @@ + 'input', 'n' => 'n']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; + + /** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. */ + public readonly ResolvesToInt|int|string $n; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. + */ + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, + ) { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($input) && ! array_is_list($input)) { + throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); + } + + $this->input = $input; + if (is_string($n) && ! str_starts_with($n, '$')) { + throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->n = $n; + } +} diff --git a/src/Builder/Accumulator/LinearFillAccumulator.php b/src/Builder/Accumulator/LinearFillAccumulator.php new file mode 100644 index 000000000..19126adbc --- /dev/null +++ b/src/Builder/Accumulator/LinearFillAccumulator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Accumulator/LocfAccumulator.php b/src/Builder/Accumulator/LocfAccumulator.php new file mode 100644 index 000000000..effb6e463 --- /dev/null +++ b/src/Builder/Accumulator/LocfAccumulator.php @@ -0,0 +1,44 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Accumulator/MaxAccumulator.php b/src/Builder/Accumulator/MaxAccumulator.php new file mode 100644 index 000000000..7870591d2 --- /dev/null +++ b/src/Builder/Accumulator/MaxAccumulator.php @@ -0,0 +1,44 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Accumulator/MaxNAccumulator.php b/src/Builder/Accumulator/MaxNAccumulator.php new file mode 100644 index 000000000..eafbfbcfe --- /dev/null +++ b/src/Builder/Accumulator/MaxNAccumulator.php @@ -0,0 +1,67 @@ + 'input', 'n' => 'n']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; + + /** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ + public readonly ResolvesToInt|int|string $n; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. + */ + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, + ) { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($input) && ! array_is_list($input)) { + throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); + } + + $this->input = $input; + if (is_string($n) && ! str_starts_with($n, '$')) { + throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->n = $n; + } +} diff --git a/src/Builder/Accumulator/MedianAccumulator.php b/src/Builder/Accumulator/MedianAccumulator.php new file mode 100644 index 000000000..cfdd05e8a --- /dev/null +++ b/src/Builder/Accumulator/MedianAccumulator.php @@ -0,0 +1,59 @@ + 'input', 'method' => 'method']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $input; + + /** @var string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. */ + public readonly string $method; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. + * @param string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $input, string $method) + { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->input = $input; + $this->method = $method; + } +} diff --git a/src/Builder/Accumulator/MergeObjectsAccumulator.php b/src/Builder/Accumulator/MergeObjectsAccumulator.php new file mode 100644 index 000000000..0a567b771 --- /dev/null +++ b/src/Builder/Accumulator/MergeObjectsAccumulator.php @@ -0,0 +1,49 @@ + 'document']; + + /** @var Document|ResolvesToObject|Serializable|array|stdClass|string $document Any valid expression that resolves to a document. */ + public readonly Document|Serializable|ResolvesToObject|stdClass|array|string $document; + + /** + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $document Any valid expression that resolves to a document. + */ + public function __construct(Document|Serializable|ResolvesToObject|stdClass|array|string $document) + { + if (is_string($document) && ! str_starts_with($document, '$')) { + throw new InvalidArgumentException('Argument $document can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->document = $document; + } +} diff --git a/src/Builder/Accumulator/MinAccumulator.php b/src/Builder/Accumulator/MinAccumulator.php new file mode 100644 index 000000000..3b8f5a05b --- /dev/null +++ b/src/Builder/Accumulator/MinAccumulator.php @@ -0,0 +1,44 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Accumulator/MinNAccumulator.php b/src/Builder/Accumulator/MinNAccumulator.php new file mode 100644 index 000000000..2d5eeab7e --- /dev/null +++ b/src/Builder/Accumulator/MinNAccumulator.php @@ -0,0 +1,67 @@ + 'input', 'n' => 'n']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; + + /** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ + public readonly ResolvesToInt|int|string $n; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. + */ + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, + ) { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($input) && ! array_is_list($input)) { + throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); + } + + $this->input = $input; + if (is_string($n) && ! str_starts_with($n, '$')) { + throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->n = $n; + } +} diff --git a/src/Builder/Accumulator/PercentileAccumulator.php b/src/Builder/Accumulator/PercentileAccumulator.php new file mode 100644 index 000000000..030f13aab --- /dev/null +++ b/src/Builder/Accumulator/PercentileAccumulator.php @@ -0,0 +1,87 @@ + 'input', 'p' => 'p', 'method' => 'method']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $input; + + /** + * @var BSONArray|PackedArray|ResolvesToArray|array|string $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. + * $percentile returns results in the same order as the elements in p. + */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $p; + + /** @var string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. */ + public readonly string $method; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. + * $percentile returns results in the same order as the elements in p. + * @param string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. + */ + public function __construct( + Decimal128|Int64|ResolvesToNumber|float|int|string $input, + PackedArray|ResolvesToArray|BSONArray|array|string $p, + string $method, + ) { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->input = $input; + if (is_string($p) && ! str_starts_with($p, '$')) { + throw new InvalidArgumentException('Argument $p can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($p) && ! array_is_list($p)) { + throw new InvalidArgumentException('Expected $p argument to be a list, got an associative array.'); + } + + $this->p = $p; + $this->method = $method; + } +} diff --git a/src/Builder/Accumulator/PushAccumulator.php b/src/Builder/Accumulator/PushAccumulator.php new file mode 100644 index 000000000..85576e0ce --- /dev/null +++ b/src/Builder/Accumulator/PushAccumulator.php @@ -0,0 +1,44 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Accumulator/RankAccumulator.php b/src/Builder/Accumulator/RankAccumulator.php new file mode 100644 index 000000000..ddf2f665c --- /dev/null +++ b/src/Builder/Accumulator/RankAccumulator.php @@ -0,0 +1,30 @@ + 'array']; + + /** @var list $array An array of expressions that resolve to an array. */ + public readonly array $array; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$array An array of expressions that resolve to an array. + * @no-named-arguments + */ + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string ...$array) + { + if (\count($array) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $array, got %d.', 1, \count($array))); + } + + if (! array_is_list($array)) { + throw new InvalidArgumentException('Expected $array arguments to be a list (array), named arguments are not supported'); + } + + $this->array = $array; + } +} diff --git a/src/Builder/Accumulator/ShiftAccumulator.php b/src/Builder/Accumulator/ShiftAccumulator.php new file mode 100644 index 000000000..e4674e9a3 --- /dev/null +++ b/src/Builder/Accumulator/ShiftAccumulator.php @@ -0,0 +1,71 @@ + 'output', 'by' => 'by', 'default' => 'default']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Specifies an expression to evaluate and return in the output. */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output; + + /** + * @var int $by Specifies an integer with a numeric document position relative to the current document in the output. + * For example: + * 1 specifies the document position after the current document. + * -1 specifies the document position before the current document. + * -2 specifies the document position that is two positions before the current document. + */ + public readonly int $by; + + /** + * @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default Specifies an optional default expression to evaluate if the document position is outside of the implicit $setWindowFields stage window. The implicit window contains all the documents in the partition. + * The default expression must evaluate to a constant value. + * If you do not specify a default expression, $shift returns null for documents whose positions are outside of the implicit $setWindowFields stage window. + */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Specifies an expression to evaluate and return in the output. + * @param int $by Specifies an integer with a numeric document position relative to the current document in the output. + * For example: + * 1 specifies the document position after the current document. + * -1 specifies the document position before the current document. + * -2 specifies the document position that is two positions before the current document. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default Specifies an optional default expression to evaluate if the document position is outside of the implicit $setWindowFields stage window. The implicit window contains all the documents in the partition. + * The default expression must evaluate to a constant value. + * If you do not specify a default expression, $shift returns null for documents whose positions are outside of the implicit $setWindowFields stage window. + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, + int $by, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default, + ) { + $this->output = $output; + $this->by = $by; + $this->default = $default; + } +} diff --git a/src/Builder/Accumulator/StdDevPopAccumulator.php b/src/Builder/Accumulator/StdDevPopAccumulator.php new file mode 100644 index 000000000..dd234dab1 --- /dev/null +++ b/src/Builder/Accumulator/StdDevPopAccumulator.php @@ -0,0 +1,51 @@ + 'expression']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Accumulator/StdDevSampAccumulator.php b/src/Builder/Accumulator/StdDevSampAccumulator.php new file mode 100644 index 000000000..897e08563 --- /dev/null +++ b/src/Builder/Accumulator/StdDevSampAccumulator.php @@ -0,0 +1,51 @@ + 'expression']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Accumulator/SumAccumulator.php b/src/Builder/Accumulator/SumAccumulator.php new file mode 100644 index 000000000..fa8cdb642 --- /dev/null +++ b/src/Builder/Accumulator/SumAccumulator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Accumulator/TopAccumulator.php b/src/Builder/Accumulator/TopAccumulator.php new file mode 100644 index 000000000..d7fb258f1 --- /dev/null +++ b/src/Builder/Accumulator/TopAccumulator.php @@ -0,0 +1,53 @@ + 'sortBy', 'output' => 'output']; + + /** @var Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */ + public readonly Document|Serializable|stdClass|array $sortBy; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output; + + /** + * @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. + */ + public function __construct( + Document|Serializable|stdClass|array $sortBy, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, + ) { + $this->sortBy = $sortBy; + $this->output = $output; + } +} diff --git a/src/Builder/Accumulator/TopNAccumulator.php b/src/Builder/Accumulator/TopNAccumulator.php new file mode 100644 index 000000000..45087d5e0 --- /dev/null +++ b/src/Builder/Accumulator/TopNAccumulator.php @@ -0,0 +1,68 @@ + 'n', 'sortBy' => 'sortBy', 'output' => 'output']; + + /** @var ResolvesToInt|int|string $n limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. */ + public readonly ResolvesToInt|int|string $n; + + /** @var Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */ + public readonly Document|Serializable|stdClass|array $sortBy; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output; + + /** + * @param ResolvesToInt|int|string $n limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. + * @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. + */ + public function __construct( + ResolvesToInt|int|string $n, + Document|Serializable|stdClass|array $sortBy, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, + ) { + if (is_string($n) && ! str_starts_with($n, '$')) { + throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->n = $n; + $this->sortBy = $sortBy; + $this->output = $output; + } +} diff --git a/src/Builder/BuilderEncoder.php b/src/Builder/BuilderEncoder.php new file mode 100644 index 000000000..e9121a7d0 --- /dev/null +++ b/src/Builder/BuilderEncoder.php @@ -0,0 +1,115 @@ + */ +final class BuilderEncoder implements Encoder +{ + /** @template-use EncodeIfSupported */ + use EncodeIfSupported; + + /** @var array */ + private array $encoders; + + /** @var array */ + private array $cachedEncoders = []; + + /** @param iterable $encoders */ + public function __construct(iterable $encoders = []) + { + $self = WeakReference::create($this); + + if (! is_array($encoders)) { + $encoders = iterator_to_array($encoders); + } + + $this->encoders = $encoders + [ + Pipeline::class => new PipelineEncoder($self), + Variable::class => new VariableEncoder(), + DictionaryInterface::class => new DictionaryEncoder(), + FieldPathInterface::class => new FieldPathEncoder(), + CombinedFieldQuery::class => new CombinedFieldQueryEncoder($self), + QueryObject::class => new QueryEncoder($self), + OutputWindow::class => new OutputWindowEncoder($self), + OperatorInterface::class => new OperatorEncoder($self), + DateTimeInterface::class => new DateTimeEncoder(), + ]; + } + + /** @psalm-assert-if-true object $value */ + public function canEncode(mixed $value): bool + { + if (! is_object($value)) { + return false; + } + + return (bool) $this->getEncoderFor($value)?->canEncode($value); + } + + public function encode(mixed $value): Type|stdClass|array|string|int + { + $encoder = $this->getEncoderFor($value); + + if (! $encoder?->canEncode($value)) { + throw UnsupportedValueException::invalidEncodableValue($value); + } + + return $encoder->encode($value); + } + + private function getEncoderFor(object $value): Encoder|null + { + $valueClass = $value::class; + if (array_key_exists($valueClass, $this->cachedEncoders)) { + return $this->cachedEncoders[$valueClass]; + } + + // First attempt: match class name exactly + if (isset($this->encoders[$valueClass])) { + return $this->cachedEncoders[$valueClass] = $this->encoders[$valueClass]; + } + + // Second attempt: catch child classes + foreach ($this->encoders as $className => $encoder) { + if ($value instanceof $className) { + return $this->cachedEncoders[$valueClass] = $encoder; + } + } + + return $this->cachedEncoders[$valueClass] = null; + } +} diff --git a/src/Builder/Encoder/CombinedFieldQueryEncoder.php b/src/Builder/Encoder/CombinedFieldQueryEncoder.php new file mode 100644 index 000000000..118757901 --- /dev/null +++ b/src/Builder/Encoder/CombinedFieldQueryEncoder.php @@ -0,0 +1,57 @@ + + * @internal + */ +final class CombinedFieldQueryEncoder implements Encoder +{ + /** @template-use EncodeIfSupported */ + use EncodeIfSupported; + use RecursiveEncode; + + public function canEncode(mixed $value): bool + { + return $value instanceof CombinedFieldQuery; + } + + public function encode(mixed $value): stdClass + { + if (! $this->canEncode($value)) { + throw UnsupportedValueException::invalidEncodableValue($value); + } + + $result = new stdClass(); + foreach ($value->fieldQueries as $filter) { + $filter = $this->recursiveEncode($filter); + if (is_object($filter)) { + $filter = get_object_vars($filter); + } elseif (! is_array($filter)) { + throw new LogicException(sprintf('Query filters must an array or an object. Got "%s"', get_debug_type($filter))); + } + + foreach ($filter as $key => $filterValue) { + $result->{$key} = $filterValue; + } + } + + return $result; + } +} diff --git a/src/Builder/Encoder/DateTimeEncoder.php b/src/Builder/Encoder/DateTimeEncoder.php new file mode 100644 index 000000000..6926bd813 --- /dev/null +++ b/src/Builder/Encoder/DateTimeEncoder.php @@ -0,0 +1,36 @@ + + * @internal + */ +final class DateTimeEncoder implements Encoder +{ + /** @template-use EncodeIfSupported */ + use EncodeIfSupported; + + /** @psalm-assert-if-true DateTimeInterface $value */ + public function canEncode(mixed $value): bool + { + return $value instanceof DateTimeInterface; + } + + public function encode(mixed $value): UTCDateTime + { + if (! $this->canEncode($value)) { + throw UnsupportedValueException::invalidEncodableValue($value); + } + + return new UTCDateTime($value); + } +} diff --git a/src/Builder/Encoder/DictionaryEncoder.php b/src/Builder/Encoder/DictionaryEncoder.php new file mode 100644 index 000000000..dc89cff11 --- /dev/null +++ b/src/Builder/Encoder/DictionaryEncoder.php @@ -0,0 +1,35 @@ + + * @internal + */ +final class DictionaryEncoder implements Encoder +{ + /** @template-use EncodeIfSupported */ + use EncodeIfSupported; + + public function canEncode(mixed $value): bool + { + return $value instanceof DictionaryInterface; + } + + public function encode(mixed $value): string|int|array|stdClass + { + if (! $this->canEncode($value)) { + throw UnsupportedValueException::invalidEncodableValue($value); + } + + return $value->getValue(); + } +} diff --git a/src/Builder/Encoder/FieldPathEncoder.php b/src/Builder/Encoder/FieldPathEncoder.php new file mode 100644 index 000000000..3766f9a0e --- /dev/null +++ b/src/Builder/Encoder/FieldPathEncoder.php @@ -0,0 +1,34 @@ + + * @internal + */ +final class FieldPathEncoder implements Encoder +{ + /** @template-use EncodeIfSupported */ + use EncodeIfSupported; + + public function canEncode(mixed $value): bool + { + return $value instanceof FieldPathInterface; + } + + public function encode(mixed $value): string + { + if (! $this->canEncode($value)) { + throw UnsupportedValueException::invalidEncodableValue($value); + } + + return '$' . $value->name; + } +} diff --git a/src/Builder/Encoder/OperatorEncoder.php b/src/Builder/Encoder/OperatorEncoder.php new file mode 100644 index 000000000..8f81edfa2 --- /dev/null +++ b/src/Builder/Encoder/OperatorEncoder.php @@ -0,0 +1,126 @@ + + * @internal + */ +final class OperatorEncoder implements Encoder +{ + /** @template-use EncodeIfSupported */ + use EncodeIfSupported; + use RecursiveEncode; + + public function canEncode(mixed $value): bool + { + return $value instanceof OperatorInterface; + } + + public function encode(mixed $value): stdClass + { + if (! $this->canEncode($value)) { + throw UnsupportedValueException::invalidEncodableValue($value); + } + + return match ($value::ENCODE) { + Encode::Single => $this->encodeAsSingle($value), + Encode::Array => $this->encodeAsArray($value), + Encode::Object => $this->encodeAsObject($value), + default => throw new LogicException(sprintf('Class "%s" does not have a valid ENCODE constant.', $value::class)), + }; + } + + /** + * Encode the value as an array of properties, in the order they are defined in the class. + */ + private function encodeAsArray(OperatorInterface $value): stdClass + { + $result = []; + foreach ($value::PROPERTIES as $prop => $name) { + $val = $value->$prop; + // Skip optional arguments. For example, the $slice expression operator has an optional argument + // in the middle of the array. + if ($val === Optional::Undefined) { + continue; + } + + $result[] = $this->recursiveEncode($val); + } + + return $this->wrap($value, $result); + } + + /** + * Encode the value as an object with properties. Property names are + * mapped by the PROPERTIES constant. + */ + private function encodeAsObject(OperatorInterface $value): stdClass + { + $result = new stdClass(); + foreach ($value::PROPERTIES as $prop => $name) { + $val = $value->$prop; + + // Skip optional arguments. If they have a default value, it is resolved by the server. + if ($val === Optional::Undefined) { + continue; + } + + // The name is null for arguments with "mergeObject: true" in the YAML file, + // the value properties are merged into the parent object. + if ($name === null) { + $val = $this->recursiveEncode($val); + foreach ($val as $k => $v) { + $result->{$k} = $v; + } + } else { + $result->{$name} = $this->recursiveEncode($val); + } + } + + if ($value::NAME === null) { + return $result; + } + + return $this->wrap($value, $result); + } + + /** + * Get the unique property of the operator as value + */ + private function encodeAsSingle(OperatorInterface $value): stdClass + { + foreach ($value::PROPERTIES as $prop => $name) { + $result = $this->recursiveEncode($value->$prop); + + return $this->wrap($value, $result); + } + + throw new LogicException(sprintf('Class "%s" does not have a single property.', $value::class)); + } + + private function wrap(OperatorInterface $value, mixed $result): stdClass + { + assert(is_string($value::NAME)); + + $object = new stdClass(); + $object->{$value::NAME} = $result; + + return $object; + } +} diff --git a/src/Builder/Encoder/OutputWindowEncoder.php b/src/Builder/Encoder/OutputWindowEncoder.php new file mode 100644 index 000000000..4e435a987 --- /dev/null +++ b/src/Builder/Encoder/OutputWindowEncoder.php @@ -0,0 +1,65 @@ + + * @internal + */ +final class OutputWindowEncoder implements Encoder +{ + /** @template-use EncodeIfSupported */ + use EncodeIfSupported; + use RecursiveEncode; + + public function canEncode(mixed $value): bool + { + return $value instanceof OutputWindow; + } + + public function encode(mixed $value): stdClass + { + if (! $this->canEncode($value)) { + throw UnsupportedValueException::invalidEncodableValue($value); + } + + $result = $this->recursiveEncode($value->operator); + + // Transform the result into an stdClass if a document is provided + if (! $value->operator instanceof WindowInterface) { + if (! is_first_key_operator($result)) { + $firstKey = array_key_first((array) $result); + + throw new LogicException(sprintf('Expected OutputWindow::$operator to be an operator. Got "%s"', $firstKey ?? 'null')); + } + + $result = (object) $result; + } + + if (! $result instanceof stdClass) { + throw new LogicException(sprintf('Expected OutputWindow::$operator to be an stdClass, array or WindowInterface. Got "%s"', get_debug_type($result))); + } + + if ($value->window !== Optional::Undefined) { + $result->window = $this->recursiveEncode($value->window); + } + + return $result; + } +} diff --git a/src/Builder/Encoder/PipelineEncoder.php b/src/Builder/Encoder/PipelineEncoder.php new file mode 100644 index 000000000..c4c0829ce --- /dev/null +++ b/src/Builder/Encoder/PipelineEncoder.php @@ -0,0 +1,42 @@ +, Pipeline> + * @internal + */ +final class PipelineEncoder implements Encoder +{ + /** @template-use EncodeIfSupported, Pipeline> */ + use EncodeIfSupported; + use RecursiveEncode; + + /** @psalm-assert-if-true Pipeline $value */ + public function canEncode(mixed $value): bool + { + return $value instanceof Pipeline; + } + + /** @return list */ + public function encode(mixed $value): array + { + if (! $this->canEncode($value)) { + throw UnsupportedValueException::invalidEncodableValue($value); + } + + $encoded = []; + foreach ($value->getIterator() as $stage) { + $encoded[] = $this->recursiveEncode($stage); + } + + return $encoded; + } +} diff --git a/src/Builder/Encoder/QueryEncoder.php b/src/Builder/Encoder/QueryEncoder.php new file mode 100644 index 000000000..19f21897c --- /dev/null +++ b/src/Builder/Encoder/QueryEncoder.php @@ -0,0 +1,62 @@ + + * @internal + */ +final class QueryEncoder implements Encoder +{ + /** @template-use EncodeIfSupported */ + use EncodeIfSupported; + use RecursiveEncode; + + public function canEncode(mixed $value): bool + { + return $value instanceof QueryObject; + } + + public function encode(mixed $value): stdClass + { + if (! $this->canEncode($value)) { + throw UnsupportedValueException::invalidEncodableValue($value); + } + + $result = new stdClass(); + foreach ($value->queries as $key => $value) { + if ($value instanceof QueryInterface) { + // The sub-objects is merged into the main object, replacing duplicate keys + foreach (get_object_vars($this->recursiveEncode($value)) as $subKey => $subValue) { + if (property_exists($result, $subKey)) { + throw new LogicException(sprintf('Duplicate key "%s" in query object', $subKey)); + } + + $result->{$subKey} = $subValue; + } + } else { + if (property_exists($result, (string) $key)) { + throw new LogicException(sprintf('Duplicate key "%s" in query object', $key)); + } + + $result->{$key} = $this->recursiveEncode($value); + } + } + + return $result; + } +} diff --git a/src/Builder/Encoder/RecursiveEncode.php b/src/Builder/Encoder/RecursiveEncode.php new file mode 100644 index 000000000..e83af8a22 --- /dev/null +++ b/src/Builder/Encoder/RecursiveEncode.php @@ -0,0 +1,59 @@ + $encoder */ + final public function __construct(private readonly WeakReference $encoder) + { + } + + /** + * Nested arrays and objects must be encoded recursively. + * + * @psalm-template T + * @psalm-param T $value + * + * @psalm-return (T is stdClass ? stdClass : (T is array ? array : mixed)) + * + * @template T + */ + private function recursiveEncode(mixed $value): mixed + { + if (is_array($value)) { + foreach ($value as $key => $val) { + $value[$key] = $this->recursiveEncode($val); + } + + return $value; + } + + if ($value instanceof stdClass) { + foreach (get_object_vars($value) as $key => $val) { + $value->{$key} = $this->recursiveEncode($val); + } + + return $value; + } + + /** + * If the BuilderEncoder instance is removed from the memory, the + * instances of the classes using this trait will be removed as well. + * Therefore, the weak reference will never return null. + * + * @psalm-suppress PossiblyNullReference + */ + return $this->encoder->get()->encodeIfSupported($value); + } +} diff --git a/src/Builder/Encoder/VariableEncoder.php b/src/Builder/Encoder/VariableEncoder.php new file mode 100644 index 000000000..051977976 --- /dev/null +++ b/src/Builder/Encoder/VariableEncoder.php @@ -0,0 +1,35 @@ + + * @internal + */ +final class VariableEncoder implements Encoder +{ + /** @template-use EncodeIfSupported */ + use EncodeIfSupported; + + public function canEncode(mixed $value): bool + { + return $value instanceof Variable; + } + + public function encode(mixed $value): string + { + if (! $this->canEncode($value)) { + throw UnsupportedValueException::invalidEncodableValue($value); + } + + // TODO: needs method because interfaces can't have properties + return '$$' . $value->name; + } +} diff --git a/src/Builder/Expression.php b/src/Builder/Expression.php new file mode 100644 index 000000000..9e4779145 --- /dev/null +++ b/src/Builder/Expression.php @@ -0,0 +1,21 @@ + 'value']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $value */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $value; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $value + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $value) + { + if (is_string($value) && ! str_starts_with($value, '$')) { + throw new InvalidArgumentException('Argument $value can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->value = $value; + } +} diff --git a/src/Builder/Expression/AcosOperator.php b/src/Builder/Expression/AcosOperator.php new file mode 100644 index 000000000..4b5017ec1 --- /dev/null +++ b/src/Builder/Expression/AcosOperator.php @@ -0,0 +1,52 @@ + 'expression']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $acos takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + * $acos returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + * By default $acos returns values as a double. $acos can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $acos takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + * $acos returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + * By default $acos returns values as a double. $acos can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/AcoshOperator.php b/src/Builder/Expression/AcoshOperator.php new file mode 100644 index 000000000..1da690261 --- /dev/null +++ b/src/Builder/Expression/AcoshOperator.php @@ -0,0 +1,52 @@ + 'expression']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $acosh takes any valid expression that resolves to a number between 1 and +Infinity, e.g. 1 <= value <= +Infinity. + * $acosh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + * By default $acosh returns values as a double. $acosh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $acosh takes any valid expression that resolves to a number between 1 and +Infinity, e.g. 1 <= value <= +Infinity. + * $acosh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + * By default $acosh returns values as a double. $acosh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/AddOperator.php b/src/Builder/Expression/AddOperator.php new file mode 100644 index 000000000..9eb139f36 --- /dev/null +++ b/src/Builder/Expression/AddOperator.php @@ -0,0 +1,53 @@ + 'expression']; + + /** @var list $expression The arguments can be any valid expression as long as they resolve to either all numbers or to numbers and a date. */ + public readonly array $expression; + + /** + * @param DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string ...$expression The arguments can be any valid expression as long as they resolve to either all numbers or to numbers and a date. + * @no-named-arguments + */ + public function __construct( + DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string ...$expression, + ) { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/AllElementsTrueOperator.php b/src/Builder/Expression/AllElementsTrueOperator.php new file mode 100644 index 000000000..282de6dfa --- /dev/null +++ b/src/Builder/Expression/AllElementsTrueOperator.php @@ -0,0 +1,52 @@ + 'expression']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression + */ + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($expression) && ! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/AndOperator.php b/src/Builder/Expression/AndOperator.php new file mode 100644 index 000000000..5e9121677 --- /dev/null +++ b/src/Builder/Expression/AndOperator.php @@ -0,0 +1,55 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param DateTimeInterface|Decimal128|ExpressionInterface|Int64|ResolvesToBool|ResolvesToNull|ResolvesToNumber|ResolvesToString|Type|array|bool|float|int|null|stdClass|string ...$expression + * @no-named-arguments + */ + public function __construct( + DateTimeInterface|Decimal128|Int64|Type|ResolvesToBool|ResolvesToNull|ResolvesToNumber|ResolvesToString|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, + ) { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/AnyElementTrueOperator.php b/src/Builder/Expression/AnyElementTrueOperator.php new file mode 100644 index 000000000..c3566ca9e --- /dev/null +++ b/src/Builder/Expression/AnyElementTrueOperator.php @@ -0,0 +1,52 @@ + 'expression']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression + */ + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($expression) && ! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/ArrayElemAtOperator.php b/src/Builder/Expression/ArrayElemAtOperator.php new file mode 100644 index 000000000..9cbca3cfe --- /dev/null +++ b/src/Builder/Expression/ArrayElemAtOperator.php @@ -0,0 +1,63 @@ + 'array', 'idx' => 'idx']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $array */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $array; + + /** @var ResolvesToInt|int|string $idx */ + public readonly ResolvesToInt|int|string $idx; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $array + * @param ResolvesToInt|int|string $idx + */ + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $array, + ResolvesToInt|int|string $idx, + ) { + if (is_string($array) && ! str_starts_with($array, '$')) { + throw new InvalidArgumentException('Argument $array can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($array) && ! array_is_list($array)) { + throw new InvalidArgumentException('Expected $array argument to be a list, got an associative array.'); + } + + $this->array = $array; + if (is_string($idx) && ! str_starts_with($idx, '$')) { + throw new InvalidArgumentException('Argument $idx can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->idx = $idx; + } +} diff --git a/src/Builder/Expression/ArrayFieldPath.php b/src/Builder/Expression/ArrayFieldPath.php new file mode 100644 index 000000000..f475beb1c --- /dev/null +++ b/src/Builder/Expression/ArrayFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/ArrayToObjectOperator.php b/src/Builder/Expression/ArrayToObjectOperator.php new file mode 100644 index 000000000..3a881363e --- /dev/null +++ b/src/Builder/Expression/ArrayToObjectOperator.php @@ -0,0 +1,52 @@ + 'array']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $array */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $array; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $array + */ + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $array) + { + if (is_string($array) && ! str_starts_with($array, '$')) { + throw new InvalidArgumentException('Argument $array can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($array) && ! array_is_list($array)) { + throw new InvalidArgumentException('Expected $array argument to be a list, got an associative array.'); + } + + $this->array = $array; + } +} diff --git a/src/Builder/Expression/AsinOperator.php b/src/Builder/Expression/AsinOperator.php new file mode 100644 index 000000000..d814f6cf1 --- /dev/null +++ b/src/Builder/Expression/AsinOperator.php @@ -0,0 +1,52 @@ + 'expression']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $asin takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + * $asin returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + * By default $asin returns values as a double. $asin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $asin takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + * $asin returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + * By default $asin returns values as a double. $asin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/AsinhOperator.php b/src/Builder/Expression/AsinhOperator.php new file mode 100644 index 000000000..edc2f2062 --- /dev/null +++ b/src/Builder/Expression/AsinhOperator.php @@ -0,0 +1,52 @@ + 'expression']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $asinh takes any valid expression that resolves to a number. + * $asinh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + * By default $asinh returns values as a double. $asinh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $asinh takes any valid expression that resolves to a number. + * $asinh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + * By default $asinh returns values as a double. $asinh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/Atan2Operator.php b/src/Builder/Expression/Atan2Operator.php new file mode 100644 index 000000000..f0af1fc97 --- /dev/null +++ b/src/Builder/Expression/Atan2Operator.php @@ -0,0 +1,63 @@ + 'y', 'x' => 'x']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $y $atan2 takes any valid expression that resolves to a number. + * $atan2 returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + * By default $atan returns values as a double. $atan2 can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $y; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $x */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $x; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $y $atan2 takes any valid expression that resolves to a number. + * $atan2 returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + * By default $atan returns values as a double. $atan2 can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $x + */ + public function __construct( + Decimal128|Int64|ResolvesToNumber|float|int|string $y, + Decimal128|Int64|ResolvesToNumber|float|int|string $x, + ) { + if (is_string($y) && ! str_starts_with($y, '$')) { + throw new InvalidArgumentException('Argument $y can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->y = $y; + if (is_string($x) && ! str_starts_with($x, '$')) { + throw new InvalidArgumentException('Argument $x can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->x = $x; + } +} diff --git a/src/Builder/Expression/AtanOperator.php b/src/Builder/Expression/AtanOperator.php new file mode 100644 index 000000000..938a9b007 --- /dev/null +++ b/src/Builder/Expression/AtanOperator.php @@ -0,0 +1,52 @@ + 'expression']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $atan takes any valid expression that resolves to a number. + * $atan returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + * By default $atan returns values as a double. $atan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $atan takes any valid expression that resolves to a number. + * $atan returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + * By default $atan returns values as a double. $atan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/AtanhOperator.php b/src/Builder/Expression/AtanhOperator.php new file mode 100644 index 000000000..fde1dae12 --- /dev/null +++ b/src/Builder/Expression/AtanhOperator.php @@ -0,0 +1,52 @@ + 'expression']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $atanh takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + * $atanh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + * By default $atanh returns values as a double. $atanh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $atanh takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + * $atanh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. + * By default $atanh returns values as a double. $atanh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/AvgOperator.php b/src/Builder/Expression/AvgOperator.php new file mode 100644 index 000000000..52be761a9 --- /dev/null +++ b/src/Builder/Expression/AvgOperator.php @@ -0,0 +1,51 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression + * @no-named-arguments + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression) + { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/BinDataFieldPath.php b/src/Builder/Expression/BinDataFieldPath.php new file mode 100644 index 000000000..77c2d39ea --- /dev/null +++ b/src/Builder/Expression/BinDataFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/BinarySizeOperator.php b/src/Builder/Expression/BinarySizeOperator.php new file mode 100644 index 000000000..792da66b0 --- /dev/null +++ b/src/Builder/Expression/BinarySizeOperator.php @@ -0,0 +1,37 @@ + 'expression']; + + /** @var Binary|ResolvesToBinData|ResolvesToNull|ResolvesToString|null|string $expression */ + public readonly Binary|ResolvesToBinData|ResolvesToNull|ResolvesToString|null|string $expression; + + /** + * @param Binary|ResolvesToBinData|ResolvesToNull|ResolvesToString|null|string $expression + */ + public function __construct(Binary|ResolvesToBinData|ResolvesToNull|ResolvesToString|null|string $expression) + { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/BitAndOperator.php b/src/Builder/Expression/BitAndOperator.php new file mode 100644 index 000000000..eb6fffaca --- /dev/null +++ b/src/Builder/Expression/BitAndOperator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression + * @no-named-arguments + */ + public function __construct(Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression) + { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/BitNotOperator.php b/src/Builder/Expression/BitNotOperator.php new file mode 100644 index 000000000..adac4fc66 --- /dev/null +++ b/src/Builder/Expression/BitNotOperator.php @@ -0,0 +1,46 @@ + 'expression']; + + /** @var Int64|ResolvesToInt|ResolvesToLong|int|string $expression */ + public readonly Int64|ResolvesToInt|ResolvesToLong|int|string $expression; + + /** + * @param Int64|ResolvesToInt|ResolvesToLong|int|string $expression + */ + public function __construct(Int64|ResolvesToInt|ResolvesToLong|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/BitOrOperator.php b/src/Builder/Expression/BitOrOperator.php new file mode 100644 index 000000000..bc68838e9 --- /dev/null +++ b/src/Builder/Expression/BitOrOperator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression + * @no-named-arguments + */ + public function __construct(Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression) + { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/BitXorOperator.php b/src/Builder/Expression/BitXorOperator.php new file mode 100644 index 000000000..adbf5eb2e --- /dev/null +++ b/src/Builder/Expression/BitXorOperator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression + * @no-named-arguments + */ + public function __construct(Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression) + { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/BoolFieldPath.php b/src/Builder/Expression/BoolFieldPath.php new file mode 100644 index 000000000..1dff80de0 --- /dev/null +++ b/src/Builder/Expression/BoolFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/BsonSizeOperator.php b/src/Builder/Expression/BsonSizeOperator.php new file mode 100644 index 000000000..37626d0d9 --- /dev/null +++ b/src/Builder/Expression/BsonSizeOperator.php @@ -0,0 +1,48 @@ + 'object']; + + /** @var Document|ResolvesToNull|ResolvesToObject|Serializable|array|null|stdClass|string $object */ + public readonly Document|Serializable|ResolvesToNull|ResolvesToObject|stdClass|array|null|string $object; + + /** + * @param Document|ResolvesToNull|ResolvesToObject|Serializable|array|null|stdClass|string $object + */ + public function __construct( + Document|Serializable|ResolvesToNull|ResolvesToObject|stdClass|array|null|string $object, + ) { + if (is_string($object) && ! str_starts_with($object, '$')) { + throw new InvalidArgumentException('Argument $object can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->object = $object; + } +} diff --git a/src/Builder/Expression/CaseOperator.php b/src/Builder/Expression/CaseOperator.php new file mode 100644 index 000000000..686d27ec9 --- /dev/null +++ b/src/Builder/Expression/CaseOperator.php @@ -0,0 +1,56 @@ + 'case', 'then' => 'then']; + + /** @var ResolvesToBool|bool|string $case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. */ + public readonly ResolvesToBool|bool|string $case; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $then Can be any valid expression. */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then; + + /** + * @param ResolvesToBool|bool|string $case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $then Can be any valid expression. + */ + public function __construct( + ResolvesToBool|bool|string $case, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then, + ) { + if (is_string($case) && ! str_starts_with($case, '$')) { + throw new InvalidArgumentException('Argument $case can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->case = $case; + $this->then = $then; + } +} diff --git a/src/Builder/Expression/CeilOperator.php b/src/Builder/Expression/CeilOperator.php new file mode 100644 index 000000000..9f318c454 --- /dev/null +++ b/src/Builder/Expression/CeilOperator.php @@ -0,0 +1,46 @@ + 'expression']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression If the argument resolves to a value of null or refers to a field that is missing, $ceil returns null. If the argument resolves to NaN, $ceil returns NaN. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression If the argument resolves to a value of null or refers to a field that is missing, $ceil returns null. If the argument resolves to NaN, $ceil returns NaN. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/CmpOperator.php b/src/Builder/Expression/CmpOperator.php new file mode 100644 index 000000000..7e090f242 --- /dev/null +++ b/src/Builder/Expression/CmpOperator.php @@ -0,0 +1,47 @@ + 'expression1', 'expression2' => 'expression2']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, + ) { + $this->expression1 = $expression1; + $this->expression2 = $expression2; + } +} diff --git a/src/Builder/Expression/ConcatArraysOperator.php b/src/Builder/Expression/ConcatArraysOperator.php new file mode 100644 index 000000000..12f862086 --- /dev/null +++ b/src/Builder/Expression/ConcatArraysOperator.php @@ -0,0 +1,50 @@ + 'array']; + + /** @var list $array */ + public readonly array $array; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$array + * @no-named-arguments + */ + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string ...$array) + { + if (\count($array) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $array, got %d.', 1, \count($array))); + } + + if (! array_is_list($array)) { + throw new InvalidArgumentException('Expected $array arguments to be a list (array), named arguments are not supported'); + } + + $this->array = $array; + } +} diff --git a/src/Builder/Expression/ConcatOperator.php b/src/Builder/Expression/ConcatOperator.php new file mode 100644 index 000000000..c8497be08 --- /dev/null +++ b/src/Builder/Expression/ConcatOperator.php @@ -0,0 +1,48 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param ResolvesToString|string ...$expression + * @no-named-arguments + */ + public function __construct(ResolvesToString|string ...$expression) + { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/CondOperator.php b/src/Builder/Expression/CondOperator.php new file mode 100644 index 000000000..ba34c910a --- /dev/null +++ b/src/Builder/Expression/CondOperator.php @@ -0,0 +1,61 @@ + 'if', 'then' => 'then', 'else' => 'else']; + + /** @var ResolvesToBool|bool|string $if */ + public readonly ResolvesToBool|bool|string $if; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $then */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $else */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $else; + + /** + * @param ResolvesToBool|bool|string $if + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $then + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $else + */ + public function __construct( + ResolvesToBool|bool|string $if, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $else, + ) { + if (is_string($if) && ! str_starts_with($if, '$')) { + throw new InvalidArgumentException('Argument $if can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->if = $if; + $this->then = $then; + $this->else = $else; + } +} diff --git a/src/Builder/Expression/ConvertOperator.php b/src/Builder/Expression/ConvertOperator.php new file mode 100644 index 000000000..3a8d3764c --- /dev/null +++ b/src/Builder/Expression/ConvertOperator.php @@ -0,0 +1,69 @@ + 'input', 'to' => 'to', 'onError' => 'onError', 'onNull' => 'onNull']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $input */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input; + + /** @var ResolvesToInt|ResolvesToString|int|string $to */ + public readonly ResolvesToInt|ResolvesToString|int|string $to; + + /** + * @var Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onError The value to return on encountering an error during conversion, including unsupported type conversions. The arguments can be any valid expression. + * If unspecified, the operation throws an error upon encountering an error and stops. + */ + public readonly Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onError; + + /** + * @var Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onNull The value to return if the input is null or missing. The arguments can be any valid expression. + * If unspecified, $convert returns null if the input is null or missing. + */ + public readonly Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $input + * @param ResolvesToInt|ResolvesToString|int|string $to + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onError The value to return on encountering an error during conversion, including unsupported type conversions. The arguments can be any valid expression. + * If unspecified, the operation throws an error upon encountering an error and stops. + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onNull The value to return if the input is null or missing. The arguments can be any valid expression. + * If unspecified, $convert returns null if the input is null or missing. + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input, + ResolvesToInt|ResolvesToString|int|string $to, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onError = Optional::Undefined, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, + ) { + $this->input = $input; + $this->to = $to; + $this->onError = $onError; + $this->onNull = $onNull; + } +} diff --git a/src/Builder/Expression/CosOperator.php b/src/Builder/Expression/CosOperator.php new file mode 100644 index 000000000..fdc5fe5f0 --- /dev/null +++ b/src/Builder/Expression/CosOperator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $cos takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * By default $cos returns values as a double. $cos can also return values as a 128-bit decimal as long as the resolves to a 128-bit decimal value. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $cos takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * By default $cos returns values as a double. $cos can also return values as a 128-bit decimal as long as the resolves to a 128-bit decimal value. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/CoshOperator.php b/src/Builder/Expression/CoshOperator.php new file mode 100644 index 000000000..3133153a7 --- /dev/null +++ b/src/Builder/Expression/CoshOperator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $cosh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * By default $cosh returns values as a double. $cosh can also return values as a 128-bit decimal if the resolves to a 128-bit decimal value. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $cosh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * By default $cosh returns values as a double. $cosh can also return values as a 128-bit decimal if the resolves to a 128-bit decimal value. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/CreateObjectIdOperator.php b/src/Builder/Expression/CreateObjectIdOperator.php new file mode 100644 index 000000000..eef57b3ca --- /dev/null +++ b/src/Builder/Expression/CreateObjectIdOperator.php @@ -0,0 +1,28 @@ + 'startDate', 'unit' => 'unit', 'amount' => 'amount', 'timezone' => 'timezone']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate; + + /** @var ResolvesToString|TimeUnit|string $unit The unit used to measure the amount of time added to the startDate. */ + public readonly ResolvesToString|TimeUnit|string $unit; + + /** @var Int64|ResolvesToInt|ResolvesToLong|int|string $amount */ + public readonly Int64|ResolvesToInt|ResolvesToLong|int|string $amount; + + /** @var Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ResolvesToString|TimeUnit|string $unit The unit used to measure the amount of time added to the startDate. + * @param Int64|ResolvesToInt|ResolvesToLong|int|string $amount + * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate, + ResolvesToString|TimeUnit|string $unit, + Int64|ResolvesToInt|ResolvesToLong|int|string $amount, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($startDate) && ! str_starts_with($startDate, '$')) { + throw new InvalidArgumentException('Argument $startDate can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->startDate = $startDate; + $this->unit = $unit; + if (is_string($amount) && ! str_starts_with($amount, '$')) { + throw new InvalidArgumentException('Argument $amount can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->amount = $amount; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/DateDiffOperator.php b/src/Builder/Expression/DateDiffOperator.php new file mode 100644 index 000000000..8c4f5e5b4 --- /dev/null +++ b/src/Builder/Expression/DateDiffOperator.php @@ -0,0 +1,86 @@ + 'startDate', + 'endDate' => 'endDate', + 'unit' => 'unit', + 'timezone' => 'timezone', + 'startOfWeek' => 'startOfWeek', + ]; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The start of the time period. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $endDate The end of the time period. The endDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $endDate; + + /** @var ResolvesToString|TimeUnit|string $unit The time measurement unit between the startDate and endDate */ + public readonly ResolvesToString|TimeUnit|string $unit; + + /** @var Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** @var Optional|ResolvesToString|string $startOfWeek Used when the unit is equal to week. Defaults to Sunday. The startOfWeek parameter is an expression that resolves to a case insensitive string */ + public readonly Optional|ResolvesToString|string $startOfWeek; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The start of the time period. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $endDate The end of the time period. The endDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ResolvesToString|TimeUnit|string $unit The time measurement unit between the startDate and endDate + * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + * @param Optional|ResolvesToString|string $startOfWeek Used when the unit is equal to week. Defaults to Sunday. The startOfWeek parameter is an expression that resolves to a case insensitive string + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate, + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $endDate, + ResolvesToString|TimeUnit|string $unit, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + Optional|ResolvesToString|string $startOfWeek = Optional::Undefined, + ) { + if (is_string($startDate) && ! str_starts_with($startDate, '$')) { + throw new InvalidArgumentException('Argument $startDate can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->startDate = $startDate; + if (is_string($endDate) && ! str_starts_with($endDate, '$')) { + throw new InvalidArgumentException('Argument $endDate can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->endDate = $endDate; + $this->unit = $unit; + $this->timezone = $timezone; + $this->startOfWeek = $startOfWeek; + } +} diff --git a/src/Builder/Expression/DateFieldPath.php b/src/Builder/Expression/DateFieldPath.php new file mode 100644 index 000000000..d32988537 --- /dev/null +++ b/src/Builder/Expression/DateFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/DateFromPartsOperator.php b/src/Builder/Expression/DateFromPartsOperator.php new file mode 100644 index 000000000..c2d32c290 --- /dev/null +++ b/src/Builder/Expression/DateFromPartsOperator.php @@ -0,0 +1,157 @@ + 'year', + 'isoWeekYear' => 'isoWeekYear', + 'month' => 'month', + 'isoWeek' => 'isoWeek', + 'day' => 'day', + 'isoDayOfWeek' => 'isoDayOfWeek', + 'hour' => 'hour', + 'minute' => 'minute', + 'second' => 'second', + 'millisecond' => 'millisecond', + 'timezone' => 'timezone', + ]; + + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year Calendar year. Can be any expression that evaluates to a number. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year; + + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear ISO Week Date Year. Can be any expression that evaluates to a number. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear; + + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month Month. Defaults to 1. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month; + + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek Week of year. Defaults to 1. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek; + + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day Day of month. Defaults to 1. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day; + + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek Day of week (Monday 1 - Sunday 7). Defaults to 1. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek; + + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour Hour. Defaults to 0. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour; + + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute Minute. Defaults to 0. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute; + + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second Second. Defaults to 0. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second; + + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond Millisecond. Defaults to 0. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond; + + /** @var Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year Calendar year. Can be any expression that evaluates to a number. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear ISO Week Date Year. Can be any expression that evaluates to a number. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month Month. Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek Week of year. Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day Day of month. Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek Day of week (Monday 1 - Sunday 7). Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour Hour. Defaults to 0. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute Minute. Defaults to 0. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second Second. Defaults to 0. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond Millisecond. Defaults to 0. + * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond = Optional::Undefined, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($year) && ! str_starts_with($year, '$')) { + throw new InvalidArgumentException('Argument $year can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->year = $year; + if (is_string($isoWeekYear) && ! str_starts_with($isoWeekYear, '$')) { + throw new InvalidArgumentException('Argument $isoWeekYear can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->isoWeekYear = $isoWeekYear; + if (is_string($month) && ! str_starts_with($month, '$')) { + throw new InvalidArgumentException('Argument $month can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->month = $month; + if (is_string($isoWeek) && ! str_starts_with($isoWeek, '$')) { + throw new InvalidArgumentException('Argument $isoWeek can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->isoWeek = $isoWeek; + if (is_string($day) && ! str_starts_with($day, '$')) { + throw new InvalidArgumentException('Argument $day can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->day = $day; + if (is_string($isoDayOfWeek) && ! str_starts_with($isoDayOfWeek, '$')) { + throw new InvalidArgumentException('Argument $isoDayOfWeek can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->isoDayOfWeek = $isoDayOfWeek; + if (is_string($hour) && ! str_starts_with($hour, '$')) { + throw new InvalidArgumentException('Argument $hour can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->hour = $hour; + if (is_string($minute) && ! str_starts_with($minute, '$')) { + throw new InvalidArgumentException('Argument $minute can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->minute = $minute; + if (is_string($second) && ! str_starts_with($second, '$')) { + throw new InvalidArgumentException('Argument $second can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->second = $second; + if (is_string($millisecond) && ! str_starts_with($millisecond, '$')) { + throw new InvalidArgumentException('Argument $millisecond can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->millisecond = $millisecond; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/DateFromStringOperator.php b/src/Builder/Expression/DateFromStringOperator.php new file mode 100644 index 000000000..ad796df98 --- /dev/null +++ b/src/Builder/Expression/DateFromStringOperator.php @@ -0,0 +1,85 @@ + 'dateString', + 'format' => 'format', + 'timezone' => 'timezone', + 'onError' => 'onError', + 'onNull' => 'onNull', + ]; + + /** @var ResolvesToString|string $dateString The date/time string to convert to a date object. */ + public readonly ResolvesToString|string $dateString; + + /** + * @var Optional|ResolvesToString|string $format The date format specification of the dateString. The format can be any expression that evaluates to a string literal, containing 0 or more format specifiers. + * If unspecified, $dateFromString uses "%Y-%m-%dT%H:%M:%S.%LZ" as the default format but accepts a variety of formats and attempts to parse the dateString if possible. + */ + public readonly Optional|ResolvesToString|string $format; + + /** @var Optional|ResolvesToString|string $timezone The time zone to use to format the date. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @var Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onError If $dateFromString encounters an error while parsing the given dateString, it outputs the result value of the provided onError expression. This result value can be of any type. + * If you do not specify onError, $dateFromString throws an error if it cannot parse dateString. + */ + public readonly Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onError; + + /** + * @var Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onNull If the dateString provided to $dateFromString is null or missing, it outputs the result value of the provided onNull expression. This result value can be of any type. + * If you do not specify onNull and dateString is null or missing, then $dateFromString outputs null. + */ + public readonly Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull; + + /** + * @param ResolvesToString|string $dateString The date/time string to convert to a date object. + * @param Optional|ResolvesToString|string $format The date format specification of the dateString. The format can be any expression that evaluates to a string literal, containing 0 or more format specifiers. + * If unspecified, $dateFromString uses "%Y-%m-%dT%H:%M:%S.%LZ" as the default format but accepts a variety of formats and attempts to parse the dateString if possible. + * @param Optional|ResolvesToString|string $timezone The time zone to use to format the date. + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onError If $dateFromString encounters an error while parsing the given dateString, it outputs the result value of the provided onError expression. This result value can be of any type. + * If you do not specify onError, $dateFromString throws an error if it cannot parse dateString. + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onNull If the dateString provided to $dateFromString is null or missing, it outputs the result value of the provided onNull expression. This result value can be of any type. + * If you do not specify onNull and dateString is null or missing, then $dateFromString outputs null. + */ + public function __construct( + ResolvesToString|string $dateString, + Optional|ResolvesToString|string $format = Optional::Undefined, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onError = Optional::Undefined, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, + ) { + $this->dateString = $dateString; + $this->format = $format; + $this->timezone = $timezone; + $this->onError = $onError; + $this->onNull = $onNull; + } +} diff --git a/src/Builder/Expression/DateSubtractOperator.php b/src/Builder/Expression/DateSubtractOperator.php new file mode 100644 index 000000000..91c790872 --- /dev/null +++ b/src/Builder/Expression/DateSubtractOperator.php @@ -0,0 +1,74 @@ + 'startDate', 'unit' => 'unit', 'amount' => 'amount', 'timezone' => 'timezone']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate; + + /** @var ResolvesToString|TimeUnit|string $unit The unit used to measure the amount of time added to the startDate. */ + public readonly ResolvesToString|TimeUnit|string $unit; + + /** @var Int64|ResolvesToInt|ResolvesToLong|int|string $amount */ + public readonly Int64|ResolvesToInt|ResolvesToLong|int|string $amount; + + /** @var Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ResolvesToString|TimeUnit|string $unit The unit used to measure the amount of time added to the startDate. + * @param Int64|ResolvesToInt|ResolvesToLong|int|string $amount + * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate, + ResolvesToString|TimeUnit|string $unit, + Int64|ResolvesToInt|ResolvesToLong|int|string $amount, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($startDate) && ! str_starts_with($startDate, '$')) { + throw new InvalidArgumentException('Argument $startDate can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->startDate = $startDate; + $this->unit = $unit; + if (is_string($amount) && ! str_starts_with($amount, '$')) { + throw new InvalidArgumentException('Argument $amount can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->amount = $amount; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/DateToPartsOperator.php b/src/Builder/Expression/DateToPartsOperator.php new file mode 100644 index 000000000..8e23c751c --- /dev/null +++ b/src/Builder/Expression/DateToPartsOperator.php @@ -0,0 +1,62 @@ + 'date', 'timezone' => 'timezone', 'iso8601' => 'iso8601']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The input date for which to return parts. date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** @var Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** @var Optional|bool $iso8601 If set to true, modifies the output document to use ISO week date fields. Defaults to false. */ + public readonly Optional|bool $iso8601; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The input date for which to return parts. date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + * @param Optional|bool $iso8601 If set to true, modifies the output document to use ISO week date fields. Defaults to false. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + Optional|bool $iso8601 = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->timezone = $timezone; + $this->iso8601 = $iso8601; + } +} diff --git a/src/Builder/Expression/DateToStringOperator.php b/src/Builder/Expression/DateToStringOperator.php new file mode 100644 index 000000000..703ac643e --- /dev/null +++ b/src/Builder/Expression/DateToStringOperator.php @@ -0,0 +1,79 @@ + 'date', 'format' => 'format', 'timezone' => 'timezone', 'onNull' => 'onNull']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to convert to string. Must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** + * @var Optional|ResolvesToString|string $format The date format specification of the dateString. The format can be any expression that evaluates to a string literal, containing 0 or more format specifiers. + * If unspecified, $dateFromString uses "%Y-%m-%dT%H:%M:%S.%LZ" as the default format but accepts a variety of formats and attempts to parse the dateString if possible. + */ + public readonly Optional|ResolvesToString|string $format; + + /** @var Optional|ResolvesToString|string $timezone The time zone to use to format the date. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @var Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onNull The value to return if the date is null or missing. + * If unspecified, $dateToString returns null if the date is null or missing. + */ + public readonly Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to convert to string. Must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $format The date format specification of the dateString. The format can be any expression that evaluates to a string literal, containing 0 or more format specifiers. + * If unspecified, $dateFromString uses "%Y-%m-%dT%H:%M:%S.%LZ" as the default format but accepts a variety of formats and attempts to parse the dateString if possible. + * @param Optional|ResolvesToString|string $timezone The time zone to use to format the date. + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onNull The value to return if the date is null or missing. + * If unspecified, $dateToString returns null if the date is null or missing. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $format = Optional::Undefined, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->format = $format; + $this->timezone = $timezone; + $this->onNull = $onNull; + } +} diff --git a/src/Builder/Expression/DateTruncOperator.php b/src/Builder/Expression/DateTruncOperator.php new file mode 100644 index 000000000..af550491f --- /dev/null +++ b/src/Builder/Expression/DateTruncOperator.php @@ -0,0 +1,100 @@ + 'date', + 'unit' => 'unit', + 'binSize' => 'binSize', + 'timezone' => 'timezone', + 'startOfWeek' => 'startOfWeek', + ]; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to truncate, specified in UTC. The date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** + * @var ResolvesToString|TimeUnit|string $unit The unit of time, specified as an expression that must resolve to one of these strings: year, quarter, week, month, day, hour, minute, second. + * Together, binSize and unit specify the time period used in the $dateTrunc calculation. + */ + public readonly ResolvesToString|TimeUnit|string $unit; + + /** + * @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $binSize The numeric time value, specified as an expression that must resolve to a positive non-zero number. Defaults to 1. + * Together, binSize and unit specify the time period used in the $dateTrunc calculation. + */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $binSize; + + /** @var Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @var Optional|string $startOfWeek The start of the week. Used when + * unit is week. Defaults to Sunday. + */ + public readonly Optional|string $startOfWeek; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to truncate, specified in UTC. The date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ResolvesToString|TimeUnit|string $unit The unit of time, specified as an expression that must resolve to one of these strings: year, quarter, week, month, day, hour, minute, second. + * Together, binSize and unit specify the time period used in the $dateTrunc calculation. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $binSize The numeric time value, specified as an expression that must resolve to a positive non-zero number. Defaults to 1. + * Together, binSize and unit specify the time period used in the $dateTrunc calculation. + * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + * @param Optional|string $startOfWeek The start of the week. Used when + * unit is week. Defaults to Sunday. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + ResolvesToString|TimeUnit|string $unit, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $binSize = Optional::Undefined, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + Optional|string $startOfWeek = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->unit = $unit; + if (is_string($binSize) && ! str_starts_with($binSize, '$')) { + throw new InvalidArgumentException('Argument $binSize can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->binSize = $binSize; + $this->timezone = $timezone; + $this->startOfWeek = $startOfWeek; + } +} diff --git a/src/Builder/Expression/DayOfMonthOperator.php b/src/Builder/Expression/DayOfMonthOperator.php new file mode 100644 index 000000000..ce3df4a86 --- /dev/null +++ b/src/Builder/Expression/DayOfMonthOperator.php @@ -0,0 +1,56 @@ + 'date', 'timezone' => 'timezone']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/DayOfWeekOperator.php b/src/Builder/Expression/DayOfWeekOperator.php new file mode 100644 index 000000000..db07c7a2a --- /dev/null +++ b/src/Builder/Expression/DayOfWeekOperator.php @@ -0,0 +1,56 @@ + 'date', 'timezone' => 'timezone']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/DayOfYearOperator.php b/src/Builder/Expression/DayOfYearOperator.php new file mode 100644 index 000000000..530fc619c --- /dev/null +++ b/src/Builder/Expression/DayOfYearOperator.php @@ -0,0 +1,56 @@ + 'date', 'timezone' => 'timezone']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/DecimalFieldPath.php b/src/Builder/Expression/DecimalFieldPath.php new file mode 100644 index 000000000..2a9136675 --- /dev/null +++ b/src/Builder/Expression/DecimalFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/DegreesToRadiansOperator.php b/src/Builder/Expression/DegreesToRadiansOperator.php new file mode 100644 index 000000000..45482c733 --- /dev/null +++ b/src/Builder/Expression/DegreesToRadiansOperator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $degreesToRadians takes any valid expression that resolves to a number. + * By default $degreesToRadians returns values as a double. $degreesToRadians can also return values as a 128-bit decimal as long as the resolves to a 128-bit decimal value. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $degreesToRadians takes any valid expression that resolves to a number. + * By default $degreesToRadians returns values as a double. $degreesToRadians can also return values as a 128-bit decimal as long as the resolves to a 128-bit decimal value. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/DivideOperator.php b/src/Builder/Expression/DivideOperator.php new file mode 100644 index 000000000..55ba88b21 --- /dev/null +++ b/src/Builder/Expression/DivideOperator.php @@ -0,0 +1,57 @@ + 'dividend', 'divisor' => 'divisor']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $dividend The first argument is the dividend, and the second argument is the divisor; i.e. the first argument is divided by the second argument. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $dividend; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $divisor */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $divisor; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $dividend The first argument is the dividend, and the second argument is the divisor; i.e. the first argument is divided by the second argument. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $divisor + */ + public function __construct( + Decimal128|Int64|ResolvesToNumber|float|int|string $dividend, + Decimal128|Int64|ResolvesToNumber|float|int|string $divisor, + ) { + if (is_string($dividend) && ! str_starts_with($dividend, '$')) { + throw new InvalidArgumentException('Argument $dividend can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->dividend = $dividend; + if (is_string($divisor) && ! str_starts_with($divisor, '$')) { + throw new InvalidArgumentException('Argument $divisor can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->divisor = $divisor; + } +} diff --git a/src/Builder/Expression/DoubleFieldPath.php b/src/Builder/Expression/DoubleFieldPath.php new file mode 100644 index 000000000..2af25b87c --- /dev/null +++ b/src/Builder/Expression/DoubleFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/EqOperator.php b/src/Builder/Expression/EqOperator.php new file mode 100644 index 000000000..5db6ed26a --- /dev/null +++ b/src/Builder/Expression/EqOperator.php @@ -0,0 +1,47 @@ + 'expression1', 'expression2' => 'expression2']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, + ) { + $this->expression1 = $expression1; + $this->expression2 = $expression2; + } +} diff --git a/src/Builder/Expression/ExpOperator.php b/src/Builder/Expression/ExpOperator.php new file mode 100644 index 000000000..5aab19c1e --- /dev/null +++ b/src/Builder/Expression/ExpOperator.php @@ -0,0 +1,46 @@ + 'exponent']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $exponent */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $exponent; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $exponent + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $exponent) + { + if (is_string($exponent) && ! str_starts_with($exponent, '$')) { + throw new InvalidArgumentException('Argument $exponent can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->exponent = $exponent; + } +} diff --git a/src/Builder/Expression/ExpressionFactoryTrait.php b/src/Builder/Expression/ExpressionFactoryTrait.php new file mode 100644 index 000000000..3f5f04339 --- /dev/null +++ b/src/Builder/Expression/ExpressionFactoryTrait.php @@ -0,0 +1,105 @@ + resolves to a 128-bit decimal value. + */ + public static function cos(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): CosOperator + { + return new CosOperator($expression); + } + + /** + * Returns the hyperbolic cosine of a value that is measured in radians. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/cosh/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $cosh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * By default $cosh returns values as a double. $cosh can also return values as a 128-bit decimal if the resolves to a 128-bit decimal value. + */ + public static function cosh(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): CoshOperator + { + return new CoshOperator($expression); + } + + /** + * Returns a random object ID + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/createObjectId/ + */ + public static function createObjectId(): CreateObjectIdOperator + { + return new CreateObjectIdOperator(); + } + + /** + * Adds a number of time units to a date object. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateAdd/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ResolvesToString|TimeUnit|string $unit The unit used to measure the amount of time added to the startDate. + * @param Int64|ResolvesToInt|ResolvesToLong|int|string $amount + * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function dateAdd( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate, + ResolvesToString|TimeUnit|string $unit, + Int64|ResolvesToInt|ResolvesToLong|int|string $amount, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): DateAddOperator { + return new DateAddOperator($startDate, $unit, $amount, $timezone); + } + + /** + * Returns the difference between two dates. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateDiff/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The start of the time period. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $endDate The end of the time period. The endDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ResolvesToString|TimeUnit|string $unit The time measurement unit between the startDate and endDate + * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + * @param Optional|ResolvesToString|string $startOfWeek Used when the unit is equal to week. Defaults to Sunday. The startOfWeek parameter is an expression that resolves to a case insensitive string + */ + public static function dateDiff( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate, + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $endDate, + ResolvesToString|TimeUnit|string $unit, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + Optional|ResolvesToString|string $startOfWeek = Optional::Undefined, + ): DateDiffOperator { + return new DateDiffOperator($startDate, $endDate, $unit, $timezone, $startOfWeek); + } + + /** + * Constructs a BSON Date object given the date's constituent parts. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateFromParts/ + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year Calendar year. Can be any expression that evaluates to a number. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear ISO Week Date Year. Can be any expression that evaluates to a number. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month Month. Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek Week of year. Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day Day of month. Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek Day of week (Monday 1 - Sunday 7). Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour Hour. Defaults to 0. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute Minute. Defaults to 0. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second Second. Defaults to 0. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond Millisecond. Defaults to 0. + * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function dateFromParts( + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond = Optional::Undefined, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): DateFromPartsOperator { + return new DateFromPartsOperator($year, $isoWeekYear, $month, $isoWeek, $day, $isoDayOfWeek, $hour, $minute, $second, $millisecond, $timezone); + } + + /** + * Converts a date/time string to a date object. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateFromString/ + * @param ResolvesToString|string $dateString The date/time string to convert to a date object. + * @param Optional|ResolvesToString|string $format The date format specification of the dateString. The format can be any expression that evaluates to a string literal, containing 0 or more format specifiers. + * If unspecified, $dateFromString uses "%Y-%m-%dT%H:%M:%S.%LZ" as the default format but accepts a variety of formats and attempts to parse the dateString if possible. + * @param Optional|ResolvesToString|string $timezone The time zone to use to format the date. + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onError If $dateFromString encounters an error while parsing the given dateString, it outputs the result value of the provided onError expression. This result value can be of any type. + * If you do not specify onError, $dateFromString throws an error if it cannot parse dateString. + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onNull If the dateString provided to $dateFromString is null or missing, it outputs the result value of the provided onNull expression. This result value can be of any type. + * If you do not specify onNull and dateString is null or missing, then $dateFromString outputs null. + */ + public static function dateFromString( + ResolvesToString|string $dateString, + Optional|ResolvesToString|string $format = Optional::Undefined, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onError = Optional::Undefined, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, + ): DateFromStringOperator { + return new DateFromStringOperator($dateString, $format, $timezone, $onError, $onNull); + } + + /** + * Subtracts a number of time units from a date object. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateSubtract/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ResolvesToString|TimeUnit|string $unit The unit used to measure the amount of time added to the startDate. + * @param Int64|ResolvesToInt|ResolvesToLong|int|string $amount + * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function dateSubtract( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate, + ResolvesToString|TimeUnit|string $unit, + Int64|ResolvesToInt|ResolvesToLong|int|string $amount, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): DateSubtractOperator { + return new DateSubtractOperator($startDate, $unit, $amount, $timezone); + } + + /** + * Returns a document containing the constituent parts of a date. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateToParts/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The input date for which to return parts. date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + * @param Optional|bool $iso8601 If set to true, modifies the output document to use ISO week date fields. Defaults to false. + */ + public static function dateToParts( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + Optional|bool $iso8601 = Optional::Undefined, + ): DateToPartsOperator { + return new DateToPartsOperator($date, $timezone, $iso8601); + } + + /** + * Returns the date as a formatted string. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateToString/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to convert to string. Must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $format The date format specification of the dateString. The format can be any expression that evaluates to a string literal, containing 0 or more format specifiers. + * If unspecified, $dateFromString uses "%Y-%m-%dT%H:%M:%S.%LZ" as the default format but accepts a variety of formats and attempts to parse the dateString if possible. + * @param Optional|ResolvesToString|string $timezone The time zone to use to format the date. + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onNull The value to return if the date is null or missing. + * If unspecified, $dateToString returns null if the date is null or missing. + */ + public static function dateToString( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $format = Optional::Undefined, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, + ): DateToStringOperator { + return new DateToStringOperator($date, $format, $timezone, $onNull); + } + + /** + * Truncates a date. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateTrunc/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to truncate, specified in UTC. The date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ResolvesToString|TimeUnit|string $unit The unit of time, specified as an expression that must resolve to one of these strings: year, quarter, week, month, day, hour, minute, second. + * Together, binSize and unit specify the time period used in the $dateTrunc calculation. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $binSize The numeric time value, specified as an expression that must resolve to a positive non-zero number. Defaults to 1. + * Together, binSize and unit specify the time period used in the $dateTrunc calculation. + * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + * @param Optional|string $startOfWeek The start of the week. Used when + * unit is week. Defaults to Sunday. + */ + public static function dateTrunc( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + ResolvesToString|TimeUnit|string $unit, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $binSize = Optional::Undefined, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + Optional|string $startOfWeek = Optional::Undefined, + ): DateTruncOperator { + return new DateTruncOperator($date, $unit, $binSize, $timezone, $startOfWeek); + } + + /** + * Returns the day of the month for a date as a number between 1 and 31. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfMonth/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function dayOfMonth( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): DayOfMonthOperator { + return new DayOfMonthOperator($date, $timezone); + } + + /** + * Returns the day of the week for a date as a number between 1 (Sunday) and 7 (Saturday). + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfWeek/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function dayOfWeek( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): DayOfWeekOperator { + return new DayOfWeekOperator($date, $timezone); + } + + /** + * Returns the day of the year for a date as a number between 1 and 366 (leap year). + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfYear/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function dayOfYear( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): DayOfYearOperator { + return new DayOfYearOperator($date, $timezone); + } + + /** + * Converts a value from degrees to radians. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/degreesToRadians/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $degreesToRadians takes any valid expression that resolves to a number. + * By default $degreesToRadians returns values as a double. $degreesToRadians can also return values as a 128-bit decimal as long as the resolves to a 128-bit decimal value. + */ + public static function degreesToRadians( + Decimal128|Int64|ResolvesToNumber|float|int|string $expression, + ): DegreesToRadiansOperator { + return new DegreesToRadiansOperator($expression); + } + + /** + * Returns the result of dividing the first number by the second. Accepts two argument expressions. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/divide/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $dividend The first argument is the dividend, and the second argument is the divisor; i.e. the first argument is divided by the second argument. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $divisor + */ + public static function divide( + Decimal128|Int64|ResolvesToNumber|float|int|string $dividend, + Decimal128|Int64|ResolvesToNumber|float|int|string $divisor, + ): DivideOperator { + return new DivideOperator($dividend, $divisor); + } + + /** + * Returns true if the values are equivalent. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/eq/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 + */ + public static function eq( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, + ): EqOperator { + return new EqOperator($expression1, $expression2); + } + + /** + * Raises e to the specified exponent. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/exp/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $exponent + */ + public static function exp(Decimal128|Int64|ResolvesToNumber|float|int|string $exponent): ExpOperator + { + return new ExpOperator($exponent); + } + + /** + * Selects a subset of the array to return an array with only the elements that match the filter condition. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/filter/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input + * @param ResolvesToBool|bool|string $cond An expression that resolves to a boolean value used to determine if an element should be included in the output array. The expression references each element of the input array individually with the variable name specified in as. + * @param Optional|string $as A name for the variable that represents each individual element of the input array. If no name is specified, the variable name defaults to this. + * @param Optional|ResolvesToInt|int|string $limit A number expression that restricts the number of matching array elements that $filter returns. You cannot specify a limit less than 1. The matching array elements are returned in the order they appear in the input array. + * If the specified limit is greater than the number of matching array elements, $filter returns all matching array elements. If the limit is null, $filter returns all matching array elements. + */ + public static function filter( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToBool|bool|string $cond, + Optional|string $as = Optional::Undefined, + Optional|ResolvesToInt|int|string $limit = Optional::Undefined, + ): FilterOperator { + return new FilterOperator($input, $cond, $as, $limit); + } + + /** + * Returns the result of an expression for the first document in an array. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/first/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression + */ + public static function first(PackedArray|ResolvesToArray|BSONArray|array|string $expression): FirstOperator + { + return new FirstOperator($expression); + } + + /** + * Returns a specified number of elements from the beginning of an array. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN-array-element/ + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. + */ + public static function firstN( + ResolvesToInt|int|string $n, + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ): FirstNOperator { + return new FirstNOperator($n, $input); + } + + /** + * Returns the largest integer less than or equal to the specified number. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/floor/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression + */ + public static function floor(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): FloorOperator + { + return new FloorOperator($expression); + } + + /** + * Defines a custom function. + * New in MongoDB 4.4. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/function/ + * @param Javascript|string $body The function definition. You can specify the function definition as either BSON\JavaScript or string. + * function(arg1, arg2, ...) { ... } + * @param BSONArray|PackedArray|array $args Arguments passed to the function body. If the body function does not take an argument, you can specify an empty array [ ]. + * @param string $lang + */ + public static function function( + Javascript|string $body, + PackedArray|BSONArray|array $args = [], + string $lang = 'js', + ): FunctionOperator { + return new FunctionOperator($body, $args, $lang); + } + + /** + * Returns the value of a specified field from a document. You can use $getField to retrieve the value of fields with names that contain periods (.) or start with dollar signs ($). + * New in MongoDB 5.0. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/getField/ + * @param ResolvesToString|string $field Field in the input object for which you want to return a value. field can be any valid expression that resolves to a string constant. + * If field begins with a dollar sign ($), place the field name inside of a $literal expression to return its value. + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $input Default: $$CURRENT + * A valid expression that contains the field for which you want to return a value. input must resolve to an object, missing, null, or undefined. If omitted, defaults to the document currently being processed in the pipeline ($$CURRENT). + */ + public static function getField( + ResolvesToString|string $field, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input = Optional::Undefined, + ): GetFieldOperator { + return new GetFieldOperator($field, $input); + } + + /** + * Returns true if the first value is greater than the second. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/gt/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 + */ + public static function gt( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, + ): GtOperator { + return new GtOperator($expression1, $expression2); + } + + /** + * Returns true if the first value is greater than or equal to the second. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/gte/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 + */ + public static function gte( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, + ): GteOperator { + return new GteOperator($expression1, $expression2); + } + + /** + * Returns the hour for a date as a number between 0 and 23. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/hour/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function hour( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): HourOperator { + return new HourOperator($date, $timezone); + } + + /** + * Returns either the non-null result of the first expression or the result of the second expression if the first expression results in a null result. Null result encompasses instances of undefined values or missing fields. Accepts two expressions as arguments. The result of the second expression can be null. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/ifNull/ + * @no-named-arguments + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string ...$expression + */ + public static function ifNull( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, + ): IfNullOperator { + return new IfNullOperator(...$expression); + } + + /** + * Returns a boolean indicating whether a specified value is in an array. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/in/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression Any valid expression expression. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $array Any valid expression that resolves to an array. + */ + public static function in( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + PackedArray|ResolvesToArray|BSONArray|array|string $array, + ): InOperator { + return new InOperator($expression, $array); + } + + /** + * Searches an array for an occurrence of a specified value and returns the array index of the first occurrence. Array indexes start at zero. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfArray/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $array Can be any valid expression as long as it resolves to an array. + * If the array expression resolves to a value of null or refers to a field that is missing, $indexOfArray returns null. + * If the array expression does not resolve to an array or null nor refers to a missing field, $indexOfArray returns an error. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $search + * @param Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * If unspecified, the starting index position for the search is the beginning of the string. + * @param Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * If unspecified, the ending index position for the search is the end of the string. + */ + public static function indexOfArray( + PackedArray|ResolvesToArray|BSONArray|array|string $array, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $search, + Optional|ResolvesToInt|int|string $start = Optional::Undefined, + Optional|ResolvesToInt|int|string $end = Optional::Undefined, + ): IndexOfArrayOperator { + return new IndexOfArrayOperator($array, $search, $start, $end); + } + + /** + * Searches a string for an occurrence of a substring and returns the UTF-8 byte index of the first occurrence. If the substring is not found, returns -1. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfBytes/ + * @param ResolvesToString|string $string Can be any valid expression as long as it resolves to a string. + * If the string expression resolves to a value of null or refers to a field that is missing, $indexOfBytes returns null. + * If the string expression does not resolve to a string or null nor refers to a missing field, $indexOfBytes returns an error. + * @param ResolvesToString|string $substring Can be any valid expression as long as it resolves to a string. + * @param Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * If unspecified, the starting index position for the search is the beginning of the string. + * @param Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * If unspecified, the ending index position for the search is the end of the string. + */ + public static function indexOfBytes( + ResolvesToString|string $string, + ResolvesToString|string $substring, + Optional|ResolvesToInt|int|string $start = Optional::Undefined, + Optional|ResolvesToInt|int|string $end = Optional::Undefined, + ): IndexOfBytesOperator { + return new IndexOfBytesOperator($string, $substring, $start, $end); + } + + /** + * Searches a string for an occurrence of a substring and returns the UTF-8 code point index of the first occurrence. If the substring is not found, returns -1 + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfCP/ + * @param ResolvesToString|string $string Can be any valid expression as long as it resolves to a string. + * If the string expression resolves to a value of null or refers to a field that is missing, $indexOfCP returns null. + * If the string expression does not resolve to a string or null nor refers to a missing field, $indexOfCP returns an error. + * @param ResolvesToString|string $substring Can be any valid expression as long as it resolves to a string. + * @param Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * If unspecified, the starting index position for the search is the beginning of the string. + * @param Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * If unspecified, the ending index position for the search is the end of the string. + */ + public static function indexOfCP( + ResolvesToString|string $string, + ResolvesToString|string $substring, + Optional|ResolvesToInt|int|string $start = Optional::Undefined, + Optional|ResolvesToInt|int|string $end = Optional::Undefined, + ): IndexOfCPOperator { + return new IndexOfCPOperator($string, $substring, $start, $end); + } + + /** + * Determines if the operand is an array. Returns a boolean. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/isArray/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public static function isArray( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ): IsArrayOperator { + return new IsArrayOperator($expression); + } + + /** + * Returns boolean true if the specified expression resolves to an integer, decimal, double, or long. + * Returns boolean false if the expression resolves to any other BSON type, null, or a missing field. + * New in MongoDB 4.4. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/isNumber/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public static function isNumber( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ): IsNumberOperator { + return new IsNumberOperator($expression); + } + + /** + * Returns the weekday number in ISO 8601 format, ranging from 1 (for Monday) to 7 (for Sunday). + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoDayOfWeek/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function isoDayOfWeek( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): IsoDayOfWeekOperator { + return new IsoDayOfWeekOperator($date, $timezone); + } + + /** + * Returns the week number in ISO 8601 format, ranging from 1 to 53. Week numbers start at 1 with the week (Monday through Sunday) that contains the year's first Thursday. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoWeek/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function isoWeek( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): IsoWeekOperator { + return new IsoWeekOperator($date, $timezone); + } + + /** + * Returns the year number in ISO 8601 format. The year starts with the Monday of week 1 (ISO 8601) and ends with the Sunday of the last week (ISO 8601). + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoWeekYear/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function isoWeekYear( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): IsoWeekYearOperator { + return new IsoWeekYearOperator($date, $timezone); + } + + /** + * Returns the result of an expression for the last document in an array. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/last/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression + */ + public static function last(PackedArray|ResolvesToArray|BSONArray|array|string $expression): LastOperator + { + return new LastOperator($expression); + } + + /** + * Returns a specified number of elements from the end of an array. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN-array-element/ + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. + */ + public static function lastN( + ResolvesToInt|int|string $n, + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ): LastNOperator { + return new LastNOperator($n, $input); + } + + /** + * Defines variables for use within the scope of a subexpression and returns the result of the subexpression. Accepts named parameters. + * Accepts any number of argument expressions. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/let/ + * @param Document|Serializable|array|stdClass $vars Assignment block for the variables accessible in the in expression. To assign a variable, specify a string for the variable name and assign a valid expression for the value. + * The variable assignments have no meaning outside the in expression, not even within the vars block itself. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $in The expression to evaluate. + */ + public static function let( + Document|Serializable|stdClass|array $vars, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, + ): LetOperator { + return new LetOperator($vars, $in); + } + + /** + * Return a value without parsing. Use for values that the aggregation pipeline may interpret as an expression. For example, use a $literal expression to a string that starts with a dollar sign ($) to avoid parsing as a field path. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/literal/ + * @param DateTimeInterface|Type|array|bool|float|int|null|stdClass|string $value If the value is an expression, $literal does not evaluate the expression but instead returns the unparsed expression. + */ + public static function literal( + DateTimeInterface|Type|stdClass|array|bool|float|int|null|string $value, + ): LiteralOperator { + return new LiteralOperator($value); + } + + /** + * Calculates the natural log of a number. + * $ln is equivalent to $log: [ , Math.E ] expression, where Math.E is a JavaScript representation for Euler's number e. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/ln/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. For more information on expressions, see Expressions. + */ + public static function ln(Decimal128|Int64|ResolvesToNumber|float|int|string $number): LnOperator + { + return new LnOperator($number); + } + + /** + * Calculates the log of a number in the specified base. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/log/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $base Any valid expression as long as it resolves to a positive number greater than 1. + */ + public static function log( + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Decimal128|Int64|ResolvesToNumber|float|int|string $base, + ): LogOperator { + return new LogOperator($number, $base); + } + + /** + * Calculates the log base 10 of a number. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/log10/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. + */ + public static function log10(Decimal128|Int64|ResolvesToNumber|float|int|string $number): Log10Operator + { + return new Log10Operator($number); + } + + /** + * Returns true if the first value is less than the second. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/lt/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 + */ + public static function lt( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, + ): LtOperator { + return new LtOperator($expression1, $expression2); + } + + /** + * Returns true if the first value is less than or equal to the second. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/lte/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 + */ + public static function lte( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, + ): LteOperator { + return new LteOperator($expression1, $expression2); + } + + /** + * Removes whitespace or the specified characters from the beginning of a string. + * New in MongoDB 4.0. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/ltrim/ + * @param ResolvesToString|string $input The string to trim. The argument can be any valid expression that resolves to a string. + * @param Optional|ResolvesToString|string $chars The character(s) to trim from the beginning of the input. + * The argument can be any valid expression that resolves to a string. The $ltrim operator breaks down the string into individual UTF code point to trim from input. + * If unspecified, $ltrim removes whitespace characters, including the null character. + */ + public static function ltrim( + ResolvesToString|string $input, + Optional|ResolvesToString|string $chars = Optional::Undefined, + ): LtrimOperator { + return new LtrimOperator($input, $chars); + } + + /** + * Applies a subexpression to each element of an array and returns the array of resulting values in order. Accepts named parameters. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/map/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to an array. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $in An expression that is applied to each element of the input array. The expression references each element individually with the variable name specified in as. + * @param Optional|ResolvesToString|string $as A name for the variable that represents each individual element of the input array. If no name is specified, the variable name defaults to this. + */ + public static function map( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, + Optional|ResolvesToString|string $as = Optional::Undefined, + ): MapOperator { + return new MapOperator($input, $in, $as); + } + + /** + * Returns the maximum value that results from applying an expression to each document. + * Changed in MongoDB 5.0: Available in the $setWindowFields stage. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/max/ + * @no-named-arguments + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string ...$expression + */ + public static function max( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, + ): MaxOperator { + return new MaxOperator(...$expression); + } + + /** + * Returns the n largest values in an array. Distinct from the $maxN accumulator. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/maxN-array-element/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. + */ + public static function maxN( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, + ): MaxNOperator { + return new MaxNOperator($input, $n); + } + + /** + * Returns an approximation of the median, the 50th percentile, as a scalar value. + * New in MongoDB 7.0. + * This operator is available as an accumulator in these stages: + * $group + * $setWindowFields + * It is also available as an aggregation expression. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/median/ + * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int|string $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. + * @param string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. + */ + public static function median( + Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int|string $input, + string $method, + ): MedianOperator { + return new MedianOperator($input, $method); + } + + /** + * Combines multiple documents into a single document. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/mergeObjects/ + * @no-named-arguments + * @param Document|ResolvesToObject|Serializable|array|stdClass|string ...$document Any valid expression that resolves to a document. + */ + public static function mergeObjects( + Document|Serializable|ResolvesToObject|stdClass|array|string ...$document, + ): MergeObjectsOperator { + return new MergeObjectsOperator(...$document); + } + + /** + * Access available per-document metadata related to the aggregation operation. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/meta/ + * @param string $keyword + */ + public static function meta(string $keyword): MetaOperator + { + return new MetaOperator($keyword); + } + + /** + * Returns the milliseconds of a date as a number between 0 and 999. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/millisecond/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function millisecond( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): MillisecondOperator { + return new MillisecondOperator($date, $timezone); + } + + /** + * Returns the minimum value that results from applying an expression to each document. + * Changed in MongoDB 5.0: Available in the $setWindowFields stage. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/min/ + * @no-named-arguments + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string ...$expression + */ + public static function min( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, + ): MinOperator { + return new MinOperator(...$expression); + } + + /** + * Returns the n smallest values in an array. Distinct from the $minN accumulator. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/minN-array-element/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. + */ + public static function minN( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, + ): MinNOperator { + return new MinNOperator($input, $n); + } + + /** + * Returns the minute for a date as a number between 0 and 59. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/minute/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function minute( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): MinuteOperator { + return new MinuteOperator($date, $timezone); + } + + /** + * Returns the remainder of the first number divided by the second. Accepts two argument expressions. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/mod/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $dividend The first argument is the dividend, and the second argument is the divisor; i.e. first argument is divided by the second argument. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $divisor + */ + public static function mod( + Decimal128|Int64|ResolvesToNumber|float|int|string $dividend, + Decimal128|Int64|ResolvesToNumber|float|int|string $divisor, + ): ModOperator { + return new ModOperator($dividend, $divisor); + } + + /** + * Returns the month for a date as a number between 1 (January) and 12 (December). + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/month/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function month( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): MonthOperator { + return new MonthOperator($date, $timezone); + } + + /** + * Multiplies numbers to return the product. Accepts any number of argument expressions. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/multiply/ + * @no-named-arguments + * @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression The arguments can be any valid expression as long as they resolve to numbers. + * Starting in MongoDB 6.1 you can optimize the $multiply operation. To improve performance, group references at the end of the argument list. + */ + public static function multiply( + Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression, + ): MultiplyOperator { + return new MultiplyOperator(...$expression); + } + + /** + * Returns true if the values are not equivalent. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/ne/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 + */ + public static function ne( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, + ): NeOperator { + return new NeOperator($expression1, $expression2); + } + + /** + * Returns the boolean value that is the opposite of its argument expression. Accepts a single argument expression. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/not/ + * @param DateTimeInterface|ExpressionInterface|ResolvesToBool|Type|array|bool|float|int|null|stdClass|string $expression + */ + public static function not( + DateTimeInterface|Type|ResolvesToBool|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ): NotOperator { + return new NotOperator($expression); + } + + /** + * Converts a document to an array of documents representing key-value pairs. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/objectToArray/ + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $object Any valid expression as long as it resolves to a document object. $objectToArray applies to the top-level fields of its argument. If the argument is a document that itself contains embedded document fields, the $objectToArray does not recursively apply to the embedded document fields. + */ + public static function objectToArray( + Document|Serializable|ResolvesToObject|stdClass|array|string $object, + ): ObjectToArrayOperator { + return new ObjectToArrayOperator($object); + } + + /** + * Returns true when any of its expressions evaluates to true. Accepts any number of argument expressions. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/or/ + * @no-named-arguments + * @param DateTimeInterface|ExpressionInterface|ResolvesToBool|Type|array|bool|float|int|null|stdClass|string ...$expression + */ + public static function or( + DateTimeInterface|Type|ResolvesToBool|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, + ): OrOperator { + return new OrOperator(...$expression); + } + + /** + * Returns an array of scalar values that correspond to specified percentile values. + * New in MongoDB 7.0. + * + * This operator is available as an accumulator in these stages: + * $group + * + * $setWindowFields + * + * It is also available as an aggregation expression. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/percentile/ + * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int|string $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. + * $percentile returns results in the same order as the elements in p. + * @param string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. + */ + public static function percentile( + Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int|string $input, + PackedArray|ResolvesToArray|BSONArray|array|string $p, + string $method, + ): PercentileOperator { + return new PercentileOperator($input, $p, $method); + } + + /** + * Raises a number to the specified exponent. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/pow/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $exponent + */ + public static function pow( + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Decimal128|Int64|ResolvesToNumber|float|int|string $exponent, + ): PowOperator { + return new PowOperator($number, $exponent); + } + + /** + * Converts a value from radians to degrees. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/radiansToDegrees/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression + */ + public static function radiansToDegrees( + Decimal128|Int64|ResolvesToNumber|float|int|string $expression, + ): RadiansToDegreesOperator { + return new RadiansToDegreesOperator($expression); + } + + /** + * Returns a random float between 0 and 1 + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/rand/ + */ + public static function rand(): RandOperator + { + return new RandOperator(); + } + + /** + * Outputs an array containing a sequence of integers according to user-defined inputs. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/range/ + * @param ResolvesToInt|int|string $start An integer that specifies the start of the sequence. Can be any valid expression that resolves to an integer. + * @param ResolvesToInt|int|string $end An integer that specifies the exclusive upper limit of the sequence. Can be any valid expression that resolves to an integer. + * @param Optional|ResolvesToInt|int|string $step An integer that specifies the increment value. Can be any valid expression that resolves to a non-zero integer. Defaults to 1. + */ + public static function range( + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $end, + Optional|ResolvesToInt|int|string $step = Optional::Undefined, + ): RangeOperator { + return new RangeOperator($start, $end, $step); + } + + /** + * Applies an expression to each element in an array and combines them into a single value. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/reduce/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input Can be any valid expression that resolves to an array. + * If the argument resolves to a value of null or refers to a missing field, $reduce returns null. + * If the argument does not resolve to an array or null nor refers to a missing field, $reduce returns an error. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $initialValue The initial cumulative value set before in is applied to the first element of the input array. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $in A valid expression that $reduce applies to each element in the input array in left-to-right order. Wrap the input value with $reverseArray to yield the equivalent of applying the combining expression from right-to-left. + * During evaluation of the in expression, two variables will be available: + * - value is the variable that represents the cumulative value of the expression. + * - this is the variable that refers to the element being processed. + */ + public static function reduce( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $initialValue, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, + ): ReduceOperator { + return new ReduceOperator($input, $initialValue, $in); + } + + /** + * Applies a regular expression (regex) to a string and returns information on the first matched substring. + * New in MongoDB 4.2. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/regexFind/ + * @param ResolvesToString|string $input The string on which you wish to apply the regex pattern. Can be a string or any valid expression that resolves to a string. + * @param Regex|ResolvesToString|string $regex The regex pattern to apply. Can be any valid expression that resolves to either a string or regex pattern //. When using the regex //, you can also specify the regex options i and m (but not the s or x options) + * @param Optional|string $options + */ + public static function regexFind( + ResolvesToString|string $input, + Regex|ResolvesToString|string $regex, + Optional|string $options = Optional::Undefined, + ): RegexFindOperator { + return new RegexFindOperator($input, $regex, $options); + } + + /** + * Applies a regular expression (regex) to a string and returns information on the all matched substrings. + * New in MongoDB 4.2. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/regexFindAll/ + * @param ResolvesToString|string $input The string on which you wish to apply the regex pattern. Can be a string or any valid expression that resolves to a string. + * @param Regex|ResolvesToString|string $regex The regex pattern to apply. Can be any valid expression that resolves to either a string or regex pattern //. When using the regex //, you can also specify the regex options i and m (but not the s or x options) + * @param Optional|string $options + */ + public static function regexFindAll( + ResolvesToString|string $input, + Regex|ResolvesToString|string $regex, + Optional|string $options = Optional::Undefined, + ): RegexFindAllOperator { + return new RegexFindAllOperator($input, $regex, $options); + } + + /** + * Applies a regular expression (regex) to a string and returns a boolean that indicates if a match is found or not. + * New in MongoDB 4.2. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/regexMatch/ + * @param ResolvesToString|string $input The string on which you wish to apply the regex pattern. Can be a string or any valid expression that resolves to a string. + * @param Regex|ResolvesToString|string $regex The regex pattern to apply. Can be any valid expression that resolves to either a string or regex pattern //. When using the regex //, you can also specify the regex options i and m (but not the s or x options) + * @param Optional|string $options + */ + public static function regexMatch( + ResolvesToString|string $input, + Regex|ResolvesToString|string $regex, + Optional|string $options = Optional::Undefined, + ): RegexMatchOperator { + return new RegexMatchOperator($input, $regex, $options); + } + + /** + * Replaces all instances of a search string in an input string with a replacement string. + * $replaceAll is both case-sensitive and diacritic-sensitive, and ignores any collation present on a collection. + * New in MongoDB 4.4. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceAll/ + * @param ResolvesToNull|ResolvesToString|null|string $input The string on which you wish to apply the find. Can be any valid expression that resolves to a string or a null. If input refers to a field that is missing, $replaceAll returns null. + * @param Regex|ResolvesToNull|ResolvesToRegex|ResolvesToString|null|string $find The string to search for within the given input. Can be any valid expression that resolves to a string or a null. If find refers to a field that is missing, $replaceAll returns null. + * @param ResolvesToNull|ResolvesToString|null|string $replacement The string to use to replace all matched instances of find in input. Can be any valid expression that resolves to a string or a null. + */ + public static function replaceAll( + ResolvesToNull|ResolvesToString|null|string $input, + Regex|ResolvesToNull|ResolvesToRegex|ResolvesToString|null|string $find, + ResolvesToNull|ResolvesToString|null|string $replacement, + ): ReplaceAllOperator { + return new ReplaceAllOperator($input, $find, $replacement); + } + + /** + * Replaces the first instance of a matched string in a given input. + * New in MongoDB 4.4. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceOne/ + * @param ResolvesToNull|ResolvesToString|null|string $input The string on which you wish to apply the find. Can be any valid expression that resolves to a string or a null. If input refers to a field that is missing, $replaceAll returns null. + * @param ResolvesToNull|ResolvesToString|null|string $find The string to search for within the given input. Can be any valid expression that resolves to a string or a null. If find refers to a field that is missing, $replaceAll returns null. + * @param ResolvesToNull|ResolvesToString|null|string $replacement The string to use to replace all matched instances of find in input. Can be any valid expression that resolves to a string or a null. + */ + public static function replaceOne( + ResolvesToNull|ResolvesToString|null|string $input, + ResolvesToNull|ResolvesToString|null|string $find, + ResolvesToNull|ResolvesToString|null|string $replacement, + ): ReplaceOneOperator { + return new ReplaceOneOperator($input, $find, $replacement); + } + + /** + * Returns an array with the elements in reverse order. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/reverseArray/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression The argument can be any valid expression as long as it resolves to an array. + */ + public static function reverseArray( + PackedArray|ResolvesToArray|BSONArray|array|string $expression, + ): ReverseArrayOperator { + return new ReverseArrayOperator($expression); + } + + /** + * Rounds a number to a whole integer or to a specified decimal place. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/round/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. + * $round returns an error if the expression resolves to a non-numeric data type. + * @param Optional|ResolvesToInt|int|string $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. + */ + public static function round( + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Optional|ResolvesToInt|int|string $place = Optional::Undefined, + ): RoundOperator { + return new RoundOperator($number, $place); + } + + /** + * Removes whitespace characters, including null, or the specified characters from the end of a string. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/rtrim/ + * @param ResolvesToString|string $input The string to trim. The argument can be any valid expression that resolves to a string. + * @param Optional|ResolvesToString|string $chars The character(s) to trim from the beginning of the input. + * The argument can be any valid expression that resolves to a string. The $ltrim operator breaks down the string into individual UTF code point to trim from input. + * If unspecified, $ltrim removes whitespace characters, including the null character. + */ + public static function rtrim( + ResolvesToString|string $input, + Optional|ResolvesToString|string $chars = Optional::Undefined, + ): RtrimOperator { + return new RtrimOperator($input, $chars); + } + + /** + * Returns the seconds for a date as a number between 0 and 60 (leap seconds). + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/second/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function second( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): SecondOperator { + return new SecondOperator($date, $timezone); + } + + /** + * Returns a set with elements that appear in the first set but not in the second set; i.e. performs a relative complement of the second set relative to the first. Accepts exactly two argument expressions. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setDifference/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression1 The arguments can be any valid expression as long as they each resolve to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression2 The arguments can be any valid expression as long as they each resolve to an array. + */ + public static function setDifference( + PackedArray|ResolvesToArray|BSONArray|array|string $expression1, + PackedArray|ResolvesToArray|BSONArray|array|string $expression2, + ): SetDifferenceOperator { + return new SetDifferenceOperator($expression1, $expression2); + } + + /** + * Returns true if the input sets have the same distinct elements. Accepts two or more argument expressions. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setEquals/ + * @no-named-arguments + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$expression + */ + public static function setEquals( + PackedArray|ResolvesToArray|BSONArray|array|string ...$expression, + ): SetEqualsOperator { + return new SetEqualsOperator(...$expression); + } + + /** + * Adds, updates, or removes a specified field in a document. You can use $setField to add, update, or remove fields with names that contain periods (.) or start with dollar signs ($). + * New in MongoDB 5.0. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setField/ + * @param ResolvesToString|string $field Field in the input object that you want to add, update, or remove. field can be any valid expression that resolves to a string constant. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $value The value that you want to assign to field. value can be any valid expression. + * Set to $$REMOVE to remove field from the input document. + */ + public static function setField( + ResolvesToString|string $field, + Document|Serializable|ResolvesToObject|stdClass|array|string $input, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $value, + ): SetFieldOperator { + return new SetFieldOperator($field, $input, $value); + } + + /** + * Returns a set with elements that appear in all of the input sets. Accepts any number of argument expressions. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setIntersection/ + * @no-named-arguments + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$expression + */ + public static function setIntersection( + PackedArray|ResolvesToArray|BSONArray|array|string ...$expression, + ): SetIntersectionOperator { + return new SetIntersectionOperator(...$expression); + } + + /** + * Returns true if all elements of the first set appear in the second set, including when the first set equals the second set; i.e. not a strict subset. Accepts exactly two argument expressions. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setIsSubset/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression1 + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression2 + */ + public static function setIsSubset( + PackedArray|ResolvesToArray|BSONArray|array|string $expression1, + PackedArray|ResolvesToArray|BSONArray|array|string $expression2, + ): SetIsSubsetOperator { + return new SetIsSubsetOperator($expression1, $expression2); + } + + /** + * Returns a set with elements that appear in any of the input sets. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setUnion/ + * @no-named-arguments + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$expression + */ + public static function setUnion( + PackedArray|ResolvesToArray|BSONArray|array|string ...$expression, + ): SetUnionOperator { + return new SetUnionOperator(...$expression); + } + + /** + * Returns the sine of a value that is measured in radians. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sin/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $sin takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * By default $sin returns values as a double. $sin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public static function sin(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): SinOperator + { + return new SinOperator($expression); + } + + /** + * Returns the hyperbolic sine of a value that is measured in radians. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sinh/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $sinh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * By default $sinh returns values as a double. $sinh can also return values as a 128-bit decimal if the expression resolves to a 128-bit decimal value. + */ + public static function sinh(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): SinhOperator + { + return new SinhOperator($expression); + } + + /** + * Returns the number of elements in the array. Accepts a single expression as argument. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/size/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression The argument for $size can be any expression as long as it resolves to an array. + */ + public static function size(PackedArray|ResolvesToArray|BSONArray|array|string $expression): SizeOperator + { + return new SizeOperator($expression); + } + + /** + * Returns a subset of an array. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/slice/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression Any valid expression as long as it resolves to an array. + * @param ResolvesToInt|int|string $n Any valid expression as long as it resolves to an integer. If position is specified, n must resolve to a positive integer. + * If positive, $slice returns up to the first n elements in the array. If the position is specified, $slice returns the first n elements starting from the position. + * If negative, $slice returns up to the last n elements in the array. n cannot resolve to a negative number if is specified. + * @param Optional|ResolvesToInt|int|string $position Any valid expression as long as it resolves to an integer. + * If positive, $slice determines the starting position from the start of the array. If position is greater than the number of elements, the $slice returns an empty array. + * If negative, $slice determines the starting position from the end of the array. If the absolute value of the is greater than the number of elements, the starting position is the start of the array. + */ + public static function slice( + PackedArray|ResolvesToArray|BSONArray|array|string $expression, + ResolvesToInt|int|string $n, + Optional|ResolvesToInt|int|string $position = Optional::Undefined, + ): SliceOperator { + return new SliceOperator($expression, $n, $position); + } + + /** + * Sorts the elements of an array. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortArray/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input The array to be sorted. + * The result is null if the expression: is missing, evaluates to null, or evaluates to undefined + * If the expression evaluates to any other non-array value, the document returns an error. + * @param Document|Serializable|Sort|array|int|stdClass $sortBy The document specifies a sort ordering. + */ + public static function sortArray( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + Document|Serializable|Sort|stdClass|array|int $sortBy, + ): SortArrayOperator { + return new SortArrayOperator($input, $sortBy); + } + + /** + * Splits a string into substrings based on a delimiter. Returns an array of substrings. If the delimiter is not found within the string, returns an array containing the original string. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/split/ + * @param ResolvesToString|string $string The string to be split. string expression can be any valid expression as long as it resolves to a string. + * @param Regex|ResolvesToRegex|ResolvesToString|string $delimiter The delimiter to use when splitting the string expression. delimiter can be any valid expression as long as it resolves to a string. + */ + public static function split( + ResolvesToString|string $string, + Regex|ResolvesToRegex|ResolvesToString|string $delimiter, + ): SplitOperator { + return new SplitOperator($string, $delimiter); + } + + /** + * Calculates the square root. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sqrt/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number The argument can be any valid expression as long as it resolves to a non-negative number. + */ + public static function sqrt(Decimal128|Int64|ResolvesToNumber|float|int|string $number): SqrtOperator + { + return new SqrtOperator($number); + } + + /** + * Calculates the population standard deviation of the input values. Use if the values encompass the entire population of data you want to represent and do not wish to generalize about a larger population. $stdDevPop ignores non-numeric values. + * If the values represent only a sample of a population of data from which to generalize about the population, use $stdDevSamp instead. + * Changed in MongoDB 5.0: Available in the $setWindowFields stage. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/ + * @no-named-arguments + * @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression + */ + public static function stdDevPop( + Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression, + ): StdDevPopOperator { + return new StdDevPopOperator(...$expression); + } + + /** + * Calculates the sample standard deviation of the input values. Use if the values encompass a sample of a population of data from which to generalize about the population. $stdDevSamp ignores non-numeric values. + * If the values represent the entire population of data or you do not wish to generalize about a larger population, use $stdDevPop instead. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/ + * @no-named-arguments + * @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression + */ + public static function stdDevSamp( + Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression, + ): StdDevSampOperator { + return new StdDevSampOperator(...$expression); + } + + /** + * Performs case-insensitive string comparison and returns: 0 if two strings are equivalent, 1 if the first string is greater than the second, and -1 if the first string is less than the second. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/strcasecmp/ + * @param ResolvesToString|string $expression1 + * @param ResolvesToString|string $expression2 + */ + public static function strcasecmp( + ResolvesToString|string $expression1, + ResolvesToString|string $expression2, + ): StrcasecmpOperator { + return new StrcasecmpOperator($expression1, $expression2); + } + + /** + * Returns the number of UTF-8 encoded bytes in a string. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/strLenBytes/ + * @param ResolvesToString|string $expression + */ + public static function strLenBytes(ResolvesToString|string $expression): StrLenBytesOperator + { + return new StrLenBytesOperator($expression); + } + + /** + * Returns the number of UTF-8 code points in a string. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/strLenCP/ + * @param ResolvesToString|string $expression + */ + public static function strLenCP(ResolvesToString|string $expression): StrLenCPOperator + { + return new StrLenCPOperator($expression); + } + + /** + * Deprecated. Use $substrBytes or $substrCP. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/substr/ + * @param ResolvesToString|string $string + * @param ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". + * @param ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. + */ + public static function substr( + ResolvesToString|string $string, + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $length, + ): SubstrOperator { + return new SubstrOperator($string, $start, $length); + } + + /** + * Returns the substring of a string. Starts with the character at the specified UTF-8 byte index (zero-based) in the string and continues for the specified number of bytes. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/substrBytes/ + * @param ResolvesToString|string $string + * @param ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". + * @param ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. + */ + public static function substrBytes( + ResolvesToString|string $string, + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $length, + ): SubstrBytesOperator { + return new SubstrBytesOperator($string, $start, $length); + } + + /** + * Returns the substring of a string. Starts with the character at the specified UTF-8 code point (CP) index (zero-based) in the string and continues for the number of code points specified. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/substrCP/ + * @param ResolvesToString|string $string + * @param ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". + * @param ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. + */ + public static function substrCP( + ResolvesToString|string $string, + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $length, + ): SubstrCPOperator { + return new SubstrCPOperator($string, $start, $length); + } + + /** + * Returns the result of subtracting the second value from the first. If the two values are numbers, return the difference. If the two values are dates, return the difference in milliseconds. If the two values are a date and a number in milliseconds, return the resulting date. Accepts two argument expressions. If the two values are a date and a number, specify the date argument first as it is not meaningful to subtract a date from a number. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/subtract/ + * @param DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $expression1 + * @param DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $expression2 + */ + public static function subtract( + DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $expression1, + DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $expression2, + ): SubtractOperator { + return new SubtractOperator($expression1, $expression2); + } + + /** + * Returns a sum of numerical values. Ignores non-numeric values. + * Changed in MongoDB 5.0: Available in the $setWindowFields stage. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/ + * @no-named-arguments + * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToArray|ResolvesToNumber|array|float|int|string ...$expression + */ + public static function sum( + Decimal128|Int64|PackedArray|ResolvesToArray|ResolvesToNumber|BSONArray|array|float|int|string ...$expression, + ): SumOperator { + return new SumOperator(...$expression); + } + + /** + * Evaluates a series of case expressions. When it finds an expression which evaluates to true, $switch executes a specified expression and breaks out of the control flow. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/switch/ + * @param BSONArray|PackedArray|array $branches An array of control branch documents. Each branch is a document with the following fields: + * - case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. + * - then Can be any valid expression. + * The branches array must contain at least one branch document. + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default The path to take if no branch case expression evaluates to true. + * Although optional, if default is unspecified and no branch case evaluates to true, $switch returns an error. + */ + public static function switch( + PackedArray|BSONArray|array $branches, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default = Optional::Undefined, + ): SwitchOperator { + return new SwitchOperator($branches, $default); + } + + /** + * Returns the tangent of a value that is measured in radians. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/tan/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $tan takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * By default $tan returns values as a double. $tan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public static function tan(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): TanOperator + { + return new TanOperator($expression); + } + + /** + * Returns the hyperbolic tangent of a value that is measured in radians. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/tanh/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $tanh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * By default $tanh returns values as a double. $tanh can also return values as a 128-bit decimal if the expression resolves to a 128-bit decimal value. + */ + public static function tanh(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): TanhOperator + { + return new TanhOperator($expression); + } + + /** + * Converts value to a boolean. + * New in MongoDB 4.0. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toBool/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public static function toBool( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ): ToBoolOperator { + return new ToBoolOperator($expression); + } + + /** + * Converts value to a Date. + * New in MongoDB 4.0. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toDate/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public static function toDate( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ): ToDateOperator { + return new ToDateOperator($expression); + } + + /** + * Converts value to a Decimal128. + * New in MongoDB 4.0. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toDecimal/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public static function toDecimal( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ): ToDecimalOperator { + return new ToDecimalOperator($expression); + } + + /** + * Converts value to a double. + * New in MongoDB 4.0. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toDouble/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public static function toDouble( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ): ToDoubleOperator { + return new ToDoubleOperator($expression); + } + + /** + * Computes and returns the hash value of the input expression using the same hash function that MongoDB uses to create a hashed index. A hash function maps a key or string to a fixed-size numeric value. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toHashedIndexKey/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $value key or string to hash + */ + public static function toHashedIndexKey( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $value, + ): ToHashedIndexKeyOperator { + return new ToHashedIndexKeyOperator($value); + } + + /** + * Converts value to an integer. + * New in MongoDB 4.0. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toInt/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public static function toInt( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ): ToIntOperator { + return new ToIntOperator($expression); + } + + /** + * Converts value to a long. + * New in MongoDB 4.0. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toLong/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public static function toLong( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ): ToLongOperator { + return new ToLongOperator($expression); + } + + /** + * Converts a string to lowercase. Accepts a single argument expression. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toLower/ + * @param ResolvesToString|string $expression + */ + public static function toLower(ResolvesToString|string $expression): ToLowerOperator + { + return new ToLowerOperator($expression); + } + + /** + * Converts value to an ObjectId. + * New in MongoDB 4.0. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toObjectId/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public static function toObjectId( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ): ToObjectIdOperator { + return new ToObjectIdOperator($expression); + } + + /** + * Converts value to a string. + * New in MongoDB 4.0. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toString/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public static function toString( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ): ToStringOperator { + return new ToStringOperator($expression); + } + + /** + * Converts a string to uppercase. Accepts a single argument expression. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toUpper/ + * @param ResolvesToString|string $expression + */ + public static function toUpper(ResolvesToString|string $expression): ToUpperOperator + { + return new ToUpperOperator($expression); + } + + /** + * Removes whitespace or the specified characters from the beginning and end of a string. + * New in MongoDB 4.0. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/trim/ + * @param ResolvesToString|string $input The string to trim. The argument can be any valid expression that resolves to a string. + * @param Optional|ResolvesToString|string $chars The character(s) to trim from the beginning of the input. + * The argument can be any valid expression that resolves to a string. The $ltrim operator breaks down the string into individual UTF code point to trim from input. + * If unspecified, $ltrim removes whitespace characters, including the null character. + */ + public static function trim( + ResolvesToString|string $input, + Optional|ResolvesToString|string $chars = Optional::Undefined, + ): TrimOperator { + return new TrimOperator($input, $chars); + } + + /** + * Truncates a number to a whole integer or to a specified decimal place. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/trunc/ + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. + * $trunc returns an error if the expression resolves to a non-numeric data type. + * @param Optional|ResolvesToInt|int|string $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. e.g. -20 < place < 100. Defaults to 0. + */ + public static function trunc( + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Optional|ResolvesToInt|int|string $place = Optional::Undefined, + ): TruncOperator { + return new TruncOperator($number, $place); + } + + /** + * Returns the incrementing ordinal from a timestamp as a long. + * New in MongoDB 5.1. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/tsIncrement/ + * @param ResolvesToTimestamp|Timestamp|int|string $expression + */ + public static function tsIncrement(Timestamp|ResolvesToTimestamp|int|string $expression): TsIncrementOperator + { + return new TsIncrementOperator($expression); + } + + /** + * Returns the seconds from a timestamp as a long. + * New in MongoDB 5.1. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/tsSecond/ + * @param ResolvesToTimestamp|Timestamp|int|string $expression + */ + public static function tsSecond(Timestamp|ResolvesToTimestamp|int|string $expression): TsSecondOperator + { + return new TsSecondOperator($expression); + } + + /** + * Return the BSON data type of the field. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/type/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public static function type( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ): TypeOperator { + return new TypeOperator($expression); + } + + /** + * You can use $unsetField to remove fields with names that contain periods (.) or that start with dollar signs ($). + * $unsetField is an alias for $setField using $$REMOVE to remove fields. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/unsetField/ + * @param ResolvesToString|string $field Field in the input object that you want to add, update, or remove. field can be any valid expression that resolves to a string constant. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. + */ + public static function unsetField( + ResolvesToString|string $field, + Document|Serializable|ResolvesToObject|stdClass|array|string $input, + ): UnsetFieldOperator { + return new UnsetFieldOperator($field, $input); + } + + /** + * Returns the week number for a date as a number between 0 (the partial week that precedes the first Sunday of the year) and 53 (leap year). + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/week/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function week( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): WeekOperator { + return new WeekOperator($date, $timezone); + } + + /** + * Returns the year for a date as a number (e.g. 2014). + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/year/ + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public static function year( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ): YearOperator { + return new YearOperator($date, $timezone); + } + + /** + * Merge two arrays together. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/zip/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $inputs An array of expressions that resolve to arrays. The elements of these input arrays combine to form the arrays of the output array. + * If any of the inputs arrays resolves to a value of null or refers to a missing field, $zip returns null. + * If any of the inputs arrays does not resolve to an array or null nor refers to a missing field, $zip returns an error. + * @param Optional|bool $useLongestLength A boolean which specifies whether the length of the longest array determines the number of arrays in the output array. + * The default value is false: the shortest array length determines the number of arrays in the output array. + * @param Optional|BSONArray|PackedArray|array $defaults An array of default element values to use if the input arrays have different lengths. You must specify useLongestLength: true along with this field, or else $zip will return an error. + * If useLongestLength: true but defaults is empty or not specified, $zip uses null as the default value. + * If specifying a non-empty defaults, you must specify a default for each input array or else $zip will return an error. + */ + public static function zip( + PackedArray|ResolvesToArray|BSONArray|array|string $inputs, + Optional|bool $useLongestLength = Optional::Undefined, + Optional|PackedArray|BSONArray|array $defaults = Optional::Undefined, + ): ZipOperator { + return new ZipOperator($inputs, $useLongestLength, $defaults); + } +} diff --git a/src/Builder/Expression/FieldPath.php b/src/Builder/Expression/FieldPath.php new file mode 100644 index 000000000..4563994b9 --- /dev/null +++ b/src/Builder/Expression/FieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/FilterOperator.php b/src/Builder/Expression/FilterOperator.php new file mode 100644 index 000000000..b2f2df99c --- /dev/null +++ b/src/Builder/Expression/FilterOperator.php @@ -0,0 +1,84 @@ + 'input', 'cond' => 'cond', 'as' => 'as', 'limit' => 'limit']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; + + /** @var ResolvesToBool|bool|string $cond An expression that resolves to a boolean value used to determine if an element should be included in the output array. The expression references each element of the input array individually with the variable name specified in as. */ + public readonly ResolvesToBool|bool|string $cond; + + /** @var Optional|string $as A name for the variable that represents each individual element of the input array. If no name is specified, the variable name defaults to this. */ + public readonly Optional|string $as; + + /** + * @var Optional|ResolvesToInt|int|string $limit A number expression that restricts the number of matching array elements that $filter returns. You cannot specify a limit less than 1. The matching array elements are returned in the order they appear in the input array. + * If the specified limit is greater than the number of matching array elements, $filter returns all matching array elements. If the limit is null, $filter returns all matching array elements. + */ + public readonly Optional|ResolvesToInt|int|string $limit; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input + * @param ResolvesToBool|bool|string $cond An expression that resolves to a boolean value used to determine if an element should be included in the output array. The expression references each element of the input array individually with the variable name specified in as. + * @param Optional|string $as A name for the variable that represents each individual element of the input array. If no name is specified, the variable name defaults to this. + * @param Optional|ResolvesToInt|int|string $limit A number expression that restricts the number of matching array elements that $filter returns. You cannot specify a limit less than 1. The matching array elements are returned in the order they appear in the input array. + * If the specified limit is greater than the number of matching array elements, $filter returns all matching array elements. If the limit is null, $filter returns all matching array elements. + */ + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToBool|bool|string $cond, + Optional|string $as = Optional::Undefined, + Optional|ResolvesToInt|int|string $limit = Optional::Undefined, + ) { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($input) && ! array_is_list($input)) { + throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); + } + + $this->input = $input; + if (is_string($cond) && ! str_starts_with($cond, '$')) { + throw new InvalidArgumentException('Argument $cond can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->cond = $cond; + $this->as = $as; + if (is_string($limit) && ! str_starts_with($limit, '$')) { + throw new InvalidArgumentException('Argument $limit can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->limit = $limit; + } +} diff --git a/src/Builder/Expression/FirstNOperator.php b/src/Builder/Expression/FirstNOperator.php new file mode 100644 index 000000000..9051441dc --- /dev/null +++ b/src/Builder/Expression/FirstNOperator.php @@ -0,0 +1,63 @@ + 'n', 'input' => 'input']; + + /** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. */ + public readonly ResolvesToInt|int|string $n; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; + + /** + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. + */ + public function __construct( + ResolvesToInt|int|string $n, + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ) { + if (is_string($n) && ! str_starts_with($n, '$')) { + throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->n = $n; + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($input) && ! array_is_list($input)) { + throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); + } + + $this->input = $input; + } +} diff --git a/src/Builder/Expression/FirstOperator.php b/src/Builder/Expression/FirstOperator.php new file mode 100644 index 000000000..d967bf7d2 --- /dev/null +++ b/src/Builder/Expression/FirstOperator.php @@ -0,0 +1,52 @@ + 'expression']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression + */ + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($expression) && ! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/FloorOperator.php b/src/Builder/Expression/FloorOperator.php new file mode 100644 index 000000000..b81d5e05f --- /dev/null +++ b/src/Builder/Expression/FloorOperator.php @@ -0,0 +1,46 @@ + 'expression']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/FunctionOperator.php b/src/Builder/Expression/FunctionOperator.php new file mode 100644 index 000000000..516729e3a --- /dev/null +++ b/src/Builder/Expression/FunctionOperator.php @@ -0,0 +1,67 @@ + 'body', 'args' => 'args', 'lang' => 'lang']; + + /** + * @var Javascript|string $body The function definition. You can specify the function definition as either BSON\JavaScript or string. + * function(arg1, arg2, ...) { ... } + */ + public readonly Javascript|string $body; + + /** @var BSONArray|PackedArray|array $args Arguments passed to the function body. If the body function does not take an argument, you can specify an empty array [ ]. */ + public readonly PackedArray|BSONArray|array $args; + + /** @var string $lang */ + public readonly string $lang; + + /** + * @param Javascript|string $body The function definition. You can specify the function definition as either BSON\JavaScript or string. + * function(arg1, arg2, ...) { ... } + * @param BSONArray|PackedArray|array $args Arguments passed to the function body. If the body function does not take an argument, you can specify an empty array [ ]. + * @param string $lang + */ + public function __construct(Javascript|string $body, PackedArray|BSONArray|array $args = [], string $lang = 'js') + { + if (is_string($body)) { + $body = new Javascript($body); + } + + $this->body = $body; + if (is_array($args) && ! array_is_list($args)) { + throw new InvalidArgumentException('Expected $args argument to be a list, got an associative array.'); + } + + $this->args = $args; + $this->lang = $lang; + } +} diff --git a/src/Builder/Expression/GetFieldOperator.php b/src/Builder/Expression/GetFieldOperator.php new file mode 100644 index 000000000..faf2272e8 --- /dev/null +++ b/src/Builder/Expression/GetFieldOperator.php @@ -0,0 +1,57 @@ + 'field', 'input' => 'input']; + + /** + * @var ResolvesToString|string $field Field in the input object for which you want to return a value. field can be any valid expression that resolves to a string constant. + * If field begins with a dollar sign ($), place the field name inside of a $literal expression to return its value. + */ + public readonly ResolvesToString|string $field; + + /** + * @var Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $input Default: $$CURRENT + * A valid expression that contains the field for which you want to return a value. input must resolve to an object, missing, null, or undefined. If omitted, defaults to the document currently being processed in the pipeline ($$CURRENT). + */ + public readonly Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input; + + /** + * @param ResolvesToString|string $field Field in the input object for which you want to return a value. field can be any valid expression that resolves to a string constant. + * If field begins with a dollar sign ($), place the field name inside of a $literal expression to return its value. + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $input Default: $$CURRENT + * A valid expression that contains the field for which you want to return a value. input must resolve to an object, missing, null, or undefined. If omitted, defaults to the document currently being processed in the pipeline ($$CURRENT). + */ + public function __construct( + ResolvesToString|string $field, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input = Optional::Undefined, + ) { + $this->field = $field; + $this->input = $input; + } +} diff --git a/src/Builder/Expression/GtOperator.php b/src/Builder/Expression/GtOperator.php new file mode 100644 index 000000000..9d92a714e --- /dev/null +++ b/src/Builder/Expression/GtOperator.php @@ -0,0 +1,47 @@ + 'expression1', 'expression2' => 'expression2']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, + ) { + $this->expression1 = $expression1; + $this->expression2 = $expression2; + } +} diff --git a/src/Builder/Expression/GteOperator.php b/src/Builder/Expression/GteOperator.php new file mode 100644 index 000000000..4a6708ca7 --- /dev/null +++ b/src/Builder/Expression/GteOperator.php @@ -0,0 +1,47 @@ + 'expression1', 'expression2' => 'expression2']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, + ) { + $this->expression1 = $expression1; + $this->expression2 = $expression2; + } +} diff --git a/src/Builder/Expression/HourOperator.php b/src/Builder/Expression/HourOperator.php new file mode 100644 index 000000000..ffbd5ac46 --- /dev/null +++ b/src/Builder/Expression/HourOperator.php @@ -0,0 +1,56 @@ + 'date', 'timezone' => 'timezone']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/IfNullOperator.php b/src/Builder/Expression/IfNullOperator.php new file mode 100644 index 000000000..878944cdd --- /dev/null +++ b/src/Builder/Expression/IfNullOperator.php @@ -0,0 +1,53 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string ...$expression + * @no-named-arguments + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, + ) { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/InOperator.php b/src/Builder/Expression/InOperator.php new file mode 100644 index 000000000..5c4d408f1 --- /dev/null +++ b/src/Builder/Expression/InOperator.php @@ -0,0 +1,63 @@ + 'expression', 'array' => 'array']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression Any valid expression expression. */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $array Any valid expression that resolves to an array. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $array; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression Any valid expression expression. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $array Any valid expression that resolves to an array. + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + PackedArray|ResolvesToArray|BSONArray|array|string $array, + ) { + $this->expression = $expression; + if (is_string($array) && ! str_starts_with($array, '$')) { + throw new InvalidArgumentException('Argument $array can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($array) && ! array_is_list($array)) { + throw new InvalidArgumentException('Expected $array argument to be a list, got an associative array.'); + } + + $this->array = $array; + } +} diff --git a/src/Builder/Expression/IndexOfArrayOperator.php b/src/Builder/Expression/IndexOfArrayOperator.php new file mode 100644 index 000000000..34c68db41 --- /dev/null +++ b/src/Builder/Expression/IndexOfArrayOperator.php @@ -0,0 +1,98 @@ + 'array', 'search' => 'search', 'start' => 'start', 'end' => 'end']; + + /** + * @var BSONArray|PackedArray|ResolvesToArray|array|string $array Can be any valid expression as long as it resolves to an array. + * If the array expression resolves to a value of null or refers to a field that is missing, $indexOfArray returns null. + * If the array expression does not resolve to an array or null nor refers to a missing field, $indexOfArray returns an error. + */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $array; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $search */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $search; + + /** + * @var Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * If unspecified, the starting index position for the search is the beginning of the string. + */ + public readonly Optional|ResolvesToInt|int|string $start; + + /** + * @var Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * If unspecified, the ending index position for the search is the end of the string. + */ + public readonly Optional|ResolvesToInt|int|string $end; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $array Can be any valid expression as long as it resolves to an array. + * If the array expression resolves to a value of null or refers to a field that is missing, $indexOfArray returns null. + * If the array expression does not resolve to an array or null nor refers to a missing field, $indexOfArray returns an error. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $search + * @param Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * If unspecified, the starting index position for the search is the beginning of the string. + * @param Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * If unspecified, the ending index position for the search is the end of the string. + */ + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $array, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $search, + Optional|ResolvesToInt|int|string $start = Optional::Undefined, + Optional|ResolvesToInt|int|string $end = Optional::Undefined, + ) { + if (is_string($array) && ! str_starts_with($array, '$')) { + throw new InvalidArgumentException('Argument $array can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($array) && ! array_is_list($array)) { + throw new InvalidArgumentException('Expected $array argument to be a list, got an associative array.'); + } + + $this->array = $array; + $this->search = $search; + if (is_string($start) && ! str_starts_with($start, '$')) { + throw new InvalidArgumentException('Argument $start can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->start = $start; + if (is_string($end) && ! str_starts_with($end, '$')) { + throw new InvalidArgumentException('Argument $end can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->end = $end; + } +} diff --git a/src/Builder/Expression/IndexOfBytesOperator.php b/src/Builder/Expression/IndexOfBytesOperator.php new file mode 100644 index 000000000..e2f2a1cae --- /dev/null +++ b/src/Builder/Expression/IndexOfBytesOperator.php @@ -0,0 +1,82 @@ + 'string', 'substring' => 'substring', 'start' => 'start', 'end' => 'end']; + + /** + * @var ResolvesToString|string $string Can be any valid expression as long as it resolves to a string. + * If the string expression resolves to a value of null or refers to a field that is missing, $indexOfBytes returns null. + * If the string expression does not resolve to a string or null nor refers to a missing field, $indexOfBytes returns an error. + */ + public readonly ResolvesToString|string $string; + + /** @var ResolvesToString|string $substring Can be any valid expression as long as it resolves to a string. */ + public readonly ResolvesToString|string $substring; + + /** + * @var Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * If unspecified, the starting index position for the search is the beginning of the string. + */ + public readonly Optional|ResolvesToInt|int|string $start; + + /** + * @var Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * If unspecified, the ending index position for the search is the end of the string. + */ + public readonly Optional|ResolvesToInt|int|string $end; + + /** + * @param ResolvesToString|string $string Can be any valid expression as long as it resolves to a string. + * If the string expression resolves to a value of null or refers to a field that is missing, $indexOfBytes returns null. + * If the string expression does not resolve to a string or null nor refers to a missing field, $indexOfBytes returns an error. + * @param ResolvesToString|string $substring Can be any valid expression as long as it resolves to a string. + * @param Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * If unspecified, the starting index position for the search is the beginning of the string. + * @param Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * If unspecified, the ending index position for the search is the end of the string. + */ + public function __construct( + ResolvesToString|string $string, + ResolvesToString|string $substring, + Optional|ResolvesToInt|int|string $start = Optional::Undefined, + Optional|ResolvesToInt|int|string $end = Optional::Undefined, + ) { + $this->string = $string; + $this->substring = $substring; + if (is_string($start) && ! str_starts_with($start, '$')) { + throw new InvalidArgumentException('Argument $start can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->start = $start; + if (is_string($end) && ! str_starts_with($end, '$')) { + throw new InvalidArgumentException('Argument $end can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->end = $end; + } +} diff --git a/src/Builder/Expression/IndexOfCPOperator.php b/src/Builder/Expression/IndexOfCPOperator.php new file mode 100644 index 000000000..67b0c33ea --- /dev/null +++ b/src/Builder/Expression/IndexOfCPOperator.php @@ -0,0 +1,82 @@ + 'string', 'substring' => 'substring', 'start' => 'start', 'end' => 'end']; + + /** + * @var ResolvesToString|string $string Can be any valid expression as long as it resolves to a string. + * If the string expression resolves to a value of null or refers to a field that is missing, $indexOfCP returns null. + * If the string expression does not resolve to a string or null nor refers to a missing field, $indexOfCP returns an error. + */ + public readonly ResolvesToString|string $string; + + /** @var ResolvesToString|string $substring Can be any valid expression as long as it resolves to a string. */ + public readonly ResolvesToString|string $substring; + + /** + * @var Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * If unspecified, the starting index position for the search is the beginning of the string. + */ + public readonly Optional|ResolvesToInt|int|string $start; + + /** + * @var Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * If unspecified, the ending index position for the search is the end of the string. + */ + public readonly Optional|ResolvesToInt|int|string $end; + + /** + * @param ResolvesToString|string $string Can be any valid expression as long as it resolves to a string. + * If the string expression resolves to a value of null or refers to a field that is missing, $indexOfCP returns null. + * If the string expression does not resolve to a string or null nor refers to a missing field, $indexOfCP returns an error. + * @param ResolvesToString|string $substring Can be any valid expression as long as it resolves to a string. + * @param Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * If unspecified, the starting index position for the search is the beginning of the string. + * @param Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * If unspecified, the ending index position for the search is the end of the string. + */ + public function __construct( + ResolvesToString|string $string, + ResolvesToString|string $substring, + Optional|ResolvesToInt|int|string $start = Optional::Undefined, + Optional|ResolvesToInt|int|string $end = Optional::Undefined, + ) { + $this->string = $string; + $this->substring = $substring; + if (is_string($start) && ! str_starts_with($start, '$')) { + throw new InvalidArgumentException('Argument $start can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->start = $start; + if (is_string($end) && ! str_starts_with($end, '$')) { + throw new InvalidArgumentException('Argument $end can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->end = $end; + } +} diff --git a/src/Builder/Expression/IntFieldPath.php b/src/Builder/Expression/IntFieldPath.php new file mode 100644 index 000000000..dc9baeecb --- /dev/null +++ b/src/Builder/Expression/IntFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/IsArrayOperator.php b/src/Builder/Expression/IsArrayOperator.php new file mode 100644 index 000000000..136fc42b4 --- /dev/null +++ b/src/Builder/Expression/IsArrayOperator.php @@ -0,0 +1,41 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/IsNumberOperator.php b/src/Builder/Expression/IsNumberOperator.php new file mode 100644 index 000000000..96034de47 --- /dev/null +++ b/src/Builder/Expression/IsNumberOperator.php @@ -0,0 +1,43 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/IsoDayOfWeekOperator.php b/src/Builder/Expression/IsoDayOfWeekOperator.php new file mode 100644 index 000000000..46261538a --- /dev/null +++ b/src/Builder/Expression/IsoDayOfWeekOperator.php @@ -0,0 +1,56 @@ + 'date', 'timezone' => 'timezone']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/IsoWeekOperator.php b/src/Builder/Expression/IsoWeekOperator.php new file mode 100644 index 000000000..e59d66dc9 --- /dev/null +++ b/src/Builder/Expression/IsoWeekOperator.php @@ -0,0 +1,56 @@ + 'date', 'timezone' => 'timezone']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/IsoWeekYearOperator.php b/src/Builder/Expression/IsoWeekYearOperator.php new file mode 100644 index 000000000..2fe1440e4 --- /dev/null +++ b/src/Builder/Expression/IsoWeekYearOperator.php @@ -0,0 +1,56 @@ + 'date', 'timezone' => 'timezone']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/JavascriptFieldPath.php b/src/Builder/Expression/JavascriptFieldPath.php new file mode 100644 index 000000000..e371ab7a9 --- /dev/null +++ b/src/Builder/Expression/JavascriptFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/LastNOperator.php b/src/Builder/Expression/LastNOperator.php new file mode 100644 index 000000000..be714cd9b --- /dev/null +++ b/src/Builder/Expression/LastNOperator.php @@ -0,0 +1,63 @@ + 'n', 'input' => 'input']; + + /** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. */ + public readonly ResolvesToInt|int|string $n; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; + + /** + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. + */ + public function __construct( + ResolvesToInt|int|string $n, + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ) { + if (is_string($n) && ! str_starts_with($n, '$')) { + throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->n = $n; + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($input) && ! array_is_list($input)) { + throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); + } + + $this->input = $input; + } +} diff --git a/src/Builder/Expression/LastOperator.php b/src/Builder/Expression/LastOperator.php new file mode 100644 index 000000000..68043d7d5 --- /dev/null +++ b/src/Builder/Expression/LastOperator.php @@ -0,0 +1,52 @@ + 'expression']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression + */ + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($expression) && ! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/LetOperator.php b/src/Builder/Expression/LetOperator.php new file mode 100644 index 000000000..e3dfdf805 --- /dev/null +++ b/src/Builder/Expression/LetOperator.php @@ -0,0 +1,54 @@ + 'vars', 'in' => 'in']; + + /** + * @var Document|Serializable|array|stdClass $vars Assignment block for the variables accessible in the in expression. To assign a variable, specify a string for the variable name and assign a valid expression for the value. + * The variable assignments have no meaning outside the in expression, not even within the vars block itself. + */ + public readonly Document|Serializable|stdClass|array $vars; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $in The expression to evaluate. */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in; + + /** + * @param Document|Serializable|array|stdClass $vars Assignment block for the variables accessible in the in expression. To assign a variable, specify a string for the variable name and assign a valid expression for the value. + * The variable assignments have no meaning outside the in expression, not even within the vars block itself. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $in The expression to evaluate. + */ + public function __construct( + Document|Serializable|stdClass|array $vars, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, + ) { + $this->vars = $vars; + $this->in = $in; + } +} diff --git a/src/Builder/Expression/LiteralOperator.php b/src/Builder/Expression/LiteralOperator.php new file mode 100644 index 000000000..fe65495d0 --- /dev/null +++ b/src/Builder/Expression/LiteralOperator.php @@ -0,0 +1,39 @@ + 'value']; + + /** @var DateTimeInterface|Type|array|bool|float|int|null|stdClass|string $value If the value is an expression, $literal does not evaluate the expression but instead returns the unparsed expression. */ + public readonly DateTimeInterface|Type|stdClass|array|bool|float|int|null|string $value; + + /** + * @param DateTimeInterface|Type|array|bool|float|int|null|stdClass|string $value If the value is an expression, $literal does not evaluate the expression but instead returns the unparsed expression. + */ + public function __construct(DateTimeInterface|Type|stdClass|array|bool|float|int|null|string $value) + { + $this->value = $value; + } +} diff --git a/src/Builder/Expression/LnOperator.php b/src/Builder/Expression/LnOperator.php new file mode 100644 index 000000000..1848fbec6 --- /dev/null +++ b/src/Builder/Expression/LnOperator.php @@ -0,0 +1,47 @@ +, Math.E ] expression, where Math.E is a JavaScript representation for Euler's number e. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/ln/ + * @internal + */ +final class LnOperator implements ResolvesToDouble, OperatorInterface +{ + public const ENCODE = Encode::Single; + public const NAME = '$ln'; + public const PROPERTIES = ['number' => 'number']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. For more information on expressions, see Expressions. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $number; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. For more information on expressions, see Expressions. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $number) + { + if (is_string($number) && ! str_starts_with($number, '$')) { + throw new InvalidArgumentException('Argument $number can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->number = $number; + } +} diff --git a/src/Builder/Expression/Log10Operator.php b/src/Builder/Expression/Log10Operator.php new file mode 100644 index 000000000..24ea9824d --- /dev/null +++ b/src/Builder/Expression/Log10Operator.php @@ -0,0 +1,46 @@ + 'number']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $number; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $number) + { + if (is_string($number) && ! str_starts_with($number, '$')) { + throw new InvalidArgumentException('Argument $number can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->number = $number; + } +} diff --git a/src/Builder/Expression/LogOperator.php b/src/Builder/Expression/LogOperator.php new file mode 100644 index 000000000..b61fa3bef --- /dev/null +++ b/src/Builder/Expression/LogOperator.php @@ -0,0 +1,57 @@ + 'number', 'base' => 'base']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $number; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $base Any valid expression as long as it resolves to a positive number greater than 1. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $base; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $base Any valid expression as long as it resolves to a positive number greater than 1. + */ + public function __construct( + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Decimal128|Int64|ResolvesToNumber|float|int|string $base, + ) { + if (is_string($number) && ! str_starts_with($number, '$')) { + throw new InvalidArgumentException('Argument $number can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->number = $number; + if (is_string($base) && ! str_starts_with($base, '$')) { + throw new InvalidArgumentException('Argument $base can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->base = $base; + } +} diff --git a/src/Builder/Expression/LongFieldPath.php b/src/Builder/Expression/LongFieldPath.php new file mode 100644 index 000000000..7d18c015b --- /dev/null +++ b/src/Builder/Expression/LongFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/LtOperator.php b/src/Builder/Expression/LtOperator.php new file mode 100644 index 000000000..b29d33ef7 --- /dev/null +++ b/src/Builder/Expression/LtOperator.php @@ -0,0 +1,47 @@ + 'expression1', 'expression2' => 'expression2']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, + ) { + $this->expression1 = $expression1; + $this->expression2 = $expression2; + } +} diff --git a/src/Builder/Expression/LteOperator.php b/src/Builder/Expression/LteOperator.php new file mode 100644 index 000000000..2bd7ab4fd --- /dev/null +++ b/src/Builder/Expression/LteOperator.php @@ -0,0 +1,47 @@ + 'expression1', 'expression2' => 'expression2']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, + ) { + $this->expression1 = $expression1; + $this->expression2 = $expression2; + } +} diff --git a/src/Builder/Expression/LtrimOperator.php b/src/Builder/Expression/LtrimOperator.php new file mode 100644 index 000000000..0dd94eaab --- /dev/null +++ b/src/Builder/Expression/LtrimOperator.php @@ -0,0 +1,51 @@ + 'input', 'chars' => 'chars']; + + /** @var ResolvesToString|string $input The string to trim. The argument can be any valid expression that resolves to a string. */ + public readonly ResolvesToString|string $input; + + /** + * @var Optional|ResolvesToString|string $chars The character(s) to trim from the beginning of the input. + * The argument can be any valid expression that resolves to a string. The $ltrim operator breaks down the string into individual UTF code point to trim from input. + * If unspecified, $ltrim removes whitespace characters, including the null character. + */ + public readonly Optional|ResolvesToString|string $chars; + + /** + * @param ResolvesToString|string $input The string to trim. The argument can be any valid expression that resolves to a string. + * @param Optional|ResolvesToString|string $chars The character(s) to trim from the beginning of the input. + * The argument can be any valid expression that resolves to a string. The $ltrim operator breaks down the string into individual UTF code point to trim from input. + * If unspecified, $ltrim removes whitespace characters, including the null character. + */ + public function __construct( + ResolvesToString|string $input, + Optional|ResolvesToString|string $chars = Optional::Undefined, + ) { + $this->input = $input; + $this->chars = $chars; + } +} diff --git a/src/Builder/Expression/MapOperator.php b/src/Builder/Expression/MapOperator.php new file mode 100644 index 000000000..a965e69c6 --- /dev/null +++ b/src/Builder/Expression/MapOperator.php @@ -0,0 +1,70 @@ + 'input', 'in' => 'in', 'as' => 'as']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to an array. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $in An expression that is applied to each element of the input array. The expression references each element individually with the variable name specified in as. */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in; + + /** @var Optional|ResolvesToString|string $as A name for the variable that represents each individual element of the input array. If no name is specified, the variable name defaults to this. */ + public readonly Optional|ResolvesToString|string $as; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to an array. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $in An expression that is applied to each element of the input array. The expression references each element individually with the variable name specified in as. + * @param Optional|ResolvesToString|string $as A name for the variable that represents each individual element of the input array. If no name is specified, the variable name defaults to this. + */ + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, + Optional|ResolvesToString|string $as = Optional::Undefined, + ) { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($input) && ! array_is_list($input)) { + throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); + } + + $this->input = $input; + $this->in = $in; + $this->as = $as; + } +} diff --git a/src/Builder/Expression/MaxNOperator.php b/src/Builder/Expression/MaxNOperator.php new file mode 100644 index 000000000..b0da2c042 --- /dev/null +++ b/src/Builder/Expression/MaxNOperator.php @@ -0,0 +1,63 @@ + 'input', 'n' => 'n']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; + + /** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ + public readonly ResolvesToInt|int|string $n; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. + */ + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, + ) { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($input) && ! array_is_list($input)) { + throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); + } + + $this->input = $input; + if (is_string($n) && ! str_starts_with($n, '$')) { + throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->n = $n; + } +} diff --git a/src/Builder/Expression/MaxOperator.php b/src/Builder/Expression/MaxOperator.php new file mode 100644 index 000000000..acac1c5d6 --- /dev/null +++ b/src/Builder/Expression/MaxOperator.php @@ -0,0 +1,54 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string ...$expression + * @no-named-arguments + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, + ) { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/MedianOperator.php b/src/Builder/Expression/MedianOperator.php new file mode 100644 index 000000000..ec9afbdcf --- /dev/null +++ b/src/Builder/Expression/MedianOperator.php @@ -0,0 +1,66 @@ + 'input', 'method' => 'method']; + + /** @var BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int|string $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. */ + public readonly Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int|string $input; + + /** @var string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. */ + public readonly string $method; + + /** + * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int|string $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. + * @param string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. + */ + public function __construct( + Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int|string $input, + string $method, + ) { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($input) && ! array_is_list($input)) { + throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); + } + + $this->input = $input; + $this->method = $method; + } +} diff --git a/src/Builder/Expression/MergeObjectsOperator.php b/src/Builder/Expression/MergeObjectsOperator.php new file mode 100644 index 000000000..e17e1ae1d --- /dev/null +++ b/src/Builder/Expression/MergeObjectsOperator.php @@ -0,0 +1,51 @@ + 'document']; + + /** @var list $document Any valid expression that resolves to a document. */ + public readonly array $document; + + /** + * @param Document|ResolvesToObject|Serializable|array|stdClass|string ...$document Any valid expression that resolves to a document. + * @no-named-arguments + */ + public function __construct(Document|Serializable|ResolvesToObject|stdClass|array|string ...$document) + { + if (\count($document) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $document, got %d.', 1, \count($document))); + } + + if (! array_is_list($document)) { + throw new InvalidArgumentException('Expected $document arguments to be a list (array), named arguments are not supported'); + } + + $this->document = $document; + } +} diff --git a/src/Builder/Expression/MetaOperator.php b/src/Builder/Expression/MetaOperator.php new file mode 100644 index 000000000..ec1fd63e6 --- /dev/null +++ b/src/Builder/Expression/MetaOperator.php @@ -0,0 +1,36 @@ + 'keyword']; + + /** @var string $keyword */ + public readonly string $keyword; + + /** + * @param string $keyword + */ + public function __construct(string $keyword) + { + $this->keyword = $keyword; + } +} diff --git a/src/Builder/Expression/MillisecondOperator.php b/src/Builder/Expression/MillisecondOperator.php new file mode 100644 index 000000000..91dc5917c --- /dev/null +++ b/src/Builder/Expression/MillisecondOperator.php @@ -0,0 +1,56 @@ + 'date', 'timezone' => 'timezone']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/MinNOperator.php b/src/Builder/Expression/MinNOperator.php new file mode 100644 index 000000000..50b22e1fd --- /dev/null +++ b/src/Builder/Expression/MinNOperator.php @@ -0,0 +1,63 @@ + 'input', 'n' => 'n']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; + + /** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ + public readonly ResolvesToInt|int|string $n; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. + */ + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, + ) { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($input) && ! array_is_list($input)) { + throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); + } + + $this->input = $input; + if (is_string($n) && ! str_starts_with($n, '$')) { + throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->n = $n; + } +} diff --git a/src/Builder/Expression/MinOperator.php b/src/Builder/Expression/MinOperator.php new file mode 100644 index 000000000..28b707d45 --- /dev/null +++ b/src/Builder/Expression/MinOperator.php @@ -0,0 +1,54 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string ...$expression + * @no-named-arguments + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, + ) { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/MinuteOperator.php b/src/Builder/Expression/MinuteOperator.php new file mode 100644 index 000000000..ff86f8857 --- /dev/null +++ b/src/Builder/Expression/MinuteOperator.php @@ -0,0 +1,56 @@ + 'date', 'timezone' => 'timezone']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/ModOperator.php b/src/Builder/Expression/ModOperator.php new file mode 100644 index 000000000..0e7a44df8 --- /dev/null +++ b/src/Builder/Expression/ModOperator.php @@ -0,0 +1,57 @@ + 'dividend', 'divisor' => 'divisor']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $dividend The first argument is the dividend, and the second argument is the divisor; i.e. first argument is divided by the second argument. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $dividend; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $divisor */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $divisor; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $dividend The first argument is the dividend, and the second argument is the divisor; i.e. first argument is divided by the second argument. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $divisor + */ + public function __construct( + Decimal128|Int64|ResolvesToNumber|float|int|string $dividend, + Decimal128|Int64|ResolvesToNumber|float|int|string $divisor, + ) { + if (is_string($dividend) && ! str_starts_with($dividend, '$')) { + throw new InvalidArgumentException('Argument $dividend can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->dividend = $dividend; + if (is_string($divisor) && ! str_starts_with($divisor, '$')) { + throw new InvalidArgumentException('Argument $divisor can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->divisor = $divisor; + } +} diff --git a/src/Builder/Expression/MonthOperator.php b/src/Builder/Expression/MonthOperator.php new file mode 100644 index 000000000..7fd6e1760 --- /dev/null +++ b/src/Builder/Expression/MonthOperator.php @@ -0,0 +1,56 @@ + 'date', 'timezone' => 'timezone']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/MultiplyOperator.php b/src/Builder/Expression/MultiplyOperator.php new file mode 100644 index 000000000..31d781ad4 --- /dev/null +++ b/src/Builder/Expression/MultiplyOperator.php @@ -0,0 +1,54 @@ + 'expression']; + + /** + * @var list $expression The arguments can be any valid expression as long as they resolve to numbers. + * Starting in MongoDB 6.1 you can optimize the $multiply operation. To improve performance, group references at the end of the argument list. + */ + public readonly array $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression The arguments can be any valid expression as long as they resolve to numbers. + * Starting in MongoDB 6.1 you can optimize the $multiply operation. To improve performance, group references at the end of the argument list. + * @no-named-arguments + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression) + { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/NeOperator.php b/src/Builder/Expression/NeOperator.php new file mode 100644 index 000000000..b9d60c6e6 --- /dev/null +++ b/src/Builder/Expression/NeOperator.php @@ -0,0 +1,47 @@ + 'expression1', 'expression2' => 'expression2']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, + ) { + $this->expression1 = $expression1; + $this->expression2 = $expression2; + } +} diff --git a/src/Builder/Expression/NotOperator.php b/src/Builder/Expression/NotOperator.php new file mode 100644 index 000000000..212898961 --- /dev/null +++ b/src/Builder/Expression/NotOperator.php @@ -0,0 +1,41 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|ResolvesToBool|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ResolvesToBool|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|ResolvesToBool|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ResolvesToBool|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/NullFieldPath.php b/src/Builder/Expression/NullFieldPath.php new file mode 100644 index 000000000..63bf171dc --- /dev/null +++ b/src/Builder/Expression/NullFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/NumberFieldPath.php b/src/Builder/Expression/NumberFieldPath.php new file mode 100644 index 000000000..d8ab23a23 --- /dev/null +++ b/src/Builder/Expression/NumberFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/ObjectFieldPath.php b/src/Builder/Expression/ObjectFieldPath.php new file mode 100644 index 000000000..082989831 --- /dev/null +++ b/src/Builder/Expression/ObjectFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/ObjectIdFieldPath.php b/src/Builder/Expression/ObjectIdFieldPath.php new file mode 100644 index 000000000..4428c1a39 --- /dev/null +++ b/src/Builder/Expression/ObjectIdFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/ObjectToArrayOperator.php b/src/Builder/Expression/ObjectToArrayOperator.php new file mode 100644 index 000000000..c8a260970 --- /dev/null +++ b/src/Builder/Expression/ObjectToArrayOperator.php @@ -0,0 +1,47 @@ + 'object']; + + /** @var Document|ResolvesToObject|Serializable|array|stdClass|string $object Any valid expression as long as it resolves to a document object. $objectToArray applies to the top-level fields of its argument. If the argument is a document that itself contains embedded document fields, the $objectToArray does not recursively apply to the embedded document fields. */ + public readonly Document|Serializable|ResolvesToObject|stdClass|array|string $object; + + /** + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $object Any valid expression as long as it resolves to a document object. $objectToArray applies to the top-level fields of its argument. If the argument is a document that itself contains embedded document fields, the $objectToArray does not recursively apply to the embedded document fields. + */ + public function __construct(Document|Serializable|ResolvesToObject|stdClass|array|string $object) + { + if (is_string($object) && ! str_starts_with($object, '$')) { + throw new InvalidArgumentException('Argument $object can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->object = $object; + } +} diff --git a/src/Builder/Expression/OrOperator.php b/src/Builder/Expression/OrOperator.php new file mode 100644 index 000000000..4289c2b7e --- /dev/null +++ b/src/Builder/Expression/OrOperator.php @@ -0,0 +1,53 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|ResolvesToBool|Type|array|bool|float|int|null|stdClass|string ...$expression + * @no-named-arguments + */ + public function __construct( + DateTimeInterface|Type|ResolvesToBool|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, + ) { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/PercentileOperator.php b/src/Builder/Expression/PercentileOperator.php new file mode 100644 index 000000000..c30775ca3 --- /dev/null +++ b/src/Builder/Expression/PercentileOperator.php @@ -0,0 +1,87 @@ + 'input', 'p' => 'p', 'method' => 'method']; + + /** @var BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int|string $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. */ + public readonly Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int|string $input; + + /** + * @var BSONArray|PackedArray|ResolvesToArray|array|string $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. + * $percentile returns results in the same order as the elements in p. + */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $p; + + /** @var string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. */ + public readonly string $method; + + /** + * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int|string $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. + * $percentile returns results in the same order as the elements in p. + * @param string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. + */ + public function __construct( + Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int|string $input, + PackedArray|ResolvesToArray|BSONArray|array|string $p, + string $method, + ) { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($input) && ! array_is_list($input)) { + throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); + } + + $this->input = $input; + if (is_string($p) && ! str_starts_with($p, '$')) { + throw new InvalidArgumentException('Argument $p can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($p) && ! array_is_list($p)) { + throw new InvalidArgumentException('Expected $p argument to be a list, got an associative array.'); + } + + $this->p = $p; + $this->method = $method; + } +} diff --git a/src/Builder/Expression/PowOperator.php b/src/Builder/Expression/PowOperator.php new file mode 100644 index 000000000..bf132280f --- /dev/null +++ b/src/Builder/Expression/PowOperator.php @@ -0,0 +1,57 @@ + 'number', 'exponent' => 'exponent']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $number */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $number; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $exponent */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $exponent; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $exponent + */ + public function __construct( + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Decimal128|Int64|ResolvesToNumber|float|int|string $exponent, + ) { + if (is_string($number) && ! str_starts_with($number, '$')) { + throw new InvalidArgumentException('Argument $number can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->number = $number; + if (is_string($exponent) && ! str_starts_with($exponent, '$')) { + throw new InvalidArgumentException('Argument $exponent can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->exponent = $exponent; + } +} diff --git a/src/Builder/Expression/RadiansToDegreesOperator.php b/src/Builder/Expression/RadiansToDegreesOperator.php new file mode 100644 index 000000000..c8e4d5292 --- /dev/null +++ b/src/Builder/Expression/RadiansToDegreesOperator.php @@ -0,0 +1,46 @@ + 'expression']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/RandOperator.php b/src/Builder/Expression/RandOperator.php new file mode 100644 index 000000000..26da27637 --- /dev/null +++ b/src/Builder/Expression/RandOperator.php @@ -0,0 +1,28 @@ + 'start', 'end' => 'end', 'step' => 'step']; + + /** @var ResolvesToInt|int|string $start An integer that specifies the start of the sequence. Can be any valid expression that resolves to an integer. */ + public readonly ResolvesToInt|int|string $start; + + /** @var ResolvesToInt|int|string $end An integer that specifies the exclusive upper limit of the sequence. Can be any valid expression that resolves to an integer. */ + public readonly ResolvesToInt|int|string $end; + + /** @var Optional|ResolvesToInt|int|string $step An integer that specifies the increment value. Can be any valid expression that resolves to a non-zero integer. Defaults to 1. */ + public readonly Optional|ResolvesToInt|int|string $step; + + /** + * @param ResolvesToInt|int|string $start An integer that specifies the start of the sequence. Can be any valid expression that resolves to an integer. + * @param ResolvesToInt|int|string $end An integer that specifies the exclusive upper limit of the sequence. Can be any valid expression that resolves to an integer. + * @param Optional|ResolvesToInt|int|string $step An integer that specifies the increment value. Can be any valid expression that resolves to a non-zero integer. Defaults to 1. + */ + public function __construct( + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $end, + Optional|ResolvesToInt|int|string $step = Optional::Undefined, + ) { + if (is_string($start) && ! str_starts_with($start, '$')) { + throw new InvalidArgumentException('Argument $start can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->start = $start; + if (is_string($end) && ! str_starts_with($end, '$')) { + throw new InvalidArgumentException('Argument $end can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->end = $end; + if (is_string($step) && ! str_starts_with($step, '$')) { + throw new InvalidArgumentException('Argument $step can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->step = $step; + } +} diff --git a/src/Builder/Expression/ReduceOperator.php b/src/Builder/Expression/ReduceOperator.php new file mode 100644 index 000000000..d285a4532 --- /dev/null +++ b/src/Builder/Expression/ReduceOperator.php @@ -0,0 +1,83 @@ + 'input', 'initialValue' => 'initialValue', 'in' => 'in']; + + /** + * @var BSONArray|PackedArray|ResolvesToArray|array|string $input Can be any valid expression that resolves to an array. + * If the argument resolves to a value of null or refers to a missing field, $reduce returns null. + * If the argument does not resolve to an array or null nor refers to a missing field, $reduce returns an error. + */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $initialValue The initial cumulative value set before in is applied to the first element of the input array. */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $initialValue; + + /** + * @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $in A valid expression that $reduce applies to each element in the input array in left-to-right order. Wrap the input value with $reverseArray to yield the equivalent of applying the combining expression from right-to-left. + * During evaluation of the in expression, two variables will be available: + * - value is the variable that represents the cumulative value of the expression. + * - this is the variable that refers to the element being processed. + */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input Can be any valid expression that resolves to an array. + * If the argument resolves to a value of null or refers to a missing field, $reduce returns null. + * If the argument does not resolve to an array or null nor refers to a missing field, $reduce returns an error. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $initialValue The initial cumulative value set before in is applied to the first element of the input array. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $in A valid expression that $reduce applies to each element in the input array in left-to-right order. Wrap the input value with $reverseArray to yield the equivalent of applying the combining expression from right-to-left. + * During evaluation of the in expression, two variables will be available: + * - value is the variable that represents the cumulative value of the expression. + * - this is the variable that refers to the element being processed. + */ + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $initialValue, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, + ) { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($input) && ! array_is_list($input)) { + throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); + } + + $this->input = $input; + $this->initialValue = $initialValue; + $this->in = $in; + } +} diff --git a/src/Builder/Expression/RegexFieldPath.php b/src/Builder/Expression/RegexFieldPath.php new file mode 100644 index 000000000..14950bee7 --- /dev/null +++ b/src/Builder/Expression/RegexFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/RegexFindAllOperator.php b/src/Builder/Expression/RegexFindAllOperator.php new file mode 100644 index 000000000..e6e36a9fb --- /dev/null +++ b/src/Builder/Expression/RegexFindAllOperator.php @@ -0,0 +1,52 @@ + 'input', 'regex' => 'regex', 'options' => 'options']; + + /** @var ResolvesToString|string $input The string on which you wish to apply the regex pattern. Can be a string or any valid expression that resolves to a string. */ + public readonly ResolvesToString|string $input; + + /** @var Regex|ResolvesToString|string $regex The regex pattern to apply. Can be any valid expression that resolves to either a string or regex pattern //. When using the regex //, you can also specify the regex options i and m (but not the s or x options) */ + public readonly Regex|ResolvesToString|string $regex; + + /** @var Optional|string $options */ + public readonly Optional|string $options; + + /** + * @param ResolvesToString|string $input The string on which you wish to apply the regex pattern. Can be a string or any valid expression that resolves to a string. + * @param Regex|ResolvesToString|string $regex The regex pattern to apply. Can be any valid expression that resolves to either a string or regex pattern //. When using the regex //, you can also specify the regex options i and m (but not the s or x options) + * @param Optional|string $options + */ + public function __construct( + ResolvesToString|string $input, + Regex|ResolvesToString|string $regex, + Optional|string $options = Optional::Undefined, + ) { + $this->input = $input; + $this->regex = $regex; + $this->options = $options; + } +} diff --git a/src/Builder/Expression/RegexFindOperator.php b/src/Builder/Expression/RegexFindOperator.php new file mode 100644 index 000000000..81f713f35 --- /dev/null +++ b/src/Builder/Expression/RegexFindOperator.php @@ -0,0 +1,52 @@ + 'input', 'regex' => 'regex', 'options' => 'options']; + + /** @var ResolvesToString|string $input The string on which you wish to apply the regex pattern. Can be a string or any valid expression that resolves to a string. */ + public readonly ResolvesToString|string $input; + + /** @var Regex|ResolvesToString|string $regex The regex pattern to apply. Can be any valid expression that resolves to either a string or regex pattern //. When using the regex //, you can also specify the regex options i and m (but not the s or x options) */ + public readonly Regex|ResolvesToString|string $regex; + + /** @var Optional|string $options */ + public readonly Optional|string $options; + + /** + * @param ResolvesToString|string $input The string on which you wish to apply the regex pattern. Can be a string or any valid expression that resolves to a string. + * @param Regex|ResolvesToString|string $regex The regex pattern to apply. Can be any valid expression that resolves to either a string or regex pattern //. When using the regex //, you can also specify the regex options i and m (but not the s or x options) + * @param Optional|string $options + */ + public function __construct( + ResolvesToString|string $input, + Regex|ResolvesToString|string $regex, + Optional|string $options = Optional::Undefined, + ) { + $this->input = $input; + $this->regex = $regex; + $this->options = $options; + } +} diff --git a/src/Builder/Expression/RegexMatchOperator.php b/src/Builder/Expression/RegexMatchOperator.php new file mode 100644 index 000000000..50fbb1766 --- /dev/null +++ b/src/Builder/Expression/RegexMatchOperator.php @@ -0,0 +1,52 @@ + 'input', 'regex' => 'regex', 'options' => 'options']; + + /** @var ResolvesToString|string $input The string on which you wish to apply the regex pattern. Can be a string or any valid expression that resolves to a string. */ + public readonly ResolvesToString|string $input; + + /** @var Regex|ResolvesToString|string $regex The regex pattern to apply. Can be any valid expression that resolves to either a string or regex pattern //. When using the regex //, you can also specify the regex options i and m (but not the s or x options) */ + public readonly Regex|ResolvesToString|string $regex; + + /** @var Optional|string $options */ + public readonly Optional|string $options; + + /** + * @param ResolvesToString|string $input The string on which you wish to apply the regex pattern. Can be a string or any valid expression that resolves to a string. + * @param Regex|ResolvesToString|string $regex The regex pattern to apply. Can be any valid expression that resolves to either a string or regex pattern //. When using the regex //, you can also specify the regex options i and m (but not the s or x options) + * @param Optional|string $options + */ + public function __construct( + ResolvesToString|string $input, + Regex|ResolvesToString|string $regex, + Optional|string $options = Optional::Undefined, + ) { + $this->input = $input; + $this->regex = $regex; + $this->options = $options; + } +} diff --git a/src/Builder/Expression/ReplaceAllOperator.php b/src/Builder/Expression/ReplaceAllOperator.php new file mode 100644 index 000000000..5cede16d4 --- /dev/null +++ b/src/Builder/Expression/ReplaceAllOperator.php @@ -0,0 +1,52 @@ + 'input', 'find' => 'find', 'replacement' => 'replacement']; + + /** @var ResolvesToNull|ResolvesToString|null|string $input The string on which you wish to apply the find. Can be any valid expression that resolves to a string or a null. If input refers to a field that is missing, $replaceAll returns null. */ + public readonly ResolvesToNull|ResolvesToString|null|string $input; + + /** @var Regex|ResolvesToNull|ResolvesToRegex|ResolvesToString|null|string $find The string to search for within the given input. Can be any valid expression that resolves to a string or a null. If find refers to a field that is missing, $replaceAll returns null. */ + public readonly Regex|ResolvesToNull|ResolvesToRegex|ResolvesToString|null|string $find; + + /** @var ResolvesToNull|ResolvesToString|null|string $replacement The string to use to replace all matched instances of find in input. Can be any valid expression that resolves to a string or a null. */ + public readonly ResolvesToNull|ResolvesToString|null|string $replacement; + + /** + * @param ResolvesToNull|ResolvesToString|null|string $input The string on which you wish to apply the find. Can be any valid expression that resolves to a string or a null. If input refers to a field that is missing, $replaceAll returns null. + * @param Regex|ResolvesToNull|ResolvesToRegex|ResolvesToString|null|string $find The string to search for within the given input. Can be any valid expression that resolves to a string or a null. If find refers to a field that is missing, $replaceAll returns null. + * @param ResolvesToNull|ResolvesToString|null|string $replacement The string to use to replace all matched instances of find in input. Can be any valid expression that resolves to a string or a null. + */ + public function __construct( + ResolvesToNull|ResolvesToString|null|string $input, + Regex|ResolvesToNull|ResolvesToRegex|ResolvesToString|null|string $find, + ResolvesToNull|ResolvesToString|null|string $replacement, + ) { + $this->input = $input; + $this->find = $find; + $this->replacement = $replacement; + } +} diff --git a/src/Builder/Expression/ReplaceOneOperator.php b/src/Builder/Expression/ReplaceOneOperator.php new file mode 100644 index 000000000..0237aacc0 --- /dev/null +++ b/src/Builder/Expression/ReplaceOneOperator.php @@ -0,0 +1,50 @@ + 'input', 'find' => 'find', 'replacement' => 'replacement']; + + /** @var ResolvesToNull|ResolvesToString|null|string $input The string on which you wish to apply the find. Can be any valid expression that resolves to a string or a null. If input refers to a field that is missing, $replaceAll returns null. */ + public readonly ResolvesToNull|ResolvesToString|null|string $input; + + /** @var ResolvesToNull|ResolvesToString|null|string $find The string to search for within the given input. Can be any valid expression that resolves to a string or a null. If find refers to a field that is missing, $replaceAll returns null. */ + public readonly ResolvesToNull|ResolvesToString|null|string $find; + + /** @var ResolvesToNull|ResolvesToString|null|string $replacement The string to use to replace all matched instances of find in input. Can be any valid expression that resolves to a string or a null. */ + public readonly ResolvesToNull|ResolvesToString|null|string $replacement; + + /** + * @param ResolvesToNull|ResolvesToString|null|string $input The string on which you wish to apply the find. Can be any valid expression that resolves to a string or a null. If input refers to a field that is missing, $replaceAll returns null. + * @param ResolvesToNull|ResolvesToString|null|string $find The string to search for within the given input. Can be any valid expression that resolves to a string or a null. If find refers to a field that is missing, $replaceAll returns null. + * @param ResolvesToNull|ResolvesToString|null|string $replacement The string to use to replace all matched instances of find in input. Can be any valid expression that resolves to a string or a null. + */ + public function __construct( + ResolvesToNull|ResolvesToString|null|string $input, + ResolvesToNull|ResolvesToString|null|string $find, + ResolvesToNull|ResolvesToString|null|string $replacement, + ) { + $this->input = $input; + $this->find = $find; + $this->replacement = $replacement; + } +} diff --git a/src/Builder/Expression/ResolvesToAny.php b/src/Builder/Expression/ResolvesToAny.php new file mode 100644 index 000000000..665564887 --- /dev/null +++ b/src/Builder/Expression/ResolvesToAny.php @@ -0,0 +1,13 @@ + 'expression']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression The argument can be any valid expression as long as it resolves to an array. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression The argument can be any valid expression as long as it resolves to an array. + */ + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($expression) && ! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/RoundOperator.php b/src/Builder/Expression/RoundOperator.php new file mode 100644 index 000000000..0deb81104 --- /dev/null +++ b/src/Builder/Expression/RoundOperator.php @@ -0,0 +1,62 @@ + 'number', 'place' => 'place']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. + * $round returns an error if the expression resolves to a non-numeric data type. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $number; + + /** @var Optional|ResolvesToInt|int|string $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. */ + public readonly Optional|ResolvesToInt|int|string $place; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. + * $round returns an error if the expression resolves to a non-numeric data type. + * @param Optional|ResolvesToInt|int|string $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. + */ + public function __construct( + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Optional|ResolvesToInt|int|string $place = Optional::Undefined, + ) { + if (is_string($number) && ! str_starts_with($number, '$')) { + throw new InvalidArgumentException('Argument $number can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->number = $number; + if (is_string($place) && ! str_starts_with($place, '$')) { + throw new InvalidArgumentException('Argument $place can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->place = $place; + } +} diff --git a/src/Builder/Expression/RtrimOperator.php b/src/Builder/Expression/RtrimOperator.php new file mode 100644 index 000000000..46824f98a --- /dev/null +++ b/src/Builder/Expression/RtrimOperator.php @@ -0,0 +1,50 @@ + 'input', 'chars' => 'chars']; + + /** @var ResolvesToString|string $input The string to trim. The argument can be any valid expression that resolves to a string. */ + public readonly ResolvesToString|string $input; + + /** + * @var Optional|ResolvesToString|string $chars The character(s) to trim from the beginning of the input. + * The argument can be any valid expression that resolves to a string. The $ltrim operator breaks down the string into individual UTF code point to trim from input. + * If unspecified, $ltrim removes whitespace characters, including the null character. + */ + public readonly Optional|ResolvesToString|string $chars; + + /** + * @param ResolvesToString|string $input The string to trim. The argument can be any valid expression that resolves to a string. + * @param Optional|ResolvesToString|string $chars The character(s) to trim from the beginning of the input. + * The argument can be any valid expression that resolves to a string. The $ltrim operator breaks down the string into individual UTF code point to trim from input. + * If unspecified, $ltrim removes whitespace characters, including the null character. + */ + public function __construct( + ResolvesToString|string $input, + Optional|ResolvesToString|string $chars = Optional::Undefined, + ) { + $this->input = $input; + $this->chars = $chars; + } +} diff --git a/src/Builder/Expression/SecondOperator.php b/src/Builder/Expression/SecondOperator.php new file mode 100644 index 000000000..48ee9ad85 --- /dev/null +++ b/src/Builder/Expression/SecondOperator.php @@ -0,0 +1,56 @@ + 'date', 'timezone' => 'timezone']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/SetDifferenceOperator.php b/src/Builder/Expression/SetDifferenceOperator.php new file mode 100644 index 000000000..297897425 --- /dev/null +++ b/src/Builder/Expression/SetDifferenceOperator.php @@ -0,0 +1,67 @@ + 'expression1', 'expression2' => 'expression2']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression1 The arguments can be any valid expression as long as they each resolve to an array. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression1; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression2 The arguments can be any valid expression as long as they each resolve to an array. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression2; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression1 The arguments can be any valid expression as long as they each resolve to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression2 The arguments can be any valid expression as long as they each resolve to an array. + */ + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $expression1, + PackedArray|ResolvesToArray|BSONArray|array|string $expression2, + ) { + if (is_string($expression1) && ! str_starts_with($expression1, '$')) { + throw new InvalidArgumentException('Argument $expression1 can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($expression1) && ! array_is_list($expression1)) { + throw new InvalidArgumentException('Expected $expression1 argument to be a list, got an associative array.'); + } + + $this->expression1 = $expression1; + if (is_string($expression2) && ! str_starts_with($expression2, '$')) { + throw new InvalidArgumentException('Argument $expression2 can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($expression2) && ! array_is_list($expression2)) { + throw new InvalidArgumentException('Expected $expression2 argument to be a list, got an associative array.'); + } + + $this->expression2 = $expression2; + } +} diff --git a/src/Builder/Expression/SetEqualsOperator.php b/src/Builder/Expression/SetEqualsOperator.php new file mode 100644 index 000000000..c743c8cca --- /dev/null +++ b/src/Builder/Expression/SetEqualsOperator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$expression + * @no-named-arguments + */ + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string ...$expression) + { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/SetFieldOperator.php b/src/Builder/Expression/SetFieldOperator.php new file mode 100644 index 000000000..660832772 --- /dev/null +++ b/src/Builder/Expression/SetFieldOperator.php @@ -0,0 +1,68 @@ + 'field', 'input' => 'input', 'value' => 'value']; + + /** @var ResolvesToString|string $field Field in the input object that you want to add, update, or remove. field can be any valid expression that resolves to a string constant. */ + public readonly ResolvesToString|string $field; + + /** @var Document|ResolvesToObject|Serializable|array|stdClass|string $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. */ + public readonly Document|Serializable|ResolvesToObject|stdClass|array|string $input; + + /** + * @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $value The value that you want to assign to field. value can be any valid expression. + * Set to $$REMOVE to remove field from the input document. + */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $value; + + /** + * @param ResolvesToString|string $field Field in the input object that you want to add, update, or remove. field can be any valid expression that resolves to a string constant. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $value The value that you want to assign to field. value can be any valid expression. + * Set to $$REMOVE to remove field from the input document. + */ + public function __construct( + ResolvesToString|string $field, + Document|Serializable|ResolvesToObject|stdClass|array|string $input, + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $value, + ) { + $this->field = $field; + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->input = $input; + $this->value = $value; + } +} diff --git a/src/Builder/Expression/SetIntersectionOperator.php b/src/Builder/Expression/SetIntersectionOperator.php new file mode 100644 index 000000000..a27dd4e9b --- /dev/null +++ b/src/Builder/Expression/SetIntersectionOperator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$expression + * @no-named-arguments + */ + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string ...$expression) + { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/SetIsSubsetOperator.php b/src/Builder/Expression/SetIsSubsetOperator.php new file mode 100644 index 000000000..8d9a63e45 --- /dev/null +++ b/src/Builder/Expression/SetIsSubsetOperator.php @@ -0,0 +1,67 @@ + 'expression1', 'expression2' => 'expression2']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression1 */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression1; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression2 */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression2; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression1 + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression2 + */ + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $expression1, + PackedArray|ResolvesToArray|BSONArray|array|string $expression2, + ) { + if (is_string($expression1) && ! str_starts_with($expression1, '$')) { + throw new InvalidArgumentException('Argument $expression1 can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($expression1) && ! array_is_list($expression1)) { + throw new InvalidArgumentException('Expected $expression1 argument to be a list, got an associative array.'); + } + + $this->expression1 = $expression1; + if (is_string($expression2) && ! str_starts_with($expression2, '$')) { + throw new InvalidArgumentException('Argument $expression2 can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($expression2) && ! array_is_list($expression2)) { + throw new InvalidArgumentException('Expected $expression2 argument to be a list, got an associative array.'); + } + + $this->expression2 = $expression2; + } +} diff --git a/src/Builder/Expression/SetUnionOperator.php b/src/Builder/Expression/SetUnionOperator.php new file mode 100644 index 000000000..5a7af7651 --- /dev/null +++ b/src/Builder/Expression/SetUnionOperator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$expression + * @no-named-arguments + */ + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string ...$expression) + { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/SinOperator.php b/src/Builder/Expression/SinOperator.php new file mode 100644 index 000000000..cc8f82357 --- /dev/null +++ b/src/Builder/Expression/SinOperator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $sin takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * By default $sin returns values as a double. $sin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $sin takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * By default $sin returns values as a double. $sin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/SinhOperator.php b/src/Builder/Expression/SinhOperator.php new file mode 100644 index 000000000..763d2f94f --- /dev/null +++ b/src/Builder/Expression/SinhOperator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $sinh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * By default $sinh returns values as a double. $sinh can also return values as a 128-bit decimal if the expression resolves to a 128-bit decimal value. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $sinh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * By default $sinh returns values as a double. $sinh can also return values as a 128-bit decimal if the expression resolves to a 128-bit decimal value. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/SizeOperator.php b/src/Builder/Expression/SizeOperator.php new file mode 100644 index 000000000..53b6cdd1a --- /dev/null +++ b/src/Builder/Expression/SizeOperator.php @@ -0,0 +1,52 @@ + 'expression']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression The argument for $size can be any expression as long as it resolves to an array. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression The argument for $size can be any expression as long as it resolves to an array. + */ + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($expression) && ! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/SliceOperator.php b/src/Builder/Expression/SliceOperator.php new file mode 100644 index 000000000..71cc07415 --- /dev/null +++ b/src/Builder/Expression/SliceOperator.php @@ -0,0 +1,86 @@ + 'expression', 'n' => 'n', 'position' => 'position']; + + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression Any valid expression as long as it resolves to an array. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression; + + /** + * @var ResolvesToInt|int|string $n Any valid expression as long as it resolves to an integer. If position is specified, n must resolve to a positive integer. + * If positive, $slice returns up to the first n elements in the array. If the position is specified, $slice returns the first n elements starting from the position. + * If negative, $slice returns up to the last n elements in the array. n cannot resolve to a negative number if is specified. + */ + public readonly ResolvesToInt|int|string $n; + + /** + * @var Optional|ResolvesToInt|int|string $position Any valid expression as long as it resolves to an integer. + * If positive, $slice determines the starting position from the start of the array. If position is greater than the number of elements, the $slice returns an empty array. + * If negative, $slice determines the starting position from the end of the array. If the absolute value of the is greater than the number of elements, the starting position is the start of the array. + */ + public readonly Optional|ResolvesToInt|int|string $position; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression Any valid expression as long as it resolves to an array. + * @param ResolvesToInt|int|string $n Any valid expression as long as it resolves to an integer. If position is specified, n must resolve to a positive integer. + * If positive, $slice returns up to the first n elements in the array. If the position is specified, $slice returns the first n elements starting from the position. + * If negative, $slice returns up to the last n elements in the array. n cannot resolve to a negative number if is specified. + * @param Optional|ResolvesToInt|int|string $position Any valid expression as long as it resolves to an integer. + * If positive, $slice determines the starting position from the start of the array. If position is greater than the number of elements, the $slice returns an empty array. + * If negative, $slice determines the starting position from the end of the array. If the absolute value of the is greater than the number of elements, the starting position is the start of the array. + */ + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $expression, + ResolvesToInt|int|string $n, + Optional|ResolvesToInt|int|string $position = Optional::Undefined, + ) { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($expression) && ! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.'); + } + + $this->expression = $expression; + if (is_string($n) && ! str_starts_with($n, '$')) { + throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->n = $n; + if (is_string($position) && ! str_starts_with($position, '$')) { + throw new InvalidArgumentException('Argument $position can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->position = $position; + } +} diff --git a/src/Builder/Expression/SortArrayOperator.php b/src/Builder/Expression/SortArrayOperator.php new file mode 100644 index 000000000..6b1d26e0f --- /dev/null +++ b/src/Builder/Expression/SortArrayOperator.php @@ -0,0 +1,69 @@ + 'input', 'sortBy' => 'sortBy']; + + /** + * @var BSONArray|PackedArray|ResolvesToArray|array|string $input The array to be sorted. + * The result is null if the expression: is missing, evaluates to null, or evaluates to undefined + * If the expression evaluates to any other non-array value, the document returns an error. + */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; + + /** @var Document|Serializable|Sort|array|int|stdClass $sortBy The document specifies a sort ordering. */ + public readonly Document|Serializable|Sort|stdClass|array|int $sortBy; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input The array to be sorted. + * The result is null if the expression: is missing, evaluates to null, or evaluates to undefined + * If the expression evaluates to any other non-array value, the document returns an error. + * @param Document|Serializable|Sort|array|int|stdClass $sortBy The document specifies a sort ordering. + */ + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + Document|Serializable|Sort|stdClass|array|int $sortBy, + ) { + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($input) && ! array_is_list($input)) { + throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); + } + + $this->input = $input; + $this->sortBy = $sortBy; + } +} diff --git a/src/Builder/Expression/SplitOperator.php b/src/Builder/Expression/SplitOperator.php new file mode 100644 index 000000000..30d306259 --- /dev/null +++ b/src/Builder/Expression/SplitOperator.php @@ -0,0 +1,44 @@ + 'string', 'delimiter' => 'delimiter']; + + /** @var ResolvesToString|string $string The string to be split. string expression can be any valid expression as long as it resolves to a string. */ + public readonly ResolvesToString|string $string; + + /** @var Regex|ResolvesToRegex|ResolvesToString|string $delimiter The delimiter to use when splitting the string expression. delimiter can be any valid expression as long as it resolves to a string. */ + public readonly Regex|ResolvesToRegex|ResolvesToString|string $delimiter; + + /** + * @param ResolvesToString|string $string The string to be split. string expression can be any valid expression as long as it resolves to a string. + * @param Regex|ResolvesToRegex|ResolvesToString|string $delimiter The delimiter to use when splitting the string expression. delimiter can be any valid expression as long as it resolves to a string. + */ + public function __construct( + ResolvesToString|string $string, + Regex|ResolvesToRegex|ResolvesToString|string $delimiter, + ) { + $this->string = $string; + $this->delimiter = $delimiter; + } +} diff --git a/src/Builder/Expression/SqrtOperator.php b/src/Builder/Expression/SqrtOperator.php new file mode 100644 index 000000000..9453fb77b --- /dev/null +++ b/src/Builder/Expression/SqrtOperator.php @@ -0,0 +1,46 @@ + 'number']; + + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $number The argument can be any valid expression as long as it resolves to a non-negative number. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $number; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number The argument can be any valid expression as long as it resolves to a non-negative number. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $number) + { + if (is_string($number) && ! str_starts_with($number, '$')) { + throw new InvalidArgumentException('Argument $number can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->number = $number; + } +} diff --git a/src/Builder/Expression/StdDevPopOperator.php b/src/Builder/Expression/StdDevPopOperator.php new file mode 100644 index 000000000..dae7344a1 --- /dev/null +++ b/src/Builder/Expression/StdDevPopOperator.php @@ -0,0 +1,52 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression + * @no-named-arguments + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression) + { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/StdDevSampOperator.php b/src/Builder/Expression/StdDevSampOperator.php new file mode 100644 index 000000000..55af36f53 --- /dev/null +++ b/src/Builder/Expression/StdDevSampOperator.php @@ -0,0 +1,51 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression + * @no-named-arguments + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression) + { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/StrLenBytesOperator.php b/src/Builder/Expression/StrLenBytesOperator.php new file mode 100644 index 000000000..39ae8dbe8 --- /dev/null +++ b/src/Builder/Expression/StrLenBytesOperator.php @@ -0,0 +1,36 @@ + 'expression']; + + /** @var ResolvesToString|string $expression */ + public readonly ResolvesToString|string $expression; + + /** + * @param ResolvesToString|string $expression + */ + public function __construct(ResolvesToString|string $expression) + { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/StrLenCPOperator.php b/src/Builder/Expression/StrLenCPOperator.php new file mode 100644 index 000000000..8add7c3f8 --- /dev/null +++ b/src/Builder/Expression/StrLenCPOperator.php @@ -0,0 +1,36 @@ + 'expression']; + + /** @var ResolvesToString|string $expression */ + public readonly ResolvesToString|string $expression; + + /** + * @param ResolvesToString|string $expression + */ + public function __construct(ResolvesToString|string $expression) + { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/StrcasecmpOperator.php b/src/Builder/Expression/StrcasecmpOperator.php new file mode 100644 index 000000000..efcb0e41b --- /dev/null +++ b/src/Builder/Expression/StrcasecmpOperator.php @@ -0,0 +1,41 @@ + 'expression1', 'expression2' => 'expression2']; + + /** @var ResolvesToString|string $expression1 */ + public readonly ResolvesToString|string $expression1; + + /** @var ResolvesToString|string $expression2 */ + public readonly ResolvesToString|string $expression2; + + /** + * @param ResolvesToString|string $expression1 + * @param ResolvesToString|string $expression2 + */ + public function __construct(ResolvesToString|string $expression1, ResolvesToString|string $expression2) + { + $this->expression1 = $expression1; + $this->expression2 = $expression2; + } +} diff --git a/src/Builder/Expression/StringFieldPath.php b/src/Builder/Expression/StringFieldPath.php new file mode 100644 index 000000000..487d34782 --- /dev/null +++ b/src/Builder/Expression/StringFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/SubstrBytesOperator.php b/src/Builder/Expression/SubstrBytesOperator.php new file mode 100644 index 000000000..ff11d234b --- /dev/null +++ b/src/Builder/Expression/SubstrBytesOperator.php @@ -0,0 +1,61 @@ + 'string', 'start' => 'start', 'length' => 'length']; + + /** @var ResolvesToString|string $string */ + public readonly ResolvesToString|string $string; + + /** @var ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". */ + public readonly ResolvesToInt|int|string $start; + + /** @var ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. */ + public readonly ResolvesToInt|int|string $length; + + /** + * @param ResolvesToString|string $string + * @param ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". + * @param ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. + */ + public function __construct( + ResolvesToString|string $string, + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $length, + ) { + $this->string = $string; + if (is_string($start) && ! str_starts_with($start, '$')) { + throw new InvalidArgumentException('Argument $start can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->start = $start; + if (is_string($length) && ! str_starts_with($length, '$')) { + throw new InvalidArgumentException('Argument $length can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->length = $length; + } +} diff --git a/src/Builder/Expression/SubstrCPOperator.php b/src/Builder/Expression/SubstrCPOperator.php new file mode 100644 index 000000000..e2c7e89e0 --- /dev/null +++ b/src/Builder/Expression/SubstrCPOperator.php @@ -0,0 +1,61 @@ + 'string', 'start' => 'start', 'length' => 'length']; + + /** @var ResolvesToString|string $string */ + public readonly ResolvesToString|string $string; + + /** @var ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". */ + public readonly ResolvesToInt|int|string $start; + + /** @var ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. */ + public readonly ResolvesToInt|int|string $length; + + /** + * @param ResolvesToString|string $string + * @param ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". + * @param ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. + */ + public function __construct( + ResolvesToString|string $string, + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $length, + ) { + $this->string = $string; + if (is_string($start) && ! str_starts_with($start, '$')) { + throw new InvalidArgumentException('Argument $start can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->start = $start; + if (is_string($length) && ! str_starts_with($length, '$')) { + throw new InvalidArgumentException('Argument $length can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->length = $length; + } +} diff --git a/src/Builder/Expression/SubstrOperator.php b/src/Builder/Expression/SubstrOperator.php new file mode 100644 index 000000000..3547f5331 --- /dev/null +++ b/src/Builder/Expression/SubstrOperator.php @@ -0,0 +1,61 @@ + 'string', 'start' => 'start', 'length' => 'length']; + + /** @var ResolvesToString|string $string */ + public readonly ResolvesToString|string $string; + + /** @var ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". */ + public readonly ResolvesToInt|int|string $start; + + /** @var ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. */ + public readonly ResolvesToInt|int|string $length; + + /** + * @param ResolvesToString|string $string + * @param ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". + * @param ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. + */ + public function __construct( + ResolvesToString|string $string, + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $length, + ) { + $this->string = $string; + if (is_string($start) && ! str_starts_with($start, '$')) { + throw new InvalidArgumentException('Argument $start can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->start = $start; + if (is_string($length) && ! str_starts_with($length, '$')) { + throw new InvalidArgumentException('Argument $length can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->length = $length; + } +} diff --git a/src/Builder/Expression/SubtractOperator.php b/src/Builder/Expression/SubtractOperator.php new file mode 100644 index 000000000..351f520cb --- /dev/null +++ b/src/Builder/Expression/SubtractOperator.php @@ -0,0 +1,59 @@ + 'expression1', 'expression2' => 'expression2']; + + /** @var DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $expression1 */ + public readonly DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $expression1; + + /** @var DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $expression2 */ + public readonly DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $expression2; + + /** + * @param DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $expression1 + * @param DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $expression2 + */ + public function __construct( + DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $expression1, + DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $expression2, + ) { + if (is_string($expression1) && ! str_starts_with($expression1, '$')) { + throw new InvalidArgumentException('Argument $expression1 can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression1 = $expression1; + if (is_string($expression2) && ! str_starts_with($expression2, '$')) { + throw new InvalidArgumentException('Argument $expression2 can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression2 = $expression2; + } +} diff --git a/src/Builder/Expression/SumOperator.php b/src/Builder/Expression/SumOperator.php new file mode 100644 index 000000000..04bfaf06a --- /dev/null +++ b/src/Builder/Expression/SumOperator.php @@ -0,0 +1,54 @@ + 'expression']; + + /** @var list $expression */ + public readonly array $expression; + + /** + * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToArray|ResolvesToNumber|array|float|int|string ...$expression + * @no-named-arguments + */ + public function __construct( + Decimal128|Int64|PackedArray|ResolvesToArray|ResolvesToNumber|BSONArray|array|float|int|string ...$expression, + ) { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + if (! array_is_list($expression)) { + throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/SwitchOperator.php b/src/Builder/Expression/SwitchOperator.php new file mode 100644 index 000000000..7af40b0f1 --- /dev/null +++ b/src/Builder/Expression/SwitchOperator.php @@ -0,0 +1,70 @@ + 'branches', 'default' => 'default']; + + /** + * @var BSONArray|PackedArray|array $branches An array of control branch documents. Each branch is a document with the following fields: + * - case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. + * - then Can be any valid expression. + * The branches array must contain at least one branch document. + */ + public readonly PackedArray|BSONArray|array $branches; + + /** + * @var Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default The path to take if no branch case expression evaluates to true. + * Although optional, if default is unspecified and no branch case evaluates to true, $switch returns an error. + */ + public readonly Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default; + + /** + * @param BSONArray|PackedArray|array $branches An array of control branch documents. Each branch is a document with the following fields: + * - case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. + * - then Can be any valid expression. + * The branches array must contain at least one branch document. + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default The path to take if no branch case expression evaluates to true. + * Although optional, if default is unspecified and no branch case evaluates to true, $switch returns an error. + */ + public function __construct( + PackedArray|BSONArray|array $branches, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default = Optional::Undefined, + ) { + if (is_array($branches) && ! array_is_list($branches)) { + throw new InvalidArgumentException('Expected $branches argument to be a list, got an associative array.'); + } + + $this->branches = $branches; + $this->default = $default; + } +} diff --git a/src/Builder/Expression/TanOperator.php b/src/Builder/Expression/TanOperator.php new file mode 100644 index 000000000..c783b0392 --- /dev/null +++ b/src/Builder/Expression/TanOperator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $tan takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * By default $tan returns values as a double. $tan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $tan takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * By default $tan returns values as a double. $tan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/TanhOperator.php b/src/Builder/Expression/TanhOperator.php new file mode 100644 index 000000000..e6f8bb619 --- /dev/null +++ b/src/Builder/Expression/TanhOperator.php @@ -0,0 +1,50 @@ + 'expression']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $tanh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * By default $tanh returns values as a double. $tanh can also return values as a 128-bit decimal if the expression resolves to a 128-bit decimal value. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $tanh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * By default $tanh returns values as a double. $tanh can also return values as a 128-bit decimal if the expression resolves to a 128-bit decimal value. + */ + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/TimestampFieldPath.php b/src/Builder/Expression/TimestampFieldPath.php new file mode 100644 index 000000000..5aac9492f --- /dev/null +++ b/src/Builder/Expression/TimestampFieldPath.php @@ -0,0 +1,29 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/ToBoolOperator.php b/src/Builder/Expression/ToBoolOperator.php new file mode 100644 index 000000000..6affe2ea5 --- /dev/null +++ b/src/Builder/Expression/ToBoolOperator.php @@ -0,0 +1,42 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/ToDateOperator.php b/src/Builder/Expression/ToDateOperator.php new file mode 100644 index 000000000..9c5a42b1c --- /dev/null +++ b/src/Builder/Expression/ToDateOperator.php @@ -0,0 +1,42 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/ToDecimalOperator.php b/src/Builder/Expression/ToDecimalOperator.php new file mode 100644 index 000000000..b1440e9a0 --- /dev/null +++ b/src/Builder/Expression/ToDecimalOperator.php @@ -0,0 +1,42 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/ToDoubleOperator.php b/src/Builder/Expression/ToDoubleOperator.php new file mode 100644 index 000000000..8c0d336f5 --- /dev/null +++ b/src/Builder/Expression/ToDoubleOperator.php @@ -0,0 +1,42 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/ToHashedIndexKeyOperator.php b/src/Builder/Expression/ToHashedIndexKeyOperator.php new file mode 100644 index 000000000..15f919544 --- /dev/null +++ b/src/Builder/Expression/ToHashedIndexKeyOperator.php @@ -0,0 +1,41 @@ + 'value']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $value key or string to hash */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $value; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $value key or string to hash + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $value, + ) { + $this->value = $value; + } +} diff --git a/src/Builder/Expression/ToIntOperator.php b/src/Builder/Expression/ToIntOperator.php new file mode 100644 index 000000000..a769d69ad --- /dev/null +++ b/src/Builder/Expression/ToIntOperator.php @@ -0,0 +1,42 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/ToLongOperator.php b/src/Builder/Expression/ToLongOperator.php new file mode 100644 index 000000000..7b68c2f55 --- /dev/null +++ b/src/Builder/Expression/ToLongOperator.php @@ -0,0 +1,42 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/ToLowerOperator.php b/src/Builder/Expression/ToLowerOperator.php new file mode 100644 index 000000000..500605889 --- /dev/null +++ b/src/Builder/Expression/ToLowerOperator.php @@ -0,0 +1,36 @@ + 'expression']; + + /** @var ResolvesToString|string $expression */ + public readonly ResolvesToString|string $expression; + + /** + * @param ResolvesToString|string $expression + */ + public function __construct(ResolvesToString|string $expression) + { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/ToObjectIdOperator.php b/src/Builder/Expression/ToObjectIdOperator.php new file mode 100644 index 000000000..bb70f957e --- /dev/null +++ b/src/Builder/Expression/ToObjectIdOperator.php @@ -0,0 +1,42 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/ToStringOperator.php b/src/Builder/Expression/ToStringOperator.php new file mode 100644 index 000000000..4d0f59968 --- /dev/null +++ b/src/Builder/Expression/ToStringOperator.php @@ -0,0 +1,42 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/ToUpperOperator.php b/src/Builder/Expression/ToUpperOperator.php new file mode 100644 index 000000000..604711964 --- /dev/null +++ b/src/Builder/Expression/ToUpperOperator.php @@ -0,0 +1,36 @@ + 'expression']; + + /** @var ResolvesToString|string $expression */ + public readonly ResolvesToString|string $expression; + + /** + * @param ResolvesToString|string $expression + */ + public function __construct(ResolvesToString|string $expression) + { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/TrimOperator.php b/src/Builder/Expression/TrimOperator.php new file mode 100644 index 000000000..0b210e467 --- /dev/null +++ b/src/Builder/Expression/TrimOperator.php @@ -0,0 +1,51 @@ + 'input', 'chars' => 'chars']; + + /** @var ResolvesToString|string $input The string to trim. The argument can be any valid expression that resolves to a string. */ + public readonly ResolvesToString|string $input; + + /** + * @var Optional|ResolvesToString|string $chars The character(s) to trim from the beginning of the input. + * The argument can be any valid expression that resolves to a string. The $ltrim operator breaks down the string into individual UTF code point to trim from input. + * If unspecified, $ltrim removes whitespace characters, including the null character. + */ + public readonly Optional|ResolvesToString|string $chars; + + /** + * @param ResolvesToString|string $input The string to trim. The argument can be any valid expression that resolves to a string. + * @param Optional|ResolvesToString|string $chars The character(s) to trim from the beginning of the input. + * The argument can be any valid expression that resolves to a string. The $ltrim operator breaks down the string into individual UTF code point to trim from input. + * If unspecified, $ltrim removes whitespace characters, including the null character. + */ + public function __construct( + ResolvesToString|string $input, + Optional|ResolvesToString|string $chars = Optional::Undefined, + ) { + $this->input = $input; + $this->chars = $chars; + } +} diff --git a/src/Builder/Expression/TruncOperator.php b/src/Builder/Expression/TruncOperator.php new file mode 100644 index 000000000..b8e98c562 --- /dev/null +++ b/src/Builder/Expression/TruncOperator.php @@ -0,0 +1,62 @@ + 'number', 'place' => 'place']; + + /** + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. + * $trunc returns an error if the expression resolves to a non-numeric data type. + */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $number; + + /** @var Optional|ResolvesToInt|int|string $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. e.g. -20 < place < 100. Defaults to 0. */ + public readonly Optional|ResolvesToInt|int|string $place; + + /** + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. + * $trunc returns an error if the expression resolves to a non-numeric data type. + * @param Optional|ResolvesToInt|int|string $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. e.g. -20 < place < 100. Defaults to 0. + */ + public function __construct( + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Optional|ResolvesToInt|int|string $place = Optional::Undefined, + ) { + if (is_string($number) && ! str_starts_with($number, '$')) { + throw new InvalidArgumentException('Argument $number can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->number = $number; + if (is_string($place) && ! str_starts_with($place, '$')) { + throw new InvalidArgumentException('Argument $place can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->place = $place; + } +} diff --git a/src/Builder/Expression/TsIncrementOperator.php b/src/Builder/Expression/TsIncrementOperator.php new file mode 100644 index 000000000..3e1e404c1 --- /dev/null +++ b/src/Builder/Expression/TsIncrementOperator.php @@ -0,0 +1,46 @@ + 'expression']; + + /** @var ResolvesToTimestamp|Timestamp|int|string $expression */ + public readonly Timestamp|ResolvesToTimestamp|int|string $expression; + + /** + * @param ResolvesToTimestamp|Timestamp|int|string $expression + */ + public function __construct(Timestamp|ResolvesToTimestamp|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/TsSecondOperator.php b/src/Builder/Expression/TsSecondOperator.php new file mode 100644 index 000000000..bea14d9e1 --- /dev/null +++ b/src/Builder/Expression/TsSecondOperator.php @@ -0,0 +1,46 @@ + 'expression']; + + /** @var ResolvesToTimestamp|Timestamp|int|string $expression */ + public readonly Timestamp|ResolvesToTimestamp|int|string $expression; + + /** + * @param ResolvesToTimestamp|Timestamp|int|string $expression + */ + public function __construct(Timestamp|ResolvesToTimestamp|int|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/TypeOperator.php b/src/Builder/Expression/TypeOperator.php new file mode 100644 index 000000000..78a25aa6e --- /dev/null +++ b/src/Builder/Expression/TypeOperator.php @@ -0,0 +1,41 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Expression/UnsetFieldOperator.php b/src/Builder/Expression/UnsetFieldOperator.php new file mode 100644 index 000000000..1d0fcf9d2 --- /dev/null +++ b/src/Builder/Expression/UnsetFieldOperator.php @@ -0,0 +1,55 @@ + 'field', 'input' => 'input']; + + /** @var ResolvesToString|string $field Field in the input object that you want to add, update, or remove. field can be any valid expression that resolves to a string constant. */ + public readonly ResolvesToString|string $field; + + /** @var Document|ResolvesToObject|Serializable|array|stdClass|string $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. */ + public readonly Document|Serializable|ResolvesToObject|stdClass|array|string $input; + + /** + * @param ResolvesToString|string $field Field in the input object that you want to add, update, or remove. field can be any valid expression that resolves to a string constant. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. + */ + public function __construct( + ResolvesToString|string $field, + Document|Serializable|ResolvesToObject|stdClass|array|string $input, + ) { + $this->field = $field; + if (is_string($input) && ! str_starts_with($input, '$')) { + throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->input = $input; + } +} diff --git a/src/Builder/Expression/Variable.php b/src/Builder/Expression/Variable.php new file mode 100644 index 000000000..99b0750be --- /dev/null +++ b/src/Builder/Expression/Variable.php @@ -0,0 +1,28 @@ +name = $name; + } +} diff --git a/src/Builder/Expression/WeekOperator.php b/src/Builder/Expression/WeekOperator.php new file mode 100644 index 000000000..a895012dc --- /dev/null +++ b/src/Builder/Expression/WeekOperator.php @@ -0,0 +1,56 @@ + 'date', 'timezone' => 'timezone']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/YearOperator.php b/src/Builder/Expression/YearOperator.php new file mode 100644 index 000000000..314b1de9f --- /dev/null +++ b/src/Builder/Expression/YearOperator.php @@ -0,0 +1,56 @@ + 'date', 'timezone' => 'timezone']; + + /** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; + + /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ + public readonly Optional|ResolvesToString|string $timezone; + + /** + * @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. + */ + public function __construct( + DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, + Optional|ResolvesToString|string $timezone = Optional::Undefined, + ) { + if (is_string($date) && ! str_starts_with($date, '$')) { + throw new InvalidArgumentException('Argument $date can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->date = $date; + $this->timezone = $timezone; + } +} diff --git a/src/Builder/Expression/ZipOperator.php b/src/Builder/Expression/ZipOperator.php new file mode 100644 index 000000000..cc98f9ecf --- /dev/null +++ b/src/Builder/Expression/ZipOperator.php @@ -0,0 +1,86 @@ + 'inputs', 'useLongestLength' => 'useLongestLength', 'defaults' => 'defaults']; + + /** + * @var BSONArray|PackedArray|ResolvesToArray|array|string $inputs An array of expressions that resolve to arrays. The elements of these input arrays combine to form the arrays of the output array. + * If any of the inputs arrays resolves to a value of null or refers to a missing field, $zip returns null. + * If any of the inputs arrays does not resolve to an array or null nor refers to a missing field, $zip returns an error. + */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $inputs; + + /** + * @var Optional|bool $useLongestLength A boolean which specifies whether the length of the longest array determines the number of arrays in the output array. + * The default value is false: the shortest array length determines the number of arrays in the output array. + */ + public readonly Optional|bool $useLongestLength; + + /** + * @var Optional|BSONArray|PackedArray|array $defaults An array of default element values to use if the input arrays have different lengths. You must specify useLongestLength: true along with this field, or else $zip will return an error. + * If useLongestLength: true but defaults is empty or not specified, $zip uses null as the default value. + * If specifying a non-empty defaults, you must specify a default for each input array or else $zip will return an error. + */ + public readonly Optional|PackedArray|BSONArray|array $defaults; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $inputs An array of expressions that resolve to arrays. The elements of these input arrays combine to form the arrays of the output array. + * If any of the inputs arrays resolves to a value of null or refers to a missing field, $zip returns null. + * If any of the inputs arrays does not resolve to an array or null nor refers to a missing field, $zip returns an error. + * @param Optional|bool $useLongestLength A boolean which specifies whether the length of the longest array determines the number of arrays in the output array. + * The default value is false: the shortest array length determines the number of arrays in the output array. + * @param Optional|BSONArray|PackedArray|array $defaults An array of default element values to use if the input arrays have different lengths. You must specify useLongestLength: true along with this field, or else $zip will return an error. + * If useLongestLength: true but defaults is empty or not specified, $zip uses null as the default value. + * If specifying a non-empty defaults, you must specify a default for each input array or else $zip will return an error. + */ + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $inputs, + Optional|bool $useLongestLength = Optional::Undefined, + Optional|PackedArray|BSONArray|array $defaults = Optional::Undefined, + ) { + if (is_string($inputs) && ! str_starts_with($inputs, '$')) { + throw new InvalidArgumentException('Argument $inputs can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($inputs) && ! array_is_list($inputs)) { + throw new InvalidArgumentException('Expected $inputs argument to be a list, got an associative array.'); + } + + $this->inputs = $inputs; + $this->useLongestLength = $useLongestLength; + if (is_array($defaults) && ! array_is_list($defaults)) { + throw new InvalidArgumentException('Expected $defaults argument to be a list, got an associative array.'); + } + + $this->defaults = $defaults; + } +} diff --git a/src/Builder/Pipeline.php b/src/Builder/Pipeline.php new file mode 100644 index 000000000..e481277a9 --- /dev/null +++ b/src/Builder/Pipeline.php @@ -0,0 +1,60 @@ +|stdClass + * @implements IteratorAggregate + */ +final class Pipeline implements IteratorAggregate +{ + private readonly array $stages; + + /** + * @psalm-param stage|list ...$stagesOrPipelines + * + * @no-named-arguments + */ + public function __construct(StageInterface|Pipeline|array|stdClass ...$stagesOrPipelines) + { + if (! array_is_list($stagesOrPipelines)) { + throw new InvalidArgumentException('Named arguments are not supported for pipelines'); + } + + $stages = []; + + foreach ($stagesOrPipelines as $stageOrPipeline) { + if (is_array($stageOrPipeline) && array_is_list($stageOrPipeline)) { + $stages = array_merge($stages, $stageOrPipeline); + } elseif ($stageOrPipeline instanceof Pipeline) { + $stages = array_merge($stages, $stageOrPipeline->stages); + } else { + $stages[] = $stageOrPipeline; + } + } + + $this->stages = $stages; + } + + public function getIterator(): ArrayIterator + { + return new ArrayIterator($this->stages); + } +} diff --git a/src/Builder/Query.php b/src/Builder/Query.php new file mode 100644 index 000000000..b19b293fc --- /dev/null +++ b/src/Builder/Query.php @@ -0,0 +1,61 @@ + 'value']; + + /** @var list $value */ + public readonly array $value; + + /** + * @param DateTimeInterface|FieldQueryInterface|Type|array|bool|float|int|null|stdClass|string ...$value + * @no-named-arguments + */ + public function __construct( + DateTimeInterface|Type|FieldQueryInterface|stdClass|array|bool|float|int|null|string ...$value, + ) { + if (\count($value) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $value, got %d.', 1, \count($value))); + } + + if (! array_is_list($value)) { + throw new InvalidArgumentException('Expected $value arguments to be a list (array), named arguments are not supported'); + } + + $this->value = $value; + } +} diff --git a/src/Builder/Query/AndOperator.php b/src/Builder/Query/AndOperator.php new file mode 100644 index 000000000..8738591be --- /dev/null +++ b/src/Builder/Query/AndOperator.php @@ -0,0 +1,49 @@ + 'queries']; + + /** @var list $queries */ + public readonly array $queries; + + /** + * @param QueryInterface|array ...$queries + * @no-named-arguments + */ + public function __construct(QueryInterface|array ...$queries) + { + if (\count($queries) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $queries, got %d.', 1, \count($queries))); + } + + if (! array_is_list($queries)) { + throw new InvalidArgumentException('Expected $queries arguments to be a list (array), named arguments are not supported'); + } + + $this->queries = $queries; + } +} diff --git a/src/Builder/Query/BitsAllClearOperator.php b/src/Builder/Query/BitsAllClearOperator.php new file mode 100644 index 000000000..072c031bb --- /dev/null +++ b/src/Builder/Query/BitsAllClearOperator.php @@ -0,0 +1,48 @@ + 'bitmask']; + + /** @var BSONArray|Binary|PackedArray|array|int|string $bitmask */ + public readonly Binary|PackedArray|BSONArray|array|int|string $bitmask; + + /** + * @param BSONArray|Binary|PackedArray|array|int|string $bitmask + */ + public function __construct(Binary|PackedArray|BSONArray|array|int|string $bitmask) + { + if (is_array($bitmask) && ! array_is_list($bitmask)) { + throw new InvalidArgumentException('Expected $bitmask argument to be a list, got an associative array.'); + } + + $this->bitmask = $bitmask; + } +} diff --git a/src/Builder/Query/BitsAllSetOperator.php b/src/Builder/Query/BitsAllSetOperator.php new file mode 100644 index 000000000..a90e12f35 --- /dev/null +++ b/src/Builder/Query/BitsAllSetOperator.php @@ -0,0 +1,48 @@ + 'bitmask']; + + /** @var BSONArray|Binary|PackedArray|array|int|string $bitmask */ + public readonly Binary|PackedArray|BSONArray|array|int|string $bitmask; + + /** + * @param BSONArray|Binary|PackedArray|array|int|string $bitmask + */ + public function __construct(Binary|PackedArray|BSONArray|array|int|string $bitmask) + { + if (is_array($bitmask) && ! array_is_list($bitmask)) { + throw new InvalidArgumentException('Expected $bitmask argument to be a list, got an associative array.'); + } + + $this->bitmask = $bitmask; + } +} diff --git a/src/Builder/Query/BitsAnyClearOperator.php b/src/Builder/Query/BitsAnyClearOperator.php new file mode 100644 index 000000000..0ae56d93a --- /dev/null +++ b/src/Builder/Query/BitsAnyClearOperator.php @@ -0,0 +1,48 @@ + 'bitmask']; + + /** @var BSONArray|Binary|PackedArray|array|int|string $bitmask */ + public readonly Binary|PackedArray|BSONArray|array|int|string $bitmask; + + /** + * @param BSONArray|Binary|PackedArray|array|int|string $bitmask + */ + public function __construct(Binary|PackedArray|BSONArray|array|int|string $bitmask) + { + if (is_array($bitmask) && ! array_is_list($bitmask)) { + throw new InvalidArgumentException('Expected $bitmask argument to be a list, got an associative array.'); + } + + $this->bitmask = $bitmask; + } +} diff --git a/src/Builder/Query/BitsAnySetOperator.php b/src/Builder/Query/BitsAnySetOperator.php new file mode 100644 index 000000000..5a202c9d4 --- /dev/null +++ b/src/Builder/Query/BitsAnySetOperator.php @@ -0,0 +1,48 @@ + 'bitmask']; + + /** @var BSONArray|Binary|PackedArray|array|int|string $bitmask */ + public readonly Binary|PackedArray|BSONArray|array|int|string $bitmask; + + /** + * @param BSONArray|Binary|PackedArray|array|int|string $bitmask + */ + public function __construct(Binary|PackedArray|BSONArray|array|int|string $bitmask) + { + if (is_array($bitmask) && ! array_is_list($bitmask)) { + throw new InvalidArgumentException('Expected $bitmask argument to be a list, got an associative array.'); + } + + $this->bitmask = $bitmask; + } +} diff --git a/src/Builder/Query/BoxOperator.php b/src/Builder/Query/BoxOperator.php new file mode 100644 index 000000000..cce9cf8d8 --- /dev/null +++ b/src/Builder/Query/BoxOperator.php @@ -0,0 +1,47 @@ + 'value']; + + /** @var BSONArray|PackedArray|array $value */ + public readonly PackedArray|BSONArray|array $value; + + /** + * @param BSONArray|PackedArray|array $value + */ + public function __construct(PackedArray|BSONArray|array $value) + { + if (is_array($value) && ! array_is_list($value)) { + throw new InvalidArgumentException('Expected $value argument to be a list, got an associative array.'); + } + + $this->value = $value; + } +} diff --git a/src/Builder/Query/CenterOperator.php b/src/Builder/Query/CenterOperator.php new file mode 100644 index 000000000..f3a0b890a --- /dev/null +++ b/src/Builder/Query/CenterOperator.php @@ -0,0 +1,47 @@ + 'value']; + + /** @var BSONArray|PackedArray|array $value */ + public readonly PackedArray|BSONArray|array $value; + + /** + * @param BSONArray|PackedArray|array $value + */ + public function __construct(PackedArray|BSONArray|array $value) + { + if (is_array($value) && ! array_is_list($value)) { + throw new InvalidArgumentException('Expected $value argument to be a list, got an associative array.'); + } + + $this->value = $value; + } +} diff --git a/src/Builder/Query/CenterSphereOperator.php b/src/Builder/Query/CenterSphereOperator.php new file mode 100644 index 000000000..350f535f0 --- /dev/null +++ b/src/Builder/Query/CenterSphereOperator.php @@ -0,0 +1,47 @@ + 'value']; + + /** @var BSONArray|PackedArray|array $value */ + public readonly PackedArray|BSONArray|array $value; + + /** + * @param BSONArray|PackedArray|array $value + */ + public function __construct(PackedArray|BSONArray|array $value) + { + if (is_array($value) && ! array_is_list($value)) { + throw new InvalidArgumentException('Expected $value argument to be a list, got an associative array.'); + } + + $this->value = $value; + } +} diff --git a/src/Builder/Query/CommentOperator.php b/src/Builder/Query/CommentOperator.php new file mode 100644 index 000000000..938498039 --- /dev/null +++ b/src/Builder/Query/CommentOperator.php @@ -0,0 +1,37 @@ + 'comment']; + + /** @var string $comment */ + public readonly string $comment; + + /** + * @param string $comment + */ + public function __construct(string $comment) + { + $this->comment = $comment; + } +} diff --git a/src/Builder/Query/ElemMatchOperator.php b/src/Builder/Query/ElemMatchOperator.php new file mode 100644 index 000000000..59d59528b --- /dev/null +++ b/src/Builder/Query/ElemMatchOperator.php @@ -0,0 +1,49 @@ + 'query']; + + /** @var DateTimeInterface|FieldQueryInterface|QueryInterface|Type|array|bool|float|int|null|stdClass|string $query */ + public readonly DateTimeInterface|Type|FieldQueryInterface|QueryInterface|stdClass|array|bool|float|int|null|string $query; + + /** + * @param DateTimeInterface|FieldQueryInterface|QueryInterface|Type|array|bool|float|int|null|stdClass|string $query + */ + public function __construct( + DateTimeInterface|Type|FieldQueryInterface|QueryInterface|stdClass|array|bool|float|int|null|string $query, + ) { + if (is_array($query)) { + $query = QueryObject::create($query); + } + + $this->query = $query; + } +} diff --git a/src/Builder/Query/EqOperator.php b/src/Builder/Query/EqOperator.php new file mode 100644 index 000000000..73eaae719 --- /dev/null +++ b/src/Builder/Query/EqOperator.php @@ -0,0 +1,40 @@ + 'value']; + + /** @var DateTimeInterface|Type|array|bool|float|int|null|stdClass|string $value */ + public readonly DateTimeInterface|Type|stdClass|array|bool|float|int|null|string $value; + + /** + * @param DateTimeInterface|Type|array|bool|float|int|null|stdClass|string $value + */ + public function __construct(DateTimeInterface|Type|stdClass|array|bool|float|int|null|string $value) + { + $this->value = $value; + } +} diff --git a/src/Builder/Query/ExistsOperator.php b/src/Builder/Query/ExistsOperator.php new file mode 100644 index 000000000..1d0b0a292 --- /dev/null +++ b/src/Builder/Query/ExistsOperator.php @@ -0,0 +1,37 @@ + 'exists']; + + /** @var bool $exists */ + public readonly bool $exists; + + /** + * @param bool $exists + */ + public function __construct(bool $exists = true) + { + $this->exists = $exists; + } +} diff --git a/src/Builder/Query/ExprOperator.php b/src/Builder/Query/ExprOperator.php new file mode 100644 index 000000000..15562f046 --- /dev/null +++ b/src/Builder/Query/ExprOperator.php @@ -0,0 +1,42 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Query/FactoryTrait.php b/src/Builder/Query/FactoryTrait.php new file mode 100644 index 000000000..cedc2adb7 --- /dev/null +++ b/src/Builder/Query/FactoryTrait.php @@ -0,0 +1,523 @@ + null]; + + /** @var Document|GeometryInterface|Serializable|array|stdClass $geometry */ + public readonly Document|Serializable|GeometryInterface|stdClass|array $geometry; + + /** + * @param Document|GeometryInterface|Serializable|array|stdClass $geometry + */ + public function __construct(Document|Serializable|GeometryInterface|stdClass|array $geometry) + { + $this->geometry = $geometry; + } +} diff --git a/src/Builder/Query/GeoWithinOperator.php b/src/Builder/Query/GeoWithinOperator.php new file mode 100644 index 000000000..258592f00 --- /dev/null +++ b/src/Builder/Query/GeoWithinOperator.php @@ -0,0 +1,41 @@ + null]; + + /** @var Document|GeometryInterface|Serializable|array|stdClass $geometry */ + public readonly Document|Serializable|GeometryInterface|stdClass|array $geometry; + + /** + * @param Document|GeometryInterface|Serializable|array|stdClass $geometry + */ + public function __construct(Document|Serializable|GeometryInterface|stdClass|array $geometry) + { + $this->geometry = $geometry; + } +} diff --git a/src/Builder/Query/GeometryOperator.php b/src/Builder/Query/GeometryOperator.php new file mode 100644 index 000000000..fe52be973 --- /dev/null +++ b/src/Builder/Query/GeometryOperator.php @@ -0,0 +1,64 @@ + 'type', 'coordinates' => 'coordinates', 'crs' => 'crs']; + + /** @var string $type */ + public readonly string $type; + + /** @var BSONArray|PackedArray|array $coordinates */ + public readonly PackedArray|BSONArray|array $coordinates; + + /** @var Optional|Document|Serializable|array|stdClass $crs */ + public readonly Optional|Document|Serializable|stdClass|array $crs; + + /** + * @param string $type + * @param BSONArray|PackedArray|array $coordinates + * @param Optional|Document|Serializable|array|stdClass $crs + */ + public function __construct( + string $type, + PackedArray|BSONArray|array $coordinates, + Optional|Document|Serializable|stdClass|array $crs = Optional::Undefined, + ) { + $this->type = $type; + if (is_array($coordinates) && ! array_is_list($coordinates)) { + throw new InvalidArgumentException('Expected $coordinates argument to be a list, got an associative array.'); + } + + $this->coordinates = $coordinates; + $this->crs = $crs; + } +} diff --git a/src/Builder/Query/GtOperator.php b/src/Builder/Query/GtOperator.php new file mode 100644 index 000000000..235e26c7b --- /dev/null +++ b/src/Builder/Query/GtOperator.php @@ -0,0 +1,40 @@ + 'value']; + + /** @var DateTimeInterface|Type|array|bool|float|int|null|stdClass|string $value */ + public readonly DateTimeInterface|Type|stdClass|array|bool|float|int|null|string $value; + + /** + * @param DateTimeInterface|Type|array|bool|float|int|null|stdClass|string $value + */ + public function __construct(DateTimeInterface|Type|stdClass|array|bool|float|int|null|string $value) + { + $this->value = $value; + } +} diff --git a/src/Builder/Query/GteOperator.php b/src/Builder/Query/GteOperator.php new file mode 100644 index 000000000..05d8e5961 --- /dev/null +++ b/src/Builder/Query/GteOperator.php @@ -0,0 +1,40 @@ + 'value']; + + /** @var DateTimeInterface|Type|array|bool|float|int|null|stdClass|string $value */ + public readonly DateTimeInterface|Type|stdClass|array|bool|float|int|null|string $value; + + /** + * @param DateTimeInterface|Type|array|bool|float|int|null|stdClass|string $value + */ + public function __construct(DateTimeInterface|Type|stdClass|array|bool|float|int|null|string $value) + { + $this->value = $value; + } +} diff --git a/src/Builder/Query/InOperator.php b/src/Builder/Query/InOperator.php new file mode 100644 index 000000000..e6f1456a4 --- /dev/null +++ b/src/Builder/Query/InOperator.php @@ -0,0 +1,47 @@ + 'value']; + + /** @var BSONArray|PackedArray|array $value */ + public readonly PackedArray|BSONArray|array $value; + + /** + * @param BSONArray|PackedArray|array $value + */ + public function __construct(PackedArray|BSONArray|array $value) + { + if (is_array($value) && ! array_is_list($value)) { + throw new InvalidArgumentException('Expected $value argument to be a list, got an associative array.'); + } + + $this->value = $value; + } +} diff --git a/src/Builder/Query/JsonSchemaOperator.php b/src/Builder/Query/JsonSchemaOperator.php new file mode 100644 index 000000000..3dc8b918e --- /dev/null +++ b/src/Builder/Query/JsonSchemaOperator.php @@ -0,0 +1,40 @@ + 'schema']; + + /** @var Document|Serializable|array|stdClass $schema */ + public readonly Document|Serializable|stdClass|array $schema; + + /** + * @param Document|Serializable|array|stdClass $schema + */ + public function __construct(Document|Serializable|stdClass|array $schema) + { + $this->schema = $schema; + } +} diff --git a/src/Builder/Query/LtOperator.php b/src/Builder/Query/LtOperator.php new file mode 100644 index 000000000..b4c2dd449 --- /dev/null +++ b/src/Builder/Query/LtOperator.php @@ -0,0 +1,40 @@ + 'value']; + + /** @var DateTimeInterface|Type|array|bool|float|int|null|stdClass|string $value */ + public readonly DateTimeInterface|Type|stdClass|array|bool|float|int|null|string $value; + + /** + * @param DateTimeInterface|Type|array|bool|float|int|null|stdClass|string $value + */ + public function __construct(DateTimeInterface|Type|stdClass|array|bool|float|int|null|string $value) + { + $this->value = $value; + } +} diff --git a/src/Builder/Query/LteOperator.php b/src/Builder/Query/LteOperator.php new file mode 100644 index 000000000..d0ca1fc9c --- /dev/null +++ b/src/Builder/Query/LteOperator.php @@ -0,0 +1,40 @@ + 'value']; + + /** @var DateTimeInterface|Type|array|bool|float|int|null|stdClass|string $value */ + public readonly DateTimeInterface|Type|stdClass|array|bool|float|int|null|string $value; + + /** + * @param DateTimeInterface|Type|array|bool|float|int|null|stdClass|string $value + */ + public function __construct(DateTimeInterface|Type|stdClass|array|bool|float|int|null|string $value) + { + $this->value = $value; + } +} diff --git a/src/Builder/Query/MaxDistanceOperator.php b/src/Builder/Query/MaxDistanceOperator.php new file mode 100644 index 000000000..2aea7d4c8 --- /dev/null +++ b/src/Builder/Query/MaxDistanceOperator.php @@ -0,0 +1,39 @@ + 'value']; + + /** @var Decimal128|Int64|float|int $value */ + public readonly Decimal128|Int64|float|int $value; + + /** + * @param Decimal128|Int64|float|int $value + */ + public function __construct(Decimal128|Int64|float|int $value) + { + $this->value = $value; + } +} diff --git a/src/Builder/Query/MinDistanceOperator.php b/src/Builder/Query/MinDistanceOperator.php new file mode 100644 index 000000000..74aadb397 --- /dev/null +++ b/src/Builder/Query/MinDistanceOperator.php @@ -0,0 +1,38 @@ + 'value']; + + /** @var Int64|float|int $value */ + public readonly Int64|float|int $value; + + /** + * @param Int64|float|int $value + */ + public function __construct(Int64|float|int $value) + { + $this->value = $value; + } +} diff --git a/src/Builder/Query/ModOperator.php b/src/Builder/Query/ModOperator.php new file mode 100644 index 000000000..bbabdfdc9 --- /dev/null +++ b/src/Builder/Query/ModOperator.php @@ -0,0 +1,44 @@ + 'divisor', 'remainder' => 'remainder']; + + /** @var Decimal128|Int64|float|int $divisor */ + public readonly Decimal128|Int64|float|int $divisor; + + /** @var Decimal128|Int64|float|int $remainder */ + public readonly Decimal128|Int64|float|int $remainder; + + /** + * @param Decimal128|Int64|float|int $divisor + * @param Decimal128|Int64|float|int $remainder + */ + public function __construct(Decimal128|Int64|float|int $divisor, Decimal128|Int64|float|int $remainder) + { + $this->divisor = $divisor; + $this->remainder = $remainder; + } +} diff --git a/src/Builder/Query/NeOperator.php b/src/Builder/Query/NeOperator.php new file mode 100644 index 000000000..e5a8cd31d --- /dev/null +++ b/src/Builder/Query/NeOperator.php @@ -0,0 +1,40 @@ + 'value']; + + /** @var DateTimeInterface|Type|array|bool|float|int|null|stdClass|string $value */ + public readonly DateTimeInterface|Type|stdClass|array|bool|float|int|null|string $value; + + /** + * @param DateTimeInterface|Type|array|bool|float|int|null|stdClass|string $value + */ + public function __construct(DateTimeInterface|Type|stdClass|array|bool|float|int|null|string $value) + { + $this->value = $value; + } +} diff --git a/src/Builder/Query/NearOperator.php b/src/Builder/Query/NearOperator.php new file mode 100644 index 000000000..85be90ac4 --- /dev/null +++ b/src/Builder/Query/NearOperator.php @@ -0,0 +1,57 @@ + null, 'maxDistance' => '$maxDistance', 'minDistance' => '$minDistance']; + + /** @var Document|GeometryInterface|Serializable|array|stdClass $geometry */ + public readonly Document|Serializable|GeometryInterface|stdClass|array $geometry; + + /** @var Optional|Decimal128|Int64|float|int $maxDistance Distance in meters. Limits the results to those documents that are at most the specified distance from the center point. */ + public readonly Optional|Decimal128|Int64|float|int $maxDistance; + + /** @var Optional|Decimal128|Int64|float|int $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. */ + public readonly Optional|Decimal128|Int64|float|int $minDistance; + + /** + * @param Document|GeometryInterface|Serializable|array|stdClass $geometry + * @param Optional|Decimal128|Int64|float|int $maxDistance Distance in meters. Limits the results to those documents that are at most the specified distance from the center point. + * @param Optional|Decimal128|Int64|float|int $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. + */ + public function __construct( + Document|Serializable|GeometryInterface|stdClass|array $geometry, + Optional|Decimal128|Int64|float|int $maxDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int $minDistance = Optional::Undefined, + ) { + $this->geometry = $geometry; + $this->maxDistance = $maxDistance; + $this->minDistance = $minDistance; + } +} diff --git a/src/Builder/Query/NearSphereOperator.php b/src/Builder/Query/NearSphereOperator.php new file mode 100644 index 000000000..5494048b0 --- /dev/null +++ b/src/Builder/Query/NearSphereOperator.php @@ -0,0 +1,57 @@ + null, 'maxDistance' => '$maxDistance', 'minDistance' => '$minDistance']; + + /** @var Document|GeometryInterface|Serializable|array|stdClass $geometry */ + public readonly Document|Serializable|GeometryInterface|stdClass|array $geometry; + + /** @var Optional|Decimal128|Int64|float|int $maxDistance Distance in meters. */ + public readonly Optional|Decimal128|Int64|float|int $maxDistance; + + /** @var Optional|Decimal128|Int64|float|int $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. */ + public readonly Optional|Decimal128|Int64|float|int $minDistance; + + /** + * @param Document|GeometryInterface|Serializable|array|stdClass $geometry + * @param Optional|Decimal128|Int64|float|int $maxDistance Distance in meters. + * @param Optional|Decimal128|Int64|float|int $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. + */ + public function __construct( + Document|Serializable|GeometryInterface|stdClass|array $geometry, + Optional|Decimal128|Int64|float|int $maxDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int $minDistance = Optional::Undefined, + ) { + $this->geometry = $geometry; + $this->maxDistance = $maxDistance; + $this->minDistance = $minDistance; + } +} diff --git a/src/Builder/Query/NinOperator.php b/src/Builder/Query/NinOperator.php new file mode 100644 index 000000000..5c82c3fd8 --- /dev/null +++ b/src/Builder/Query/NinOperator.php @@ -0,0 +1,47 @@ + 'value']; + + /** @var BSONArray|PackedArray|array $value */ + public readonly PackedArray|BSONArray|array $value; + + /** + * @param BSONArray|PackedArray|array $value + */ + public function __construct(PackedArray|BSONArray|array $value) + { + if (is_array($value) && ! array_is_list($value)) { + throw new InvalidArgumentException('Expected $value argument to be a list, got an associative array.'); + } + + $this->value = $value; + } +} diff --git a/src/Builder/Query/NorOperator.php b/src/Builder/Query/NorOperator.php new file mode 100644 index 000000000..06bdc7e39 --- /dev/null +++ b/src/Builder/Query/NorOperator.php @@ -0,0 +1,49 @@ + 'queries']; + + /** @var list $queries */ + public readonly array $queries; + + /** + * @param QueryInterface|array ...$queries + * @no-named-arguments + */ + public function __construct(QueryInterface|array ...$queries) + { + if (\count($queries) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $queries, got %d.', 1, \count($queries))); + } + + if (! array_is_list($queries)) { + throw new InvalidArgumentException('Expected $queries arguments to be a list (array), named arguments are not supported'); + } + + $this->queries = $queries; + } +} diff --git a/src/Builder/Query/NotOperator.php b/src/Builder/Query/NotOperator.php new file mode 100644 index 000000000..b2ba0894b --- /dev/null +++ b/src/Builder/Query/NotOperator.php @@ -0,0 +1,41 @@ + 'expression']; + + /** @var DateTimeInterface|FieldQueryInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|FieldQueryInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|FieldQueryInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|FieldQueryInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Query/OrOperator.php b/src/Builder/Query/OrOperator.php new file mode 100644 index 000000000..1b922fdb4 --- /dev/null +++ b/src/Builder/Query/OrOperator.php @@ -0,0 +1,49 @@ + 'queries']; + + /** @var list $queries */ + public readonly array $queries; + + /** + * @param QueryInterface|array ...$queries + * @no-named-arguments + */ + public function __construct(QueryInterface|array ...$queries) + { + if (\count($queries) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $queries, got %d.', 1, \count($queries))); + } + + if (! array_is_list($queries)) { + throw new InvalidArgumentException('Expected $queries arguments to be a list (array), named arguments are not supported'); + } + + $this->queries = $queries; + } +} diff --git a/src/Builder/Query/PolygonOperator.php b/src/Builder/Query/PolygonOperator.php new file mode 100644 index 000000000..bba3aac08 --- /dev/null +++ b/src/Builder/Query/PolygonOperator.php @@ -0,0 +1,47 @@ + 'points']; + + /** @var BSONArray|PackedArray|array $points */ + public readonly PackedArray|BSONArray|array $points; + + /** + * @param BSONArray|PackedArray|array $points + */ + public function __construct(PackedArray|BSONArray|array $points) + { + if (is_array($points) && ! array_is_list($points)) { + throw new InvalidArgumentException('Expected $points argument to be a list, got an associative array.'); + } + + $this->points = $points; + } +} diff --git a/src/Builder/Query/RandOperator.php b/src/Builder/Query/RandOperator.php new file mode 100644 index 000000000..ccf8a8d28 --- /dev/null +++ b/src/Builder/Query/RandOperator.php @@ -0,0 +1,29 @@ + 'regex']; + + /** @var Regex $regex */ + public readonly Regex $regex; + + /** + * @param Regex $regex + */ + public function __construct(Regex $regex) + { + $this->regex = $regex; + } +} diff --git a/src/Builder/Query/SampleRateOperator.php b/src/Builder/Query/SampleRateOperator.php new file mode 100644 index 000000000..a027972da --- /dev/null +++ b/src/Builder/Query/SampleRateOperator.php @@ -0,0 +1,51 @@ + 'rate']; + + /** + * @var Int64|ResolvesToDouble|float|int|string $rate The selection process uses a uniform random distribution. The sample rate is a floating point number between 0 and 1, inclusive, which represents the probability that a given document will be selected as it passes through the pipeline. + * For example, a sample rate of 0.33 selects roughly one document in three. + */ + public readonly Int64|ResolvesToDouble|float|int|string $rate; + + /** + * @param Int64|ResolvesToDouble|float|int|string $rate The selection process uses a uniform random distribution. The sample rate is a floating point number between 0 and 1, inclusive, which represents the probability that a given document will be selected as it passes through the pipeline. + * For example, a sample rate of 0.33 selects roughly one document in three. + */ + public function __construct(Int64|ResolvesToDouble|float|int|string $rate) + { + if (is_string($rate) && ! str_starts_with($rate, '$')) { + throw new InvalidArgumentException('Argument $rate can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->rate = $rate; + } +} diff --git a/src/Builder/Query/SizeOperator.php b/src/Builder/Query/SizeOperator.php new file mode 100644 index 000000000..8ec123b11 --- /dev/null +++ b/src/Builder/Query/SizeOperator.php @@ -0,0 +1,37 @@ + 'value']; + + /** @var int $value */ + public readonly int $value; + + /** + * @param int $value + */ + public function __construct(int $value) + { + $this->value = $value; + } +} diff --git a/src/Builder/Query/TextOperator.php b/src/Builder/Query/TextOperator.php new file mode 100644 index 000000000..7c1c0a7ba --- /dev/null +++ b/src/Builder/Query/TextOperator.php @@ -0,0 +1,71 @@ + '$search', + 'language' => '$language', + 'caseSensitive' => '$caseSensitive', + 'diacriticSensitive' => '$diacriticSensitive', + ]; + + /** @var string $search A string of terms that MongoDB parses and uses to query the text index. MongoDB performs a logical OR search of the terms unless specified as a phrase. */ + public readonly string $search; + + /** + * @var Optional|string $language The language that determines the list of stop words for the search and the rules for the stemmer and tokenizer. If not specified, the search uses the default language of the index. + * If you specify a default_language value of none, then the text index parses through each word in the field, including stop words, and ignores suffix stemming. + */ + public readonly Optional|string $language; + + /** @var Optional|bool $caseSensitive A boolean flag to enable or disable case sensitive search. Defaults to false; i.e. the search defers to the case insensitivity of the text index. */ + public readonly Optional|bool $caseSensitive; + + /** + * @var Optional|bool $diacriticSensitive A boolean flag to enable or disable diacritic sensitive search against version 3 text indexes. Defaults to false; i.e. the search defers to the diacritic insensitivity of the text index. + * Text searches against earlier versions of the text index are inherently diacritic sensitive and cannot be diacritic insensitive. As such, the $diacriticSensitive option has no effect with earlier versions of the text index. + */ + public readonly Optional|bool $diacriticSensitive; + + /** + * @param string $search A string of terms that MongoDB parses and uses to query the text index. MongoDB performs a logical OR search of the terms unless specified as a phrase. + * @param Optional|string $language The language that determines the list of stop words for the search and the rules for the stemmer and tokenizer. If not specified, the search uses the default language of the index. + * If you specify a default_language value of none, then the text index parses through each word in the field, including stop words, and ignores suffix stemming. + * @param Optional|bool $caseSensitive A boolean flag to enable or disable case sensitive search. Defaults to false; i.e. the search defers to the case insensitivity of the text index. + * @param Optional|bool $diacriticSensitive A boolean flag to enable or disable diacritic sensitive search against version 3 text indexes. Defaults to false; i.e. the search defers to the diacritic insensitivity of the text index. + * Text searches against earlier versions of the text index are inherently diacritic sensitive and cannot be diacritic insensitive. As such, the $diacriticSensitive option has no effect with earlier versions of the text index. + */ + public function __construct( + string $search, + Optional|string $language = Optional::Undefined, + Optional|bool $caseSensitive = Optional::Undefined, + Optional|bool $diacriticSensitive = Optional::Undefined, + ) { + $this->search = $search; + $this->language = $language; + $this->caseSensitive = $caseSensitive; + $this->diacriticSensitive = $diacriticSensitive; + } +} diff --git a/src/Builder/Query/TypeOperator.php b/src/Builder/Query/TypeOperator.php new file mode 100644 index 000000000..e539ebfc8 --- /dev/null +++ b/src/Builder/Query/TypeOperator.php @@ -0,0 +1,49 @@ + 'type']; + + /** @var list $type */ + public readonly array $type; + + /** + * @param int|string ...$type + * @no-named-arguments + */ + public function __construct(int|string ...$type) + { + if (\count($type) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $type, got %d.', 1, \count($type))); + } + + if (! array_is_list($type)) { + throw new InvalidArgumentException('Expected $type arguments to be a list (array), named arguments are not supported'); + } + + $this->type = $type; + } +} diff --git a/src/Builder/Query/WhereOperator.php b/src/Builder/Query/WhereOperator.php new file mode 100644 index 000000000..e679f7347 --- /dev/null +++ b/src/Builder/Query/WhereOperator.php @@ -0,0 +1,44 @@ + 'function']; + + /** @var Javascript|string $function */ + public readonly Javascript|string $function; + + /** + * @param Javascript|string $function + */ + public function __construct(Javascript|string $function) + { + if (is_string($function)) { + $function = new Javascript($function); + } + + $this->function = $function; + } +} diff --git a/src/Builder/Search.php b/src/Builder/Search.php new file mode 100644 index 000000000..7cab84641 --- /dev/null +++ b/src/Builder/Search.php @@ -0,0 +1,10 @@ + 'path', + 'query' => 'query', + 'tokenOrder' => 'tokenOrder', + 'fuzzy' => 'fuzzy', + 'score' => 'score', + ]; + + /** @var array|string $path */ + public readonly array|string $path; + + /** @var string $query */ + public readonly string $query; + + /** @var Optional|string $tokenOrder */ + public readonly Optional|string $tokenOrder; + + /** @var Optional|Document|Serializable|array|stdClass $fuzzy */ + public readonly Optional|Document|Serializable|stdClass|array $fuzzy; + + /** @var Optional|Document|Serializable|array|stdClass $score */ + public readonly Optional|Document|Serializable|stdClass|array $score; + + /** + * @param array|string $path + * @param string $query + * @param Optional|string $tokenOrder + * @param Optional|Document|Serializable|array|stdClass $fuzzy + * @param Optional|Document|Serializable|array|stdClass $score + */ + public function __construct( + array|string $path, + string $query, + Optional|string $tokenOrder = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $fuzzy = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, + ) { + $this->path = $path; + $this->query = $query; + $this->tokenOrder = $tokenOrder; + $this->fuzzy = $fuzzy; + $this->score = $score; + } +} diff --git a/src/Builder/Search/CompoundOperator.php b/src/Builder/Search/CompoundOperator.php new file mode 100644 index 000000000..27b8c2aeb --- /dev/null +++ b/src/Builder/Search/CompoundOperator.php @@ -0,0 +1,84 @@ + 'must', + 'mustNot' => 'mustNot', + 'should' => 'should', + 'filter' => 'filter', + 'minimumShouldMatch' => 'minimumShouldMatch', + 'score' => 'score', + ]; + + /** @var Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $must */ + public readonly Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $must; + + /** @var Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $mustNot */ + public readonly Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $mustNot; + + /** @var Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $should */ + public readonly Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $should; + + /** @var Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $filter */ + public readonly Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $filter; + + /** @var Optional|int $minimumShouldMatch */ + public readonly Optional|int $minimumShouldMatch; + + /** @var Optional|Document|Serializable|array|stdClass $score */ + public readonly Optional|Document|Serializable|stdClass|array $score; + + /** + * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $must + * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $mustNot + * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $should + * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $filter + * @param Optional|int $minimumShouldMatch + * @param Optional|Document|Serializable|array|stdClass $score + */ + public function __construct( + Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $must = Optional::Undefined, + Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $mustNot = Optional::Undefined, + Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $should = Optional::Undefined, + Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $filter = Optional::Undefined, + Optional|int $minimumShouldMatch = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, + ) { + $this->must = $must; + $this->mustNot = $mustNot; + $this->should = $should; + $this->filter = $filter; + $this->minimumShouldMatch = $minimumShouldMatch; + $this->score = $score; + } +} diff --git a/src/Builder/Search/EmbeddedDocumentOperator.php b/src/Builder/Search/EmbeddedDocumentOperator.php new file mode 100644 index 000000000..91f6c1f96 --- /dev/null +++ b/src/Builder/Search/EmbeddedDocumentOperator.php @@ -0,0 +1,57 @@ + 'path', 'operator' => 'operator', 'score' => 'score']; + + /** @var array|string $path */ + public readonly array|string $path; + + /** @var Document|SearchOperatorInterface|Serializable|array|stdClass $operator */ + public readonly Document|Serializable|SearchOperatorInterface|stdClass|array $operator; + + /** @var Optional|Document|Serializable|array|stdClass $score */ + public readonly Optional|Document|Serializable|stdClass|array $score; + + /** + * @param array|string $path + * @param Document|SearchOperatorInterface|Serializable|array|stdClass $operator + * @param Optional|Document|Serializable|array|stdClass $score + */ + public function __construct( + array|string $path, + Document|Serializable|SearchOperatorInterface|stdClass|array $operator, + Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, + ) { + $this->path = $path; + $this->operator = $operator; + $this->score = $score; + } +} diff --git a/src/Builder/Search/EqualsOperator.php b/src/Builder/Search/EqualsOperator.php new file mode 100644 index 000000000..092a9ca48 --- /dev/null +++ b/src/Builder/Search/EqualsOperator.php @@ -0,0 +1,60 @@ + 'path', 'value' => 'value', 'score' => 'score']; + + /** @var array|string $path */ + public readonly array|string $path; + + /** @var Binary|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|bool|float|int|null|string $value */ + public readonly DateTimeInterface|Binary|Decimal128|Int64|ObjectId|UTCDateTime|bool|float|int|null|string $value; + + /** @var Optional|Document|Serializable|array|stdClass $score */ + public readonly Optional|Document|Serializable|stdClass|array $score; + + /** + * @param array|string $path + * @param Binary|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|bool|float|int|null|string $value + * @param Optional|Document|Serializable|array|stdClass $score + */ + public function __construct( + array|string $path, + DateTimeInterface|Binary|Decimal128|Int64|ObjectId|UTCDateTime|bool|float|int|null|string $value, + Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, + ) { + $this->path = $path; + $this->value = $value; + $this->score = $score; + } +} diff --git a/src/Builder/Search/ExistsOperator.php b/src/Builder/Search/ExistsOperator.php new file mode 100644 index 000000000..4330f130f --- /dev/null +++ b/src/Builder/Search/ExistsOperator.php @@ -0,0 +1,48 @@ + 'path', 'score' => 'score']; + + /** @var array|string $path */ + public readonly array|string $path; + + /** @var Optional|Document|Serializable|array|stdClass $score */ + public readonly Optional|Document|Serializable|stdClass|array $score; + + /** + * @param array|string $path + * @param Optional|Document|Serializable|array|stdClass $score + */ + public function __construct( + array|string $path, + Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, + ) { + $this->path = $path; + $this->score = $score; + } +} diff --git a/src/Builder/Search/FacetOperator.php b/src/Builder/Search/FacetOperator.php new file mode 100644 index 000000000..15fc10830 --- /dev/null +++ b/src/Builder/Search/FacetOperator.php @@ -0,0 +1,49 @@ + 'facets', 'operator' => 'operator']; + + /** @var Document|Serializable|array|stdClass $facets */ + public readonly Document|Serializable|stdClass|array $facets; + + /** @var Optional|Document|SearchOperatorInterface|Serializable|array|stdClass $operator */ + public readonly Optional|Document|Serializable|SearchOperatorInterface|stdClass|array $operator; + + /** + * @param Document|Serializable|array|stdClass $facets + * @param Optional|Document|SearchOperatorInterface|Serializable|array|stdClass $operator + */ + public function __construct( + Document|Serializable|stdClass|array $facets, + Optional|Document|Serializable|SearchOperatorInterface|stdClass|array $operator = Optional::Undefined, + ) { + $this->facets = $facets; + $this->operator = $operator; + } +} diff --git a/src/Builder/Search/FactoryTrait.php b/src/Builder/Search/FactoryTrait.php new file mode 100644 index 000000000..c5f3b009c --- /dev/null +++ b/src/Builder/Search/FactoryTrait.php @@ -0,0 +1,346 @@ + 'path', 'relation' => 'relation', 'geometry' => 'geometry', 'score' => 'score']; + + /** @var array|string $path */ + public readonly array|string $path; + + /** @var string $relation */ + public readonly string $relation; + + /** @var Document|GeometryInterface|Serializable|array|stdClass $geometry */ + public readonly Document|Serializable|GeometryInterface|stdClass|array $geometry; + + /** @var Optional|Document|Serializable|array|stdClass $score */ + public readonly Optional|Document|Serializable|stdClass|array $score; + + /** + * @param array|string $path + * @param string $relation + * @param Document|GeometryInterface|Serializable|array|stdClass $geometry + * @param Optional|Document|Serializable|array|stdClass $score + */ + public function __construct( + array|string $path, + string $relation, + Document|Serializable|GeometryInterface|stdClass|array $geometry, + Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, + ) { + $this->path = $path; + $this->relation = $relation; + $this->geometry = $geometry; + $this->score = $score; + } +} diff --git a/src/Builder/Search/GeoWithinOperator.php b/src/Builder/Search/GeoWithinOperator.php new file mode 100644 index 000000000..dcf605697 --- /dev/null +++ b/src/Builder/Search/GeoWithinOperator.php @@ -0,0 +1,76 @@ + 'path', + 'box' => 'box', + 'circle' => 'circle', + 'geometry' => 'geometry', + 'score' => 'score', + ]; + + /** @var array|string $path */ + public readonly array|string $path; + + /** @var Optional|Document|Serializable|array|stdClass $box */ + public readonly Optional|Document|Serializable|stdClass|array $box; + + /** @var Optional|Document|Serializable|array|stdClass $circle */ + public readonly Optional|Document|Serializable|stdClass|array $circle; + + /** @var Optional|Document|GeometryInterface|Serializable|array|stdClass $geometry */ + public readonly Optional|Document|Serializable|GeometryInterface|stdClass|array $geometry; + + /** @var Optional|Document|Serializable|array|stdClass $score */ + public readonly Optional|Document|Serializable|stdClass|array $score; + + /** + * @param array|string $path + * @param Optional|Document|Serializable|array|stdClass $box + * @param Optional|Document|Serializable|array|stdClass $circle + * @param Optional|Document|GeometryInterface|Serializable|array|stdClass $geometry + * @param Optional|Document|Serializable|array|stdClass $score + */ + public function __construct( + array|string $path, + Optional|Document|Serializable|stdClass|array $box = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $circle = Optional::Undefined, + Optional|Document|Serializable|GeometryInterface|stdClass|array $geometry = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, + ) { + $this->path = $path; + $this->box = $box; + $this->circle = $circle; + $this->geometry = $geometry; + $this->score = $score; + } +} diff --git a/src/Builder/Search/InOperator.php b/src/Builder/Search/InOperator.php new file mode 100644 index 000000000..b9aaf5875 --- /dev/null +++ b/src/Builder/Search/InOperator.php @@ -0,0 +1,66 @@ + 'path', 'value' => 'value', 'score' => 'score']; + + /** @var array|string $path */ + public readonly array|string $path; + + /** @var BSONArray|DateTimeInterface|PackedArray|Type|array|bool|float|int|null|stdClass|string $value */ + public readonly DateTimeInterface|PackedArray|Type|BSONArray|stdClass|array|bool|float|int|null|string $value; + + /** @var Optional|Document|Serializable|array|stdClass $score */ + public readonly Optional|Document|Serializable|stdClass|array $score; + + /** + * @param array|string $path + * @param BSONArray|DateTimeInterface|PackedArray|Type|array|bool|float|int|null|stdClass|string $value + * @param Optional|Document|Serializable|array|stdClass $score + */ + public function __construct( + array|string $path, + DateTimeInterface|PackedArray|Type|BSONArray|stdClass|array|bool|float|int|null|string $value, + Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, + ) { + $this->path = $path; + if (is_array($value) && ! array_is_list($value)) { + throw new InvalidArgumentException('Expected $value argument to be a list, got an associative array.'); + } + + $this->value = $value; + $this->score = $score; + } +} diff --git a/src/Builder/Search/MoreLikeThisOperator.php b/src/Builder/Search/MoreLikeThisOperator.php new file mode 100644 index 000000000..689508d53 --- /dev/null +++ b/src/Builder/Search/MoreLikeThisOperator.php @@ -0,0 +1,52 @@ + 'like', 'score' => 'score']; + + /** @var BSONArray|Document|PackedArray|Serializable|array|stdClass $like */ + public readonly Document|PackedArray|Serializable|BSONArray|stdClass|array $like; + + /** @var Optional|Document|Serializable|array|stdClass $score */ + public readonly Optional|Document|Serializable|stdClass|array $score; + + /** + * @param BSONArray|Document|PackedArray|Serializable|array|stdClass $like + * @param Optional|Document|Serializable|array|stdClass $score + */ + public function __construct( + Document|PackedArray|Serializable|BSONArray|stdClass|array $like, + Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, + ) { + $this->like = $like; + $this->score = $score; + } +} diff --git a/src/Builder/Search/NearOperator.php b/src/Builder/Search/NearOperator.php new file mode 100644 index 000000000..b22013ead --- /dev/null +++ b/src/Builder/Search/NearOperator.php @@ -0,0 +1,65 @@ + 'path', 'origin' => 'origin', 'pivot' => 'pivot', 'score' => 'score']; + + /** @var array|string $path */ + public readonly array|string $path; + + /** @var DateTimeInterface|Decimal128|Document|GeometryInterface|Int64|Serializable|UTCDateTime|array|float|int|stdClass $origin */ + public readonly DateTimeInterface|Decimal128|Document|Int64|Serializable|UTCDateTime|GeometryInterface|stdClass|array|float|int $origin; + + /** @var Decimal128|Int64|float|int $pivot */ + public readonly Decimal128|Int64|float|int $pivot; + + /** @var Optional|Document|Serializable|array|stdClass $score */ + public readonly Optional|Document|Serializable|stdClass|array $score; + + /** + * @param array|string $path + * @param DateTimeInterface|Decimal128|Document|GeometryInterface|Int64|Serializable|UTCDateTime|array|float|int|stdClass $origin + * @param Decimal128|Int64|float|int $pivot + * @param Optional|Document|Serializable|array|stdClass $score + */ + public function __construct( + array|string $path, + DateTimeInterface|Decimal128|Document|Int64|Serializable|UTCDateTime|GeometryInterface|stdClass|array|float|int $origin, + Decimal128|Int64|float|int $pivot, + Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, + ) { + $this->path = $path; + $this->origin = $origin; + $this->pivot = $pivot; + $this->score = $score; + } +} diff --git a/src/Builder/Search/PhraseOperator.php b/src/Builder/Search/PhraseOperator.php new file mode 100644 index 000000000..2bbb707a9 --- /dev/null +++ b/src/Builder/Search/PhraseOperator.php @@ -0,0 +1,83 @@ + 'path', + 'query' => 'query', + 'slop' => 'slop', + 'synonyms' => 'synonyms', + 'score' => 'score', + ]; + + /** @var array|string $path */ + public readonly array|string $path; + + /** @var BSONArray|PackedArray|array|string $query */ + public readonly PackedArray|BSONArray|array|string $query; + + /** @var Optional|int $slop */ + public readonly Optional|int $slop; + + /** @var Optional|string $synonyms */ + public readonly Optional|string $synonyms; + + /** @var Optional|Document|Serializable|array|stdClass $score */ + public readonly Optional|Document|Serializable|stdClass|array $score; + + /** + * @param array|string $path + * @param BSONArray|PackedArray|array|string $query + * @param Optional|int $slop + * @param Optional|string $synonyms + * @param Optional|Document|Serializable|array|stdClass $score + */ + public function __construct( + array|string $path, + PackedArray|BSONArray|array|string $query, + Optional|int $slop = Optional::Undefined, + Optional|string $synonyms = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, + ) { + $this->path = $path; + if (is_array($query) && ! array_is_list($query)) { + throw new InvalidArgumentException('Expected $query argument to be a list, got an associative array.'); + } + + $this->query = $query; + $this->slop = $slop; + $this->synonyms = $synonyms; + $this->score = $score; + } +} diff --git a/src/Builder/Search/QueryStringOperator.php b/src/Builder/Search/QueryStringOperator.php new file mode 100644 index 000000000..edc4d3471 --- /dev/null +++ b/src/Builder/Search/QueryStringOperator.php @@ -0,0 +1,40 @@ + 'defaultPath', 'query' => 'query']; + + /** @var array|string $defaultPath */ + public readonly array|string $defaultPath; + + /** @var string $query */ + public readonly string $query; + + /** + * @param array|string $defaultPath + * @param string $query + */ + public function __construct(array|string $defaultPath, string $query) + { + $this->defaultPath = $defaultPath; + $this->query = $query; + } +} diff --git a/src/Builder/Search/RangeOperator.php b/src/Builder/Search/RangeOperator.php new file mode 100644 index 000000000..e277f2b06 --- /dev/null +++ b/src/Builder/Search/RangeOperator.php @@ -0,0 +1,86 @@ + 'path', + 'gt' => 'gt', + 'gte' => 'gte', + 'lt' => 'lt', + 'lte' => 'lte', + 'score' => 'score', + ]; + + /** @var array|string $path */ + public readonly array|string $path; + + /** @var Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $gt */ + public readonly Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $gt; + + /** @var Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $gte */ + public readonly Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $gte; + + /** @var Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $lt */ + public readonly Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $lt; + + /** @var Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $lte */ + public readonly Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $lte; + + /** @var Optional|Document|Serializable|array|stdClass $score */ + public readonly Optional|Document|Serializable|stdClass|array $score; + + /** + * @param array|string $path + * @param Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $gt + * @param Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $gte + * @param Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $lt + * @param Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $lte + * @param Optional|Document|Serializable|array|stdClass $score + */ + public function __construct( + array|string $path, + Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $gt = Optional::Undefined, + Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $gte = Optional::Undefined, + Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $lt = Optional::Undefined, + Optional|DateTimeInterface|Decimal128|Int64|ObjectId|UTCDateTime|float|int|string $lte = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, + ) { + $this->path = $path; + $this->gt = $gt; + $this->gte = $gte; + $this->lt = $lt; + $this->lte = $lte; + $this->score = $score; + } +} diff --git a/src/Builder/Search/RegexOperator.php b/src/Builder/Search/RegexOperator.php new file mode 100644 index 000000000..6b2c2d63a --- /dev/null +++ b/src/Builder/Search/RegexOperator.php @@ -0,0 +1,67 @@ + 'path', + 'query' => 'query', + 'allowAnalyzedField' => 'allowAnalyzedField', + 'score' => 'score', + ]; + + /** @var array|string $path */ + public readonly array|string $path; + + /** @var string $query */ + public readonly string $query; + + /** @var Optional|bool $allowAnalyzedField */ + public readonly Optional|bool $allowAnalyzedField; + + /** @var Optional|Document|Serializable|array|stdClass $score */ + public readonly Optional|Document|Serializable|stdClass|array $score; + + /** + * @param array|string $path + * @param string $query + * @param Optional|bool $allowAnalyzedField + * @param Optional|Document|Serializable|array|stdClass $score + */ + public function __construct( + array|string $path, + string $query, + Optional|bool $allowAnalyzedField = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, + ) { + $this->path = $path; + $this->query = $query; + $this->allowAnalyzedField = $allowAnalyzedField; + $this->score = $score; + } +} diff --git a/src/Builder/Search/TextOperator.php b/src/Builder/Search/TextOperator.php new file mode 100644 index 000000000..4ade6b434 --- /dev/null +++ b/src/Builder/Search/TextOperator.php @@ -0,0 +1,81 @@ + 'path', + 'query' => 'query', + 'fuzzy' => 'fuzzy', + 'matchCriteria' => 'matchCriteria', + 'synonyms' => 'synonyms', + 'score' => 'score', + ]; + + /** @var array|string $path */ + public readonly array|string $path; + + /** @var string $query */ + public readonly string $query; + + /** @var Optional|Document|Serializable|array|stdClass $fuzzy */ + public readonly Optional|Document|Serializable|stdClass|array $fuzzy; + + /** @var Optional|string $matchCriteria */ + public readonly Optional|string $matchCriteria; + + /** @var Optional|string $synonyms */ + public readonly Optional|string $synonyms; + + /** @var Optional|Document|Serializable|array|stdClass $score */ + public readonly Optional|Document|Serializable|stdClass|array $score; + + /** + * @param array|string $path + * @param string $query + * @param Optional|Document|Serializable|array|stdClass $fuzzy + * @param Optional|string $matchCriteria + * @param Optional|string $synonyms + * @param Optional|Document|Serializable|array|stdClass $score + */ + public function __construct( + array|string $path, + string $query, + Optional|Document|Serializable|stdClass|array $fuzzy = Optional::Undefined, + Optional|string $matchCriteria = Optional::Undefined, + Optional|string $synonyms = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, + ) { + $this->path = $path; + $this->query = $query; + $this->fuzzy = $fuzzy; + $this->matchCriteria = $matchCriteria; + $this->synonyms = $synonyms; + $this->score = $score; + } +} diff --git a/src/Builder/Search/WildcardOperator.php b/src/Builder/Search/WildcardOperator.php new file mode 100644 index 000000000..ee481910e --- /dev/null +++ b/src/Builder/Search/WildcardOperator.php @@ -0,0 +1,66 @@ + 'path', + 'query' => 'query', + 'allowAnalyzedField' => 'allowAnalyzedField', + 'score' => 'score', + ]; + + /** @var array|string $path */ + public readonly array|string $path; + + /** @var string $query */ + public readonly string $query; + + /** @var Optional|bool $allowAnalyzedField */ + public readonly Optional|bool $allowAnalyzedField; + + /** @var Optional|Document|Serializable|array|stdClass $score */ + public readonly Optional|Document|Serializable|stdClass|array $score; + + /** + * @param array|string $path + * @param string $query + * @param Optional|bool $allowAnalyzedField + * @param Optional|Document|Serializable|array|stdClass $score + */ + public function __construct( + array|string $path, + string $query, + Optional|bool $allowAnalyzedField = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, + ) { + $this->path = $path; + $this->query = $query; + $this->allowAnalyzedField = $allowAnalyzedField; + $this->score = $score; + } +} diff --git a/src/Builder/Stage.php b/src/Builder/Stage.php new file mode 100644 index 000000000..2dbbfd972 --- /dev/null +++ b/src/Builder/Stage.php @@ -0,0 +1,37 @@ +|bool|float|int|string|null ...$queries The query predicates to match + */ + public static function match(DateTimeInterface|QueryInterface|FieldQueryInterface|Type|stdClass|array|bool|float|int|string|null ...$queries): MatchStage + { + // Override the generated method to allow variadic arguments + return self::generatedMatch($queries); + } + + private function __construct() + { + // This class cannot be instantiated + } +} diff --git a/src/Builder/Stage/AddFieldsStage.php b/src/Builder/Stage/AddFieldsStage.php new file mode 100644 index 000000000..f6385a391 --- /dev/null +++ b/src/Builder/Stage/AddFieldsStage.php @@ -0,0 +1,56 @@ + 'expression']; + + /** @var stdClass $expression Specify the name of each field to add and set its value to an aggregation expression or an empty object. */ + public readonly stdClass $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string ...$expression Specify the name of each field to add and set its value to an aggregation expression or an empty object. + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, + ) { + if (\count($expression) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); + } + + foreach($expression as $key => $value) { + if (! is_string($key)) { + throw new InvalidArgumentException('Expected $expression arguments to be a map (object), named arguments (:) or array unpacking ...[\'\' => ] must be used'); + } + } + + $expression = (object) $expression; + $this->expression = $expression; + } +} diff --git a/src/Builder/Stage/BucketAutoStage.php b/src/Builder/Stage/BucketAutoStage.php new file mode 100644 index 000000000..21975208c --- /dev/null +++ b/src/Builder/Stage/BucketAutoStage.php @@ -0,0 +1,77 @@ + 'groupBy', + 'buckets' => 'buckets', + 'output' => 'output', + 'granularity' => 'granularity', + ]; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $groupBy An expression to group documents by. To specify a field path, prefix the field name with a dollar sign $ and enclose it in quotes. */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $groupBy; + + /** @var int $buckets A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. */ + public readonly int $buckets; + + /** + * @var Optional|Document|Serializable|array|stdClass $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + * The default count field is not included in the output document when output is specified. Explicitly specify the count expression as part of the output document to include it. + */ + public readonly Optional|Document|Serializable|stdClass|array $output; + + /** + * @var Optional|string $granularity A string that specifies the preferred number series to use to ensure that the calculated boundary edges end on preferred round numbers or their powers of 10. + * Available only if the all groupBy values are numeric and none of them are NaN. + */ + public readonly Optional|string $granularity; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $groupBy An expression to group documents by. To specify a field path, prefix the field name with a dollar sign $ and enclose it in quotes. + * @param int $buckets A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. + * @param Optional|Document|Serializable|array|stdClass $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + * The default count field is not included in the output document when output is specified. Explicitly specify the count expression as part of the output document to include it. + * @param Optional|string $granularity A string that specifies the preferred number series to use to ensure that the calculated boundary edges end on preferred round numbers or their powers of 10. + * Available only if the all groupBy values are numeric and none of them are NaN. + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $groupBy, + int $buckets, + Optional|Document|Serializable|stdClass|array $output = Optional::Undefined, + Optional|string $granularity = Optional::Undefined, + ) { + $this->groupBy = $groupBy; + $this->buckets = $buckets; + $this->output = $output; + $this->granularity = $granularity; + } +} diff --git a/src/Builder/Stage/BucketStage.php b/src/Builder/Stage/BucketStage.php new file mode 100644 index 000000000..334f73dd7 --- /dev/null +++ b/src/Builder/Stage/BucketStage.php @@ -0,0 +1,101 @@ + 'groupBy', + 'boundaries' => 'boundaries', + 'default' => 'default', + 'output' => 'output', + ]; + + /** + * @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $groupBy An expression to group documents by. To specify a field path, prefix the field name with a dollar sign $ and enclose it in quotes. + * Unless $bucket includes a default specification, each input document must resolve the groupBy field path or expression to a value that falls within one of the ranges specified by the boundaries. + */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $groupBy; + + /** + * @var BSONArray|PackedArray|array $boundaries An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries. + * The specified values must be in ascending order and all of the same type. The exception is if the values are of mixed numeric types, such as: + */ + public readonly PackedArray|BSONArray|array $boundaries; + + /** + * @var Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default A literal that specifies the _id of an additional bucket that contains all documents whose groupBy expression result does not fall into a bucket specified by boundaries. + * If unspecified, each input document must resolve the groupBy expression to a value within one of the bucket ranges specified by boundaries or the operation throws an error. + * The default value must be less than the lowest boundaries value, or greater than or equal to the highest boundaries value. + * The default value can be of a different type than the entries in boundaries. + */ + public readonly Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default; + + /** + * @var Optional|Document|Serializable|array|stdClass $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + * If you do not specify an output document, the operation returns a count field containing the number of documents in each bucket. + * If you specify an output document, only the fields specified in the document are returned; i.e. the count field is not returned unless it is explicitly included in the output document. + */ + public readonly Optional|Document|Serializable|stdClass|array $output; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $groupBy An expression to group documents by. To specify a field path, prefix the field name with a dollar sign $ and enclose it in quotes. + * Unless $bucket includes a default specification, each input document must resolve the groupBy field path or expression to a value that falls within one of the ranges specified by the boundaries. + * @param BSONArray|PackedArray|array $boundaries An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries. + * The specified values must be in ascending order and all of the same type. The exception is if the values are of mixed numeric types, such as: + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default A literal that specifies the _id of an additional bucket that contains all documents whose groupBy expression result does not fall into a bucket specified by boundaries. + * If unspecified, each input document must resolve the groupBy expression to a value within one of the bucket ranges specified by boundaries or the operation throws an error. + * The default value must be less than the lowest boundaries value, or greater than or equal to the highest boundaries value. + * The default value can be of a different type than the entries in boundaries. + * @param Optional|Document|Serializable|array|stdClass $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + * If you do not specify an output document, the operation returns a count field containing the number of documents in each bucket. + * If you specify an output document, only the fields specified in the document are returned; i.e. the count field is not returned unless it is explicitly included in the output document. + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $groupBy, + PackedArray|BSONArray|array $boundaries, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $output = Optional::Undefined, + ) { + $this->groupBy = $groupBy; + if (is_array($boundaries) && ! array_is_list($boundaries)) { + throw new InvalidArgumentException('Expected $boundaries argument to be a list, got an associative array.'); + } + + $this->boundaries = $boundaries; + $this->default = $default; + $this->output = $output; + } +} diff --git a/src/Builder/Stage/ChangeStreamSplitLargeEventStage.php b/src/Builder/Stage/ChangeStreamSplitLargeEventStage.php new file mode 100644 index 000000000..2539ddb19 --- /dev/null +++ b/src/Builder/Stage/ChangeStreamSplitLargeEventStage.php @@ -0,0 +1,30 @@ + 'allChangesForCluster', + 'fullDocument' => 'fullDocument', + 'fullDocumentBeforeChange' => 'fullDocumentBeforeChange', + 'resumeAfter' => 'resumeAfter', + 'showExpandedEvents' => 'showExpandedEvents', + 'startAfter' => 'startAfter', + 'startAtOperationTime' => 'startAtOperationTime', + ]; + + /** @var Optional|bool $allChangesForCluster A flag indicating whether the stream should report all changes that occur on the deployment, aside from those on internal databases or collections. */ + public readonly Optional|bool $allChangesForCluster; + + /** @var Optional|string $fullDocument Specifies whether change notifications include a copy of the full document when modified by update operations. */ + public readonly Optional|string $fullDocument; + + /** @var Optional|string $fullDocumentBeforeChange Valid values are "off", "whenAvailable", or "required". If set to "off", the "fullDocumentBeforeChange" field of the output document is always omitted. If set to "whenAvailable", the "fullDocumentBeforeChange" field will be populated with the pre-image of the document modified by the current change event if such a pre-image is available, and will be omitted otherwise. If set to "required", then the "fullDocumentBeforeChange" field is always populated and an exception is thrown if the pre-image is not available. */ + public readonly Optional|string $fullDocumentBeforeChange; + + /** @var Optional|int $resumeAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with startAfter or startAtOperationTime fields. */ + public readonly Optional|int $resumeAfter; + + /** + * @var Optional|bool $showExpandedEvents Specifies whether to include additional change events, such as such as DDL and index operations. + * New in MongoDB 6.0. + */ + public readonly Optional|bool $showExpandedEvents; + + /** @var Optional|Document|Serializable|array|stdClass $startAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with resumeAfter or startAtOperationTime fields. */ + public readonly Optional|Document|Serializable|stdClass|array $startAfter; + + /** @var Optional|Timestamp|int $startAtOperationTime Specifies a time as the logical starting point for the change stream. Cannot be used with resumeAfter or startAfter fields. */ + public readonly Optional|Timestamp|int $startAtOperationTime; + + /** + * @param Optional|bool $allChangesForCluster A flag indicating whether the stream should report all changes that occur on the deployment, aside from those on internal databases or collections. + * @param Optional|string $fullDocument Specifies whether change notifications include a copy of the full document when modified by update operations. + * @param Optional|string $fullDocumentBeforeChange Valid values are "off", "whenAvailable", or "required". If set to "off", the "fullDocumentBeforeChange" field of the output document is always omitted. If set to "whenAvailable", the "fullDocumentBeforeChange" field will be populated with the pre-image of the document modified by the current change event if such a pre-image is available, and will be omitted otherwise. If set to "required", then the "fullDocumentBeforeChange" field is always populated and an exception is thrown if the pre-image is not available. + * @param Optional|int $resumeAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with startAfter or startAtOperationTime fields. + * @param Optional|bool $showExpandedEvents Specifies whether to include additional change events, such as such as DDL and index operations. + * New in MongoDB 6.0. + * @param Optional|Document|Serializable|array|stdClass $startAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with resumeAfter or startAtOperationTime fields. + * @param Optional|Timestamp|int $startAtOperationTime Specifies a time as the logical starting point for the change stream. Cannot be used with resumeAfter or startAfter fields. + */ + public function __construct( + Optional|bool $allChangesForCluster = Optional::Undefined, + Optional|string $fullDocument = Optional::Undefined, + Optional|string $fullDocumentBeforeChange = Optional::Undefined, + Optional|int $resumeAfter = Optional::Undefined, + Optional|bool $showExpandedEvents = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $startAfter = Optional::Undefined, + Optional|Timestamp|int $startAtOperationTime = Optional::Undefined, + ) { + $this->allChangesForCluster = $allChangesForCluster; + $this->fullDocument = $fullDocument; + $this->fullDocumentBeforeChange = $fullDocumentBeforeChange; + $this->resumeAfter = $resumeAfter; + $this->showExpandedEvents = $showExpandedEvents; + $this->startAfter = $startAfter; + $this->startAtOperationTime = $startAtOperationTime; + } +} diff --git a/src/Builder/Stage/CollStatsStage.php b/src/Builder/Stage/CollStatsStage.php new file mode 100644 index 000000000..d84245320 --- /dev/null +++ b/src/Builder/Stage/CollStatsStage.php @@ -0,0 +1,66 @@ + 'latencyStats', + 'storageStats' => 'storageStats', + 'count' => 'count', + 'queryExecStats' => 'queryExecStats', + ]; + + /** @var Optional|Document|Serializable|array|stdClass $latencyStats */ + public readonly Optional|Document|Serializable|stdClass|array $latencyStats; + + /** @var Optional|Document|Serializable|array|stdClass $storageStats */ + public readonly Optional|Document|Serializable|stdClass|array $storageStats; + + /** @var Optional|Document|Serializable|array|stdClass $count */ + public readonly Optional|Document|Serializable|stdClass|array $count; + + /** @var Optional|Document|Serializable|array|stdClass $queryExecStats */ + public readonly Optional|Document|Serializable|stdClass|array $queryExecStats; + + /** + * @param Optional|Document|Serializable|array|stdClass $latencyStats + * @param Optional|Document|Serializable|array|stdClass $storageStats + * @param Optional|Document|Serializable|array|stdClass $count + * @param Optional|Document|Serializable|array|stdClass $queryExecStats + */ + public function __construct( + Optional|Document|Serializable|stdClass|array $latencyStats = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $storageStats = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $queryExecStats = Optional::Undefined, + ) { + $this->latencyStats = $latencyStats; + $this->storageStats = $storageStats; + $this->count = $count; + $this->queryExecStats = $queryExecStats; + } +} diff --git a/src/Builder/Stage/CountStage.php b/src/Builder/Stage/CountStage.php new file mode 100644 index 000000000..387da5efc --- /dev/null +++ b/src/Builder/Stage/CountStage.php @@ -0,0 +1,38 @@ + 'field']; + + /** @var string $field Name of the output field which has the count as its value. It must be a non-empty string, must not start with $ and must not contain the . character. */ + public readonly string $field; + + /** + * @param string $field Name of the output field which has the count as its value. It must be a non-empty string, must not start with $ and must not contain the . character. + */ + public function __construct(string $field) + { + $this->field = $field; + } +} diff --git a/src/Builder/Stage/CurrentOpStage.php b/src/Builder/Stage/CurrentOpStage.php new file mode 100644 index 000000000..3d0d6abb2 --- /dev/null +++ b/src/Builder/Stage/CurrentOpStage.php @@ -0,0 +1,70 @@ + 'allUsers', + 'idleConnections' => 'idleConnections', + 'idleCursors' => 'idleCursors', + 'idleSessions' => 'idleSessions', + 'localOps' => 'localOps', + ]; + + /** @var Optional|bool $allUsers */ + public readonly Optional|bool $allUsers; + + /** @var Optional|bool $idleConnections */ + public readonly Optional|bool $idleConnections; + + /** @var Optional|bool $idleCursors */ + public readonly Optional|bool $idleCursors; + + /** @var Optional|bool $idleSessions */ + public readonly Optional|bool $idleSessions; + + /** @var Optional|bool $localOps */ + public readonly Optional|bool $localOps; + + /** + * @param Optional|bool $allUsers + * @param Optional|bool $idleConnections + * @param Optional|bool $idleCursors + * @param Optional|bool $idleSessions + * @param Optional|bool $localOps + */ + public function __construct( + Optional|bool $allUsers = Optional::Undefined, + Optional|bool $idleConnections = Optional::Undefined, + Optional|bool $idleCursors = Optional::Undefined, + Optional|bool $idleSessions = Optional::Undefined, + Optional|bool $localOps = Optional::Undefined, + ) { + $this->allUsers = $allUsers; + $this->idleConnections = $idleConnections; + $this->idleCursors = $idleCursors; + $this->idleSessions = $idleSessions; + $this->localOps = $localOps; + } +} diff --git a/src/Builder/Stage/DensifyStage.php b/src/Builder/Stage/DensifyStage.php new file mode 100644 index 000000000..9ecff7bbc --- /dev/null +++ b/src/Builder/Stage/DensifyStage.php @@ -0,0 +1,70 @@ + 'field', 'range' => 'range', 'partitionByFields' => 'partitionByFields']; + + /** + * @var string $field The field to densify. The values of the specified field must either be all numeric values or all dates. + * Documents that do not contain the specified field continue through the pipeline unmodified. + * To specify a in an embedded document or in an array, use dot notation. + */ + public readonly string $field; + + /** @var Document|Serializable|array|stdClass $range Specification for range based densification. */ + public readonly Document|Serializable|stdClass|array $range; + + /** @var Optional|BSONArray|PackedArray|array $partitionByFields The field(s) that will be used as the partition keys. */ + public readonly Optional|PackedArray|BSONArray|array $partitionByFields; + + /** + * @param string $field The field to densify. The values of the specified field must either be all numeric values or all dates. + * Documents that do not contain the specified field continue through the pipeline unmodified. + * To specify a in an embedded document or in an array, use dot notation. + * @param Document|Serializable|array|stdClass $range Specification for range based densification. + * @param Optional|BSONArray|PackedArray|array $partitionByFields The field(s) that will be used as the partition keys. + */ + public function __construct( + string $field, + Document|Serializable|stdClass|array $range, + Optional|PackedArray|BSONArray|array $partitionByFields = Optional::Undefined, + ) { + $this->field = $field; + $this->range = $range; + if (is_array($partitionByFields) && ! array_is_list($partitionByFields)) { + throw new InvalidArgumentException('Expected $partitionByFields argument to be a list, got an associative array.'); + } + + $this->partitionByFields = $partitionByFields; + } +} diff --git a/src/Builder/Stage/DocumentsStage.php b/src/Builder/Stage/DocumentsStage.php new file mode 100644 index 000000000..c020a9cb0 --- /dev/null +++ b/src/Builder/Stage/DocumentsStage.php @@ -0,0 +1,64 @@ + 'documents']; + + /** + * @var BSONArray|PackedArray|ResolvesToArray|array|string $documents $documents accepts any valid expression that resolves to an array of objects. This includes: + * - system variables, such as $$NOW or $$SEARCH_META + * - $let expressions + * - variables in scope from $lookup expressions + * Expressions that do not resolve to a current document, like $myField or $$ROOT, will result in an error. + */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $documents; + + /** + * @param BSONArray|PackedArray|ResolvesToArray|array|string $documents $documents accepts any valid expression that resolves to an array of objects. This includes: + * - system variables, such as $$NOW or $$SEARCH_META + * - $let expressions + * - variables in scope from $lookup expressions + * Expressions that do not resolve to a current document, like $myField or $$ROOT, will result in an error. + */ + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $documents) + { + if (is_string($documents) && ! str_starts_with($documents, '$')) { + throw new InvalidArgumentException('Argument $documents can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + if (is_array($documents) && ! array_is_list($documents)) { + throw new InvalidArgumentException('Expected $documents argument to be a list, got an associative array.'); + } + + $this->documents = $documents; + } +} diff --git a/src/Builder/Stage/FacetStage.php b/src/Builder/Stage/FacetStage.php new file mode 100644 index 000000000..6dc36bebd --- /dev/null +++ b/src/Builder/Stage/FacetStage.php @@ -0,0 +1,55 @@ + 'facet']; + + /** @var stdClass $facet */ + public readonly stdClass $facet; + + /** + * @param BSONArray|PackedArray|Pipeline|array ...$facet + */ + public function __construct(PackedArray|Pipeline|BSONArray|array ...$facet) + { + if (\count($facet) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $facet, got %d.', 1, \count($facet))); + } + + foreach($facet as $key => $value) { + if (! is_string($key)) { + throw new InvalidArgumentException('Expected $facet arguments to be a map (object), named arguments (:) or array unpacking ...[\'\' => ] must be used'); + } + } + + $facet = (object) $facet; + $this->facet = $facet; + } +} diff --git a/src/Builder/Stage/FactoryTrait.php b/src/Builder/Stage/FactoryTrait.php new file mode 100644 index 000000000..df5860ded --- /dev/null +++ b/src/Builder/Stage/FactoryTrait.php @@ -0,0 +1,739 @@ + in an embedded document or in an array, use dot notation. + * @param Document|Serializable|array|stdClass $range Specification for range based densification. + * @param Optional|BSONArray|PackedArray|array $partitionByFields The field(s) that will be used as the partition keys. + */ + public static function densify( + string $field, + Document|Serializable|stdClass|array $range, + Optional|PackedArray|BSONArray|array $partitionByFields = Optional::Undefined, + ): DensifyStage { + return new DensifyStage($field, $range, $partitionByFields); + } + + /** + * Returns literal documents from input values. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/documents/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $documents $documents accepts any valid expression that resolves to an array of objects. This includes: + * - system variables, such as $$NOW or $$SEARCH_META + * - $let expressions + * - variables in scope from $lookup expressions + * Expressions that do not resolve to a current document, like $myField or $$ROOT, will result in an error. + */ + public static function documents(PackedArray|ResolvesToArray|BSONArray|array|string $documents): DocumentsStage + { + return new DocumentsStage($documents); + } + + /** + * Processes multiple aggregation pipelines within a single stage on the same set of input documents. Enables the creation of multi-faceted aggregations capable of characterizing data across multiple dimensions, or facets, in a single stage. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/facet/ + * @param BSONArray|PackedArray|Pipeline|array ...$facet + */ + public static function facet(PackedArray|Pipeline|BSONArray|array ...$facet): FacetStage + { + return new FacetStage(...$facet); + } + + /** + * Populates null and missing field values within documents. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/fill/ + * @param Document|Serializable|array|stdClass $output Specifies an object containing each field for which to fill missing values. You can specify multiple fields in the output object. + * The object name is the name of the field to fill. The object value specifies how the field is filled. + * @param Optional|Document|Serializable|array|stdClass|string $partitionBy Specifies an expression to group the documents. In the $fill stage, a group of documents is known as a partition. + * If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. + * partitionBy and partitionByFields are mutually exclusive. + * @param Optional|BSONArray|PackedArray|array $partitionByFields Specifies an array of fields as the compound key to group the documents. In the $fill stage, each group of documents is known as a partition. + * If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. + * partitionBy and partitionByFields are mutually exclusive. + * @param Optional|Document|Serializable|array|stdClass $sortBy Specifies the field or fields to sort the documents within each partition. Uses the same syntax as the $sort stage. + */ + public static function fill( + Document|Serializable|stdClass|array $output, + Optional|Document|Serializable|stdClass|array|string $partitionBy = Optional::Undefined, + Optional|PackedArray|BSONArray|array $partitionByFields = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $sortBy = Optional::Undefined, + ): FillStage { + return new FillStage($output, $partitionBy, $partitionByFields, $sortBy); + } + + /** + * Returns an ordered stream of documents based on the proximity to a geospatial point. Incorporates the functionality of $match, $sort, and $limit for geospatial data. The output documents include an additional distance field and can include a location identifier field. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/geoNear/ + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $near The point for which to find the closest documents. + * @param Optional|string $distanceField The output field that contains the calculated distance. To specify a field within an embedded document, use dot notation. + * @param Optional|Decimal128|Int64|float|int $distanceMultiplier The factor to multiply all distances returned by the query. For example, use the distanceMultiplier to convert radians, as returned by a spherical query, to kilometers by multiplying by the radius of the Earth. + * @param Optional|string $includeLocs This specifies the output field that identifies the location used to calculate the distance. This option is useful when a location field contains multiple locations. To specify a field within an embedded document, use dot notation. + * @param Optional|string $key Specify the geospatial indexed field to use when calculating the distance. + * @param Optional|Decimal128|Int64|float|int $maxDistance The maximum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall within the specified distance from the center point. + * Specify the distance in meters if the specified point is GeoJSON and in radians if the specified point is legacy coordinate pairs. + * @param Optional|Decimal128|Int64|float|int $minDistance The minimum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall outside the specified distance from the center point. + * Specify the distance in meters for GeoJSON data and in radians for legacy coordinate pairs. + * @param Optional|QueryInterface|array $query Limits the results to the documents that match the query. The query syntax is the usual MongoDB read operation query syntax. + * You cannot specify a $near predicate in the query field of the $geoNear stage. + * @param Optional|bool $spherical Determines how MongoDB calculates the distance between two points: + * - When true, MongoDB uses $nearSphere semantics and calculates distances using spherical geometry. + * - When false, MongoDB uses $near semantics: spherical geometry for 2dsphere indexes and planar geometry for 2d indexes. + * Default: false. + */ + public static function geoNear( + Document|Serializable|ResolvesToObject|stdClass|array|string $near, + Optional|string $distanceField = Optional::Undefined, + Optional|Decimal128|Int64|float|int $distanceMultiplier = Optional::Undefined, + Optional|string $includeLocs = Optional::Undefined, + Optional|string $key = Optional::Undefined, + Optional|Decimal128|Int64|float|int $maxDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int $minDistance = Optional::Undefined, + Optional|QueryInterface|array $query = Optional::Undefined, + Optional|bool $spherical = Optional::Undefined, + ): GeoNearStage { + return new GeoNearStage($near, $distanceField, $distanceMultiplier, $includeLocs, $key, $maxDistance, $minDistance, $query, $spherical); + } + + /** + * Performs a recursive search on a collection. To each output document, adds a new array field that contains the traversal results of the recursive search for that document. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/graphLookup/ + * @param string $from Target collection for the $graphLookup operation to search, recursively matching the connectFromField to the connectToField. The from collection must be in the same database as any other collections used in the operation. + * Starting in MongoDB 5.1, the collection specified in the from parameter can be sharded. + * @param BSONArray|DateTimeInterface|ExpressionInterface|PackedArray|Type|array|bool|float|int|null|stdClass|string $startWith Expression that specifies the value of the connectFromField with which to start the recursive search. Optionally, startWith may be array of values, each of which is individually followed through the traversal process. + * @param string $connectFromField Field name whose value $graphLookup uses to recursively match against the connectToField of other documents in the collection. If the value is an array, each element is individually followed through the traversal process. + * @param string $connectToField Field name in other documents against which to match the value of the field specified by the connectFromField parameter. + * @param string $as Name of the array field added to each output document. Contains the documents traversed in the $graphLookup stage to reach the document. + * @param Optional|int $maxDepth Non-negative integral number specifying the maximum recursion depth. + * @param Optional|string $depthField Name of the field to add to each traversed document in the search path. The value of this field is the recursion depth for the document, represented as a NumberLong. Recursion depth value starts at zero, so the first lookup corresponds to zero depth. + * @param Optional|QueryInterface|array $restrictSearchWithMatch A document specifying additional conditions for the recursive search. The syntax is identical to query filter syntax. + */ + public static function graphLookup( + string $from, + DateTimeInterface|PackedArray|Type|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $startWith, + string $connectFromField, + string $connectToField, + string $as, + Optional|int $maxDepth = Optional::Undefined, + Optional|string $depthField = Optional::Undefined, + Optional|QueryInterface|array $restrictSearchWithMatch = Optional::Undefined, + ): GraphLookupStage { + return new GraphLookupStage($from, $startWith, $connectFromField, $connectToField, $as, $maxDepth, $depthField, $restrictSearchWithMatch); + } + + /** + * Groups input documents by a specified identifier expression and applies the accumulator expression(s), if specified, to each group. Consumes all input documents and outputs one document per each distinct group. The output documents only contain the identifier field and, if specified, accumulated fields. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/group/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $_id The _id expression specifies the group key. If you specify an _id value of null, or any other constant value, the $group stage returns a single document that aggregates values across all of the input documents. + * @param AccumulatorInterface|Document|Serializable|array|stdClass ...$field Computed using the accumulator operators. + */ + public static function group( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $_id, + Document|Serializable|AccumulatorInterface|stdClass|array ...$field, + ): GroupStage { + return new GroupStage($_id, ...$field); + } + + /** + * Returns statistics regarding the use of each index for the collection. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexStats/ + */ + public static function indexStats(): IndexStatsStage + { + return new IndexStatsStage(); + } + + /** + * Passes the first n documents unmodified to the pipeline where n is the specified limit. For each input document, outputs either one document (for the first n documents) or zero documents (after the first n documents). + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/limit/ + * @param int $limit + */ + public static function limit(int $limit): LimitStage + { + return new LimitStage($limit); + } + + /** + * Lists all active sessions recently in use on the currently connected mongos or mongod instance. These sessions may have not yet propagated to the system.sessions collection. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/listLocalSessions/ + * @param Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. + * @param Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. + */ + public static function listLocalSessions( + Optional|PackedArray|BSONArray|array $users = Optional::Undefined, + Optional|bool $allUsers = Optional::Undefined, + ): ListLocalSessionsStage { + return new ListLocalSessionsStage($users, $allUsers); + } + + /** + * Lists sampled queries for all collections or a specific collection. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSampledQueries/ + * @param Optional|string $namespace + */ + public static function listSampledQueries( + Optional|string $namespace = Optional::Undefined, + ): ListSampledQueriesStage { + return new ListSampledQueriesStage($namespace); + } + + /** + * Returns information about existing Atlas Search indexes on a specified collection. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSearchIndexes/ + * @param Optional|string $id The id of the index to return information about. + * @param Optional|string $name The name of the index to return information about. + */ + public static function listSearchIndexes( + Optional|string $id = Optional::Undefined, + Optional|string $name = Optional::Undefined, + ): ListSearchIndexesStage { + return new ListSearchIndexesStage($id, $name); + } + + /** + * Lists all sessions that have been active long enough to propagate to the system.sessions collection. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSessions/ + * @param Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. + * @param Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. + */ + public static function listSessions( + Optional|PackedArray|BSONArray|array $users = Optional::Undefined, + Optional|bool $allUsers = Optional::Undefined, + ): ListSessionsStage { + return new ListSessionsStage($users, $allUsers); + } + + /** + * Performs a left outer join to another collection in the same database to filter in documents from the "joined" collection for processing. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/lookup/ + * @param string $as Specifies the name of the new array field to add to the input documents. The new array field contains the matching documents from the from collection. If the specified name already exists in the input document, the existing field is overwritten. + * @param Optional|string $from Specifies the collection in the same database to perform the join with. + * from is optional, you can use a $documents stage in a $lookup stage instead. For an example, see Use a $documents Stage in a $lookup Stage. + * Starting in MongoDB 5.1, the collection specified in the from parameter can be sharded. + * @param Optional|string $localField Specifies the field from the documents input to the $lookup stage. $lookup performs an equality match on the localField to the foreignField from the documents of the from collection. If an input document does not contain the localField, the $lookup treats the field as having a value of null for matching purposes. + * @param Optional|string $foreignField Specifies the field from the documents in the from collection. $lookup performs an equality match on the foreignField to the localField from the input documents. If a document in the from collection does not contain the foreignField, the $lookup treats the value as null for matching purposes. + * @param Optional|Document|Serializable|array|stdClass $let Specifies variables to use in the pipeline stages. Use the variable expressions to access the fields from the joined collection's documents that are input to the pipeline. + * @param Optional|BSONArray|PackedArray|Pipeline|array $pipeline Specifies the pipeline to run on the joined collection. The pipeline determines the resulting documents from the joined collection. To return all documents, specify an empty pipeline []. + * The pipeline cannot include the $out stage or the $merge stage. Starting in v6.0, the pipeline can contain the Atlas Search $search stage as the first stage inside the pipeline. + * The pipeline cannot directly access the joined document fields. Instead, define variables for the joined document fields using the let option and then reference the variables in the pipeline stages. + */ + public static function lookup( + string $as, + Optional|string $from = Optional::Undefined, + Optional|string $localField = Optional::Undefined, + Optional|string $foreignField = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $let = Optional::Undefined, + Optional|PackedArray|Pipeline|BSONArray|array $pipeline = Optional::Undefined, + ): LookupStage { + return new LookupStage($as, $from, $localField, $foreignField, $let, $pipeline); + } + + /** + * Filters the document stream to allow only matching documents to pass unmodified into the next pipeline stage. $match uses standard MongoDB queries. For each input document, outputs either one document (a match) or zero documents (no match). + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/match/ + * @param QueryInterface|array $query + */ + public static function match(QueryInterface|array $query): MatchStage + { + return new MatchStage($query); + } + + /** + * Writes the resulting documents of the aggregation pipeline to a collection. The stage can incorporate (insert new documents, merge documents, replace documents, keep existing documents, fail the operation, process documents with a custom update pipeline) the results into an output collection. To use the $merge stage, it must be the last stage in the pipeline. + * New in MongoDB 4.2. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/ + * @param Document|Serializable|array|stdClass|string $into The output collection. + * @param Optional|BSONArray|PackedArray|array|string $on Field or fields that act as a unique identifier for a document. The identifier determines if a results document matches an existing document in the output collection. + * @param Optional|Document|Serializable|array|stdClass $let Specifies variables for use in the whenMatched pipeline. + * @param Optional|BSONArray|PackedArray|Pipeline|array|string $whenMatched The behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s). + * @param Optional|string $whenNotMatched The behavior of $merge if a result document does not match an existing document in the out collection. + */ + public static function merge( + Document|Serializable|stdClass|array|string $into, + Optional|PackedArray|BSONArray|array|string $on = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $let = Optional::Undefined, + Optional|PackedArray|Pipeline|BSONArray|array|string $whenMatched = Optional::Undefined, + Optional|string $whenNotMatched = Optional::Undefined, + ): MergeStage { + return new MergeStage($into, $on, $let, $whenMatched, $whenNotMatched); + } + + /** + * Writes the resulting documents of the aggregation pipeline to a collection. To use the $out stage, it must be the last stage in the pipeline. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/out/ + * @param Document|Serializable|array|stdClass|string $coll Target database name to write documents from $out to. + */ + public static function out(Document|Serializable|stdClass|array|string $coll): OutStage + { + return new OutStage($coll); + } + + /** + * Returns plan cache information for a collection. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/planCacheStats/ + */ + public static function planCacheStats(): PlanCacheStatsStage + { + return new PlanCacheStatsStage(); + } + + /** + * Reshapes each document in the stream, such as by adding new fields or removing existing fields. For each input document, outputs one document. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/project/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string ...$specification + */ + public static function project( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$specification, + ): ProjectStage { + return new ProjectStage(...$specification); + } + + /** + * Reshapes each document in the stream by restricting the content for each document based on information stored in the documents themselves. Incorporates the functionality of $project and $match. Can be used to implement field level redaction. For each input document, outputs either one or zero documents. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/redact/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public static function redact( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ): RedactStage { + return new RedactStage($expression); + } + + /** + * Replaces a document with the specified embedded document. The operation replaces all existing fields in the input document, including the _id field. Specify a document embedded in the input document to promote the embedded document to the top level. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceRoot/ + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $newRoot + */ + public static function replaceRoot( + Document|Serializable|ResolvesToObject|stdClass|array|string $newRoot, + ): ReplaceRootStage { + return new ReplaceRootStage($newRoot); + } + + /** + * Replaces a document with the specified embedded document. The operation replaces all existing fields in the input document, including the _id field. Specify a document embedded in the input document to promote the embedded document to the top level. + * Alias for $replaceRoot. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceWith/ + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $expression + */ + public static function replaceWith( + Document|Serializable|ResolvesToObject|stdClass|array|string $expression, + ): ReplaceWithStage { + return new ReplaceWithStage($expression); + } + + /** + * Randomly selects the specified number of documents from its input. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sample/ + * @param int $size The number of documents to randomly select. + */ + public static function sample(int $size): SampleStage + { + return new SampleStage($size); + } + + /** + * Performs a full-text search of the field or fields in an Atlas collection. + * NOTE: $search is only available for MongoDB Atlas clusters, and is not available for self-managed deployments. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/search/ + * @param Document|SearchOperatorInterface|Serializable|array|stdClass $operator Operator to search with. You can provide a specific operator or use + * the compound operator to run a compound query with multiple operators. + * @param Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to "default". + * @param Optional|Document|Serializable|array|stdClass $highlight Specifies the highlighting options for displaying search terms in their original context. + * @param Optional|bool $concurrent Parallelize search across segments on dedicated search nodes. + * If you don't have separate search nodes on your cluster, + * Atlas Search ignores this flag. If omitted, defaults to false. + * @param Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. + * @param Optional|string $searchAfter Reference point for retrieving results. searchAfter returns documents starting immediately following the specified reference point. + * @param Optional|string $searchBefore Reference point for retrieving results. searchBefore returns documents starting immediately before the specified reference point. + * @param Optional|bool $scoreDetails Flag that specifies whether to retrieve a detailed breakdown of the score for the documents in the results. If omitted, defaults to false. + * @param Optional|Document|Serializable|array|stdClass $sort Document that specifies the fields to sort the Atlas Search results by in ascending or descending order. + * @param Optional|bool $returnStoredSource Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search. + * @param Optional|Document|Serializable|array|stdClass $tracking Document that specifies the tracking option to retrieve analytics information on the search terms. + */ + public static function search( + Document|Serializable|SearchOperatorInterface|stdClass|array $operator, + Optional|string $index = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $highlight = Optional::Undefined, + Optional|bool $concurrent = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, + Optional|string $searchAfter = Optional::Undefined, + Optional|string $searchBefore = Optional::Undefined, + Optional|bool $scoreDetails = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $sort = Optional::Undefined, + Optional|bool $returnStoredSource = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $tracking = Optional::Undefined, + ): SearchStage { + return new SearchStage($operator, $index, $highlight, $concurrent, $count, $searchAfter, $searchBefore, $scoreDetails, $sort, $returnStoredSource, $tracking); + } + + /** + * Returns different types of metadata result documents for the Atlas Search query against an Atlas collection. + * NOTE: $searchMeta is only available for MongoDB Atlas clusters running MongoDB v4.4.9 or higher, and is not available for self-managed deployments. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/searchMeta/ + * @param Document|SearchOperatorInterface|Serializable|array|stdClass $operator Operator to search with. You can provide a specific operator or use + * the compound operator to run a compound query with multiple operators. + * @param Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to default. + * @param Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. + */ + public static function searchMeta( + Document|Serializable|SearchOperatorInterface|stdClass|array $operator, + Optional|string $index = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, + ): SearchMetaStage { + return new SearchMetaStage($operator, $index, $count); + } + + /** + * Adds new fields to documents. Outputs documents that contain all existing fields from the input documents and newly added fields. + * Alias for $addFields. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/set/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string ...$field + */ + public static function set( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$field, + ): SetStage { + return new SetStage(...$field); + } + + /** + * Groups documents into windows and applies one or more operators to the documents in each window. + * New in MongoDB 5.0. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/ + * @param Document|Serializable|array|stdClass $sortBy Specifies the field(s) to sort the documents by in the partition. Uses the same syntax as the $sort stage. Default is no sorting. + * @param Document|Serializable|array|stdClass $output Specifies the field(s) to append to the documents in the output returned by the $setWindowFields stage. Each field is set to the result returned by the window operator. + * A field can contain dots to specify embedded document fields and array fields. The semantics for the embedded document dotted notation in the $setWindowFields stage are the same as the $addFields and $set stages. + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $partitionBy Specifies an expression to group the documents. In the $setWindowFields stage, the group of documents is known as a partition. Default is one partition for the entire collection. + */ + public static function setWindowFields( + Document|Serializable|stdClass|array $sortBy, + Document|Serializable|stdClass|array $output, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $partitionBy = Optional::Undefined, + ): SetWindowFieldsStage { + return new SetWindowFieldsStage($sortBy, $output, $partitionBy); + } + + /** + * Provides data and size distribution information on sharded collections. + * New in MongoDB 6.0.3. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/shardedDataDistribution/ + */ + public static function shardedDataDistribution(): ShardedDataDistributionStage + { + return new ShardedDataDistributionStage(); + } + + /** + * Skips the first n documents where n is the specified skip number and passes the remaining documents unmodified to the pipeline. For each input document, outputs either zero documents (for the first n documents) or one document (if after the first n documents). + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/skip/ + * @param int $skip + */ + public static function skip(int $skip): SkipStage + { + return new SkipStage($skip); + } + + /** + * Reorders the document stream by a specified sort key. Only the order changes; the documents remain unmodified. For each input document, outputs one document. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sort/ + * @param DateTimeInterface|ExpressionInterface|Sort|Type|array|bool|float|int|null|stdClass|string ...$sort + */ + public static function sort( + DateTimeInterface|Type|ExpressionInterface|Sort|stdClass|array|bool|float|int|null|string ...$sort, + ): SortStage { + return new SortStage(...$sort); + } + + /** + * Groups incoming documents based on the value of a specified expression, then computes the count of documents in each distinct group. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortByCount/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public static function sortByCount( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ): SortByCountStage { + return new SortByCountStage($expression); + } + + /** + * Performs a union of two collections; i.e. combines pipeline results from two collections into a single result set. + * New in MongoDB 4.4. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/unionWith/ + * @param string $coll The collection or view whose pipeline results you wish to include in the result set. + * @param Optional|BSONArray|PackedArray|Pipeline|array $pipeline An aggregation pipeline to apply to the specified coll. + * The pipeline cannot include the $out and $merge stages. Starting in v6.0, the pipeline can contain the Atlas Search $search stage as the first stage inside the pipeline. + */ + public static function unionWith( + string $coll, + Optional|PackedArray|Pipeline|BSONArray|array $pipeline = Optional::Undefined, + ): UnionWithStage { + return new UnionWithStage($coll, $pipeline); + } + + /** + * Removes or excludes fields from documents. + * Alias for $project stage that removes or excludes fields. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/unset/ + * @no-named-arguments + * @param FieldPath|string ...$field + */ + public static function unset(FieldPath|string ...$field): UnsetStage + { + return new UnsetStage(...$field); + } + + /** + * Deconstructs an array field from the input documents to output a document for each element. Each output document replaces the array with an element value. For each input document, outputs n documents where n is the number of array elements and can be zero for an empty array. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/unwind/ + * @param ArrayFieldPath|string $path Field path to an array field. + * @param Optional|string $includeArrayIndex The name of a new field to hold the array index of the element. The name cannot start with a dollar sign $. + * @param Optional|bool $preserveNullAndEmptyArrays If true, if the path is null, missing, or an empty array, $unwind outputs the document. + * If false, if path is null, missing, or an empty array, $unwind does not output a document. + * The default value is false. + */ + public static function unwind( + ArrayFieldPath|string $path, + Optional|string $includeArrayIndex = Optional::Undefined, + Optional|bool $preserveNullAndEmptyArrays = Optional::Undefined, + ): UnwindStage { + return new UnwindStage($path, $includeArrayIndex, $preserveNullAndEmptyArrays); + } + + /** + * The $vectorSearch stage performs an ANN or ENN search on a vector in the specified field. + * + * @see https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/ + * @param string $index Name of the Atlas Vector Search index to use. + * @param int $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. + * @param string $path Indexed vector type field to search. + * @param BSONArray|PackedArray|array $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. + * @param Optional|bool $exact This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. + * @param Optional|QueryInterface|array $filter Any match query that compares an indexed field with a boolean, date, objectId, number (not decimals), string, or UUID to use as a pre-filter. + * @param Optional|int $numCandidates This field is required if exact is false or omitted. + * Number of nearest neighbors to use during the search. Value must be less than or equal to (<=) 10000. You can't specify a number less than the number of documents to return (limit). + */ + public static function vectorSearch( + string $index, + int $limit, + string $path, + PackedArray|BSONArray|array $queryVector, + Optional|bool $exact = Optional::Undefined, + Optional|QueryInterface|array $filter = Optional::Undefined, + Optional|int $numCandidates = Optional::Undefined, + ): VectorSearchStage { + return new VectorSearchStage($index, $limit, $path, $queryVector, $exact, $filter, $numCandidates); + } +} diff --git a/src/Builder/Stage/FillStage.php b/src/Builder/Stage/FillStage.php new file mode 100644 index 000000000..f7b3b35e2 --- /dev/null +++ b/src/Builder/Stage/FillStage.php @@ -0,0 +1,92 @@ + 'output', + 'partitionBy' => 'partitionBy', + 'partitionByFields' => 'partitionByFields', + 'sortBy' => 'sortBy', + ]; + + /** + * @var Document|Serializable|array|stdClass $output Specifies an object containing each field for which to fill missing values. You can specify multiple fields in the output object. + * The object name is the name of the field to fill. The object value specifies how the field is filled. + */ + public readonly Document|Serializable|stdClass|array $output; + + /** + * @var Optional|Document|Serializable|array|stdClass|string $partitionBy Specifies an expression to group the documents. In the $fill stage, a group of documents is known as a partition. + * If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. + * partitionBy and partitionByFields are mutually exclusive. + */ + public readonly Optional|Document|Serializable|stdClass|array|string $partitionBy; + + /** + * @var Optional|BSONArray|PackedArray|array $partitionByFields Specifies an array of fields as the compound key to group the documents. In the $fill stage, each group of documents is known as a partition. + * If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. + * partitionBy and partitionByFields are mutually exclusive. + */ + public readonly Optional|PackedArray|BSONArray|array $partitionByFields; + + /** @var Optional|Document|Serializable|array|stdClass $sortBy Specifies the field or fields to sort the documents within each partition. Uses the same syntax as the $sort stage. */ + public readonly Optional|Document|Serializable|stdClass|array $sortBy; + + /** + * @param Document|Serializable|array|stdClass $output Specifies an object containing each field for which to fill missing values. You can specify multiple fields in the output object. + * The object name is the name of the field to fill. The object value specifies how the field is filled. + * @param Optional|Document|Serializable|array|stdClass|string $partitionBy Specifies an expression to group the documents. In the $fill stage, a group of documents is known as a partition. + * If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. + * partitionBy and partitionByFields are mutually exclusive. + * @param Optional|BSONArray|PackedArray|array $partitionByFields Specifies an array of fields as the compound key to group the documents. In the $fill stage, each group of documents is known as a partition. + * If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. + * partitionBy and partitionByFields are mutually exclusive. + * @param Optional|Document|Serializable|array|stdClass $sortBy Specifies the field or fields to sort the documents within each partition. Uses the same syntax as the $sort stage. + */ + public function __construct( + Document|Serializable|stdClass|array $output, + Optional|Document|Serializable|stdClass|array|string $partitionBy = Optional::Undefined, + Optional|PackedArray|BSONArray|array $partitionByFields = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $sortBy = Optional::Undefined, + ) { + $this->output = $output; + $this->partitionBy = $partitionBy; + if (is_array($partitionByFields) && ! array_is_list($partitionByFields)) { + throw new InvalidArgumentException('Expected $partitionByFields argument to be a list, got an associative array.'); + } + + $this->partitionByFields = $partitionByFields; + $this->sortBy = $sortBy; + } +} diff --git a/src/Builder/Stage/FluentFactoryTrait.php b/src/Builder/Stage/FluentFactoryTrait.php new file mode 100644 index 000000000..1b9e542ac --- /dev/null +++ b/src/Builder/Stage/FluentFactoryTrait.php @@ -0,0 +1,832 @@ +|stdClass> */ + public array $pipeline = []; + + public function getPipeline(): Pipeline + { + return new Pipeline(...$this->pipeline); + } + + /** + * Filters the document stream to allow only matching documents to pass unmodified into the next pipeline stage. $match uses standard MongoDB queries. For each input document, outputs either one document (a match) or zero documents (no match). + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/match/ + * + * @param DateTimeInterface|QueryInterface|FieldQueryInterface|Type|stdClass|array|bool|float|int|string|null ...$queries The query predicates to match + */ + public function match( + DateTimeInterface|QueryInterface|FieldQueryInterface|Type|stdClass|array|string|int|float|bool|null ...$queries, + ): static { + $this->pipeline[] = Stage::match(...$queries); + + return $this; + } + + /** + * Adds new fields to documents. Outputs documents that contain all existing fields from the input documents and newly added fields. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/addFields/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string ...$expression Specify the name of each field to add and set its value to an aggregation expression or an empty object. + */ + public function addFields( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|string|int|float|bool|null ...$expression, + ): static { + $this->pipeline[] = Stage::addFields(...$expression); + + return $this; + } + + /** + * Categorizes incoming documents into groups, called buckets, based on a specified expression and bucket boundaries. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucket/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $groupBy An expression to group documents by. To specify a field path, prefix the field name with a dollar sign $ and enclose it in quotes. + * Unless $bucket includes a default specification, each input document must resolve the groupBy field path or expression to a value that falls within one of the ranges specified by the boundaries. + * @param BSONArray|PackedArray|array $boundaries An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries. + * The specified values must be in ascending order and all of the same type. The exception is if the values are of mixed numeric types, such as: + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default A literal that specifies the _id of an additional bucket that contains all documents whose groupBy expression result does not fall into a bucket specified by boundaries. + * If unspecified, each input document must resolve the groupBy expression to a value within one of the bucket ranges specified by boundaries or the operation throws an error. + * The default value must be less than the lowest boundaries value, or greater than or equal to the highest boundaries value. + * The default value can be of a different type than the entries in boundaries. + * @param Optional|Document|Serializable|array|stdClass $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + * If you do not specify an output document, the operation returns a count field containing the number of documents in each bucket. + * If you specify an output document, only the fields specified in the document are returned; i.e. the count field is not returned unless it is explicitly included in the output document. + */ + public function bucket( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|string|int|float|bool|null $groupBy, + PackedArray|BSONArray|array $boundaries, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|string|int|float|bool|null $default = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $output = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::bucket($groupBy, $boundaries, $default, $output); + + return $this; + } + + /** + * Categorizes incoming documents into a specific number of groups, called buckets, based on a specified expression. Bucket boundaries are automatically determined in an attempt to evenly distribute the documents into the specified number of buckets. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucketAuto/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $groupBy An expression to group documents by. To specify a field path, prefix the field name with a dollar sign $ and enclose it in quotes. + * @param int $buckets A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. + * @param Optional|Document|Serializable|array|stdClass $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + * The default count field is not included in the output document when output is specified. Explicitly specify the count expression as part of the output document to include it. + * @param Optional|string $granularity A string that specifies the preferred number series to use to ensure that the calculated boundary edges end on preferred round numbers or their powers of 10. + * Available only if the all groupBy values are numeric and none of them are NaN. + */ + public function bucketAuto( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|string|int|float|bool|null $groupBy, + int $buckets, + Optional|Document|Serializable|stdClass|array $output = Optional::Undefined, + Optional|string $granularity = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::bucketAuto($groupBy, $buckets, $output, $granularity); + + return $this; + } + + /** + * Returns a Change Stream cursor for the collection or database. This stage can only occur once in an aggregation pipeline and it must occur as the first stage. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/changeStream/ + * @param Optional|bool $allChangesForCluster A flag indicating whether the stream should report all changes that occur on the deployment, aside from those on internal databases or collections. + * @param Optional|string $fullDocument Specifies whether change notifications include a copy of the full document when modified by update operations. + * @param Optional|string $fullDocumentBeforeChange Valid values are "off", "whenAvailable", or "required". If set to "off", the "fullDocumentBeforeChange" field of the output document is always omitted. If set to "whenAvailable", the "fullDocumentBeforeChange" field will be populated with the pre-image of the document modified by the current change event if such a pre-image is available, and will be omitted otherwise. If set to "required", then the "fullDocumentBeforeChange" field is always populated and an exception is thrown if the pre-image is not available. + * @param Optional|int $resumeAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with startAfter or startAtOperationTime fields. + * @param Optional|bool $showExpandedEvents Specifies whether to include additional change events, such as such as DDL and index operations. + * New in MongoDB 6.0. + * @param Optional|Document|Serializable|array|stdClass $startAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with resumeAfter or startAtOperationTime fields. + * @param Optional|Timestamp|int $startAtOperationTime Specifies a time as the logical starting point for the change stream. Cannot be used with resumeAfter or startAfter fields. + */ + public function changeStream( + Optional|bool $allChangesForCluster = Optional::Undefined, + Optional|string $fullDocument = Optional::Undefined, + Optional|string $fullDocumentBeforeChange = Optional::Undefined, + Optional|int $resumeAfter = Optional::Undefined, + Optional|bool $showExpandedEvents = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $startAfter = Optional::Undefined, + Optional|Timestamp|int $startAtOperationTime = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::changeStream($allChangesForCluster, $fullDocument, $fullDocumentBeforeChange, $resumeAfter, $showExpandedEvents, $startAfter, $startAtOperationTime); + + return $this; + } + + /** + * Splits large change stream events that exceed 16 MB into smaller fragments returned in a change stream cursor. + * You can only use $changeStreamSplitLargeEvent in a $changeStream pipeline and it must be the final stage in the pipeline. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/changeStreamSplitLargeEvent/ + */ + public function changeStreamSplitLargeEvent(): static + { + $this->pipeline[] = Stage::changeStreamSplitLargeEvent(); + + return $this; + } + + /** + * Returns statistics regarding a collection or view. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/collStats/ + * @param Optional|Document|Serializable|array|stdClass $latencyStats + * @param Optional|Document|Serializable|array|stdClass $storageStats + * @param Optional|Document|Serializable|array|stdClass $count + * @param Optional|Document|Serializable|array|stdClass $queryExecStats + */ + public function collStats( + Optional|Document|Serializable|stdClass|array $latencyStats = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $storageStats = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $queryExecStats = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::collStats($latencyStats, $storageStats, $count, $queryExecStats); + + return $this; + } + + /** + * Returns a count of the number of documents at this stage of the aggregation pipeline. + * Distinct from the $count aggregation accumulator. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/count/ + * @param string $field Name of the output field which has the count as its value. It must be a non-empty string, must not start with $ and must not contain the . character. + */ + public function count(string $field): static + { + $this->pipeline[] = Stage::count($field); + + return $this; + } + + /** + * Returns information on active and/or dormant operations for the MongoDB deployment. To run, use the db.aggregate() method. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/currentOp/ + * @param Optional|bool $allUsers + * @param Optional|bool $idleConnections + * @param Optional|bool $idleCursors + * @param Optional|bool $idleSessions + * @param Optional|bool $localOps + */ + public function currentOp( + Optional|bool $allUsers = Optional::Undefined, + Optional|bool $idleConnections = Optional::Undefined, + Optional|bool $idleCursors = Optional::Undefined, + Optional|bool $idleSessions = Optional::Undefined, + Optional|bool $localOps = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::currentOp($allUsers, $idleConnections, $idleCursors, $idleSessions, $localOps); + + return $this; + } + + /** + * Creates new documents in a sequence of documents where certain values in a field are missing. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/densify/ + * @param string $field The field to densify. The values of the specified field must either be all numeric values or all dates. + * Documents that do not contain the specified field continue through the pipeline unmodified. + * To specify a in an embedded document or in an array, use dot notation. + * @param Document|Serializable|array|stdClass $range Specification for range based densification. + * @param Optional|BSONArray|PackedArray|array $partitionByFields The field(s) that will be used as the partition keys. + */ + public function densify( + string $field, + Document|Serializable|stdClass|array $range, + Optional|PackedArray|BSONArray|array $partitionByFields = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::densify($field, $range, $partitionByFields); + + return $this; + } + + /** + * Returns literal documents from input values. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/documents/ + * @param BSONArray|PackedArray|ResolvesToArray|array|string $documents $documents accepts any valid expression that resolves to an array of objects. This includes: + * - system variables, such as $$NOW or $$SEARCH_META + * - $let expressions + * - variables in scope from $lookup expressions + * Expressions that do not resolve to a current document, like $myField or $$ROOT, will result in an error. + */ + public function documents(PackedArray|ResolvesToArray|BSONArray|array|string $documents): static + { + $this->pipeline[] = Stage::documents($documents); + + return $this; + } + + /** + * Processes multiple aggregation pipelines within a single stage on the same set of input documents. Enables the creation of multi-faceted aggregations capable of characterizing data across multiple dimensions, or facets, in a single stage. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/facet/ + * @param BSONArray|PackedArray|Pipeline|array ...$facet + */ + public function facet(PackedArray|Pipeline|BSONArray|array ...$facet): static + { + $this->pipeline[] = Stage::facet(...$facet); + + return $this; + } + + /** + * Populates null and missing field values within documents. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/fill/ + * @param Document|Serializable|array|stdClass $output Specifies an object containing each field for which to fill missing values. You can specify multiple fields in the output object. + * The object name is the name of the field to fill. The object value specifies how the field is filled. + * @param Optional|Document|Serializable|array|stdClass|string $partitionBy Specifies an expression to group the documents. In the $fill stage, a group of documents is known as a partition. + * If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. + * partitionBy and partitionByFields are mutually exclusive. + * @param Optional|BSONArray|PackedArray|array $partitionByFields Specifies an array of fields as the compound key to group the documents. In the $fill stage, each group of documents is known as a partition. + * If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. + * partitionBy and partitionByFields are mutually exclusive. + * @param Optional|Document|Serializable|array|stdClass $sortBy Specifies the field or fields to sort the documents within each partition. Uses the same syntax as the $sort stage. + */ + public function fill( + Document|Serializable|stdClass|array $output, + Optional|Document|Serializable|stdClass|array|string $partitionBy = Optional::Undefined, + Optional|PackedArray|BSONArray|array $partitionByFields = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $sortBy = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::fill($output, $partitionBy, $partitionByFields, $sortBy); + + return $this; + } + + /** + * Returns an ordered stream of documents based on the proximity to a geospatial point. Incorporates the functionality of $match, $sort, and $limit for geospatial data. The output documents include an additional distance field and can include a location identifier field. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/geoNear/ + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $near The point for which to find the closest documents. + * @param Optional|string $distanceField The output field that contains the calculated distance. To specify a field within an embedded document, use dot notation. + * @param Optional|Decimal128|Int64|float|int $distanceMultiplier The factor to multiply all distances returned by the query. For example, use the distanceMultiplier to convert radians, as returned by a spherical query, to kilometers by multiplying by the radius of the Earth. + * @param Optional|string $includeLocs This specifies the output field that identifies the location used to calculate the distance. This option is useful when a location field contains multiple locations. To specify a field within an embedded document, use dot notation. + * @param Optional|string $key Specify the geospatial indexed field to use when calculating the distance. + * @param Optional|Decimal128|Int64|float|int $maxDistance The maximum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall within the specified distance from the center point. + * Specify the distance in meters if the specified point is GeoJSON and in radians if the specified point is legacy coordinate pairs. + * @param Optional|Decimal128|Int64|float|int $minDistance The minimum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall outside the specified distance from the center point. + * Specify the distance in meters for GeoJSON data and in radians for legacy coordinate pairs. + * @param Optional|QueryInterface|array $query Limits the results to the documents that match the query. The query syntax is the usual MongoDB read operation query syntax. + * You cannot specify a $near predicate in the query field of the $geoNear stage. + * @param Optional|bool $spherical Determines how MongoDB calculates the distance between two points: + * - When true, MongoDB uses $nearSphere semantics and calculates distances using spherical geometry. + * - When false, MongoDB uses $near semantics: spherical geometry for 2dsphere indexes and planar geometry for 2d indexes. + * Default: false. + */ + public function geoNear( + Document|Serializable|ResolvesToObject|stdClass|array|string $near, + Optional|string $distanceField = Optional::Undefined, + Optional|Decimal128|Int64|int|float $distanceMultiplier = Optional::Undefined, + Optional|string $includeLocs = Optional::Undefined, + Optional|string $key = Optional::Undefined, + Optional|Decimal128|Int64|int|float $maxDistance = Optional::Undefined, + Optional|Decimal128|Int64|int|float $minDistance = Optional::Undefined, + Optional|QueryInterface|array $query = Optional::Undefined, + Optional|bool $spherical = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::geoNear($near, $distanceField, $distanceMultiplier, $includeLocs, $key, $maxDistance, $minDistance, $query, $spherical); + + return $this; + } + + /** + * Performs a recursive search on a collection. To each output document, adds a new array field that contains the traversal results of the recursive search for that document. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/graphLookup/ + * @param string $from Target collection for the $graphLookup operation to search, recursively matching the connectFromField to the connectToField. The from collection must be in the same database as any other collections used in the operation. + * Starting in MongoDB 5.1, the collection specified in the from parameter can be sharded. + * @param BSONArray|DateTimeInterface|ExpressionInterface|PackedArray|Type|array|bool|float|int|null|stdClass|string $startWith Expression that specifies the value of the connectFromField with which to start the recursive search. Optionally, startWith may be array of values, each of which is individually followed through the traversal process. + * @param string $connectFromField Field name whose value $graphLookup uses to recursively match against the connectToField of other documents in the collection. If the value is an array, each element is individually followed through the traversal process. + * @param string $connectToField Field name in other documents against which to match the value of the field specified by the connectFromField parameter. + * @param string $as Name of the array field added to each output document. Contains the documents traversed in the $graphLookup stage to reach the document. + * @param Optional|int $maxDepth Non-negative integral number specifying the maximum recursion depth. + * @param Optional|string $depthField Name of the field to add to each traversed document in the search path. The value of this field is the recursion depth for the document, represented as a NumberLong. Recursion depth value starts at zero, so the first lookup corresponds to zero depth. + * @param Optional|QueryInterface|array $restrictSearchWithMatch A document specifying additional conditions for the recursive search. The syntax is identical to query filter syntax. + */ + public function graphLookup( + string $from, + DateTimeInterface|PackedArray|Type|ExpressionInterface|BSONArray|stdClass|array|string|int|float|bool|null $startWith, + string $connectFromField, + string $connectToField, + string $as, + Optional|int $maxDepth = Optional::Undefined, + Optional|string $depthField = Optional::Undefined, + Optional|QueryInterface|array $restrictSearchWithMatch = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::graphLookup($from, $startWith, $connectFromField, $connectToField, $as, $maxDepth, $depthField, $restrictSearchWithMatch); + + return $this; + } + + /** + * Groups input documents by a specified identifier expression and applies the accumulator expression(s), if specified, to each group. Consumes all input documents and outputs one document per each distinct group. The output documents only contain the identifier field and, if specified, accumulated fields. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/group/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $_id The _id expression specifies the group key. If you specify an _id value of null, or any other constant value, the $group stage returns a single document that aggregates values across all of the input documents. + * @param AccumulatorInterface|Document|Serializable|array|stdClass ...$field Computed using the accumulator operators. + */ + public function group( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|string|int|float|bool|null $_id, + Document|Serializable|AccumulatorInterface|stdClass|array ...$field, + ): static { + $this->pipeline[] = Stage::group($_id, ...$field); + + return $this; + } + + /** + * Returns statistics regarding the use of each index for the collection. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexStats/ + */ + public function indexStats(): static + { + $this->pipeline[] = Stage::indexStats(); + + return $this; + } + + /** + * Passes the first n documents unmodified to the pipeline where n is the specified limit. For each input document, outputs either one document (for the first n documents) or zero documents (after the first n documents). + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/limit/ + * @param int $limit + */ + public function limit(int $limit): static + { + $this->pipeline[] = Stage::limit($limit); + + return $this; + } + + /** + * Lists all active sessions recently in use on the currently connected mongos or mongod instance. These sessions may have not yet propagated to the system.sessions collection. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/listLocalSessions/ + * @param Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. + * @param Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. + */ + public function listLocalSessions( + Optional|PackedArray|BSONArray|array $users = Optional::Undefined, + Optional|bool $allUsers = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::listLocalSessions($users, $allUsers); + + return $this; + } + + /** + * Lists sampled queries for all collections or a specific collection. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSampledQueries/ + * @param Optional|string $namespace + */ + public function listSampledQueries(Optional|string $namespace = Optional::Undefined): static + { + $this->pipeline[] = Stage::listSampledQueries($namespace); + + return $this; + } + + /** + * Returns information about existing Atlas Search indexes on a specified collection. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSearchIndexes/ + * @param Optional|string $id The id of the index to return information about. + * @param Optional|string $name The name of the index to return information about. + */ + public function listSearchIndexes( + Optional|string $id = Optional::Undefined, + Optional|string $name = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::listSearchIndexes($id, $name); + + return $this; + } + + /** + * Lists all sessions that have been active long enough to propagate to the system.sessions collection. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSessions/ + * @param Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. + * @param Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. + */ + public function listSessions( + Optional|PackedArray|BSONArray|array $users = Optional::Undefined, + Optional|bool $allUsers = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::listSessions($users, $allUsers); + + return $this; + } + + /** + * Performs a left outer join to another collection in the same database to filter in documents from the "joined" collection for processing. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/lookup/ + * @param string $as Specifies the name of the new array field to add to the input documents. The new array field contains the matching documents from the from collection. If the specified name already exists in the input document, the existing field is overwritten. + * @param Optional|string $from Specifies the collection in the same database to perform the join with. + * from is optional, you can use a $documents stage in a $lookup stage instead. For an example, see Use a $documents Stage in a $lookup Stage. + * Starting in MongoDB 5.1, the collection specified in the from parameter can be sharded. + * @param Optional|string $localField Specifies the field from the documents input to the $lookup stage. $lookup performs an equality match on the localField to the foreignField from the documents of the from collection. If an input document does not contain the localField, the $lookup treats the field as having a value of null for matching purposes. + * @param Optional|string $foreignField Specifies the field from the documents in the from collection. $lookup performs an equality match on the foreignField to the localField from the input documents. If a document in the from collection does not contain the foreignField, the $lookup treats the value as null for matching purposes. + * @param Optional|Document|Serializable|array|stdClass $let Specifies variables to use in the pipeline stages. Use the variable expressions to access the fields from the joined collection's documents that are input to the pipeline. + * @param Optional|BSONArray|PackedArray|Pipeline|array $pipeline Specifies the pipeline to run on the joined collection. The pipeline determines the resulting documents from the joined collection. To return all documents, specify an empty pipeline []. + * The pipeline cannot include the $out stage or the $merge stage. Starting in v6.0, the pipeline can contain the Atlas Search $search stage as the first stage inside the pipeline. + * The pipeline cannot directly access the joined document fields. Instead, define variables for the joined document fields using the let option and then reference the variables in the pipeline stages. + */ + public function lookup( + string $as, + Optional|string $from = Optional::Undefined, + Optional|string $localField = Optional::Undefined, + Optional|string $foreignField = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $let = Optional::Undefined, + Optional|PackedArray|Pipeline|BSONArray|array $pipeline = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::lookup($as, $from, $localField, $foreignField, $let, $pipeline); + + return $this; + } + + /** + * Writes the resulting documents of the aggregation pipeline to a collection. The stage can incorporate (insert new documents, merge documents, replace documents, keep existing documents, fail the operation, process documents with a custom update pipeline) the results into an output collection. To use the $merge stage, it must be the last stage in the pipeline. + * New in MongoDB 4.2. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/ + * @param Document|Serializable|array|stdClass|string $into The output collection. + * @param Optional|BSONArray|PackedArray|array|string $on Field or fields that act as a unique identifier for a document. The identifier determines if a results document matches an existing document in the output collection. + * @param Optional|Document|Serializable|array|stdClass $let Specifies variables for use in the whenMatched pipeline. + * @param Optional|BSONArray|PackedArray|Pipeline|array|string $whenMatched The behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s). + * @param Optional|string $whenNotMatched The behavior of $merge if a result document does not match an existing document in the out collection. + */ + public function merge( + Document|Serializable|stdClass|array|string $into, + Optional|PackedArray|BSONArray|array|string $on = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $let = Optional::Undefined, + Optional|PackedArray|Pipeline|BSONArray|array|string $whenMatched = Optional::Undefined, + Optional|string $whenNotMatched = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::merge($into, $on, $let, $whenMatched, $whenNotMatched); + + return $this; + } + + /** + * Writes the resulting documents of the aggregation pipeline to a collection. To use the $out stage, it must be the last stage in the pipeline. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/out/ + * @param Document|Serializable|array|stdClass|string $coll Target database name to write documents from $out to. + */ + public function out(Document|Serializable|stdClass|array|string $coll): static + { + $this->pipeline[] = Stage::out($coll); + + return $this; + } + + /** + * Returns plan cache information for a collection. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/planCacheStats/ + */ + public function planCacheStats(): static + { + $this->pipeline[] = Stage::planCacheStats(); + + return $this; + } + + /** + * Reshapes each document in the stream, such as by adding new fields or removing existing fields. For each input document, outputs one document. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/project/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string ...$specification + */ + public function project( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|string|int|float|bool|null ...$specification, + ): static { + $this->pipeline[] = Stage::project(...$specification); + + return $this; + } + + /** + * Reshapes each document in the stream by restricting the content for each document based on information stored in the documents themselves. Incorporates the functionality of $project and $match. Can be used to implement field level redaction. For each input document, outputs either one or zero documents. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/redact/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function redact( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|string|int|float|bool|null $expression, + ): static { + $this->pipeline[] = Stage::redact($expression); + + return $this; + } + + /** + * Replaces a document with the specified embedded document. The operation replaces all existing fields in the input document, including the _id field. Specify a document embedded in the input document to promote the embedded document to the top level. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceRoot/ + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $newRoot + */ + public function replaceRoot(Document|Serializable|ResolvesToObject|stdClass|array|string $newRoot): static + { + $this->pipeline[] = Stage::replaceRoot($newRoot); + + return $this; + } + + /** + * Replaces a document with the specified embedded document. The operation replaces all existing fields in the input document, including the _id field. Specify a document embedded in the input document to promote the embedded document to the top level. + * Alias for $replaceRoot. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceWith/ + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $expression + */ + public function replaceWith(Document|Serializable|ResolvesToObject|stdClass|array|string $expression): static + { + $this->pipeline[] = Stage::replaceWith($expression); + + return $this; + } + + /** + * Randomly selects the specified number of documents from its input. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sample/ + * @param int $size The number of documents to randomly select. + */ + public function sample(int $size): static + { + $this->pipeline[] = Stage::sample($size); + + return $this; + } + + /** + * Performs a full-text search of the field or fields in an Atlas collection. + * NOTE: $search is only available for MongoDB Atlas clusters, and is not available for self-managed deployments. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/search/ + * @param Document|SearchOperatorInterface|Serializable|array|stdClass $operator Operator to search with. You can provide a specific operator or use + * the compound operator to run a compound query with multiple operators. + * @param Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to "default". + * @param Optional|Document|Serializable|array|stdClass $highlight Specifies the highlighting options for displaying search terms in their original context. + * @param Optional|bool $concurrent Parallelize search across segments on dedicated search nodes. + * If you don't have separate search nodes on your cluster, + * Atlas Search ignores this flag. If omitted, defaults to false. + * @param Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. + * @param Optional|string $searchAfter Reference point for retrieving results. searchAfter returns documents starting immediately following the specified reference point. + * @param Optional|string $searchBefore Reference point for retrieving results. searchBefore returns documents starting immediately before the specified reference point. + * @param Optional|bool $scoreDetails Flag that specifies whether to retrieve a detailed breakdown of the score for the documents in the results. If omitted, defaults to false. + * @param Optional|Document|Serializable|array|stdClass $sort Document that specifies the fields to sort the Atlas Search results by in ascending or descending order. + * @param Optional|bool $returnStoredSource Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search. + * @param Optional|Document|Serializable|array|stdClass $tracking Document that specifies the tracking option to retrieve analytics information on the search terms. + */ + public function search( + Document|Serializable|SearchOperatorInterface|stdClass|array $operator, + Optional|string $index = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $highlight = Optional::Undefined, + Optional|bool $concurrent = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, + Optional|string $searchAfter = Optional::Undefined, + Optional|string $searchBefore = Optional::Undefined, + Optional|bool $scoreDetails = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $sort = Optional::Undefined, + Optional|bool $returnStoredSource = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $tracking = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::search($operator, $index, $highlight, $concurrent, $count, $searchAfter, $searchBefore, $scoreDetails, $sort, $returnStoredSource, $tracking); + + return $this; + } + + /** + * Returns different types of metadata result documents for the Atlas Search query against an Atlas collection. + * NOTE: $searchMeta is only available for MongoDB Atlas clusters running MongoDB v4.4.9 or higher, and is not available for self-managed deployments. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/searchMeta/ + * @param Document|SearchOperatorInterface|Serializable|array|stdClass $operator Operator to search with. You can provide a specific operator or use + * the compound operator to run a compound query with multiple operators. + * @param Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to default. + * @param Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. + */ + public function searchMeta( + Document|Serializable|SearchOperatorInterface|stdClass|array $operator, + Optional|string $index = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::searchMeta($operator, $index, $count); + + return $this; + } + + /** + * Adds new fields to documents. Outputs documents that contain all existing fields from the input documents and newly added fields. + * Alias for $addFields. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/set/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string ...$field + */ + public function set( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|string|int|float|bool|null ...$field, + ): static { + $this->pipeline[] = Stage::set(...$field); + + return $this; + } + + /** + * Groups documents into windows and applies one or more operators to the documents in each window. + * New in MongoDB 5.0. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/ + * @param Document|Serializable|array|stdClass $sortBy Specifies the field(s) to sort the documents by in the partition. Uses the same syntax as the $sort stage. Default is no sorting. + * @param Document|Serializable|array|stdClass $output Specifies the field(s) to append to the documents in the output returned by the $setWindowFields stage. Each field is set to the result returned by the window operator. + * A field can contain dots to specify embedded document fields and array fields. The semantics for the embedded document dotted notation in the $setWindowFields stage are the same as the $addFields and $set stages. + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $partitionBy Specifies an expression to group the documents. In the $setWindowFields stage, the group of documents is known as a partition. Default is one partition for the entire collection. + */ + public function setWindowFields( + Document|Serializable|stdClass|array $sortBy, + Document|Serializable|stdClass|array $output, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|string|int|float|bool|null $partitionBy = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::setWindowFields($sortBy, $output, $partitionBy); + + return $this; + } + + /** + * Provides data and size distribution information on sharded collections. + * New in MongoDB 6.0.3. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/shardedDataDistribution/ + */ + public function shardedDataDistribution(): static + { + $this->pipeline[] = Stage::shardedDataDistribution(); + + return $this; + } + + /** + * Skips the first n documents where n is the specified skip number and passes the remaining documents unmodified to the pipeline. For each input document, outputs either zero documents (for the first n documents) or one document (if after the first n documents). + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/skip/ + * @param int $skip + */ + public function skip(int $skip): static + { + $this->pipeline[] = Stage::skip($skip); + + return $this; + } + + /** + * Reorders the document stream by a specified sort key. Only the order changes; the documents remain unmodified. For each input document, outputs one document. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sort/ + * @param DateTimeInterface|ExpressionInterface|Sort|Type|array|bool|float|int|null|stdClass|string ...$sort + */ + public function sort( + DateTimeInterface|Type|ExpressionInterface|Sort|stdClass|array|string|int|float|bool|null ...$sort, + ): static { + $this->pipeline[] = Stage::sort(...$sort); + + return $this; + } + + /** + * Groups incoming documents based on the value of a specified expression, then computes the count of documents in each distinct group. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortByCount/ + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function sortByCount( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|string|int|float|bool|null $expression, + ): static { + $this->pipeline[] = Stage::sortByCount($expression); + + return $this; + } + + /** + * Performs a union of two collections; i.e. combines pipeline results from two collections into a single result set. + * New in MongoDB 4.4. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/unionWith/ + * @param string $coll The collection or view whose pipeline results you wish to include in the result set. + * @param Optional|BSONArray|PackedArray|Pipeline|array $pipeline An aggregation pipeline to apply to the specified coll. + * The pipeline cannot include the $out and $merge stages. Starting in v6.0, the pipeline can contain the Atlas Search $search stage as the first stage inside the pipeline. + */ + public function unionWith( + string $coll, + Optional|PackedArray|Pipeline|BSONArray|array $pipeline = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::unionWith($coll, $pipeline); + + return $this; + } + + /** + * Removes or excludes fields from documents. + * Alias for $project stage that removes or excludes fields. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/unset/ + * @no-named-arguments + * @param FieldPath|string ...$field + */ + public function unset(FieldPath|string ...$field): static + { + $this->pipeline[] = Stage::unset(...$field); + + return $this; + } + + /** + * Deconstructs an array field from the input documents to output a document for each element. Each output document replaces the array with an element value. For each input document, outputs n documents where n is the number of array elements and can be zero for an empty array. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/unwind/ + * @param ArrayFieldPath|string $path Field path to an array field. + * @param Optional|string $includeArrayIndex The name of a new field to hold the array index of the element. The name cannot start with a dollar sign $. + * @param Optional|bool $preserveNullAndEmptyArrays If true, if the path is null, missing, or an empty array, $unwind outputs the document. + * If false, if path is null, missing, or an empty array, $unwind does not output a document. + * The default value is false. + */ + public function unwind( + ArrayFieldPath|string $path, + Optional|string $includeArrayIndex = Optional::Undefined, + Optional|bool $preserveNullAndEmptyArrays = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::unwind($path, $includeArrayIndex, $preserveNullAndEmptyArrays); + + return $this; + } + + /** + * The $vectorSearch stage performs an ANN or ENN search on a vector in the specified field. + * + * @see https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/ + * @param string $index Name of the Atlas Vector Search index to use. + * @param int $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. + * @param string $path Indexed vector type field to search. + * @param BSONArray|PackedArray|array $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. + * @param Optional|bool $exact This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. + * @param Optional|QueryInterface|array $filter Any match query that compares an indexed field with a boolean, date, objectId, number (not decimals), string, or UUID to use as a pre-filter. + * @param Optional|int $numCandidates This field is required if exact is false or omitted. + * Number of nearest neighbors to use during the search. Value must be less than or equal to (<=) 10000. You can't specify a number less than the number of documents to return (limit). + */ + public function vectorSearch( + string $index, + int $limit, + string $path, + PackedArray|BSONArray|array $queryVector, + Optional|bool $exact = Optional::Undefined, + Optional|QueryInterface|array $filter = Optional::Undefined, + Optional|int $numCandidates = Optional::Undefined, + ): static { + $this->pipeline[] = Stage::vectorSearch($index, $limit, $path, $queryVector, $exact, $filter, $numCandidates); + + return $this; + } +} diff --git a/src/Builder/Stage/GeoNearStage.php b/src/Builder/Stage/GeoNearStage.php new file mode 100644 index 000000000..21600a5b8 --- /dev/null +++ b/src/Builder/Stage/GeoNearStage.php @@ -0,0 +1,139 @@ + 'near', + 'distanceField' => 'distanceField', + 'distanceMultiplier' => 'distanceMultiplier', + 'includeLocs' => 'includeLocs', + 'key' => 'key', + 'maxDistance' => 'maxDistance', + 'minDistance' => 'minDistance', + 'query' => 'query', + 'spherical' => 'spherical', + ]; + + /** @var Document|ResolvesToObject|Serializable|array|stdClass|string $near The point for which to find the closest documents. */ + public readonly Document|Serializable|ResolvesToObject|stdClass|array|string $near; + + /** @var Optional|string $distanceField The output field that contains the calculated distance. To specify a field within an embedded document, use dot notation. */ + public readonly Optional|string $distanceField; + + /** @var Optional|Decimal128|Int64|float|int $distanceMultiplier The factor to multiply all distances returned by the query. For example, use the distanceMultiplier to convert radians, as returned by a spherical query, to kilometers by multiplying by the radius of the Earth. */ + public readonly Optional|Decimal128|Int64|float|int $distanceMultiplier; + + /** @var Optional|string $includeLocs This specifies the output field that identifies the location used to calculate the distance. This option is useful when a location field contains multiple locations. To specify a field within an embedded document, use dot notation. */ + public readonly Optional|string $includeLocs; + + /** @var Optional|string $key Specify the geospatial indexed field to use when calculating the distance. */ + public readonly Optional|string $key; + + /** + * @var Optional|Decimal128|Int64|float|int $maxDistance The maximum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall within the specified distance from the center point. + * Specify the distance in meters if the specified point is GeoJSON and in radians if the specified point is legacy coordinate pairs. + */ + public readonly Optional|Decimal128|Int64|float|int $maxDistance; + + /** + * @var Optional|Decimal128|Int64|float|int $minDistance The minimum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall outside the specified distance from the center point. + * Specify the distance in meters for GeoJSON data and in radians for legacy coordinate pairs. + */ + public readonly Optional|Decimal128|Int64|float|int $minDistance; + + /** + * @var Optional|QueryInterface|array $query Limits the results to the documents that match the query. The query syntax is the usual MongoDB read operation query syntax. + * You cannot specify a $near predicate in the query field of the $geoNear stage. + */ + public readonly Optional|QueryInterface|array $query; + + /** + * @var Optional|bool $spherical Determines how MongoDB calculates the distance between two points: + * - When true, MongoDB uses $nearSphere semantics and calculates distances using spherical geometry. + * - When false, MongoDB uses $near semantics: spherical geometry for 2dsphere indexes and planar geometry for 2d indexes. + * Default: false. + */ + public readonly Optional|bool $spherical; + + /** + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $near The point for which to find the closest documents. + * @param Optional|string $distanceField The output field that contains the calculated distance. To specify a field within an embedded document, use dot notation. + * @param Optional|Decimal128|Int64|float|int $distanceMultiplier The factor to multiply all distances returned by the query. For example, use the distanceMultiplier to convert radians, as returned by a spherical query, to kilometers by multiplying by the radius of the Earth. + * @param Optional|string $includeLocs This specifies the output field that identifies the location used to calculate the distance. This option is useful when a location field contains multiple locations. To specify a field within an embedded document, use dot notation. + * @param Optional|string $key Specify the geospatial indexed field to use when calculating the distance. + * @param Optional|Decimal128|Int64|float|int $maxDistance The maximum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall within the specified distance from the center point. + * Specify the distance in meters if the specified point is GeoJSON and in radians if the specified point is legacy coordinate pairs. + * @param Optional|Decimal128|Int64|float|int $minDistance The minimum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall outside the specified distance from the center point. + * Specify the distance in meters for GeoJSON data and in radians for legacy coordinate pairs. + * @param Optional|QueryInterface|array $query Limits the results to the documents that match the query. The query syntax is the usual MongoDB read operation query syntax. + * You cannot specify a $near predicate in the query field of the $geoNear stage. + * @param Optional|bool $spherical Determines how MongoDB calculates the distance between two points: + * - When true, MongoDB uses $nearSphere semantics and calculates distances using spherical geometry. + * - When false, MongoDB uses $near semantics: spherical geometry for 2dsphere indexes and planar geometry for 2d indexes. + * Default: false. + */ + public function __construct( + Document|Serializable|ResolvesToObject|stdClass|array|string $near, + Optional|string $distanceField = Optional::Undefined, + Optional|Decimal128|Int64|float|int $distanceMultiplier = Optional::Undefined, + Optional|string $includeLocs = Optional::Undefined, + Optional|string $key = Optional::Undefined, + Optional|Decimal128|Int64|float|int $maxDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int $minDistance = Optional::Undefined, + Optional|QueryInterface|array $query = Optional::Undefined, + Optional|bool $spherical = Optional::Undefined, + ) { + if (is_string($near) && ! str_starts_with($near, '$')) { + throw new InvalidArgumentException('Argument $near can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->near = $near; + $this->distanceField = $distanceField; + $this->distanceMultiplier = $distanceMultiplier; + $this->includeLocs = $includeLocs; + $this->key = $key; + $this->maxDistance = $maxDistance; + $this->minDistance = $minDistance; + if (is_array($query)) { + $query = QueryObject::create($query); + } + + $this->query = $query; + $this->spherical = $spherical; + } +} diff --git a/src/Builder/Stage/GraphLookupStage.php b/src/Builder/Stage/GraphLookupStage.php new file mode 100644 index 000000000..d15b51bdf --- /dev/null +++ b/src/Builder/Stage/GraphLookupStage.php @@ -0,0 +1,115 @@ + 'from', + 'startWith' => 'startWith', + 'connectFromField' => 'connectFromField', + 'connectToField' => 'connectToField', + 'as' => 'as', + 'maxDepth' => 'maxDepth', + 'depthField' => 'depthField', + 'restrictSearchWithMatch' => 'restrictSearchWithMatch', + ]; + + /** + * @var string $from Target collection for the $graphLookup operation to search, recursively matching the connectFromField to the connectToField. The from collection must be in the same database as any other collections used in the operation. + * Starting in MongoDB 5.1, the collection specified in the from parameter can be sharded. + */ + public readonly string $from; + + /** @var BSONArray|DateTimeInterface|ExpressionInterface|PackedArray|Type|array|bool|float|int|null|stdClass|string $startWith Expression that specifies the value of the connectFromField with which to start the recursive search. Optionally, startWith may be array of values, each of which is individually followed through the traversal process. */ + public readonly DateTimeInterface|PackedArray|Type|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $startWith; + + /** @var string $connectFromField Field name whose value $graphLookup uses to recursively match against the connectToField of other documents in the collection. If the value is an array, each element is individually followed through the traversal process. */ + public readonly string $connectFromField; + + /** @var string $connectToField Field name in other documents against which to match the value of the field specified by the connectFromField parameter. */ + public readonly string $connectToField; + + /** @var string $as Name of the array field added to each output document. Contains the documents traversed in the $graphLookup stage to reach the document. */ + public readonly string $as; + + /** @var Optional|int $maxDepth Non-negative integral number specifying the maximum recursion depth. */ + public readonly Optional|int $maxDepth; + + /** @var Optional|string $depthField Name of the field to add to each traversed document in the search path. The value of this field is the recursion depth for the document, represented as a NumberLong. Recursion depth value starts at zero, so the first lookup corresponds to zero depth. */ + public readonly Optional|string $depthField; + + /** @var Optional|QueryInterface|array $restrictSearchWithMatch A document specifying additional conditions for the recursive search. The syntax is identical to query filter syntax. */ + public readonly Optional|QueryInterface|array $restrictSearchWithMatch; + + /** + * @param string $from Target collection for the $graphLookup operation to search, recursively matching the connectFromField to the connectToField. The from collection must be in the same database as any other collections used in the operation. + * Starting in MongoDB 5.1, the collection specified in the from parameter can be sharded. + * @param BSONArray|DateTimeInterface|ExpressionInterface|PackedArray|Type|array|bool|float|int|null|stdClass|string $startWith Expression that specifies the value of the connectFromField with which to start the recursive search. Optionally, startWith may be array of values, each of which is individually followed through the traversal process. + * @param string $connectFromField Field name whose value $graphLookup uses to recursively match against the connectToField of other documents in the collection. If the value is an array, each element is individually followed through the traversal process. + * @param string $connectToField Field name in other documents against which to match the value of the field specified by the connectFromField parameter. + * @param string $as Name of the array field added to each output document. Contains the documents traversed in the $graphLookup stage to reach the document. + * @param Optional|int $maxDepth Non-negative integral number specifying the maximum recursion depth. + * @param Optional|string $depthField Name of the field to add to each traversed document in the search path. The value of this field is the recursion depth for the document, represented as a NumberLong. Recursion depth value starts at zero, so the first lookup corresponds to zero depth. + * @param Optional|QueryInterface|array $restrictSearchWithMatch A document specifying additional conditions for the recursive search. The syntax is identical to query filter syntax. + */ + public function __construct( + string $from, + DateTimeInterface|PackedArray|Type|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $startWith, + string $connectFromField, + string $connectToField, + string $as, + Optional|int $maxDepth = Optional::Undefined, + Optional|string $depthField = Optional::Undefined, + Optional|QueryInterface|array $restrictSearchWithMatch = Optional::Undefined, + ) { + $this->from = $from; + if (is_array($startWith) && ! array_is_list($startWith)) { + throw new InvalidArgumentException('Expected $startWith argument to be a list, got an associative array.'); + } + + $this->startWith = $startWith; + $this->connectFromField = $connectFromField; + $this->connectToField = $connectToField; + $this->as = $as; + $this->maxDepth = $maxDepth; + $this->depthField = $depthField; + if (is_array($restrictSearchWithMatch)) { + $restrictSearchWithMatch = QueryObject::create($restrictSearchWithMatch); + } + + $this->restrictSearchWithMatch = $restrictSearchWithMatch; + } +} diff --git a/src/Builder/Stage/GroupStage.php b/src/Builder/Stage/GroupStage.php new file mode 100644 index 000000000..8577b4ad1 --- /dev/null +++ b/src/Builder/Stage/GroupStage.php @@ -0,0 +1,61 @@ + '_id', 'field' => null]; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $_id The _id expression specifies the group key. If you specify an _id value of null, or any other constant value, the $group stage returns a single document that aggregates values across all of the input documents. */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $_id; + + /** @var stdClass $field Computed using the accumulator operators. */ + public readonly stdClass $field; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $_id The _id expression specifies the group key. If you specify an _id value of null, or any other constant value, the $group stage returns a single document that aggregates values across all of the input documents. + * @param AccumulatorInterface|Document|Serializable|array|stdClass ...$field Computed using the accumulator operators. + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $_id, + Document|Serializable|AccumulatorInterface|stdClass|array ...$field, + ) { + $this->_id = $_id; + foreach($field as $key => $value) { + if (! is_string($key)) { + throw new InvalidArgumentException('Expected $field arguments to be a map (object), named arguments (:) or array unpacking ...[\'\' => ] must be used'); + } + } + + $field = (object) $field; + $this->field = $field; + } +} diff --git a/src/Builder/Stage/IndexStatsStage.php b/src/Builder/Stage/IndexStatsStage.php new file mode 100644 index 000000000..0baaf8a18 --- /dev/null +++ b/src/Builder/Stage/IndexStatsStage.php @@ -0,0 +1,29 @@ + 'limit']; + + /** @var int $limit */ + public readonly int $limit; + + /** + * @param int $limit + */ + public function __construct(int $limit) + { + $this->limit = $limit; + } +} diff --git a/src/Builder/Stage/ListLocalSessionsStage.php b/src/Builder/Stage/ListLocalSessionsStage.php new file mode 100644 index 000000000..f438b0148 --- /dev/null +++ b/src/Builder/Stage/ListLocalSessionsStage.php @@ -0,0 +1,55 @@ + 'users', 'allUsers' => 'allUsers']; + + /** @var Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. */ + public readonly Optional|PackedArray|BSONArray|array $users; + + /** @var Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. */ + public readonly Optional|bool $allUsers; + + /** + * @param Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. + * @param Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. + */ + public function __construct( + Optional|PackedArray|BSONArray|array $users = Optional::Undefined, + Optional|bool $allUsers = Optional::Undefined, + ) { + if (is_array($users) && ! array_is_list($users)) { + throw new InvalidArgumentException('Expected $users argument to be a list, got an associative array.'); + } + + $this->users = $users; + $this->allUsers = $allUsers; + } +} diff --git a/src/Builder/Stage/ListSampledQueriesStage.php b/src/Builder/Stage/ListSampledQueriesStage.php new file mode 100644 index 000000000..afa242591 --- /dev/null +++ b/src/Builder/Stage/ListSampledQueriesStage.php @@ -0,0 +1,38 @@ + 'namespace']; + + /** @var Optional|string $namespace */ + public readonly Optional|string $namespace; + + /** + * @param Optional|string $namespace + */ + public function __construct(Optional|string $namespace = Optional::Undefined) + { + $this->namespace = $namespace; + } +} diff --git a/src/Builder/Stage/ListSearchIndexesStage.php b/src/Builder/Stage/ListSearchIndexesStage.php new file mode 100644 index 000000000..c6643ad33 --- /dev/null +++ b/src/Builder/Stage/ListSearchIndexesStage.php @@ -0,0 +1,45 @@ + 'id', 'name' => 'name']; + + /** @var Optional|string $id The id of the index to return information about. */ + public readonly Optional|string $id; + + /** @var Optional|string $name The name of the index to return information about. */ + public readonly Optional|string $name; + + /** + * @param Optional|string $id The id of the index to return information about. + * @param Optional|string $name The name of the index to return information about. + */ + public function __construct( + Optional|string $id = Optional::Undefined, + Optional|string $name = Optional::Undefined, + ) { + $this->id = $id; + $this->name = $name; + } +} diff --git a/src/Builder/Stage/ListSessionsStage.php b/src/Builder/Stage/ListSessionsStage.php new file mode 100644 index 000000000..687425ce1 --- /dev/null +++ b/src/Builder/Stage/ListSessionsStage.php @@ -0,0 +1,55 @@ + 'users', 'allUsers' => 'allUsers']; + + /** @var Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. */ + public readonly Optional|PackedArray|BSONArray|array $users; + + /** @var Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. */ + public readonly Optional|bool $allUsers; + + /** + * @param Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. + * @param Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. + */ + public function __construct( + Optional|PackedArray|BSONArray|array $users = Optional::Undefined, + Optional|bool $allUsers = Optional::Undefined, + ) { + if (is_array($users) && ! array_is_list($users)) { + throw new InvalidArgumentException('Expected $users argument to be a list, got an associative array.'); + } + + $this->users = $users; + $this->allUsers = $allUsers; + } +} diff --git a/src/Builder/Stage/LookupStage.php b/src/Builder/Stage/LookupStage.php new file mode 100644 index 000000000..a9bf0d7ee --- /dev/null +++ b/src/Builder/Stage/LookupStage.php @@ -0,0 +1,103 @@ + 'as', + 'from' => 'from', + 'localField' => 'localField', + 'foreignField' => 'foreignField', + 'let' => 'let', + 'pipeline' => 'pipeline', + ]; + + /** @var string $as Specifies the name of the new array field to add to the input documents. The new array field contains the matching documents from the from collection. If the specified name already exists in the input document, the existing field is overwritten. */ + public readonly string $as; + + /** + * @var Optional|string $from Specifies the collection in the same database to perform the join with. + * from is optional, you can use a $documents stage in a $lookup stage instead. For an example, see Use a $documents Stage in a $lookup Stage. + * Starting in MongoDB 5.1, the collection specified in the from parameter can be sharded. + */ + public readonly Optional|string $from; + + /** @var Optional|string $localField Specifies the field from the documents input to the $lookup stage. $lookup performs an equality match on the localField to the foreignField from the documents of the from collection. If an input document does not contain the localField, the $lookup treats the field as having a value of null for matching purposes. */ + public readonly Optional|string $localField; + + /** @var Optional|string $foreignField Specifies the field from the documents in the from collection. $lookup performs an equality match on the foreignField to the localField from the input documents. If a document in the from collection does not contain the foreignField, the $lookup treats the value as null for matching purposes. */ + public readonly Optional|string $foreignField; + + /** @var Optional|Document|Serializable|array|stdClass $let Specifies variables to use in the pipeline stages. Use the variable expressions to access the fields from the joined collection's documents that are input to the pipeline. */ + public readonly Optional|Document|Serializable|stdClass|array $let; + + /** + * @var Optional|BSONArray|PackedArray|Pipeline|array $pipeline Specifies the pipeline to run on the joined collection. The pipeline determines the resulting documents from the joined collection. To return all documents, specify an empty pipeline []. + * The pipeline cannot include the $out stage or the $merge stage. Starting in v6.0, the pipeline can contain the Atlas Search $search stage as the first stage inside the pipeline. + * The pipeline cannot directly access the joined document fields. Instead, define variables for the joined document fields using the let option and then reference the variables in the pipeline stages. + */ + public readonly Optional|PackedArray|Pipeline|BSONArray|array $pipeline; + + /** + * @param string $as Specifies the name of the new array field to add to the input documents. The new array field contains the matching documents from the from collection. If the specified name already exists in the input document, the existing field is overwritten. + * @param Optional|string $from Specifies the collection in the same database to perform the join with. + * from is optional, you can use a $documents stage in a $lookup stage instead. For an example, see Use a $documents Stage in a $lookup Stage. + * Starting in MongoDB 5.1, the collection specified in the from parameter can be sharded. + * @param Optional|string $localField Specifies the field from the documents input to the $lookup stage. $lookup performs an equality match on the localField to the foreignField from the documents of the from collection. If an input document does not contain the localField, the $lookup treats the field as having a value of null for matching purposes. + * @param Optional|string $foreignField Specifies the field from the documents in the from collection. $lookup performs an equality match on the foreignField to the localField from the input documents. If a document in the from collection does not contain the foreignField, the $lookup treats the value as null for matching purposes. + * @param Optional|Document|Serializable|array|stdClass $let Specifies variables to use in the pipeline stages. Use the variable expressions to access the fields from the joined collection's documents that are input to the pipeline. + * @param Optional|BSONArray|PackedArray|Pipeline|array $pipeline Specifies the pipeline to run on the joined collection. The pipeline determines the resulting documents from the joined collection. To return all documents, specify an empty pipeline []. + * The pipeline cannot include the $out stage or the $merge stage. Starting in v6.0, the pipeline can contain the Atlas Search $search stage as the first stage inside the pipeline. + * The pipeline cannot directly access the joined document fields. Instead, define variables for the joined document fields using the let option and then reference the variables in the pipeline stages. + */ + public function __construct( + string $as, + Optional|string $from = Optional::Undefined, + Optional|string $localField = Optional::Undefined, + Optional|string $foreignField = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $let = Optional::Undefined, + Optional|PackedArray|Pipeline|BSONArray|array $pipeline = Optional::Undefined, + ) { + $this->as = $as; + $this->from = $from; + $this->localField = $localField; + $this->foreignField = $foreignField; + $this->let = $let; + if (is_array($pipeline) && ! array_is_list($pipeline)) { + throw new InvalidArgumentException('Expected $pipeline argument to be a list, got an associative array.'); + } + + $this->pipeline = $pipeline; + } +} diff --git a/src/Builder/Stage/MatchStage.php b/src/Builder/Stage/MatchStage.php new file mode 100644 index 000000000..0c88db2cf --- /dev/null +++ b/src/Builder/Stage/MatchStage.php @@ -0,0 +1,45 @@ + 'query']; + + /** @var QueryInterface|array $query */ + public readonly QueryInterface|array $query; + + /** + * @param QueryInterface|array $query + */ + public function __construct(QueryInterface|array $query) + { + if (is_array($query)) { + $query = QueryObject::create($query); + } + + $this->query = $query; + } +} diff --git a/src/Builder/Stage/MergeStage.php b/src/Builder/Stage/MergeStage.php new file mode 100644 index 000000000..2fc3e94da --- /dev/null +++ b/src/Builder/Stage/MergeStage.php @@ -0,0 +1,89 @@ + 'into', + 'on' => 'on', + 'let' => 'let', + 'whenMatched' => 'whenMatched', + 'whenNotMatched' => 'whenNotMatched', + ]; + + /** @var Document|Serializable|array|stdClass|string $into The output collection. */ + public readonly Document|Serializable|stdClass|array|string $into; + + /** @var Optional|BSONArray|PackedArray|array|string $on Field or fields that act as a unique identifier for a document. The identifier determines if a results document matches an existing document in the output collection. */ + public readonly Optional|PackedArray|BSONArray|array|string $on; + + /** @var Optional|Document|Serializable|array|stdClass $let Specifies variables for use in the whenMatched pipeline. */ + public readonly Optional|Document|Serializable|stdClass|array $let; + + /** @var Optional|BSONArray|PackedArray|Pipeline|array|string $whenMatched The behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s). */ + public readonly Optional|PackedArray|Pipeline|BSONArray|array|string $whenMatched; + + /** @var Optional|string $whenNotMatched The behavior of $merge if a result document does not match an existing document in the out collection. */ + public readonly Optional|string $whenNotMatched; + + /** + * @param Document|Serializable|array|stdClass|string $into The output collection. + * @param Optional|BSONArray|PackedArray|array|string $on Field or fields that act as a unique identifier for a document. The identifier determines if a results document matches an existing document in the output collection. + * @param Optional|Document|Serializable|array|stdClass $let Specifies variables for use in the whenMatched pipeline. + * @param Optional|BSONArray|PackedArray|Pipeline|array|string $whenMatched The behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s). + * @param Optional|string $whenNotMatched The behavior of $merge if a result document does not match an existing document in the out collection. + */ + public function __construct( + Document|Serializable|stdClass|array|string $into, + Optional|PackedArray|BSONArray|array|string $on = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $let = Optional::Undefined, + Optional|PackedArray|Pipeline|BSONArray|array|string $whenMatched = Optional::Undefined, + Optional|string $whenNotMatched = Optional::Undefined, + ) { + $this->into = $into; + if (is_array($on) && ! array_is_list($on)) { + throw new InvalidArgumentException('Expected $on argument to be a list, got an associative array.'); + } + + $this->on = $on; + $this->let = $let; + if (is_array($whenMatched) && ! array_is_list($whenMatched)) { + throw new InvalidArgumentException('Expected $whenMatched argument to be a list, got an associative array.'); + } + + $this->whenMatched = $whenMatched; + $this->whenNotMatched = $whenNotMatched; + } +} diff --git a/src/Builder/Stage/OutStage.php b/src/Builder/Stage/OutStage.php new file mode 100644 index 000000000..77959edc8 --- /dev/null +++ b/src/Builder/Stage/OutStage.php @@ -0,0 +1,40 @@ + 'coll']; + + /** @var Document|Serializable|array|stdClass|string $coll Target database name to write documents from $out to. */ + public readonly Document|Serializable|stdClass|array|string $coll; + + /** + * @param Document|Serializable|array|stdClass|string $coll Target database name to write documents from $out to. + */ + public function __construct(Document|Serializable|stdClass|array|string $coll) + { + $this->coll = $coll; + } +} diff --git a/src/Builder/Stage/PlanCacheStatsStage.php b/src/Builder/Stage/PlanCacheStatsStage.php new file mode 100644 index 000000000..5cfd75674 --- /dev/null +++ b/src/Builder/Stage/PlanCacheStatsStage.php @@ -0,0 +1,29 @@ + 'specification']; + + /** @var stdClass $specification */ + public readonly stdClass $specification; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string ...$specification + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$specification, + ) { + if (\count($specification) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $specification, got %d.', 1, \count($specification))); + } + + foreach($specification as $key => $value) { + if (! is_string($key)) { + throw new InvalidArgumentException('Expected $specification arguments to be a map (object), named arguments (:) or array unpacking ...[\'\' => ] must be used'); + } + } + + $specification = (object) $specification; + $this->specification = $specification; + } +} diff --git a/src/Builder/Stage/RedactStage.php b/src/Builder/Stage/RedactStage.php new file mode 100644 index 000000000..0da03aba5 --- /dev/null +++ b/src/Builder/Stage/RedactStage.php @@ -0,0 +1,42 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Stage/ReplaceRootStage.php b/src/Builder/Stage/ReplaceRootStage.php new file mode 100644 index 000000000..2cf5c34b2 --- /dev/null +++ b/src/Builder/Stage/ReplaceRootStage.php @@ -0,0 +1,49 @@ + 'newRoot']; + + /** @var Document|ResolvesToObject|Serializable|array|stdClass|string $newRoot */ + public readonly Document|Serializable|ResolvesToObject|stdClass|array|string $newRoot; + + /** + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $newRoot + */ + public function __construct(Document|Serializable|ResolvesToObject|stdClass|array|string $newRoot) + { + if (is_string($newRoot) && ! str_starts_with($newRoot, '$')) { + throw new InvalidArgumentException('Argument $newRoot can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->newRoot = $newRoot; + } +} diff --git a/src/Builder/Stage/ReplaceWithStage.php b/src/Builder/Stage/ReplaceWithStage.php new file mode 100644 index 000000000..95746bfa9 --- /dev/null +++ b/src/Builder/Stage/ReplaceWithStage.php @@ -0,0 +1,50 @@ + 'expression']; + + /** @var Document|ResolvesToObject|Serializable|array|stdClass|string $expression */ + public readonly Document|Serializable|ResolvesToObject|stdClass|array|string $expression; + + /** + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $expression + */ + public function __construct(Document|Serializable|ResolvesToObject|stdClass|array|string $expression) + { + if (is_string($expression) && ! str_starts_with($expression, '$')) { + throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".'); + } + + $this->expression = $expression; + } +} diff --git a/src/Builder/Stage/SampleStage.php b/src/Builder/Stage/SampleStage.php new file mode 100644 index 000000000..c00b2bb26 --- /dev/null +++ b/src/Builder/Stage/SampleStage.php @@ -0,0 +1,37 @@ + 'size']; + + /** @var int $size The number of documents to randomly select. */ + public readonly int $size; + + /** + * @param int $size The number of documents to randomly select. + */ + public function __construct(int $size) + { + $this->size = $size; + } +} diff --git a/src/Builder/Stage/SearchMetaStage.php b/src/Builder/Stage/SearchMetaStage.php new file mode 100644 index 000000000..14687161b --- /dev/null +++ b/src/Builder/Stage/SearchMetaStage.php @@ -0,0 +1,60 @@ + null, 'index' => 'index', 'count' => 'count']; + + /** + * @var Document|SearchOperatorInterface|Serializable|array|stdClass $operator Operator to search with. You can provide a specific operator or use + * the compound operator to run a compound query with multiple operators. + */ + public readonly Document|Serializable|SearchOperatorInterface|stdClass|array $operator; + + /** @var Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to default. */ + public readonly Optional|string $index; + + /** @var Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. */ + public readonly Optional|Document|Serializable|stdClass|array $count; + + /** + * @param Document|SearchOperatorInterface|Serializable|array|stdClass $operator Operator to search with. You can provide a specific operator or use + * the compound operator to run a compound query with multiple operators. + * @param Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to default. + * @param Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. + */ + public function __construct( + Document|Serializable|SearchOperatorInterface|stdClass|array $operator, + Optional|string $index = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, + ) { + $this->operator = $operator; + $this->index = $index; + $this->count = $count; + } +} diff --git a/src/Builder/Stage/SearchStage.php b/src/Builder/Stage/SearchStage.php new file mode 100644 index 000000000..1aac4a423 --- /dev/null +++ b/src/Builder/Stage/SearchStage.php @@ -0,0 +1,127 @@ + null, + 'index' => 'index', + 'highlight' => 'highlight', + 'concurrent' => 'concurrent', + 'count' => 'count', + 'searchAfter' => 'searchAfter', + 'searchBefore' => 'searchBefore', + 'scoreDetails' => 'scoreDetails', + 'sort' => 'sort', + 'returnStoredSource' => 'returnStoredSource', + 'tracking' => 'tracking', + ]; + + /** + * @var Document|SearchOperatorInterface|Serializable|array|stdClass $operator Operator to search with. You can provide a specific operator or use + * the compound operator to run a compound query with multiple operators. + */ + public readonly Document|Serializable|SearchOperatorInterface|stdClass|array $operator; + + /** @var Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to "default". */ + public readonly Optional|string $index; + + /** @var Optional|Document|Serializable|array|stdClass $highlight Specifies the highlighting options for displaying search terms in their original context. */ + public readonly Optional|Document|Serializable|stdClass|array $highlight; + + /** + * @var Optional|bool $concurrent Parallelize search across segments on dedicated search nodes. + * If you don't have separate search nodes on your cluster, + * Atlas Search ignores this flag. If omitted, defaults to false. + */ + public readonly Optional|bool $concurrent; + + /** @var Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. */ + public readonly Optional|Document|Serializable|stdClass|array $count; + + /** @var Optional|string $searchAfter Reference point for retrieving results. searchAfter returns documents starting immediately following the specified reference point. */ + public readonly Optional|string $searchAfter; + + /** @var Optional|string $searchBefore Reference point for retrieving results. searchBefore returns documents starting immediately before the specified reference point. */ + public readonly Optional|string $searchBefore; + + /** @var Optional|bool $scoreDetails Flag that specifies whether to retrieve a detailed breakdown of the score for the documents in the results. If omitted, defaults to false. */ + public readonly Optional|bool $scoreDetails; + + /** @var Optional|Document|Serializable|array|stdClass $sort Document that specifies the fields to sort the Atlas Search results by in ascending or descending order. */ + public readonly Optional|Document|Serializable|stdClass|array $sort; + + /** @var Optional|bool $returnStoredSource Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search. */ + public readonly Optional|bool $returnStoredSource; + + /** @var Optional|Document|Serializable|array|stdClass $tracking Document that specifies the tracking option to retrieve analytics information on the search terms. */ + public readonly Optional|Document|Serializable|stdClass|array $tracking; + + /** + * @param Document|SearchOperatorInterface|Serializable|array|stdClass $operator Operator to search with. You can provide a specific operator or use + * the compound operator to run a compound query with multiple operators. + * @param Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to "default". + * @param Optional|Document|Serializable|array|stdClass $highlight Specifies the highlighting options for displaying search terms in their original context. + * @param Optional|bool $concurrent Parallelize search across segments on dedicated search nodes. + * If you don't have separate search nodes on your cluster, + * Atlas Search ignores this flag. If omitted, defaults to false. + * @param Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. + * @param Optional|string $searchAfter Reference point for retrieving results. searchAfter returns documents starting immediately following the specified reference point. + * @param Optional|string $searchBefore Reference point for retrieving results. searchBefore returns documents starting immediately before the specified reference point. + * @param Optional|bool $scoreDetails Flag that specifies whether to retrieve a detailed breakdown of the score for the documents in the results. If omitted, defaults to false. + * @param Optional|Document|Serializable|array|stdClass $sort Document that specifies the fields to sort the Atlas Search results by in ascending or descending order. + * @param Optional|bool $returnStoredSource Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search. + * @param Optional|Document|Serializable|array|stdClass $tracking Document that specifies the tracking option to retrieve analytics information on the search terms. + */ + public function __construct( + Document|Serializable|SearchOperatorInterface|stdClass|array $operator, + Optional|string $index = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $highlight = Optional::Undefined, + Optional|bool $concurrent = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, + Optional|string $searchAfter = Optional::Undefined, + Optional|string $searchBefore = Optional::Undefined, + Optional|bool $scoreDetails = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $sort = Optional::Undefined, + Optional|bool $returnStoredSource = Optional::Undefined, + Optional|Document|Serializable|stdClass|array $tracking = Optional::Undefined, + ) { + $this->operator = $operator; + $this->index = $index; + $this->highlight = $highlight; + $this->concurrent = $concurrent; + $this->count = $count; + $this->searchAfter = $searchAfter; + $this->searchBefore = $searchBefore; + $this->scoreDetails = $scoreDetails; + $this->sort = $sort; + $this->returnStoredSource = $returnStoredSource; + $this->tracking = $tracking; + } +} diff --git a/src/Builder/Stage/SetStage.php b/src/Builder/Stage/SetStage.php new file mode 100644 index 000000000..a9c2a53ec --- /dev/null +++ b/src/Builder/Stage/SetStage.php @@ -0,0 +1,57 @@ + 'field']; + + /** @var stdClass $field */ + public readonly stdClass $field; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string ...$field + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$field, + ) { + if (\count($field) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $field, got %d.', 1, \count($field))); + } + + foreach($field as $key => $value) { + if (! is_string($key)) { + throw new InvalidArgumentException('Expected $field arguments to be a map (object), named arguments (:) or array unpacking ...[\'\' => ] must be used'); + } + } + + $field = (object) $field; + $this->field = $field; + } +} diff --git a/src/Builder/Stage/SetWindowFieldsStage.php b/src/Builder/Stage/SetWindowFieldsStage.php new file mode 100644 index 000000000..7d45bc5aa --- /dev/null +++ b/src/Builder/Stage/SetWindowFieldsStage.php @@ -0,0 +1,62 @@ + 'sortBy', 'output' => 'output', 'partitionBy' => 'partitionBy']; + + /** @var Document|Serializable|array|stdClass $sortBy Specifies the field(s) to sort the documents by in the partition. Uses the same syntax as the $sort stage. Default is no sorting. */ + public readonly Document|Serializable|stdClass|array $sortBy; + + /** + * @var Document|Serializable|array|stdClass $output Specifies the field(s) to append to the documents in the output returned by the $setWindowFields stage. Each field is set to the result returned by the window operator. + * A field can contain dots to specify embedded document fields and array fields. The semantics for the embedded document dotted notation in the $setWindowFields stage are the same as the $addFields and $set stages. + */ + public readonly Document|Serializable|stdClass|array $output; + + /** @var Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $partitionBy Specifies an expression to group the documents. In the $setWindowFields stage, the group of documents is known as a partition. Default is one partition for the entire collection. */ + public readonly Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $partitionBy; + + /** + * @param Document|Serializable|array|stdClass $sortBy Specifies the field(s) to sort the documents by in the partition. Uses the same syntax as the $sort stage. Default is no sorting. + * @param Document|Serializable|array|stdClass $output Specifies the field(s) to append to the documents in the output returned by the $setWindowFields stage. Each field is set to the result returned by the window operator. + * A field can contain dots to specify embedded document fields and array fields. The semantics for the embedded document dotted notation in the $setWindowFields stage are the same as the $addFields and $set stages. + * @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $partitionBy Specifies an expression to group the documents. In the $setWindowFields stage, the group of documents is known as a partition. Default is one partition for the entire collection. + */ + public function __construct( + Document|Serializable|stdClass|array $sortBy, + Document|Serializable|stdClass|array $output, + Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $partitionBy = Optional::Undefined, + ) { + $this->sortBy = $sortBy; + $this->output = $output; + $this->partitionBy = $partitionBy; + } +} diff --git a/src/Builder/Stage/ShardedDataDistributionStage.php b/src/Builder/Stage/ShardedDataDistributionStage.php new file mode 100644 index 000000000..fe07d282a --- /dev/null +++ b/src/Builder/Stage/ShardedDataDistributionStage.php @@ -0,0 +1,30 @@ + 'skip']; + + /** @var int $skip */ + public readonly int $skip; + + /** + * @param int $skip + */ + public function __construct(int $skip) + { + $this->skip = $skip; + } +} diff --git a/src/Builder/Stage/SortByCountStage.php b/src/Builder/Stage/SortByCountStage.php new file mode 100644 index 000000000..e616470b9 --- /dev/null +++ b/src/Builder/Stage/SortByCountStage.php @@ -0,0 +1,42 @@ + 'expression']; + + /** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */ + public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; + + /** + * @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, + ) { + $this->expression = $expression; + } +} diff --git a/src/Builder/Stage/SortStage.php b/src/Builder/Stage/SortStage.php new file mode 100644 index 000000000..fc8899a4c --- /dev/null +++ b/src/Builder/Stage/SortStage.php @@ -0,0 +1,57 @@ + 'sort']; + + /** @var stdClass $sort */ + public readonly stdClass $sort; + + /** + * @param DateTimeInterface|ExpressionInterface|Sort|Type|array|bool|float|int|null|stdClass|string ...$sort + */ + public function __construct( + DateTimeInterface|Type|ExpressionInterface|Sort|stdClass|array|bool|float|int|null|string ...$sort, + ) { + if (\count($sort) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $sort, got %d.', 1, \count($sort))); + } + + foreach($sort as $key => $value) { + if (! is_string($key)) { + throw new InvalidArgumentException('Expected $sort arguments to be a map (object), named arguments (:) or array unpacking ...[\'\' => ] must be used'); + } + } + + $sort = (object) $sort; + $this->sort = $sort; + } +} diff --git a/src/Builder/Stage/UnionWithStage.php b/src/Builder/Stage/UnionWithStage.php new file mode 100644 index 000000000..25ced13de --- /dev/null +++ b/src/Builder/Stage/UnionWithStage.php @@ -0,0 +1,61 @@ + 'coll', 'pipeline' => 'pipeline']; + + /** @var string $coll The collection or view whose pipeline results you wish to include in the result set. */ + public readonly string $coll; + + /** + * @var Optional|BSONArray|PackedArray|Pipeline|array $pipeline An aggregation pipeline to apply to the specified coll. + * The pipeline cannot include the $out and $merge stages. Starting in v6.0, the pipeline can contain the Atlas Search $search stage as the first stage inside the pipeline. + */ + public readonly Optional|PackedArray|Pipeline|BSONArray|array $pipeline; + + /** + * @param string $coll The collection or view whose pipeline results you wish to include in the result set. + * @param Optional|BSONArray|PackedArray|Pipeline|array $pipeline An aggregation pipeline to apply to the specified coll. + * The pipeline cannot include the $out and $merge stages. Starting in v6.0, the pipeline can contain the Atlas Search $search stage as the first stage inside the pipeline. + */ + public function __construct( + string $coll, + Optional|PackedArray|Pipeline|BSONArray|array $pipeline = Optional::Undefined, + ) { + $this->coll = $coll; + if (is_array($pipeline) && ! array_is_list($pipeline)) { + throw new InvalidArgumentException('Expected $pipeline argument to be a list, got an associative array.'); + } + + $this->pipeline = $pipeline; + } +} diff --git a/src/Builder/Stage/UnsetStage.php b/src/Builder/Stage/UnsetStage.php new file mode 100644 index 000000000..43575d8d5 --- /dev/null +++ b/src/Builder/Stage/UnsetStage.php @@ -0,0 +1,51 @@ + 'field']; + + /** @var list $field */ + public readonly array $field; + + /** + * @param FieldPath|string ...$field + * @no-named-arguments + */ + public function __construct(FieldPath|string ...$field) + { + if (\count($field) < 1) { + throw new InvalidArgumentException(\sprintf('Expected at least %d values for $field, got %d.', 1, \count($field))); + } + + if (! array_is_list($field)) { + throw new InvalidArgumentException('Expected $field arguments to be a list (array), named arguments are not supported'); + } + + $this->field = $field; + } +} diff --git a/src/Builder/Stage/UnwindStage.php b/src/Builder/Stage/UnwindStage.php new file mode 100644 index 000000000..9959f462b --- /dev/null +++ b/src/Builder/Stage/UnwindStage.php @@ -0,0 +1,63 @@ + 'path', + 'includeArrayIndex' => 'includeArrayIndex', + 'preserveNullAndEmptyArrays' => 'preserveNullAndEmptyArrays', + ]; + + /** @var ArrayFieldPath|string $path Field path to an array field. */ + public readonly ArrayFieldPath|string $path; + + /** @var Optional|string $includeArrayIndex The name of a new field to hold the array index of the element. The name cannot start with a dollar sign $. */ + public readonly Optional|string $includeArrayIndex; + + /** + * @var Optional|bool $preserveNullAndEmptyArrays If true, if the path is null, missing, or an empty array, $unwind outputs the document. + * If false, if path is null, missing, or an empty array, $unwind does not output a document. + * The default value is false. + */ + public readonly Optional|bool $preserveNullAndEmptyArrays; + + /** + * @param ArrayFieldPath|string $path Field path to an array field. + * @param Optional|string $includeArrayIndex The name of a new field to hold the array index of the element. The name cannot start with a dollar sign $. + * @param Optional|bool $preserveNullAndEmptyArrays If true, if the path is null, missing, or an empty array, $unwind outputs the document. + * If false, if path is null, missing, or an empty array, $unwind does not output a document. + * The default value is false. + */ + public function __construct( + ArrayFieldPath|string $path, + Optional|string $includeArrayIndex = Optional::Undefined, + Optional|bool $preserveNullAndEmptyArrays = Optional::Undefined, + ) { + $this->path = $path; + $this->includeArrayIndex = $includeArrayIndex; + $this->preserveNullAndEmptyArrays = $preserveNullAndEmptyArrays; + } +} diff --git a/src/Builder/Stage/VectorSearchStage.php b/src/Builder/Stage/VectorSearchStage.php new file mode 100644 index 000000000..5a974c74e --- /dev/null +++ b/src/Builder/Stage/VectorSearchStage.php @@ -0,0 +1,104 @@ + 'index', + 'limit' => 'limit', + 'path' => 'path', + 'queryVector' => 'queryVector', + 'exact' => 'exact', + 'filter' => 'filter', + 'numCandidates' => 'numCandidates', + ]; + + /** @var string $index Name of the Atlas Vector Search index to use. */ + public readonly string $index; + + /** @var int $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. */ + public readonly int $limit; + + /** @var string $path Indexed vector type field to search. */ + public readonly string $path; + + /** @var BSONArray|PackedArray|array $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. */ + public readonly PackedArray|BSONArray|array $queryVector; + + /** @var Optional|bool $exact This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. */ + public readonly Optional|bool $exact; + + /** @var Optional|QueryInterface|array $filter Any match query that compares an indexed field with a boolean, date, objectId, number (not decimals), string, or UUID to use as a pre-filter. */ + public readonly Optional|QueryInterface|array $filter; + + /** + * @var Optional|int $numCandidates This field is required if exact is false or omitted. + * Number of nearest neighbors to use during the search. Value must be less than or equal to (<=) 10000. You can't specify a number less than the number of documents to return (limit). + */ + public readonly Optional|int $numCandidates; + + /** + * @param string $index Name of the Atlas Vector Search index to use. + * @param int $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. + * @param string $path Indexed vector type field to search. + * @param BSONArray|PackedArray|array $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. + * @param Optional|bool $exact This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. + * @param Optional|QueryInterface|array $filter Any match query that compares an indexed field with a boolean, date, objectId, number (not decimals), string, or UUID to use as a pre-filter. + * @param Optional|int $numCandidates This field is required if exact is false or omitted. + * Number of nearest neighbors to use during the search. Value must be less than or equal to (<=) 10000. You can't specify a number less than the number of documents to return (limit). + */ + public function __construct( + string $index, + int $limit, + string $path, + PackedArray|BSONArray|array $queryVector, + Optional|bool $exact = Optional::Undefined, + Optional|QueryInterface|array $filter = Optional::Undefined, + Optional|int $numCandidates = Optional::Undefined, + ) { + $this->index = $index; + $this->limit = $limit; + $this->path = $path; + if (is_array($queryVector) && ! array_is_list($queryVector)) { + throw new InvalidArgumentException('Expected $queryVector argument to be a list, got an associative array.'); + } + + $this->queryVector = $queryVector; + $this->exact = $exact; + if (is_array($filter)) { + $filter = QueryObject::create($filter); + } + + $this->filter = $filter; + $this->numCandidates = $numCandidates; + } +} diff --git a/src/Builder/Type/AccumulatorInterface.php b/src/Builder/Type/AccumulatorInterface.php new file mode 100644 index 000000000..c3aaad2af --- /dev/null +++ b/src/Builder/Type/AccumulatorInterface.php @@ -0,0 +1,14 @@ + $fieldQueries */ + public readonly array $fieldQueries; + + /** @param list $fieldQueries */ + public function __construct(array $fieldQueries) + { + if (! array_is_list($fieldQueries)) { + throw new InvalidArgumentException('Expected filters to be a list, invalid array given.'); + } + + // Flatten nested CombinedFieldQuery + $this->fieldQueries = array_reduce( + $fieldQueries, + /** + * @param list $fieldQueries + * + * @return list + */ + static function (array $fieldQueries, QueryInterface|FieldQueryInterface|Type|stdClass|array|bool|float|int|string|null $fieldQuery): array { + if ($fieldQuery instanceof CombinedFieldQuery) { + return array_merge($fieldQueries, $fieldQuery->fieldQueries); + } + + $fieldQueries[] = $fieldQuery; + + return $fieldQueries; + }, + [], + ); + + // Validate FieldQuery types and non-duplicate operators + /** @var array $seenOperators */ + $seenOperators = []; + foreach ($this->fieldQueries as $fieldQuery) { + if ($fieldQuery instanceof stdClass) { + $fieldQuery = get_object_vars($fieldQuery); + } + + if ($fieldQuery instanceof FieldQueryInterface && $fieldQuery instanceof OperatorInterface) { + $operator = $fieldQuery::NAME; + } elseif (is_array($fieldQuery)) { + if (count($fieldQuery) !== 1) { + throw new InvalidArgumentException(sprintf('Operator must contain exactly one key, %d given', count($fieldQuery))); + } + + $operator = array_key_first($fieldQuery); + if (! is_string($operator) || ! str_starts_with($operator, '$')) { + throw new InvalidArgumentException(sprintf('Operator must contain exactly one key starting with $, "%s" given', $operator)); + } + } else { + throw new InvalidArgumentException(sprintf('Expected filters to be a list of field query operators, array or stdClass, %s given', get_debug_type($fieldQuery))); + } + + if (array_key_exists($operator, $seenOperators)) { + throw new InvalidArgumentException(sprintf('Duplicate operator "%s" detected', $operator)); + } + + $seenOperators[$operator] = true; + } + } +} diff --git a/src/Builder/Type/DictionaryInterface.php b/src/Builder/Type/DictionaryInterface.php new file mode 100644 index 000000000..5d88abffa --- /dev/null +++ b/src/Builder/Type/DictionaryInterface.php @@ -0,0 +1,10 @@ + */ + public const PROPERTIES = []; + + /** @var string|null */ + public const NAME = null; +} diff --git a/src/Builder/Type/Optional.php b/src/Builder/Type/Optional.php new file mode 100644 index 000000000..f7a4a878e --- /dev/null +++ b/src/Builder/Type/Optional.php @@ -0,0 +1,17 @@ +|stdClass $operator Window operator to use in the $setWindowFields stage. + * @param Optional|array{string|int,string|int} $documents A window where the lower and upper boundaries are specified relative to the position of the current document read from the collection. + * @param Optional|array{string|numeric,string|numeric} $range Arguments passed to the init function. + * @param Optional|non-empty-string $unit Specifies the units for time range window boundaries. If omitted, default numeric range window boundaries are used. + */ + public function __construct( + Document|Serializable|WindowInterface|stdClass|array $operator, + Optional|array $documents = Optional::Undefined, + Optional|array $range = Optional::Undefined, + Optional|TimeUnit|string $unit = Optional::Undefined, + ) { + $this->operator = $operator; + + $window = null; + if ($documents !== Optional::Undefined) { + if (! array_is_list($documents) || count($documents) !== 2) { + throw new InvalidArgumentException('Expected $documents argument to be a list of 2 string or int'); + } + + if (! is_string($documents[0]) && ! is_int($documents[0]) || ! is_string($documents[1]) && ! is_int($documents[1])) { + throw new InvalidArgumentException(sprintf('Expected $documents argument to be a list of 2 string or int. Got [%s, %s]', get_debug_type($documents[0]), get_debug_type($documents[1]))); + } + + $window = new stdClass(); + $window->documents = $documents; + } + + if ($range !== Optional::Undefined) { + if (! array_is_list($range) || count($range) !== 2) { + throw new InvalidArgumentException('Expected $range argument to be a list of 2 string or numeric'); + } + + if (! is_string($range[0]) && ! is_numeric($range[0]) || ! is_string($range[1]) && ! is_numeric($range[1])) { + throw new InvalidArgumentException(sprintf('Expected $range argument to be a list of 2 string or numeric. Got [%s, %s]', get_debug_type($range[0]), get_debug_type($range[1]))); + } + + $window ??= new stdClass(); + $window->range = $range; + } + + if ($unit !== Optional::Undefined) { + $window ??= new stdClass(); + $window->unit = $unit; + } + + $this->window = $window ?? Optional::Undefined; + } +} diff --git a/src/Builder/Type/QueryInterface.php b/src/Builder/Type/QueryInterface.php new file mode 100644 index 000000000..a396d5339 --- /dev/null +++ b/src/Builder/Type/QueryInterface.php @@ -0,0 +1,14 @@ + $queries */ + public static function create(array $queries): QueryInterface + { + // We don't wrap a single query in a QueryObject + if (count($queries) === 1 && isset($queries[0]) && $queries[0] instanceof QueryInterface) { + return $queries[0]; + } + + return new self($queries); + } + + /** @param array $queriesOrArrayOfQueries */ + private function __construct(array $queriesOrArrayOfQueries) + { + // If the first element is an array and not an operator, we assume variadic arguments were not used + if ( + count($queriesOrArrayOfQueries) === 1 && + isset($queriesOrArrayOfQueries[0]) && + is_array($queriesOrArrayOfQueries[0]) && + count($queriesOrArrayOfQueries[0]) > 0 && + ! str_starts_with((string) array_key_first($queriesOrArrayOfQueries[0]), '$') + ) { + $queriesOrArrayOfQueries = $queriesOrArrayOfQueries[0]; + } + + $seenQueryOperators = []; + $queries = []; + + foreach ($queriesOrArrayOfQueries as $fieldPath => $query) { + if ($query instanceof QueryInterface) { + if ($query instanceof OperatorInterface) { + if (isset($seenQueryOperators[$query::NAME])) { + throw new InvalidArgumentException(sprintf('Query operator "%s" cannot be used multiple times in the same query.', $query::NAME)); + } + + $seenQueryOperators[$query::NAME] = true; + } + + $queries[] = $query; + continue; + } + + // Convert list of filters into CombinedFieldQuery + if (self::isListOfFilters($query)) { + if (count($query) === 1) { + $query = $query[0]; + } else { + $query = new CombinedFieldQuery($query); + } + } + + $queries[$fieldPath] = $query; + } + + $this->queries = $queries; + } + + /** @psalm-assert-if-true list $values */ + private static function isListOfFilters(mixed $values): bool + { + if (! is_array($values) || ! array_is_list($values)) { + return false; + } + + /** @var mixed $value */ + foreach ($values as $value) { + if ($value instanceof FieldQueryInterface) { + return true; + } + } + + return false; + } +} diff --git a/src/Builder/Type/SearchOperatorInterface.php b/src/Builder/Type/SearchOperatorInterface.php new file mode 100644 index 000000000..c144d4ebe --- /dev/null +++ b/src/Builder/Type/SearchOperatorInterface.php @@ -0,0 +1,7 @@ + 1, + self::Desc => -1, + self::TextScore => ['$meta' => 'textScore'], + }; + } +} diff --git a/src/Builder/Type/StageInterface.php b/src/Builder/Type/StageInterface.php new file mode 100644 index 000000000..6d4fcf2e6 --- /dev/null +++ b/src/Builder/Type/StageInterface.php @@ -0,0 +1,14 @@ +value; + } +} diff --git a/src/Builder/Type/WindowInterface.php b/src/Builder/Type/WindowInterface.php new file mode 100644 index 000000000..d3fc8c378 --- /dev/null +++ b/src/Builder/Type/WindowInterface.php @@ -0,0 +1,14 @@ + is equivalent to $$CURRENT., rebinding + * CURRENT changes the meaning of $ accesses. + */ + public static function current(string $fieldPath = ''): ResolvesToAny + { + return new Expression\Variable('CURRENT' . ($fieldPath ? '.' . $fieldPath : '')); + } + + /** + * One of the allowed results of a $redact expression. + * + * $redact returns the fields at the current document level, excluding embedded documents. To include embedded + * documents and embedded documents within arrays, apply the $cond expression to the embedded documents to determine + * access for these embedded documents. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/redact/#mongodb-pipeline-pipe.-redact + */ + public static function descend(): ExpressionInterface + { + return new Expression\Variable('DESCEND'); + } + + /** + * One of the allowed results of a $redact expression. + * + * $redact returns or keeps all fields at this current document/embedded document level, without further inspection + * of the fields at this level. This applies even if the included field contains embedded documents that may have + * different access levels. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/redact/#mongodb-pipeline-pipe.-redact + */ + public static function keep(): ExpressionInterface + { + return new Expression\Variable('KEEP'); + } + + /** + * A variable that returns the current datetime value. + * NOW returns the same value for all members of the deployment and remains the same throughout all stages of the + * aggregation pipeline. + * + * New in MongoDB 4.2. + */ + public static function now(): ResolvesToDate + { + return new Expression\Variable('NOW'); + } + + /** + * One of the allowed results of a $redact expression. + * + * $redact excludes all fields at this current document/embedded document level, without further inspection of any + * of the excluded fields. This applies even if the excluded field contains embedded documents that may have + * different access levels. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/redact/#mongodb-pipeline-pipe.-redact + */ + public static function prune(): ExpressionInterface + { + return new Expression\Variable('PRUNE'); + } + + /** + * A variable which evaluates to the missing value. Allows for the conditional exclusion of fields. In a $project, + * a field set to the variable REMOVE is excluded from the output. + * Can be used with $cond operator for conditionally exclude fields. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/project/#std-label-remove-example + */ + public static function remove(): ResolvesToAny + { + return new Expression\Variable('REMOVE'); + } + + /** + * References the root document, i.e. the top-level document, currently being processed in the aggregation pipeline + * stage. + */ + public static function root(): ResolvesToObject + { + return new Expression\Variable('ROOT'); + } + + /** + * A variable that stores the metadata results of an Atlas Search query. In all supported aggregation pipeline + * stages, a field set to the variable $$SEARCH_META returns the metadata results for the query. + * For an example of its usage, see Atlas Search facet and count. + * + * @see https://www.mongodb.com/docs/atlas/atlas-search/query-syntax/#metadata-result-types + */ + public static function searchMeta(): ResolvesToObject + { + return new Expression\Variable('SEARCH_META'); + } + + /** + * Returns the roles assigned to the current user. + * For use cases that include USER_ROLES, see the find, aggregation, view, updateOne, updateMany, and findAndModify + * examples. + * + * New in MongoDB 7.0. + */ + public static function userRoles(): ResolvesToArray + { + return new Expression\Variable('USER_ROLES'); + } + + /** + * User-defined variable that can be used to store any BSON type. + * + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/let/ + */ + public static function variable(string $name): Expression\Variable + { + return new Expression\Variable($name); + } + + private function __construct() + { + // This class cannot be instantiated + } +} diff --git a/src/BulkWriteResult.php b/src/BulkWriteResult.php index 9f86c3a81..43c60ea2d 100644 --- a/src/BulkWriteResult.php +++ b/src/BulkWriteResult.php @@ -17,25 +17,16 @@ namespace MongoDB; +use MongoDB\Driver\Exception\LogicException; use MongoDB\Driver\WriteResult; -use MongoDB\Exception\BadMethodCallException; /** * Result class for a bulk write operation. */ class BulkWriteResult { - private WriteResult $writeResult; - - private array $insertedIds; - - private bool $isAcknowledged; - - public function __construct(WriteResult $writeResult, array $insertedIds) + public function __construct(private WriteResult $writeResult, private array $insertedIds) { - $this->writeResult = $writeResult; - $this->insertedIds = $insertedIds; - $this->isAcknowledged = $writeResult->isAcknowledged(); } /** @@ -44,16 +35,11 @@ public function __construct(WriteResult $writeResult, array $insertedIds) * This method should only be called if the write was acknowledged. * * @see BulkWriteResult::isAcknowledged() - * @return integer|null - * @throws BadMethodCallException if the write result is unacknowledged + * @throws LogicException if the write result is unacknowledged */ - public function getDeletedCount() + public function getDeletedCount(): int { - if ($this->isAcknowledged) { - return $this->writeResult->getDeletedCount(); - } - - throw BadMethodCallException::unacknowledgedWriteResultAccess(__METHOD__); + return $this->writeResult->getDeletedCount(); } /** @@ -62,16 +48,11 @@ public function getDeletedCount() * This method should only be called if the write was acknowledged. * * @see BulkWriteResult::isAcknowledged() - * @return integer|null - * @throws BadMethodCallException if the write result is unacknowledged + * @throws LogicException if the write result is unacknowledged */ - public function getInsertedCount() + public function getInsertedCount(): int { - if ($this->isAcknowledged) { - return $this->writeResult->getInsertedCount(); - } - - throw BadMethodCallException::unacknowledgedWriteResultAccess(__METHOD__); + return $this->writeResult->getInsertedCount(); } /** @@ -82,10 +63,8 @@ public function getInsertedCount() * the driver did not generate an ID), the index will contain its "_id" * field value. Any driver-generated ID will be a MongoDB\BSON\ObjectId * instance. - * - * @return array */ - public function getInsertedIds() + public function getInsertedIds(): array { return $this->insertedIds; } @@ -96,16 +75,11 @@ public function getInsertedIds() * This method should only be called if the write was acknowledged. * * @see BulkWriteResult::isAcknowledged() - * @return integer|null - * @throws BadMethodCallException if the write result is unacknowledged + * @throws LogicException if the write result is unacknowledged */ - public function getMatchedCount() + public function getMatchedCount(): int { - if ($this->isAcknowledged) { - return $this->writeResult->getMatchedCount(); - } - - throw BadMethodCallException::unacknowledgedWriteResultAccess(__METHOD__); + return $this->writeResult->getMatchedCount(); } /** @@ -117,16 +91,11 @@ public function getMatchedCount() * This method should only be called if the write was acknowledged. * * @see BulkWriteResult::isAcknowledged() - * @return integer|null - * @throws BadMethodCallException if the write result is unacknowledged + * @throws LogicException if the write result is unacknowledged */ - public function getModifiedCount() + public function getModifiedCount(): int { - if ($this->isAcknowledged) { - return $this->writeResult->getModifiedCount(); - } - - throw BadMethodCallException::unacknowledgedWriteResultAccess(__METHOD__); + return $this->writeResult->getModifiedCount(); } /** @@ -135,16 +104,11 @@ public function getModifiedCount() * This method should only be called if the write was acknowledged. * * @see BulkWriteResult::isAcknowledged() - * @return integer|null - * @throws BadMethodCallException if the write result is unacknowledged + * @throws LogicException if the write result is unacknowledged */ - public function getUpsertedCount() + public function getUpsertedCount(): int { - if ($this->isAcknowledged) { - return $this->writeResult->getUpsertedCount(); - } - - throw BadMethodCallException::unacknowledgedWriteResultAccess(__METHOD__); + return $this->writeResult->getUpsertedCount(); } /** @@ -158,16 +122,11 @@ public function getUpsertedCount() * This method should only be called if the write was acknowledged. * * @see BulkWriteResult::isAcknowledged() - * @return array - * @throws BadMethodCallException if the write result is unacknowledged + * @throws LogicException if the write result is unacknowledged */ - public function getUpsertedIds() + public function getUpsertedIds(): array { - if ($this->isAcknowledged) { - return $this->writeResult->getUpsertedIds(); - } - - throw BadMethodCallException::unacknowledgedWriteResultAccess(__METHOD__); + return $this->writeResult->getUpsertedIds(); } /** @@ -175,11 +134,9 @@ public function getUpsertedIds() * * If the update was not acknowledged, other fields from the WriteResult * (e.g. matchedCount) will be undefined. - * - * @return boolean */ - public function isAcknowledged() + public function isAcknowledged(): bool { - return $this->isAcknowledged; + return $this->writeResult->isAcknowledged(); } } diff --git a/src/ChangeStream.php b/src/ChangeStream.php index 7260f495d..b9f8aed1c 100644 --- a/src/ChangeStream.php +++ b/src/ChangeStream.php @@ -21,22 +21,16 @@ use MongoDB\BSON\Document; use MongoDB\BSON\Int64; use MongoDB\Codec\DocumentCodec; -use MongoDB\Driver\CursorId; use MongoDB\Driver\Exception\ConnectionException; use MongoDB\Driver\Exception\RuntimeException; use MongoDB\Driver\Exception\ServerException; use MongoDB\Exception\BadMethodCallException; use MongoDB\Exception\ResumeTokenException; use MongoDB\Model\ChangeStreamIterator; -use ReturnTypeWillChange; use function assert; use function call_user_func; use function in_array; -use function sprintf; -use function trigger_error; - -use const E_USER_DEPRECATED; /** * Iterator for a change stream. @@ -49,11 +43,7 @@ */ class ChangeStream implements Iterator { - /** - * @deprecated 1.4 - * @todo make this constant private in 2.0 (see: PHPLIB-360) - */ - public const CURSOR_NOT_FOUND = 43; + private const CURSOR_NOT_FOUND = 43; private const RESUMABLE_ERROR_CODES = [ 6, // HostUnreachable @@ -80,8 +70,6 @@ class ChangeStream implements Iterator /** @var ResumeCallable|null */ private $resumeCallable; - private ChangeStreamIterator $iterator; - private int $key = 0; /** @@ -90,14 +78,8 @@ class ChangeStream implements Iterator */ private bool $hasAdvanced = false; - private ?DocumentCodec $codec; - - /** - * @see https://php.net/iterator.current - * @return array|object|null - */ - #[ReturnTypeWillChange] - public function current() + /** @see https://php.net/iterator.current */ + public function current(): array|object|null { $value = $this->iterator->current(); @@ -110,26 +92,9 @@ public function current() return $this->codec->decode($value); } - /** - * @return CursorId|Int64 - * @psalm-return ($asInt64 is true ? Int64 : CursorId) - */ - #[ReturnTypeWillChange] - public function getCursorId(bool $asInt64 = false) + public function getCursorId(): Int64 { - if (! $asInt64) { - @trigger_error( - sprintf( - 'The method "%s" will no longer return a "%s" instance in the future. Pass "true" as argument to change to the new behavior and receive a "%s" instance instead.', - __METHOD__, - CursorId::class, - Int64::class, - ), - E_USER_DEPRECATED, - ); - } - - return $this->iterator->getInnerIterator()->getId($asInt64); + return $this->iterator->getInnerIterator()->getId(); } /** @@ -138,20 +103,14 @@ public function getCursorId(bool $asInt64 = false) * Null may be returned if no change documents have been iterated and the * server did not include a postBatchResumeToken in its aggregate or getMore * command response. - * - * @return array|object|null */ - public function getResumeToken() + public function getResumeToken(): array|object|null { return $this->iterator->getResumeToken(); } - /** - * @see https://php.net/iterator.key - * @return int|null - */ - #[ReturnTypeWillChange] - public function key() + /** @see https://php.net/iterator.key */ + public function key(): ?int { if ($this->valid()) { return $this->key; @@ -162,11 +121,9 @@ public function key() /** * @see https://php.net/iterator.next - * @return void * @throws ResumeTokenException */ - #[ReturnTypeWillChange] - public function next() + public function next(): void { try { $this->iterator->next(); @@ -178,11 +135,9 @@ public function next() /** * @see https://php.net/iterator.rewind - * @return void * @throws ResumeTokenException */ - #[ReturnTypeWillChange] - public function rewind() + public function rewind(): void { try { $this->iterator->rewind(); @@ -195,12 +150,8 @@ public function rewind() } } - /** - * @see https://php.net/iterator.valid - * @return boolean - */ - #[ReturnTypeWillChange] - public function valid() + /** @see https://php.net/iterator.valid */ + public function valid(): bool { return $this->iterator->valid(); } @@ -210,11 +161,9 @@ public function valid() * * @param ResumeCallable $resumeCallable */ - public function __construct(ChangeStreamIterator $iterator, callable $resumeCallable, ?DocumentCodec $codec = null) + public function __construct(private ChangeStreamIterator $iterator, callable $resumeCallable, private ?DocumentCodec $codec = null) { - $this->iterator = $iterator; $this->resumeCallable = $resumeCallable; - $this->codec = $codec; if ($codec) { $this->iterator->getInnerIterator()->setTypeMap(['root' => 'bson']); @@ -224,7 +173,7 @@ public function __construct(ChangeStreamIterator $iterator, callable $resumeCall /** * Determines if an exception is a resumable error. * - * @see https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.rst#resumable-error + * @see https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.md#resumable-error */ private function isResumableError(RuntimeException $exception): bool { @@ -261,7 +210,8 @@ private function onIteration(bool $incrementKey): void * have been received in the last response. Therefore, we can unset the * resumeCallable. This will free any reference to Watch as well as the * only reference to any implicit session created therein. */ - if ((string) $this->getCursorId(true) === '0') { + // Use a type-unsafe comparison to compare with Int64 instances + if ($this->getCursorId() == 0) { $this->resumeCallable = null; } diff --git a/src/Client.php b/src/Client.php index 60f2f4567..938da2f1a 100644 --- a/src/Client.php +++ b/src/Client.php @@ -19,6 +19,13 @@ use Composer\InstalledVersions; use Iterator; +use MongoDB\BSON\Document; +use MongoDB\BSON\PackedArray; +use MongoDB\Builder\BuilderEncoder; +use MongoDB\Builder\Pipeline; +use MongoDB\Codec\Encoder; +use MongoDB\Driver\BulkWriteCommand; +use MongoDB\Driver\BulkWriteCommandResult; use MongoDB\Driver\ClientEncryption; use MongoDB\Driver\Exception\InvalidArgumentException as DriverInvalidArgumentException; use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; @@ -34,16 +41,20 @@ use MongoDB\Model\BSONArray; use MongoDB\Model\BSONDocument; use MongoDB\Model\DatabaseInfo; +use MongoDB\Operation\ClientBulkWriteCommand; use MongoDB\Operation\DropDatabase; use MongoDB\Operation\ListDatabaseNames; use MongoDB\Operation\ListDatabases; use MongoDB\Operation\Watch; +use stdClass; +use Stringable; use Throwable; +use function array_diff_key; use function is_array; use function is_string; -class Client +class Client implements Stringable { public const DEFAULT_URI = 'mongodb://127.0.0.1/'; @@ -67,8 +78,13 @@ class Client private array $typeMap; + /** @psalm-var Encoder */ + private readonly Encoder $builderEncoder; + private WriteConcern $writeConcern; + private bool $autoEncryptionEnabled; + /** * Constructs a new Client instance. * @@ -78,6 +94,9 @@ class Client * * Supported driver-specific options: * + * * builderEncoder (MongoDB\Codec\Encoder): Encoder for query and + * aggregation builders. If not given, the default encoder will be used. + * * * typeMap (array): Default type map for cursors and BSON documents. * * Other options are documented in MongoDB\Driver\Manager::__construct(). @@ -100,20 +119,26 @@ public function __construct(?string $uri = null, array $uriOptions = [], array $ throw InvalidArgumentException::invalidType('"typeMap" driver option', $driverOptions['typeMap'], 'array'); } - if (isset($driverOptions['autoEncryption']['keyVaultClient'])) { - if ($driverOptions['autoEncryption']['keyVaultClient'] instanceof self) { - $driverOptions['autoEncryption']['keyVaultClient'] = $driverOptions['autoEncryption']['keyVaultClient']->manager; - } elseif (! $driverOptions['autoEncryption']['keyVaultClient'] instanceof Manager) { - throw InvalidArgumentException::invalidType('"keyVaultClient" autoEncryption option', $driverOptions['autoEncryption']['keyVaultClient'], [self::class, Manager::class]); - } + if (isset($driverOptions['autoEncryption']) && is_array($driverOptions['autoEncryption'])) { + $driverOptions['autoEncryption'] = $this->prepareEncryptionOptions($driverOptions['autoEncryption']); + } + + if (isset($driverOptions['builderEncoder']) && ! $driverOptions['builderEncoder'] instanceof Encoder) { + throw InvalidArgumentException::invalidType('"builderEncoder" option', $driverOptions['builderEncoder'], Encoder::class); } $driverOptions['driver'] = $this->mergeDriverInfo($driverOptions['driver'] ?? []); $this->uri = $uri ?? self::DEFAULT_URI; + $this->builderEncoder = $driverOptions['builderEncoder'] ?? new BuilderEncoder(); $this->typeMap = $driverOptions['typeMap']; - unset($driverOptions['typeMap']); + /* Database and Collection objects may need to know whether auto + * encryption is enabled for dropping collections. Track this via an + * internal option until PHPC-2615 is implemented. */ + $this->autoEncryptionEnabled = isset($driverOptions['autoEncryption']['keyVaultNamespace']); + + $driverOptions = array_diff_key($driverOptions, ['builderEncoder' => 1, 'typeMap' => 1]); $this->manager = new Manager($uri, $uriOptions, $driverOptions); $this->readConcern = $this->manager->getReadConcern(); @@ -125,14 +150,14 @@ public function __construct(?string $uri = null, array $uriOptions = [], array $ * Return internal properties for debugging purposes. * * @see https://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.debuginfo - * @return array */ - public function __debugInfo() + public function __debugInfo(): array { return [ 'manager' => $this->manager, 'uri' => $this->uri, 'typeMap' => $this->typeMap, + 'builderEncoder' => $this->builderEncoder, 'writeConcern' => $this->writeConcern, ]; } @@ -147,19 +172,16 @@ public function __debugInfo() * @see https://php.net/oop5.overloading#object.get * @see https://php.net/types.string#language.types.string.parsing.complex * @param string $databaseName Name of the database to select - * @return Database */ - public function __get(string $databaseName) + public function __get(string $databaseName): Database { - return $this->selectDatabase($databaseName); + return $this->getDatabase($databaseName); } /** * Return the connection string (i.e. URI). - * - * @return string */ - public function __toString() + public function __toString(): string { return $this->uri; } @@ -174,22 +196,40 @@ final public function addSubscriber(Subscriber $subscriber): void $this->manager->addSubscriber($subscriber); } + /** + * Executes multiple write operations across multiple namespaces. + * + * @param BulkWriteCommand|ClientBulkWrite $bulk Assembled bulk write command or builder + * @param array $options Additional options + * @throws UnsupportedException if options are unsupported on the selected server + * @throws InvalidArgumentException for parameter/option parsing errors + * @throws DriverRuntimeException for other driver errors (e.g. connection errors) + * @see ClientBulkWriteCommand::__construct() for supported options + */ + public function bulkWrite(BulkWriteCommand|ClientBulkWrite $bulk, array $options = []): BulkWriteCommandResult + { + if (! isset($options['writeConcern']) && ! is_in_transaction($options)) { + $options['writeConcern'] = $this->writeConcern; + } + + if ($bulk instanceof ClientBulkWrite) { + $bulk = $bulk->bulkWriteCommand; + } + + $operation = new ClientBulkWriteCommand($bulk, $options); + $server = select_server_for_write($this->manager, $options); + + return $operation->execute($server); + } + /** * Returns a ClientEncryption instance for explicit encryption and decryption * * @param array $options Encryption options - * - * @return ClientEncryption */ - public function createClientEncryption(array $options) + public function createClientEncryption(array $options): ClientEncryption { - if (isset($options['keyVaultClient'])) { - if ($options['keyVaultClient'] instanceof self) { - $options['keyVaultClient'] = $options['keyVaultClient']->manager; - } elseif (! $options['keyVaultClient'] instanceof Manager) { - throw InvalidArgumentException::invalidType('"keyVaultClient" option', $options['keyVaultClient'], [self::class, Manager::class]); - } - } + $options = $this->prepareEncryptionOptions($options); return $this->manager->createClientEncryption($options); } @@ -200,17 +240,12 @@ public function createClientEncryption(array $options) * @see DropDatabase::__construct() for supported options * @param string $databaseName Database name * @param array $options Additional options - * @return array|object Command result document * @throws UnsupportedException if options are unsupported on the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function dropDatabase(string $databaseName, array $options = []) + public function dropDatabase(string $databaseName, array $options = []): void { - if (! isset($options['typeMap'])) { - $options['typeMap'] = $this->typeMap; - } - $server = select_server_for_write($this->manager, $options); if (! isset($options['writeConcern']) && ! is_in_transaction($options)) { @@ -219,15 +254,44 @@ public function dropDatabase(string $databaseName, array $options = []) $operation = new DropDatabase($databaseName, $options); - return $operation->execute($server); + $operation->execute($server); } /** - * Return the Manager. + * Returns a collection instance. + * + * If the collection does not exist in the database, it is not created when + * invoking this method. + * + * @see Collection::__construct() for supported options + * @throws InvalidArgumentException for parameter/option parsing errors + */ + public function getCollection(string $databaseName, string $collectionName, array $options = []): Collection + { + $options += ['typeMap' => $this->typeMap, 'builderEncoder' => $this->builderEncoder, 'autoEncryptionEnabled' => $this->autoEncryptionEnabled]; + + return new Collection($this->manager, $databaseName, $collectionName, $options); + } + + /** + * Returns a database instance. * - * @return Manager + * If the database does not exist on the server, it is not created when + * invoking this method. + * + * @see Database::__construct() for supported options */ - public function getManager() + public function getDatabase(string $databaseName, array $options = []): Database + { + $options += ['typeMap' => $this->typeMap, 'builderEncoder' => $this->builderEncoder, 'autoEncryptionEnabled' => $this->autoEncryptionEnabled]; + + return new Database($this->manager, $databaseName, $options); + } + + /** + * Return the Manager. + */ + public function getManager(): Manager { return $this->manager; } @@ -236,29 +300,24 @@ public function getManager() * Return the read concern for this client. * * @see https://php.net/manual/en/mongodb-driver-readconcern.isdefault.php - * @return ReadConcern */ - public function getReadConcern() + public function getReadConcern(): ReadConcern { return $this->readConcern; } /** * Return the read preference for this client. - * - * @return ReadPreference */ - public function getReadPreference() + public function getReadPreference(): ReadPreference { return $this->readPreference; } /** * Return the type map for this client. - * - * @return array */ - public function getTypeMap() + public function getTypeMap(): array { return $this->typeMap; } @@ -267,9 +326,8 @@ public function getTypeMap() * Return the write concern for this client. * * @see https://php.net/manual/en/mongodb-driver-writeconcern.isdefault.php - * @return WriteConcern */ - public function getWriteConcern() + public function getWriteConcern(): WriteConcern { return $this->writeConcern; } @@ -278,6 +336,7 @@ public function getWriteConcern() * List database names. * * @see ListDatabaseNames::__construct() for supported options + * @return Iterator * @throws UnexpectedValueException if the command response was malformed * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) @@ -299,7 +358,7 @@ public function listDatabaseNames(array $options = []): Iterator * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function listDatabases(array $options = []) + public function listDatabases(array $options = []): Iterator { $operation = new ListDatabases($options); $server = select_server($this->manager, $options); @@ -324,14 +383,11 @@ final public function removeSubscriber(Subscriber $subscriber): void * @param string $databaseName Name of the database containing the collection * @param string $collectionName Name of the collection to select * @param array $options Collection constructor options - * @return Collection * @throws InvalidArgumentException for parameter/option parsing errors */ - public function selectCollection(string $databaseName, string $collectionName, array $options = []) + public function selectCollection(string $databaseName, string $collectionName, array $options = []): Collection { - $options += ['typeMap' => $this->typeMap]; - - return new Collection($this->manager, $databaseName, $collectionName, $options); + return $this->getCollection($databaseName, $collectionName, $options); } /** @@ -340,14 +396,11 @@ public function selectCollection(string $databaseName, string $collectionName, a * @see Database::__construct() for supported options * @param string $databaseName Name of the database to select * @param array $options Database constructor options - * @return Database * @throws InvalidArgumentException for parameter/option parsing errors */ - public function selectDatabase(string $databaseName, array $options = []) + public function selectDatabase(string $databaseName, array $options = []): Database { - $options += ['typeMap' => $this->typeMap]; - - return new Database($this->manager, $databaseName, $options); + return $this->getDatabase($databaseName, $options); } /** @@ -355,9 +408,8 @@ public function selectDatabase(string $databaseName, array $options = []) * * @see https://php.net/manual/en/mongodb-driver-manager.startsession.php * @param array $options Session options - * @return Session */ - public function startSession(array $options = []) + public function startSession(array $options = []): Session { return $this->manager->startSession($options); } @@ -368,11 +420,16 @@ public function startSession(array $options = []) * @see Watch::__construct() for supported options * @param array $pipeline Aggregation pipeline * @param array $options Command options - * @return ChangeStream * @throws InvalidArgumentException for parameter/option parsing errors */ - public function watch(array $pipeline = [], array $options = []) + public function watch(array $pipeline = [], array $options = []): ChangeStream { + if (is_builder_pipeline($pipeline)) { + $pipeline = new Pipeline(...$pipeline); + } + + $pipeline = $this->builderEncoder->encodeIfSupported($pipeline); + if (! isset($options['readPreference']) && ! is_in_transaction($options)) { $options['readPreference'] = $this->readPreference; } @@ -397,7 +454,7 @@ private static function getVersion(): string if (self::$version === null) { try { self::$version = InstalledVersions::getPrettyVersion('mongodb/mongodb') ?? 'unknown'; - } catch (Throwable $t) { + } catch (Throwable) { self::$version = 'error'; } } @@ -434,4 +491,26 @@ private function mergeDriverInfo(array $driver): array return $mergedDriver; } + + private function prepareEncryptionOptions(array $options): array + { + if (isset($options['keyVaultClient'])) { + if ($options['keyVaultClient'] instanceof self) { + $options['keyVaultClient'] = $options['keyVaultClient']->manager; + } elseif (! $options['keyVaultClient'] instanceof Manager) { + throw InvalidArgumentException::invalidType('"keyVaultClient" option', $options['keyVaultClient'], [self::class, Manager::class]); + } + } + + // The server requires an empty document for automatic credentials. + if (isset($options['kmsProviders']) && is_array($options['kmsProviders'])) { + foreach ($options['kmsProviders'] as $name => $provider) { + if ($provider === []) { + $options['kmsProviders'][$name] = new stdClass(); + } + } + } + + return $options; + } } diff --git a/src/ClientBulkWrite.php b/src/ClientBulkWrite.php new file mode 100644 index 000000000..f11452d3a --- /dev/null +++ b/src/ClientBulkWrite.php @@ -0,0 +1,249 @@ + */ + private readonly Encoder $builderEncoder, + private readonly ?DocumentCodec $codec, + ) { + } + + #[NoDiscard] + public static function createWithCollection(Collection $collection, array $options = []): self + { + $options += ['ordered' => true]; + + if (isset($options['bypassDocumentValidation']) && ! is_bool($options['bypassDocumentValidation'])) { + throw InvalidArgumentException::invalidType('"bypassDocumentValidation" option', $options['bypassDocumentValidation'], 'boolean'); + } + + if (isset($options['let']) && ! is_document($options['let'])) { + throw InvalidArgumentException::expectedDocumentType('"let" option', $options['let']); + } + + if (! is_bool($options['ordered'])) { + throw InvalidArgumentException::invalidType('"ordered" option', $options['ordered'], 'boolean'); + } + + if (isset($options['verboseResults']) && ! is_bool($options['verboseResults'])) { + throw InvalidArgumentException::invalidType('"verboseResults" option', $options['verboseResults'], 'boolean'); + } + + return new self( + new BulkWriteCommand($options), + $collection->getManager(), + $collection->getNamespace(), + $collection->getBuilderEncoder(), + $collection->getCodec(), + ); + } + + public function deleteMany(array|object $filter, array $options = []): self + { + $filter = $this->builderEncoder->encodeIfSupported($filter); + + if (isset($options['collation']) && ! is_document($options['collation'])) { + throw InvalidArgumentException::expectedDocumentType('"collation" option', $options['collation']); + } + + if (isset($options['hint']) && ! is_string($options['hint']) && ! is_document($options['hint'])) { + throw InvalidArgumentException::expectedDocumentOrStringType('"hint" option', $options['hint']); + } + + $this->bulkWriteCommand->deleteMany($this->namespace, $filter, $options); + + return $this; + } + + public function deleteOne(array|object $filter, array $options = []): self + { + $filter = $this->builderEncoder->encodeIfSupported($filter); + + if (isset($options['collation']) && ! is_document($options['collation'])) { + throw InvalidArgumentException::expectedDocumentType('"collation" option', $options['collation']); + } + + if (isset($options['hint']) && ! is_string($options['hint']) && ! is_document($options['hint'])) { + throw InvalidArgumentException::expectedDocumentOrStringType('"hint" option', $options['hint']); + } + + $this->bulkWriteCommand->deleteOne($this->namespace, $filter, $options); + + return $this; + } + + public function insertOne(array|object $document, mixed &$id = null): self + { + if ($this->codec) { + $document = $this->codec->encode($document); + } + + // Capture the document's _id, which may have been generated, in an optional output variable + /** @var mixed $id */ + $id = $this->bulkWriteCommand->insertOne($this->namespace, $document); + + return $this; + } + + public function replaceOne(array|object $filter, array|object $replacement, array $options = []): self + { + $filter = $this->builderEncoder->encodeIfSupported($filter); + + if ($this->codec) { + $replacement = $this->codec->encode($replacement); + } + + // Treat empty arrays as replacement documents for BC + if ($replacement === []) { + $replacement = (object) $replacement; + } + + if (is_first_key_operator($replacement)) { + throw new InvalidArgumentException('First key in $replacement is an update operator'); + } + + if (is_pipeline($replacement, true)) { + throw new InvalidArgumentException('$replacement is an update pipeline'); + } + + if (isset($options['collation']) && ! is_document($options['collation'])) { + throw InvalidArgumentException::expectedDocumentType('"collation" option', $options['collation']); + } + + if (isset($options['hint']) && ! is_string($options['hint']) && ! is_document($options['hint'])) { + throw InvalidArgumentException::expectedDocumentOrStringType('"hint" option', $options['hint']); + } + + if (isset($options['sort']) && ! is_document($options['sort'])) { + throw InvalidArgumentException::expectedDocumentType('"sort" option', $options['sort']); + } + + if (isset($options['upsert']) && ! is_bool($options['upsert'])) { + throw InvalidArgumentException::invalidType('"upsert" option', $options['upsert'], 'boolean'); + } + + $this->bulkWriteCommand->replaceOne($this->namespace, $filter, $replacement, $options); + + return $this; + } + + public function updateMany(array|object $filter, array|object $update, array $options = []): self + { + $filter = $this->builderEncoder->encodeIfSupported($filter); + $update = $this->builderEncoder->encodeIfSupported($update); + + if (! is_first_key_operator($update) && ! is_pipeline($update)) { + throw new InvalidArgumentException('Expected update operator(s) or non-empty pipeline for $update'); + } + + if (isset($options['arrayFilters']) && ! is_array($options['arrayFilters'])) { + throw InvalidArgumentException::invalidType('"arrayFilters" option', $options['arrayFilters'], 'array'); + } + + if (isset($options['collation']) && ! is_document($options['collation'])) { + throw InvalidArgumentException::expectedDocumentType('"collation" option', $options['collation']); + } + + if (isset($options['hint']) && ! is_string($options['hint']) && ! is_document($options['hint'])) { + throw InvalidArgumentException::expectedDocumentOrStringType('"hint" option', $options['hint']); + } + + if (isset($options['upsert']) && ! is_bool($options['upsert'])) { + throw InvalidArgumentException::invalidType('"upsert" option', $options['upsert'], 'boolean'); + } + + $this->bulkWriteCommand->updateMany($this->namespace, $filter, $update, $options); + + return $this; + } + + public function updateOne(array|object $filter, array|object $update, array $options = []): self + { + $filter = $this->builderEncoder->encodeIfSupported($filter); + $update = $this->builderEncoder->encodeIfSupported($update); + + if (! is_first_key_operator($update) && ! is_pipeline($update)) { + throw new InvalidArgumentException('Expected update operator(s) or non-empty pipeline for $update'); + } + + if (isset($options['arrayFilters']) && ! is_array($options['arrayFilters'])) { + throw InvalidArgumentException::invalidType('"arrayFilters" option', $options['arrayFilters'], 'array'); + } + + if (isset($options['collation']) && ! is_document($options['collation'])) { + throw InvalidArgumentException::expectedDocumentType('"collation" option', $options['collation']); + } + + if (isset($options['hint']) && ! is_string($options['hint']) && ! is_document($options['hint'])) { + throw InvalidArgumentException::expectedDocumentOrStringType('"hint" option', $options['hint']); + } + + if (isset($options['sort']) && ! is_document($options['sort'])) { + throw InvalidArgumentException::expectedDocumentType('"sort" option', $options['sort']); + } + + if (isset($options['upsert']) && ! is_bool($options['upsert'])) { + throw InvalidArgumentException::invalidType('"upsert" option', $options['upsert'], 'boolean'); + } + + $this->bulkWriteCommand->updateOne($this->namespace, $filter, $update, $options); + + return $this; + } + + #[NoDiscard] + public function withCollection(Collection $collection): self + { + /* Prohibit mixing Collections associated with different Manager + * objects. This is not technically necessary, since the Collection is + * only used to derive a namespace and encoding options; however, it + * may prevent a user from inadvertently mixing writes destined for + * different deployments. */ + if ($this->manager !== $collection->getManager()) { + throw new InvalidArgumentException('$collection is associated with a different MongoDB\Driver\Manager'); + } + + return new self( + $this->bulkWriteCommand, + $this->manager, + $collection->getNamespace(), + $collection->getBuilderEncoder(), + $collection->getCodec(), + ); + } +} diff --git a/src/Codec/DecodeIfSupported.php b/src/Codec/DecodeIfSupported.php index 56dcfb9ec..ea8dde15c 100644 --- a/src/Codec/DecodeIfSupported.php +++ b/src/Codec/DecodeIfSupported.php @@ -25,27 +25,18 @@ */ trait DecodeIfSupported { - /** - * @param mixed $value - * @psalm-assert-if-true BSONType $value - */ - abstract public function canDecode($value): bool; + /** @psalm-assert-if-true BSONType $value */ + abstract public function canDecode(mixed $value): bool; /** - * @param mixed $value * @psalm-param BSONType $value - * @return mixed * @psalm-return NativeType * @throws UnsupportedValueException if the decoder does not support the value */ - abstract public function decode($value); + abstract public function decode(mixed $value): mixed; - /** - * @param mixed $value - * @return mixed - * @psalm-return ($value is BSONType ? NativeType : $value) - */ - public function decodeIfSupported($value) + /** @psalm-return ($value is BSONType ? NativeType : $value) */ + public function decodeIfSupported(mixed $value): mixed { return $this->canDecode($value) ? $this->decode($value) : $value; } diff --git a/src/Codec/Decoder.php b/src/Codec/Decoder.php index 904e097fe..37ff9b263 100644 --- a/src/Codec/Decoder.php +++ b/src/Codec/Decoder.php @@ -28,22 +28,19 @@ interface Decoder /** * Checks if the decoder supports a given value. * - * @param mixed $value * @psalm-assert-if-true BSONType $value */ - public function canDecode($value): bool; + public function canDecode(mixed $value): bool; /** * Decodes a given value. If the decoder does not support the value, it * should throw an exception. * - * @param mixed $value * @psalm-param BSONType $value - * @return mixed * @psalm-return NativeType * @throws UnsupportedValueException if the decoder does not support the value */ - public function decode($value); + public function decode(mixed $value): mixed; /** * Decodes a given value if supported, otherwise returns the value as-is. @@ -51,9 +48,7 @@ public function decode($value); * The DecodeIfSupported trait provides a default implementation of this * method. * - * @param mixed $value - * @return mixed * @psalm-return ($value is BSONType ? NativeType : $value) */ - public function decodeIfSupported($value); + public function decodeIfSupported(mixed $value): mixed; } diff --git a/src/Codec/DocumentCodec.php b/src/Codec/DocumentCodec.php index ba4488b08..6fabdb936 100644 --- a/src/Codec/DocumentCodec.php +++ b/src/Codec/DocumentCodec.php @@ -30,17 +30,15 @@ interface DocumentCodec extends Codec { /** - * @param mixed $value * @psalm-param Document $value * @psalm-return ObjectType * @throws UnsupportedValueException if the decoder does not support the value */ - public function decode($value): object; + public function decode(mixed $value): object; /** - * @param mixed $value * @psalm-param ObjectType $value * @throws UnsupportedValueException if the encoder does not support the value */ - public function encode($value): Document; + public function encode(mixed $value): Document; } diff --git a/src/Codec/EncodeIfSupported.php b/src/Codec/EncodeIfSupported.php index c4aebac6b..2ce1fcf53 100644 --- a/src/Codec/EncodeIfSupported.php +++ b/src/Codec/EncodeIfSupported.php @@ -25,27 +25,18 @@ */ trait EncodeIfSupported { - /** - * @param mixed $value - * @psalm-assert-if-true NativeType $value - */ - abstract public function canEncode($value): bool; + /** @psalm-assert-if-true NativeType $value */ + abstract public function canEncode(mixed $value): bool; /** - * @param mixed $value * @psalm-param NativeType $value - * @return mixed * @psalm-return BSONType * @throws UnsupportedValueException if the encoder does not support the value */ - abstract public function encode($value); + abstract public function encode(mixed $value): mixed; - /** - * @param mixed $value - * @return mixed - * @psalm-return ($value is NativeType ? BSONType : $value) - */ - public function encodeIfSupported($value) + /** @psalm-return ($value is NativeType ? BSONType : $value) */ + public function encodeIfSupported(mixed $value): mixed { return $this->canEncode($value) ? $this->encode($value) : $value; } diff --git a/src/Codec/Encoder.php b/src/Codec/Encoder.php index dba58d9d5..c8ee0917b 100644 --- a/src/Codec/Encoder.php +++ b/src/Codec/Encoder.php @@ -28,22 +28,19 @@ interface Encoder /** * Checks if the encoder supports a given value. * - * @param mixed $value * @psalm-assert-if-true NativeType $value */ - public function canEncode($value): bool; + public function canEncode(mixed $value): bool; /** * Encodes a given value. If the encoder does not support the value, it * should throw an exception. * - * @param mixed $value * @psalm-param NativeType $value - * @return mixed * @psalm-return BSONType * @throws UnsupportedValueException if the encoder does not support the value */ - public function encode($value); + public function encode(mixed $value): mixed; /** * Encodes a given value if supported, otherwise returns the value as-is. @@ -51,9 +48,7 @@ public function encode($value); * The EncodeIfSupported trait provides a default implementation of this * method. * - * @param mixed $value - * @return mixed * @psalm-return ($value is NativeType ? BSONType : $value) */ - public function encodeIfSupported($value); + public function encodeIfSupported(mixed $value): mixed; } diff --git a/src/Collection.php b/src/Collection.php index 81a0c7969..8cc513e9a 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -19,8 +19,12 @@ use Countable; use Iterator; -use MongoDB\BSON\JavascriptInterface; +use MongoDB\BSON\Document; +use MongoDB\BSON\PackedArray; +use MongoDB\Builder\BuilderEncoder; +use MongoDB\Builder\Pipeline; use MongoDB\Codec\DocumentCodec; +use MongoDB\Codec\Encoder; use MongoDB\Driver\CursorInterface; use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; use MongoDB\Driver\Manager; @@ -58,22 +62,24 @@ use MongoDB\Operation\InsertOne; use MongoDB\Operation\ListIndexes; use MongoDB\Operation\ListSearchIndexes; -use MongoDB\Operation\MapReduce; use MongoDB\Operation\RenameCollection; use MongoDB\Operation\ReplaceOne; use MongoDB\Operation\UpdateMany; use MongoDB\Operation\UpdateOne; use MongoDB\Operation\UpdateSearchIndex; use MongoDB\Operation\Watch; +use stdClass; +use Stringable; use function array_diff_key; use function array_intersect_key; use function array_key_exists; use function current; use function is_array; +use function is_bool; use function strlen; -class Collection +class Collection implements Stringable { private const DEFAULT_TYPE_MAP = [ 'array' => BSONArray::class, @@ -83,13 +89,10 @@ class Collection private const WIRE_VERSION_FOR_READ_CONCERN_WITH_WRITE_STAGE = 8; - private ?DocumentCodec $codec = null; - - private string $collectionName; + /** @psalm-var Encoder */ + private readonly Encoder $builderEncoder; - private string $databaseName; - - private Manager $manager; + private ?DocumentCodec $codec = null; private ReadConcern $readConcern; @@ -99,6 +102,8 @@ class Collection private WriteConcern $writeConcern; + private bool $autoEncryptionEnabled; + /** * Constructs new Collection instance. * @@ -107,6 +112,9 @@ class Collection * * Supported options: * + * * builderEncoder (MongoDB\Codec\Encoder): Encoder for query and + * aggregation builders. If not given, the default encoder will be used. + * * * codec (MongoDB\Codec\DocumentCodec): Codec used to decode documents * from BSON to PHP objects. * @@ -129,7 +137,7 @@ class Collection * @param array $options Collection options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(Manager $manager, string $databaseName, string $collectionName, array $options = []) + public function __construct(private Manager $manager, private string $databaseName, private string $collectionName, array $options = []) { if (strlen($databaseName) < 1) { throw new InvalidArgumentException('$databaseName is invalid: ' . $databaseName); @@ -139,6 +147,10 @@ public function __construct(Manager $manager, string $databaseName, string $coll throw new InvalidArgumentException('$collectionName is invalid: ' . $collectionName); } + if (isset($options['builderEncoder']) && ! $options['builderEncoder'] instanceof Encoder) { + throw InvalidArgumentException::invalidType('"builderEncoder" option', $options['builderEncoder'], Encoder::class); + } + if (isset($options['codec']) && ! $options['codec'] instanceof DocumentCodec) { throw InvalidArgumentException::invalidType('"codec" option', $options['codec'], DocumentCodec::class); } @@ -159,26 +171,28 @@ public function __construct(Manager $manager, string $databaseName, string $coll throw InvalidArgumentException::invalidType('"writeConcern" option', $options['writeConcern'], WriteConcern::class); } - $this->manager = $manager; - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; + if (isset($options['autoEncryptionEnabled']) && ! is_bool($options['autoEncryptionEnabled'])) { + throw InvalidArgumentException::invalidType('"autoEncryptionEnabled" option', $options['autoEncryptionEnabled'], 'boolean'); + } + $this->builderEncoder = $options['builderEncoder'] ?? new BuilderEncoder(); $this->codec = $options['codec'] ?? null; $this->readConcern = $options['readConcern'] ?? $this->manager->getReadConcern(); $this->readPreference = $options['readPreference'] ?? $this->manager->getReadPreference(); $this->typeMap = $options['typeMap'] ?? self::DEFAULT_TYPE_MAP; $this->writeConcern = $options['writeConcern'] ?? $this->manager->getWriteConcern(); + $this->autoEncryptionEnabled = $options['autoEncryptionEnabled'] ?? false; } /** * Return internal properties for debugging purposes. * * @see https://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.debuginfo - * @return array */ - public function __debugInfo() + public function __debugInfo(): array { return [ + 'builderEncoder' => $this->builderEncoder, 'codec' => $this->codec, 'collectionName' => $this->collectionName, 'databaseName' => $this->databaseName, @@ -194,9 +208,8 @@ public function __debugInfo() * Return the collection namespace (e.g. "db.collection"). * * @see https://mongodb.com/docs/manual/core/databases-and-collections/ - * @return string */ - public function __toString() + public function __toString(): string { return $this->databaseName . '.' . $this->collectionName; } @@ -205,16 +218,21 @@ public function __toString() * Executes an aggregation framework pipeline on the collection. * * @see Aggregate::__construct() for supported options - * @param array $pipeline Aggregation pipeline - * @param array $options Command options - * @return CursorInterface&Iterator + * @param array|Pipeline $pipeline Aggregation pipeline + * @param array $options Command options * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function aggregate(array $pipeline, array $options = []) + public function aggregate(array|Pipeline $pipeline, array $options = []): CursorInterface { + if (is_array($pipeline) && is_builder_pipeline($pipeline)) { + $pipeline = new Pipeline(...$pipeline); + } + + $pipeline = $this->builderEncoder->encodeIfSupported($pipeline); + $hasWriteStage = is_last_pipeline_operator_write($pipeline); $options = $this->inheritReadPreference($options); @@ -247,13 +265,13 @@ public function aggregate(array $pipeline, array $options = []) * @see BulkWrite::__construct() for supported options * @param array[] $operations List of write operations * @param array $options Command options - * @return BulkWriteResult * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function bulkWrite(array $operations, array $options = []) + public function bulkWrite(array $operations, array $options = []): BulkWriteResult { + $options = $this->inheritBuilderEncoder($options); $options = $this->inheritWriteOptions($options); $options = $this->inheritCodec($options); @@ -268,7 +286,6 @@ public function bulkWrite(array $operations, array $options = []) * @see Count::__construct() for supported options * @param array|object $filter Query by which to filter documents * @param array $options Command options - * @return integer * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors @@ -276,8 +293,9 @@ public function bulkWrite(array $operations, array $options = []) * * @deprecated 1.4 */ - public function count($filter = [], array $options = []) + public function count(array|object $filter = [], array $options = []): int { + $filter = $this->builderEncoder->encodeIfSupported($filter); $options = $this->inheritReadOptions($options); $operation = new Count($this->databaseName, $this->collectionName, $filter, $options); @@ -291,14 +309,14 @@ public function count($filter = [], array $options = []) * @see CountDocuments::__construct() for supported options * @param array|object $filter Query by which to filter documents * @param array $options Command options - * @return integer * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function countDocuments($filter = [], array $options = []) + public function countDocuments(array|object $filter = [], array $options = []): int { + $filter = $this->builderEncoder->encodeIfSupported($filter); $options = $this->inheritReadOptions($options); $operation = new CountDocuments($this->databaseName, $this->collectionName, $filter, $options); @@ -319,7 +337,7 @@ public function countDocuments($filter = [], array $options = []) * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function createIndex($key, array $options = []) + public function createIndex(array|object $key, array $options = []): string { $operationOptionKeys = ['comment' => 1, 'commitQuorum' => 1, 'maxTimeMS' => 1, 'session' => 1, 'writeConcern' => 1]; $indexOptions = array_diff_key($options, $operationOptionKeys); @@ -355,7 +373,7 @@ public function createIndex($key, array $options = []) * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function createIndexes(array $indexes, array $options = []) + public function createIndexes(array $indexes, array $options = []): array { $options = $this->inheritWriteOptions($options); @@ -377,7 +395,7 @@ public function createIndexes(array $indexes, array $options = []) * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function createSearchIndex($definition, array $options = []): string + public function createSearchIndex(array|object $definition, array $options = []): string { $indexOptionKeys = ['name' => 1, 'type' => 1]; /** @psalm-var array{name?: string, type?: string} */ @@ -429,13 +447,13 @@ public function createSearchIndexes(array $indexes, array $options = []): array * @see https://mongodb.com/docs/manual/reference/command/delete/ * @param array|object $filter Query by which to delete documents * @param array $options Command options - * @return DeleteResult * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function deleteMany($filter, array $options = []) + public function deleteMany(array|object $filter, array $options = []): DeleteResult { + $filter = $this->builderEncoder->encodeIfSupported($filter); $options = $this->inheritWriteOptions($options); $operation = new DeleteMany($this->databaseName, $this->collectionName, $filter, $options); @@ -450,13 +468,13 @@ public function deleteMany($filter, array $options = []) * @see https://mongodb.com/docs/manual/reference/command/delete/ * @param array|object $filter Query by which to delete documents * @param array $options Command options - * @return DeleteResult * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function deleteOne($filter, array $options = []) + public function deleteOne(array|object $filter, array $options = []): DeleteResult { + $filter = $this->builderEncoder->encodeIfSupported($filter); $options = $this->inheritWriteOptions($options); $operation = new DeleteOne($this->databaseName, $this->collectionName, $filter, $options); @@ -471,14 +489,14 @@ public function deleteOne($filter, array $options = []) * @param string $fieldName Field for which to return distinct values * @param array|object $filter Query by which to filter documents * @param array $options Command options - * @return array * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function distinct(string $fieldName, $filter = [], array $options = []) + public function distinct(string $fieldName, array|object $filter = [], array $options = []): array { + $filter = $this->builderEncoder->encodeIfSupported($filter); $options = $this->inheritReadOptions($options); $options = $this->inheritTypeMap($options); @@ -492,28 +510,26 @@ public function distinct(string $fieldName, $filter = [], array $options = []) * * @see DropCollection::__construct() for supported options * @param array $options Additional options - * @return array|object Command result document * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function drop(array $options = []) + public function drop(array $options = []): void { $options = $this->inheritWriteOptions($options); - $options = $this->inheritTypeMap($options); $server = select_server_for_write($this->manager, $options); - if (! isset($options['encryptedFields'])) { + if ($this->autoEncryptionEnabled && ! isset($options['encryptedFields'])) { $options['encryptedFields'] = get_encrypted_fields_from_driver($this->databaseName, $this->collectionName, $this->manager) - ?? get_encrypted_fields_from_server($this->databaseName, $this->collectionName, $this->manager, $server); + ?? get_encrypted_fields_from_server($this->databaseName, $this->collectionName, $server); } $operation = isset($options['encryptedFields']) ? new DropEncryptedCollection($this->databaseName, $this->collectionName, $options) : new DropCollection($this->databaseName, $this->collectionName, $options); - return $operation->execute($server); + $operation->execute($server); } /** @@ -522,12 +538,11 @@ public function drop(array $options = []) * @see DropIndexes::__construct() for supported options * @param string|IndexInfo $indexName Index name or model object * @param array $options Additional options - * @return array|object Command result document * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function dropIndex($indexName, array $options = []) + public function dropIndex(string|IndexInfo $indexName, array $options = []): void { $indexName = (string) $indexName; @@ -536,11 +551,10 @@ public function dropIndex($indexName, array $options = []) } $options = $this->inheritWriteOptions($options); - $options = $this->inheritTypeMap($options); $operation = new DropIndexes($this->databaseName, $this->collectionName, $indexName, $options); - return $operation->execute(select_server_for_write($this->manager, $options)); + $operation->execute(select_server_for_write($this->manager, $options)); } /** @@ -548,19 +562,17 @@ public function dropIndex($indexName, array $options = []) * * @see DropIndexes::__construct() for supported options * @param array $options Additional options - * @return array|object Command result document * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function dropIndexes(array $options = []) + public function dropIndexes(array $options = []): void { $options = $this->inheritWriteOptions($options); - $options = $this->inheritTypeMap($options); $operation = new DropIndexes($this->databaseName, $this->collectionName, '*', $options); - return $operation->execute(select_server_for_write($this->manager, $options)); + $operation->execute(select_server_for_write($this->manager, $options)); } /** @@ -586,13 +598,12 @@ public function dropSearchIndex(string $name, array $options = []): void * * @see EstimatedDocumentCount::__construct() for supported options * @param array $options Command options - * @return integer * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function estimatedDocumentCount(array $options = []) + public function estimatedDocumentCount(array $options = []): int { $options = $this->inheritReadOptions($options); @@ -608,12 +619,11 @@ public function estimatedDocumentCount(array $options = []) * @see https://mongodb.com/docs/manual/reference/command/explain/ * @param Explainable $explainable Command on which to run explain * @param array $options Additional options - * @return array|object * @throws UnsupportedException if explainable or options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function explain(Explainable $explainable, array $options = []) + public function explain(Explainable $explainable, array $options = []): array|object { $options = $this->inheritReadPreference($options); $options = $this->inheritTypeMap($options); @@ -630,13 +640,13 @@ public function explain(Explainable $explainable, array $options = []) * @see https://mongodb.com/docs/manual/crud/#read-operations * @param array|object $filter Query by which to filter documents * @param array $options Additional options - * @return CursorInterface&Iterator * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function find($filter = [], array $options = []) + public function find(array|object $filter = [], array $options = []): CursorInterface { + $filter = $this->builderEncoder->encodeIfSupported($filter); $options = $this->inheritReadOptions($options); $options = $this->inheritCodecOrTypeMap($options); @@ -652,13 +662,13 @@ public function find($filter = [], array $options = []) * @see https://mongodb.com/docs/manual/crud/#read-operations * @param array|object $filter Query by which to filter documents * @param array $options Additional options - * @return array|object|null * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function findOne($filter = [], array $options = []) + public function findOne(array|object $filter = [], array $options = []): array|object|null { + $filter = $this->builderEncoder->encodeIfSupported($filter); $options = $this->inheritReadOptions($options); $options = $this->inheritCodecOrTypeMap($options); @@ -676,14 +686,14 @@ public function findOne($filter = [], array $options = []) * @see https://mongodb.com/docs/manual/reference/command/findAndModify/ * @param array|object $filter Query by which to filter documents * @param array $options Command options - * @return array|object|null * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function findOneAndDelete($filter, array $options = []) + public function findOneAndDelete(array|object $filter, array $options = []): array|object|null { + $filter = $this->builderEncoder->encodeIfSupported($filter); $options = $this->inheritWriteOptions($options); $options = $this->inheritCodecOrTypeMap($options); @@ -706,14 +716,14 @@ public function findOneAndDelete($filter, array $options = []) * @param array|object $filter Query by which to filter documents * @param array|object $replacement Replacement document * @param array $options Command options - * @return array|object|null * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function findOneAndReplace($filter, $replacement, array $options = []) + public function findOneAndReplace(array|object $filter, array|object $replacement, array $options = []): array|object|null { + $filter = $this->builderEncoder->encodeIfSupported($filter); $options = $this->inheritWriteOptions($options); $options = $this->inheritCodecOrTypeMap($options); @@ -736,14 +746,15 @@ public function findOneAndReplace($filter, $replacement, array $options = []) * @param array|object $filter Query by which to filter documents * @param array|object $update Update to apply to the matched document * @param array $options Command options - * @return array|object|null * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function findOneAndUpdate($filter, $update, array $options = []) + public function findOneAndUpdate(array|object $filter, array|object $update, array $options = []): array|object|null { + $filter = $this->builderEncoder->encodeIfSupported($filter); + $update = $this->builderEncoder->encodeIfSupported($update); $options = $this->inheritWriteOptions($options); $options = $this->inheritCodecOrTypeMap($options); @@ -752,32 +763,37 @@ public function findOneAndUpdate($filter, $update, array $options = []) return $operation->execute(select_server_for_write($this->manager, $options)); } + /** @psalm-return Encoder */ + public function getBuilderEncoder(): Encoder + { + return $this->builderEncoder; + } + + public function getCodec(): ?DocumentCodec + { + return $this->codec; + } + /** * Return the collection name. - * - * @return string */ - public function getCollectionName() + public function getCollectionName(): string { return $this->collectionName; } /** * Return the database name. - * - * @return string */ - public function getDatabaseName() + public function getDatabaseName(): string { return $this->databaseName; } /** * Return the Manager. - * - * @return Manager */ - public function getManager() + public function getManager(): Manager { return $this->manager; } @@ -786,9 +802,8 @@ public function getManager() * Return the collection namespace. * * @see https://mongodb.com/docs/manual/reference/glossary/#term-namespace - * @return string */ - public function getNamespace() + public function getNamespace(): string { return $this->databaseName . '.' . $this->collectionName; } @@ -797,29 +812,24 @@ public function getNamespace() * Return the read concern for this collection. * * @see https://php.net/manual/en/mongodb-driver-readconcern.isdefault.php - * @return ReadConcern */ - public function getReadConcern() + public function getReadConcern(): ReadConcern { return $this->readConcern; } /** * Return the read preference for this collection. - * - * @return ReadPreference */ - public function getReadPreference() + public function getReadPreference(): ReadPreference { return $this->readPreference; } /** * Return the type map for this collection. - * - * @return array */ - public function getTypeMap() + public function getTypeMap(): array { return $this->typeMap; } @@ -828,9 +838,8 @@ public function getTypeMap() * Return the write concern for this collection. * * @see https://php.net/manual/en/mongodb-driver-writeconcern.isdefault.php - * @return WriteConcern */ - public function getWriteConcern() + public function getWriteConcern(): WriteConcern { return $this->writeConcern; } @@ -842,11 +851,10 @@ public function getWriteConcern() * @see https://mongodb.com/docs/manual/reference/command/insert/ * @param list $documents The documents to insert * @param array $options Command options - * @return InsertManyResult * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function insertMany(array $documents, array $options = []) + public function insertMany(array $documents, array $options = []): InsertManyResult { $options = $this->inheritWriteOptions($options); $options = $this->inheritCodec($options); @@ -863,11 +871,10 @@ public function insertMany(array $documents, array $options = []) * @see https://mongodb.com/docs/manual/reference/command/insert/ * @param array|object $document The document to insert * @param array $options Command options - * @return InsertOneResult * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function insertOne($document, array $options = []) + public function insertOne(array|object $document, array $options = []): InsertOneResult { $options = $this->inheritWriteOptions($options); $options = $this->inheritCodec($options); @@ -885,7 +892,7 @@ public function insertOne($document, array $options = []) * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function listIndexes(array $options = []) + public function listIndexes(array $options = []): Iterator { $operation = new ListIndexes($this->databaseName, $this->collectionName, $options); @@ -896,7 +903,7 @@ public function listIndexes(array $options = []) * Returns information for all Atlas Search indexes for the collection. * Only available when used against a 7.0+ Atlas cluster. * - * @param array{name?: string} $options Command options + * @param array $options Command options * @return Countable&Iterator * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) @@ -904,53 +911,14 @@ public function listIndexes(array $options = []) */ public function listSearchIndexes(array $options = []): Iterator { + $options = $this->inheritTypeMap($options); + $operation = new ListSearchIndexes($this->databaseName, $this->collectionName, $options); $server = select_server($this->manager, $options); return $operation->execute($server); } - /** - * Executes a map-reduce aggregation on the collection. - * - * @see MapReduce::__construct() for supported options - * @see https://mongodb.com/docs/manual/reference/command/mapReduce/ - * @param JavascriptInterface $map Map function - * @param JavascriptInterface $reduce Reduce function - * @param string|array|object $out Output specification - * @param array $options Command options - * @return MapReduceResult - * @throws UnsupportedException if options are not supported by the selected server - * @throws InvalidArgumentException for parameter/option parsing errors - * @throws DriverRuntimeException for other driver errors (e.g. connection errors) - * @throws UnexpectedValueException if the command response was malformed - */ - public function mapReduce(JavascriptInterface $map, JavascriptInterface $reduce, $out, array $options = []) - { - $hasOutputCollection = ! is_mapreduce_output_inline($out); - - // Check if the out option is inline because we will want to coerce a primary read preference if not - if ($hasOutputCollection) { - $options['readPreference'] = new ReadPreference(ReadPreference::PRIMARY); - } else { - $options = $this->inheritReadPreference($options); - } - - /* A "majority" read concern is not compatible with inline output, so - * avoid providing the Collection's read concern if it would conflict. - */ - if (! $hasOutputCollection || $this->readConcern->getLevel() !== ReadConcern::MAJORITY) { - $options = $this->inheritReadConcern($options); - } - - $options = $this->inheritWriteOptions($options); - $options = $this->inheritTypeMap($options); - - $operation = new MapReduce($this->databaseName, $this->collectionName, $map, $reduce, $out, $options); - - return $operation->execute(select_server_for_write($this->manager, $options)); - } - /** * Renames the collection. * @@ -958,23 +926,21 @@ public function mapReduce(JavascriptInterface $map, JavascriptInterface $reduce, * @param string $toCollectionName New name of the collection * @param string|null $toDatabaseName New database name of the collection. Defaults to the original database. * @param array $options Additional options - * @return array|object Command result document * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function rename(string $toCollectionName, ?string $toDatabaseName = null, array $options = []) + public function rename(string $toCollectionName, ?string $toDatabaseName = null, array $options = []): void { if (! isset($toDatabaseName)) { $toDatabaseName = $this->databaseName; } $options = $this->inheritWriteOptions($options); - $options = $this->inheritTypeMap($options); $operation = new RenameCollection($this->databaseName, $this->collectionName, $toDatabaseName, $toCollectionName, $options); - return $operation->execute(select_server_for_write($this->manager, $options)); + $operation->execute(select_server_for_write($this->manager, $options)); } /** @@ -985,13 +951,13 @@ public function rename(string $toCollectionName, ?string $toDatabaseName = null, * @param array|object $filter Query by which to filter documents * @param array|object $replacement Replacement document * @param array $options Command options - * @return UpdateResult * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function replaceOne($filter, $replacement, array $options = []) + public function replaceOne(array|object $filter, array|object $replacement, array $options = []): UpdateResult { + $filter = $this->builderEncoder->encodeIfSupported($filter); $options = $this->inheritWriteOptions($options); $options = $this->inheritCodec($options); @@ -1008,13 +974,14 @@ public function replaceOne($filter, $replacement, array $options = []) * @param array|object $filter Query by which to filter documents * @param array|object $update Update to apply to the matched documents * @param array $options Command options - * @return UpdateResult * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function updateMany($filter, $update, array $options = []) + public function updateMany(array|object $filter, array|object $update, array $options = []): UpdateResult { + $filter = $this->builderEncoder->encodeIfSupported($filter); + $update = $this->builderEncoder->encodeIfSupported($update); $options = $this->inheritWriteOptions($options); $operation = new UpdateMany($this->databaseName, $this->collectionName, $filter, $update, $options); @@ -1030,13 +997,14 @@ public function updateMany($filter, $update, array $options = []) * @param array|object $filter Query by which to filter documents * @param array|object $update Update to apply to the matched document * @param array $options Command options - * @return UpdateResult * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function updateOne($filter, $update, array $options = []) + public function updateOne(array|object $filter, array|object $update, array $options = []): UpdateResult { + $filter = $this->builderEncoder->encodeIfSupported($filter); + $update = $this->builderEncoder->encodeIfSupported($update); $options = $this->inheritWriteOptions($options); $operation = new UpdateOne($this->databaseName, $this->collectionName, $filter, $update, $options); @@ -1055,7 +1023,7 @@ public function updateOne($filter, $update, array $options = []) * @throws InvalidArgumentException for parameter parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function updateSearchIndex(string $name, $definition, array $options = []): void + public function updateSearchIndex(string $name, array|object $definition, array $options = []): void { $operation = new UpdateSearchIndex($this->databaseName, $this->collectionName, $name, $definition, $options); $server = select_server_for_write($this->manager, $options); @@ -1067,13 +1035,18 @@ public function updateSearchIndex(string $name, $definition, array $options = [] * Create a change stream for watching changes to the collection. * * @see Watch::__construct() for supported options - * @param array $pipeline Aggregation pipeline - * @param array $options Command options - * @return ChangeStream + * @param array|Pipeline $pipeline Aggregation pipeline + * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function watch(array $pipeline = [], array $options = []) + public function watch(array|Pipeline $pipeline = [], array $options = []): ChangeStream { + if (is_array($pipeline) && is_builder_pipeline($pipeline)) { + $pipeline = new Pipeline(...$pipeline); + } + + $pipeline = $this->builderEncoder->encodeIfSupported($pipeline); + $options = $this->inheritReadOptions($options); $options = $this->inheritCodecOrTypeMap($options); @@ -1087,12 +1060,13 @@ public function watch(array $pipeline = [], array $options = []) * * @see Collection::__construct() for supported options * @param array $options Collection constructor options - * @return Collection * @throws InvalidArgumentException for parameter/option parsing errors */ - public function withOptions(array $options = []) + public function withOptions(array $options = []): Collection { $options += [ + 'autoEncryptionEnabled' => $this->autoEncryptionEnabled, + 'builderEncoder' => $this->builderEncoder, 'codec' => $this->codec, 'readConcern' => $this->readConcern, 'readPreference' => $this->readPreference, @@ -1103,6 +1077,11 @@ public function withOptions(array $options = []) return new Collection($this->manager, $this->databaseName, $this->collectionName, $options); } + private function inheritBuilderEncoder(array $options): array + { + return ['builderEncoder' => $this->builderEncoder] + $options; + } + private function inheritCodec(array $options): array { // If the options contain a type map, don't inherit anything diff --git a/src/Command/ListCollections.php b/src/Command/ListCollections.php index 857b35254..d42250cd3 100644 --- a/src/Command/ListCollections.php +++ b/src/Command/ListCollections.php @@ -18,13 +18,11 @@ namespace MongoDB\Command; use MongoDB\Driver\Command; -use MongoDB\Driver\Cursor; +use MongoDB\Driver\CursorInterface; use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; use MongoDB\Driver\Server; use MongoDB\Driver\Session; use MongoDB\Exception\InvalidArgumentException; -use MongoDB\Model\CachingIterator; -use MongoDB\Operation\Executable; use function is_bool; use function is_integer; @@ -36,12 +34,8 @@ * @internal * @see https://mongodb.com/docs/manual/reference/command/listCollections/ */ -class ListCollections implements Executable +final class ListCollections { - private string $databaseName; - - private array $options; - /** * Constructs a listCollections command. * @@ -71,7 +65,7 @@ class ListCollections implements Executable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, array $options = []) + public function __construct(private string $databaseName, private array $options = []) { if (isset($options['authorizedCollections']) && ! is_bool($options['authorizedCollections'])) { throw InvalidArgumentException::invalidType('"authorizedCollections" option', $options['authorizedCollections'], 'boolean'); @@ -92,25 +86,21 @@ public function __construct(string $databaseName, array $options = []) if (isset($options['session']) && ! $options['session'] instanceof Session) { throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); } - - $this->databaseName = $databaseName; - $this->options = $options; } /** * Execute the operation. * - * @return CachingIterator - * @see Executable::execute() + * @return CursorInterface * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server): CachingIterator + public function execute(Server $server): CursorInterface { - /** @var Cursor $cursor */ + /** @var CursorInterface $cursor */ $cursor = $server->executeReadCommand($this->databaseName, $this->createCommand(), $this->createOptions()); $cursor->setTypeMap(['root' => 'array', 'document' => 'array']); - return new CachingIterator($cursor); + return $cursor; } /** diff --git a/src/Command/ListDatabases.php b/src/Command/ListDatabases.php index 3aba5f835..31ca5f741 100644 --- a/src/Command/ListDatabases.php +++ b/src/Command/ListDatabases.php @@ -23,7 +23,6 @@ use MongoDB\Driver\Session; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Exception\UnexpectedValueException; -use MongoDB\Operation\Executable; use function current; use function is_array; @@ -37,10 +36,8 @@ * @internal * @see https://mongodb.com/docs/manual/reference/command/listDatabases/ */ -class ListDatabases implements Executable +final class ListDatabases { - private array $options; - /** * Constructs a listDatabases command. * @@ -69,7 +66,7 @@ class ListDatabases implements Executable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(array $options = []) + public function __construct(private array $options = []) { if (isset($options['authorizedDatabases']) && ! is_bool($options['authorizedDatabases'])) { throw InvalidArgumentException::invalidType('"authorizedDatabases" option', $options['authorizedDatabases'], 'boolean'); @@ -90,14 +87,11 @@ public function __construct(array $options = []) if (isset($options['session']) && ! $options['session'] instanceof Session) { throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); } - - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() * @return array An array of database info structures * @throws UnexpectedValueException if the command response was malformed * @throws DriverRuntimeException for other driver errors (e.g. connection errors) @@ -106,6 +100,7 @@ public function execute(Server $server): array { $cursor = $server->executeReadCommand('admin', $this->createCommand(), $this->createOptions()); $cursor->setTypeMap(['root' => 'array', 'document' => 'array']); + $result = current($cursor->toArray()); if (! isset($result['databases']) || ! is_array($result['databases'])) { diff --git a/src/Database.php b/src/Database.php index dbaff6709..be5803e34 100644 --- a/src/Database.php +++ b/src/Database.php @@ -18,8 +18,13 @@ namespace MongoDB; use Iterator; +use MongoDB\BSON\Document; +use MongoDB\BSON\PackedArray; +use MongoDB\Builder\BuilderEncoder; +use MongoDB\Builder\Pipeline; +use MongoDB\Codec\Encoder; use MongoDB\Driver\ClientEncryption; -use MongoDB\Driver\Cursor; +use MongoDB\Driver\CursorInterface; use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; use MongoDB\Driver\Manager; use MongoDB\Driver\ReadConcern; @@ -45,13 +50,15 @@ use MongoDB\Operation\ModifyCollection; use MongoDB\Operation\RenameCollection; use MongoDB\Operation\Watch; +use stdClass; +use Stringable; use Throwable; -use Traversable; use function is_array; +use function is_bool; use function strlen; -class Database +class Database implements Stringable { private const DEFAULT_TYPE_MAP = [ 'array' => BSONArray::class, @@ -61,9 +68,8 @@ class Database private const WIRE_VERSION_FOR_READ_CONCERN_WITH_WRITE_STAGE = 8; - private string $databaseName; - - private Manager $manager; + /** @psalm-var Encoder */ + private readonly Encoder $builderEncoder; private ReadConcern $readConcern; @@ -73,6 +79,8 @@ class Database private WriteConcern $writeConcern; + private bool $autoEncryptionEnabled; + /** * Constructs new Database instance. * @@ -81,6 +89,9 @@ class Database * * Supported options: * + * * builderEncoder (MongoDB\Codec\Encoder): Encoder for query and + * aggregation builders. If not given, the default encoder will be used. + * * * readConcern (MongoDB\Driver\ReadConcern): The default read concern to * use for database operations and selected collections. Defaults to the * Manager's read concern. @@ -100,12 +111,16 @@ class Database * @param array $options Database options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(Manager $manager, string $databaseName, array $options = []) + public function __construct(private Manager $manager, private string $databaseName, array $options = []) { if (strlen($databaseName) < 1) { throw new InvalidArgumentException('$databaseName is invalid: ' . $databaseName); } + if (isset($options['builderEncoder']) && ! $options['builderEncoder'] instanceof Encoder) { + throw InvalidArgumentException::invalidType('"builderEncoder" option', $options['builderEncoder'], Encoder::class); + } + if (isset($options['readConcern']) && ! $options['readConcern'] instanceof ReadConcern) { throw InvalidArgumentException::invalidType('"readConcern" option', $options['readConcern'], ReadConcern::class); } @@ -122,23 +137,27 @@ public function __construct(Manager $manager, string $databaseName, array $optio throw InvalidArgumentException::invalidType('"writeConcern" option', $options['writeConcern'], WriteConcern::class); } - $this->manager = $manager; - $this->databaseName = $databaseName; + if (isset($options['autoEncryptionEnabled']) && ! is_bool($options['autoEncryptionEnabled'])) { + throw InvalidArgumentException::invalidType('"autoEncryptionEnabled" option', $options['autoEncryptionEnabled'], 'boolean'); + } + + $this->builderEncoder = $options['builderEncoder'] ?? new BuilderEncoder(); $this->readConcern = $options['readConcern'] ?? $this->manager->getReadConcern(); $this->readPreference = $options['readPreference'] ?? $this->manager->getReadPreference(); $this->typeMap = $options['typeMap'] ?? self::DEFAULT_TYPE_MAP; $this->writeConcern = $options['writeConcern'] ?? $this->manager->getWriteConcern(); + $this->autoEncryptionEnabled = $options['autoEncryptionEnabled'] ?? false; } /** * Return internal properties for debugging purposes. * * @see https://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.debuginfo - * @return array */ - public function __debugInfo() + public function __debugInfo(): array { return [ + 'builderEncoder' => $this->builderEncoder, 'databaseName' => $this->databaseName, 'manager' => $this->manager, 'readConcern' => $this->readConcern, @@ -158,19 +177,16 @@ public function __debugInfo() * @see https://php.net/oop5.overloading#object.get * @see https://php.net/types.string#language.types.string.parsing.complex * @param string $collectionName Name of the collection to select - * @return Collection */ - public function __get(string $collectionName) + public function __get(string $collectionName): Collection { - return $this->selectCollection($collectionName); + return $this->getCollection($collectionName); } /** * Return the database name. - * - * @return string */ - public function __toString() + public function __toString(): string { return $this->databaseName; } @@ -181,16 +197,21 @@ public function __toString() * and $listLocalSessions. Requires MongoDB >= 3.6 * * @see Aggregate::__construct() for supported options - * @param array $pipeline Aggregation pipeline - * @param array $options Command options - * @return Traversable + * @param array|Pipeline $pipeline Aggregation pipeline + * @param array $options Command options * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function aggregate(array $pipeline, array $options = []) + public function aggregate(array|Pipeline $pipeline, array $options = []): CursorInterface { + if (is_array($pipeline) && is_builder_pipeline($pipeline)) { + $pipeline = new Pipeline(...$pipeline); + } + + $pipeline = $this->builderEncoder->encodeIfSupported($pipeline); + $hasWriteStage = is_last_pipeline_operator_write($pipeline); if (! isset($options['readPreference']) && ! is_in_transaction($options)) { @@ -233,11 +254,10 @@ public function aggregate(array $pipeline, array $options = []) * @see DatabaseCommand::__construct() for supported options * @param array|object $command Command document * @param array $options Options for command execution - * @return Cursor * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function command($command, array $options = []) + public function command(array|object $command, array $options = []): CursorInterface { if (! isset($options['typeMap'])) { $options['typeMap'] = $this->typeMap; @@ -257,19 +277,14 @@ public function command($command, array $options = []) * collection. * * @see CreateCollection::__construct() for supported options - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#create-collection-helper + * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.md#create-collection-helper * @see https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/manage-collections/ - * @return array|object Command result document * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function createCollection(string $collectionName, array $options = []) + public function createCollection(string $collectionName, array $options = []): void { - if (! isset($options['typeMap'])) { - $options['typeMap'] = $this->typeMap; - } - if (! isset($options['writeConcern']) && ! is_in_transaction($options)) { $options['writeConcern'] = $this->writeConcern; } @@ -284,7 +299,7 @@ public function createCollection(string $collectionName, array $options = []) $server = select_server_for_write($this->manager, $options); - return $operation->execute($server); + $operation->execute($server); } /** @@ -302,17 +317,13 @@ public function createCollection(string $collectionName, array $options = []) * getPrevious() and getEncryptedFields() methods, respectively. * * @see CreateCollection::__construct() for supported options - * @return array A tuple containing the command result document from creating the collection and the modified "encryptedFields" option + * @return array The modified "encryptedFields" option * @throws InvalidArgumentException for parameter/option parsing errors * @throws CreateEncryptedCollectionException for any errors creating data keys or creating the collection * @throws UnsupportedException if Queryable Encryption is not supported by the selected server */ public function createEncryptedCollection(string $collectionName, ClientEncryption $clientEncryption, string $kmsProvider, ?array $masterKey, array $options): array { - if (! isset($options['typeMap'])) { - $options['typeMap'] = $this->typeMap; - } - if (! isset($options['writeConcern']) && ! is_in_transaction($options)) { $options['writeConcern'] = $this->writeConcern; } @@ -321,10 +332,10 @@ public function createEncryptedCollection(string $collectionName, ClientEncrypti $server = select_server_for_write($this->manager, $options); try { - $operation->createDataKeys($clientEncryption, $kmsProvider, $masterKey, $encryptedFields); - $result = $operation->execute($server); + $encryptedFields = $operation->createDataKeys($clientEncryption, $kmsProvider, $masterKey); + $operation->execute($server); - return [$result, $encryptedFields]; + return $encryptedFields; } catch (Throwable $e) { throw new CreateEncryptedCollectionException($e, $encryptedFields ?? []); } @@ -335,17 +346,12 @@ public function createEncryptedCollection(string $collectionName, ClientEncrypti * * @see DropDatabase::__construct() for supported options * @param array $options Additional options - * @return array|object Command result document * @throws UnsupportedException if options are unsupported on the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function drop(array $options = []) + public function drop(array $options = []): void { - if (! isset($options['typeMap'])) { - $options['typeMap'] = $this->typeMap; - } - $server = select_server_for_write($this->manager, $options); if (! isset($options['writeConcern']) && ! is_in_transaction($options)) { @@ -354,7 +360,7 @@ public function drop(array $options = []) $operation = new DropDatabase($this->databaseName, $options); - return $operation->execute($server); + $operation->execute($server); } /** @@ -363,51 +369,65 @@ public function drop(array $options = []) * @see DropCollection::__construct() for supported options * @param string $collectionName Collection name * @param array $options Additional options - * @return array|object Command result document * @throws UnsupportedException if options are unsupported on the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function dropCollection(string $collectionName, array $options = []) + public function dropCollection(string $collectionName, array $options = []): void { - if (! isset($options['typeMap'])) { - $options['typeMap'] = $this->typeMap; - } - $server = select_server_for_write($this->manager, $options); if (! isset($options['writeConcern']) && ! is_in_transaction($options)) { $options['writeConcern'] = $this->writeConcern; } - if (! isset($options['encryptedFields'])) { + if ($this->autoEncryptionEnabled && ! isset($options['encryptedFields'])) { $options['encryptedFields'] = get_encrypted_fields_from_driver($this->databaseName, $collectionName, $this->manager) - ?? get_encrypted_fields_from_server($this->databaseName, $collectionName, $this->manager, $server); + ?? get_encrypted_fields_from_server($this->databaseName, $collectionName, $server); } $operation = isset($options['encryptedFields']) ? new DropEncryptedCollection($this->databaseName, $collectionName, $options) : new DropCollection($this->databaseName, $collectionName, $options); - return $operation->execute($server); + $operation->execute($server); } /** - * Returns the database name. + * Returns a collection instance. * - * @return string + * If the collection does not exist in the database, it is not created when + * invoking this method. + * + * @see Collection::__construct() for supported options + * @throws InvalidArgumentException for parameter/option parsing errors */ - public function getDatabaseName() + public function getCollection(string $collectionName, array $options = []): Collection + { + $options += [ + 'builderEncoder' => $this->builderEncoder, + 'readConcern' => $this->readConcern, + 'readPreference' => $this->readPreference, + 'typeMap' => $this->typeMap, + 'writeConcern' => $this->writeConcern, + 'autoEncryptionEnabled' => $this->autoEncryptionEnabled, + ]; + + return new Collection($this->manager, $this->databaseName, $collectionName, $options); + } + + /** + * Returns the database name. + */ + public function getDatabaseName(): string { return $this->databaseName; } /** * Return the Manager. - * - * @return Manager */ - public function getManager() + public function getManager(): Manager { return $this->manager; } @@ -416,29 +436,24 @@ public function getManager() * Return the read concern for this database. * * @see https://php.net/manual/en/mongodb-driver-readconcern.isdefault.php - * @return ReadConcern */ - public function getReadConcern() + public function getReadConcern(): ReadConcern { return $this->readConcern; } /** * Return the read preference for this database. - * - * @return ReadPreference */ - public function getReadPreference() + public function getReadPreference(): ReadPreference { return $this->readPreference; } /** * Return the type map for this database. - * - * @return array */ - public function getTypeMap() + public function getTypeMap(): array { return $this->typeMap; } @@ -447,9 +462,8 @@ public function getTypeMap() * Return the write concern for this database. * * @see https://php.net/manual/en/mongodb-driver-writeconcern.isdefault.php - * @return WriteConcern */ - public function getWriteConcern() + public function getWriteConcern(): WriteConcern { return $this->writeConcern; } @@ -458,6 +472,7 @@ public function getWriteConcern() * Returns the names of all collections in this database * * @see ListCollectionNames::__construct() for supported options + * @return Iterator * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ @@ -477,7 +492,7 @@ public function listCollectionNames(array $options = []): Iterator * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function listCollections(array $options = []) + public function listCollections(array $options = []): Iterator { $operation = new ListCollections($this->databaseName, $options); $server = select_server($this->manager, $options); @@ -492,11 +507,10 @@ public function listCollections(array $options = []) * @param string $collectionName Collection or view to modify * @param array $collectionOptions Collection or view options to assign * @param array $options Command options - * @return array|object * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function modifyCollection(string $collectionName, array $collectionOptions, array $options = []) + public function modifyCollection(string $collectionName, array $collectionOptions, array $options = []): array|object { if (! isset($options['typeMap'])) { $options['typeMap'] = $this->typeMap; @@ -521,21 +535,16 @@ public function modifyCollection(string $collectionName, array $collectionOption * @param string $toCollectionName New name of the collection * @param string|null $toDatabaseName New database name of the collection. Defaults to the original database. * @param array $options Additional options - * @return array|object Command result document * @throws UnsupportedException if options are unsupported on the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function renameCollection(string $fromCollectionName, string $toCollectionName, ?string $toDatabaseName = null, array $options = []) + public function renameCollection(string $fromCollectionName, string $toCollectionName, ?string $toDatabaseName = null, array $options = []): void { if (! isset($toDatabaseName)) { $toDatabaseName = $this->databaseName; } - if (! isset($options['typeMap'])) { - $options['typeMap'] = $this->typeMap; - } - $server = select_server_for_write($this->manager, $options); if (! isset($options['writeConcern']) && ! is_in_transaction($options)) { @@ -544,7 +553,7 @@ public function renameCollection(string $fromCollectionName, string $toCollectio $operation = new RenameCollection($this->databaseName, $fromCollectionName, $toDatabaseName, $toCollectionName, $options); - return $operation->execute($server); + $operation->execute($server); } /** @@ -553,19 +562,11 @@ public function renameCollection(string $fromCollectionName, string $toCollectio * @see Collection::__construct() for supported options * @param string $collectionName Name of the collection to select * @param array $options Collection constructor options - * @return Collection * @throws InvalidArgumentException for parameter/option parsing errors */ - public function selectCollection(string $collectionName, array $options = []) + public function selectCollection(string $collectionName, array $options = []): Collection { - $options += [ - 'readConcern' => $this->readConcern, - 'readPreference' => $this->readPreference, - 'typeMap' => $this->typeMap, - 'writeConcern' => $this->writeConcern, - ]; - - return new Collection($this->manager, $this->databaseName, $collectionName, $options); + return $this->getCollection($collectionName, $options); } /** @@ -573,10 +574,9 @@ public function selectCollection(string $collectionName, array $options = []) * * @see Bucket::__construct() for supported options * @param array $options Bucket constructor options - * @return Bucket * @throws InvalidArgumentException for parameter/option parsing errors */ - public function selectGridFSBucket(array $options = []) + public function selectGridFSBucket(array $options = []): Bucket { $options += [ 'readConcern' => $this->readConcern, @@ -592,13 +592,18 @@ public function selectGridFSBucket(array $options = []) * Create a change stream for watching changes to the database. * * @see Watch::__construct() for supported options - * @param array $pipeline Aggregation pipeline - * @param array $options Command options - * @return ChangeStream + * @param array|Pipeline $pipeline Aggregation pipeline + * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function watch(array $pipeline = [], array $options = []) + public function watch(array|Pipeline $pipeline = [], array $options = []): ChangeStream { + if (is_array($pipeline) && is_builder_pipeline($pipeline)) { + $pipeline = new Pipeline(...$pipeline); + } + + $pipeline = $this->builderEncoder->encodeIfSupported($pipeline); + if (! isset($options['readPreference']) && ! is_in_transaction($options)) { $options['readPreference'] = $this->readPreference; } @@ -623,12 +628,13 @@ public function watch(array $pipeline = [], array $options = []) * * @see Database::__construct() for supported options * @param array $options Database constructor options - * @return Database * @throws InvalidArgumentException for parameter/option parsing errors */ - public function withOptions(array $options = []) + public function withOptions(array $options = []): Database { $options += [ + 'autoEncryptionEnabled' => $this->autoEncryptionEnabled, + 'builderEncoder' => $this->builderEncoder, 'readConcern' => $this->readConcern, 'readPreference' => $this->readPreference, 'typeMap' => $this->typeMap, diff --git a/src/DeleteResult.php b/src/DeleteResult.php index 7d2744ccc..23b416d0a 100644 --- a/src/DeleteResult.php +++ b/src/DeleteResult.php @@ -17,22 +17,16 @@ namespace MongoDB; +use MongoDB\Driver\Exception\LogicException; use MongoDB\Driver\WriteResult; -use MongoDB\Exception\BadMethodCallException; /** * Result class for a delete operation. */ class DeleteResult { - private WriteResult $writeResult; - - private bool $isAcknowledged; - - public function __construct(WriteResult $writeResult) + public function __construct(private WriteResult $writeResult) { - $this->writeResult = $writeResult; - $this->isAcknowledged = $writeResult->isAcknowledged(); } /** @@ -41,16 +35,11 @@ public function __construct(WriteResult $writeResult) * This method should only be called if the write was acknowledged. * * @see DeleteResult::isAcknowledged() - * @return integer|null - * @throws BadMethodCallException if the write result is unacknowledged + * @throws LogicException if the write result is unacknowledged */ - public function getDeletedCount() + public function getDeletedCount(): int { - if ($this->isAcknowledged) { - return $this->writeResult->getDeletedCount(); - } - - throw BadMethodCallException::unacknowledgedWriteResultAccess(__METHOD__); + return $this->writeResult->getDeletedCount(); } /** @@ -58,11 +47,9 @@ public function getDeletedCount() * * If the delete was not acknowledged, other fields from the WriteResult * (e.g. deletedCount) will be undefined. - * - * @return boolean */ - public function isAcknowledged() + public function isAcknowledged(): bool { - return $this->isAcknowledged; + return $this->writeResult->isAcknowledged(); } } diff --git a/src/Exception/BadMethodCallException.php b/src/Exception/BadMethodCallException.php index e1070982a..00cece346 100644 --- a/src/Exception/BadMethodCallException.php +++ b/src/Exception/BadMethodCallException.php @@ -27,21 +27,10 @@ class BadMethodCallException extends BaseBadMethodCallException implements Excep * Thrown when a mutable method is invoked on an immutable object. * * @param string $class Class name - * @return self + * @internal */ - public static function classIsImmutable(string $class) + public static function classIsImmutable(string $class): self { return new self(sprintf('%s is immutable', $class)); } - - /** - * Thrown when accessing a result field on an unacknowledged write result. - * - * @param string $method Method name - * @return self - */ - public static function unacknowledgedWriteResultAccess(string $method) - { - return new self(sprintf('%s should not be called for an unacknowledged write result', $method)); - } } diff --git a/src/Exception/CreateEncryptedCollectionException.php b/src/Exception/CreateEncryptedCollectionException.php index 3aca268fe..5f348edd7 100644 --- a/src/Exception/CreateEncryptedCollectionException.php +++ b/src/Exception/CreateEncryptedCollectionException.php @@ -19,7 +19,6 @@ use Throwable; -use function get_class; use function sprintf; /** @@ -28,13 +27,9 @@ */ final class CreateEncryptedCollectionException extends RuntimeException { - private array $encryptedFields; - - public function __construct(Throwable $previous, array $encryptedFields) + public function __construct(Throwable $previous, private array $encryptedFields) { - parent::__construct(sprintf('Creating encrypted collection failed due to previous %s: %s', get_class($previous), $previous->getMessage()), 0, $previous); - - $this->encryptedFields = $encryptedFields; + parent::__construct(sprintf('Creating encrypted collection failed due to previous %s: %s', $previous::class, $previous->getMessage()), 0, $previous); } /** diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index 7091e82af..c92734a0c 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -29,18 +29,33 @@ class InvalidArgumentException extends DriverInvalidArgumentException implements Exception { + /** @internal */ public static function cannotCombineCodecAndTypeMap(): self { return new self('Cannot provide both "codec" and "typeMap" options'); } + /** + * Thrown when an argument or option is expected to be a string or a document. + * + * @internal + * + * @param string $name Name of the argument or option + * @param mixed $value Actual value (used to derive the type) + */ + public static function expectedDocumentOrStringType(string $name, mixed $value): self + { + return new self(sprintf('Expected %s to have type "string" or "document" (array or object) but found "%s"', $name, get_debug_type($value))); + } + /** * Thrown when an argument or option is expected to be a document. * * @param string $name Name of the argument or option * @param mixed $value Actual value (used to derive the type) + * @internal */ - public static function expectedDocumentType(string $name, $value): self + public static function expectedDocumentType(string $name, mixed $value): self { return new self(sprintf('Expected %s to have type "document" (array or object) but found "%s"', $name, get_debug_type($value))); } @@ -51,9 +66,9 @@ public static function expectedDocumentType(string $name, $value): self * @param string $name Name of the argument or option * @param mixed $value Actual value (used to derive the type) * @param string|list $expectedType Expected type as a string or an array containing one or more strings - * @return self + * @internal */ - public static function invalidType(string $name, $value, $expectedType) + public static function invalidType(string $name, mixed $value, string|array $expectedType): self { if (is_array($expectedType)) { $expectedType = self::expectedTypesToString($expectedType); diff --git a/src/Exception/ResumeTokenException.php b/src/Exception/ResumeTokenException.php index ce7a35c71..9117f700d 100644 --- a/src/Exception/ResumeTokenException.php +++ b/src/Exception/ResumeTokenException.php @@ -26,9 +26,9 @@ class ResumeTokenException extends RuntimeException * Thrown when a resume token has an invalid type. * * @param mixed $value Actual value (used to derive the type) - * @return self + * @internal */ - public static function invalidType($value) + public static function invalidType(mixed $value): self { return new self(sprintf('Expected resume token to have type "array or object" but found "%s"', get_debug_type($value))); } @@ -36,9 +36,9 @@ public static function invalidType($value) /** * Thrown when a resume token is not found in a change document. * - * @return self + * @internal */ - public static function notFound() + public static function notFound(): self { return new self('Resume token not found in change document'); } diff --git a/src/Exception/UnsupportedException.php b/src/Exception/UnsupportedException.php index 2bf910a09..a2204b886 100644 --- a/src/Exception/UnsupportedException.php +++ b/src/Exception/UnsupportedException.php @@ -19,110 +19,44 @@ class UnsupportedException extends RuntimeException { - /** - * Thrown when a command's allowDiskUse option is not supported by a server. - * - * @return self - */ - public static function allowDiskUseNotSupported() - { - return new self('The "allowDiskUse" option is not supported by the server executing this operation'); - } - - /** - * Thrown when array filters are not supported by a server. - * - * @deprecated 1.12 - * @todo Remove this in 2.0 (see: PHPLIB-797) - * - * @return self - */ - public static function arrayFiltersNotSupported() - { - return new self('Array filters are not supported by the server executing this operation'); - } - - /** - * Thrown when collations are not supported by a server. - * - * @deprecated 1.12 - * @todo Remove this in 2.0 (see: PHPLIB-797) - * - * @return self - */ - public static function collationNotSupported() - { - return new self('Collations are not supported by the server executing this operation'); - } - /** * Thrown when the commitQuorum option for createIndexes is not supported * by a server. * - * @return self + * @internal */ - public static function commitQuorumNotSupported() + public static function commitQuorumNotSupported(): self { return new self('The "commitQuorum" option is not supported by the server executing this operation'); } - /** - * Thrown when explain is not supported by a server. - * - * @return self - */ - public static function explainNotSupported() - { - return new self('Explain is not supported by the server executing this operation'); - } - /** * Thrown when a command's hint option is not supported by a server. * - * @return self + * @internal */ - public static function hintNotSupported() + public static function hintNotSupported(): self { return new self('Hint is not supported by the server executing this operation'); } - /** - * Thrown when a command's readConcern option is not supported by a server. - * - * @return self - */ - public static function readConcernNotSupported() - { - return new self('Read concern is not supported by the server executing this command'); - } - /** * Thrown when a readConcern is used with a read operation in a transaction. * - * @return self - */ - public static function readConcernNotSupportedInTransaction() - { - return new self('The "readConcern" option cannot be specified within a transaction. Instead, specify it when starting the transaction.'); - } - - /** - * Thrown when a command's writeConcern option is not supported by a server. - * - * @return self + * @internal */ - public static function writeConcernNotSupported() + public static function readConcernNotSupportedInTransaction(): self { - return new self('Write concern is not supported by the server executing this command'); + return new self('Cannot set read concern after starting a transaction. Instead, specify the "readConcern" option when starting the transaction.'); } /** * Thrown when a writeConcern is used with a write operation in a transaction. * - * @return self + * @internal */ - public static function writeConcernNotSupportedInTransaction() + public static function writeConcernNotSupportedInTransaction(): self { - return new self('The "writeConcern" option cannot be specified within a transaction. Instead, specify it when starting the transaction.'); + return new self('Cannot set write concern after starting a transaction. Instead, specify the "writeConcern" option when starting the transaction.'); } } diff --git a/src/Exception/UnsupportedValueException.php b/src/Exception/UnsupportedValueException.php index 33635d8a0..62e089e5e 100644 --- a/src/Exception/UnsupportedValueException.php +++ b/src/Exception/UnsupportedValueException.php @@ -24,32 +24,23 @@ class UnsupportedValueException extends InvalidArgumentException implements Exception { - /** @var mixed */ - private $value; - - /** @return mixed */ - public function getValue() + public function getValue(): mixed { return $this->value; } - /** @param mixed $value */ - public static function invalidDecodableValue($value): self + public static function invalidDecodableValue(mixed $value): self { return new self(sprintf('Could not decode value of type "%s".', get_debug_type($value)), $value); } - /** @param mixed $value */ - public static function invalidEncodableValue($value): self + public static function invalidEncodableValue(mixed $value): self { return new self(sprintf('Could not encode value of type "%s".', get_debug_type($value)), $value); } - /** @param mixed $value */ - private function __construct(string $message, $value) + private function __construct(string $message, private mixed $value) { parent::__construct($message); - - $this->value = $value; } } diff --git a/src/GridFS/Bucket.php b/src/GridFS/Bucket.php index 8a7ef25b5..3210f8b42 100644 --- a/src/GridFS/Bucket.php +++ b/src/GridFS/Bucket.php @@ -17,7 +17,6 @@ namespace MongoDB\GridFS; -use Iterator; use MongoDB\BSON\Document; use MongoDB\Codec\DocumentCodec; use MongoDB\Collection; @@ -35,7 +34,6 @@ use MongoDB\GridFS\Exception\StreamException; use MongoDB\Model\BSONArray; use MongoDB\Model\BSONDocument; -use MongoDB\Operation\Find; use function array_intersect_key; use function array_key_exists; @@ -45,7 +43,6 @@ use function get_resource_type; use function in_array; use function is_array; -use function is_bool; use function is_integer; use function is_object; use function is_resource; @@ -59,11 +56,8 @@ use function stream_copy_to_stream; use function stream_get_meta_data; use function stream_get_wrappers; -use function trigger_error; use function urlencode; -use const E_USER_DEPRECATED; - /** * Bucket provides a public API for interacting with the GridFS files and chunks * collections. @@ -86,14 +80,8 @@ class Bucket private CollectionWrapper $collectionWrapper; - private string $databaseName; - - private Manager $manager; - private string $bucketName; - private bool $disableMD5; - private int $chunkSizeBytes; private ReadConcern $readConcern; @@ -115,9 +103,6 @@ class Bucket * * chunkSizeBytes (integer): The chunk size in bytes. Defaults to * 261120 (i.e. 255 KiB). * - * * disableMD5 (boolean): When true, no MD5 sum will be generated for - * each stored file. Defaults to "false". - * * * readConcern (MongoDB\Driver\ReadConcern): Read concern. * * * readPreference (MongoDB\Driver\ReadPreference): Read preference. @@ -131,16 +116,11 @@ class Bucket * @param array $options Bucket options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(Manager $manager, string $databaseName, array $options = []) + public function __construct(private Manager $manager, private string $databaseName, array $options = []) { - if (isset($options['disableMD5']) && $options['disableMD5'] === false) { - @trigger_error('Setting GridFS "disableMD5" option to "false" is deprecated since mongodb/mongodb 1.18 and will not be supported in version 2.0.', E_USER_DEPRECATED); - } - $options += [ 'bucketName' => self::DEFAULT_BUCKET_NAME, 'chunkSizeBytes' => self::DEFAULT_CHUNK_SIZE_BYTES, - 'disableMD5' => false, ]; if (! is_string($options['bucketName'])) { @@ -159,10 +139,6 @@ public function __construct(Manager $manager, string $databaseName, array $optio throw InvalidArgumentException::invalidType('"codec" option', $options['codec'], DocumentCodec::class); } - if (! is_bool($options['disableMD5'])) { - throw InvalidArgumentException::invalidType('"disableMD5" option', $options['disableMD5'], 'boolean'); - } - if (isset($options['readConcern']) && ! $options['readConcern'] instanceof ReadConcern) { throw InvalidArgumentException::invalidType('"readConcern" option', $options['readConcern'], ReadConcern::class); } @@ -183,12 +159,9 @@ public function __construct(Manager $manager, string $databaseName, array $optio throw InvalidArgumentException::cannotCombineCodecAndTypeMap(); } - $this->manager = $manager; - $this->databaseName = $databaseName; $this->bucketName = $options['bucketName']; $this->chunkSizeBytes = $options['chunkSizeBytes']; $this->codec = $options['codec'] ?? null; - $this->disableMD5 = $options['disableMD5']; $this->readConcern = $options['readConcern'] ?? $this->manager->getReadConcern(); $this->readPreference = $options['readPreference'] ?? $this->manager->getReadPreference(); $this->typeMap = $options['typeMap'] ?? self::DEFAULT_TYPE_MAP; @@ -209,15 +182,13 @@ public function __construct(Manager $manager, string $databaseName, array $optio * Return internal properties for debugging purposes. * * @see https://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.debuginfo - * @return array */ - public function __debugInfo() + public function __debugInfo(): array { return [ 'bucketName' => $this->bucketName, 'codec' => $this->codec, 'databaseName' => $this->databaseName, - 'disableMD5' => $this->disableMD5, 'manager' => $this->manager, 'chunkSizeBytes' => $this->chunkSizeBytes, 'readConcern' => $this->readConcern, @@ -234,11 +205,10 @@ public function __debugInfo() * attempt to delete orphaned chunks. * * @param mixed $id File ID - * @return void * @throws FileNotFoundException if no file could be selected * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function delete($id) + public function delete(mixed $id): void { $file = $this->collectionWrapper->findFileById($id); $this->collectionWrapper->deleteFileAndChunksById($id); @@ -248,18 +218,34 @@ public function delete($id) } } + /** + * Delete all the revisions of a file name from the GridFS bucket. + * + * @param string $filename Filename + * + * @throws FileNotFoundException if no file could be selected + * @throws DriverRuntimeException for other driver errors (e.g. connection errors) + */ + public function deleteByName(string $filename): void + { + $count = $this->collectionWrapper->deleteFileAndChunksByFilename($filename); + + if ($count === 0) { + throw FileNotFoundException::byFilename($filename); + } + } + /** * Writes the contents of a GridFS file to a writable stream. * * @param mixed $id File ID * @param resource $destination Writable Stream - * @return void * @throws FileNotFoundException if no file could be selected * @throws InvalidArgumentException if $destination is not a stream * @throws StreamException if the file could not be uploaded * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function downloadToStream($id, $destination) + public function downloadToStream(mixed $id, $destination): void { if (! is_resource($destination) || get_resource_type($destination) != 'stream') { throw InvalidArgumentException::invalidType('$destination', $destination, 'resource'); @@ -293,13 +279,12 @@ public function downloadToStream($id, $destination) * @param string $filename Filename * @param resource $destination Writable Stream * @param array $options Download options - * @return void * @throws FileNotFoundException if no file could be selected * @throws InvalidArgumentException if $destination is not a stream * @throws StreamException if the file could not be uploaded * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function downloadToStreamByName(string $filename, $destination, array $options = []) + public function downloadToStreamByName(string $filename, $destination, array $options = []): void { if (! is_resource($destination) || get_resource_type($destination) != 'stream') { throw InvalidArgumentException::invalidType('$destination', $destination, 'resource'); @@ -315,10 +300,9 @@ public function downloadToStreamByName(string $filename, $destination, array $op * Drops the files and chunks collections associated with this GridFS * bucket. * - * @return void * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function drop() + public function drop(): void { $this->collectionWrapper->dropCollections(); } @@ -330,12 +314,11 @@ public function drop() * @see Find::__construct() for supported options * @param array|object $filter Query by which to filter documents * @param array $options Additional options - * @return CursorInterface&Iterator * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function find($filter = [], array $options = []) + public function find(array|object $filter = [], array $options = []): CursorInterface { if ($this->codec && ! array_key_exists('codec', $options)) { $options['codec'] = $this->codec; @@ -351,12 +334,11 @@ public function find($filter = [], array $options = []) * @see FindOne::__construct() for supported options * @param array|object $filter Query by which to filter documents * @param array $options Additional options - * @return array|object|null * @throws UnsupportedException if options are not supported by the selected server * @throws InvalidArgumentException for parameter/option parsing errors * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function findOne($filter = [], array $options = []) + public function findOne(array|object $filter = [], array $options = []): array|object|null { if ($this->codec && ! array_key_exists('codec', $options)) { $options['codec'] = $this->codec; @@ -367,40 +349,32 @@ public function findOne($filter = [], array $options = []) /** * Return the bucket name. - * - * @return string */ - public function getBucketName() + public function getBucketName(): string { return $this->bucketName; } /** * Return the chunks collection. - * - * @return Collection */ - public function getChunksCollection() + public function getChunksCollection(): Collection { return $this->collectionWrapper->getChunksCollection(); } /** * Return the chunk size in bytes. - * - * @return integer */ - public function getChunkSizeBytes() + public function getChunkSizeBytes(): int { return $this->chunkSizeBytes; } /** * Return the database name. - * - * @return string */ - public function getDatabaseName() + public function getDatabaseName(): string { return $this->databaseName; } @@ -409,11 +383,10 @@ public function getDatabaseName() * Gets the file document of the GridFS file associated with a stream. * * @param resource $stream GridFS stream - * @return array|object * @throws InvalidArgumentException if $stream is not a GridFS stream * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function getFileDocumentForStream($stream) + public function getFileDocumentForStream($stream): array|object { $file = $this->getRawFileDocumentForStream($stream); @@ -429,12 +402,11 @@ public function getFileDocumentForStream($stream) * Gets the file document's ID of the GridFS file associated with a stream. * * @param resource $stream GridFS stream - * @return mixed * @throws CorruptFileException if the file "_id" field does not exist * @throws InvalidArgumentException if $stream is not a GridFS stream * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function getFileIdForStream($stream) + public function getFileIdForStream($stream): mixed { $file = $this->getRawFileDocumentForStream($stream); @@ -454,10 +426,8 @@ public function getFileIdForStream($stream) /** * Return the files collection. - * - * @return Collection */ - public function getFilesCollection() + public function getFilesCollection(): Collection { return $this->collectionWrapper->getFilesCollection(); } @@ -466,29 +436,24 @@ public function getFilesCollection() * Return the read concern for this GridFS bucket. * * @see https://php.net/manual/en/mongodb-driver-readconcern.isdefault.php - * @return ReadConcern */ - public function getReadConcern() + public function getReadConcern(): ReadConcern { return $this->readConcern; } /** * Return the read preference for this GridFS bucket. - * - * @return ReadPreference */ - public function getReadPreference() + public function getReadPreference(): ReadPreference { return $this->readPreference; } /** * Return the type map for this GridFS bucket. - * - * @return array */ - public function getTypeMap() + public function getTypeMap(): array { return $this->typeMap; } @@ -497,9 +462,8 @@ public function getTypeMap() * Return the write concern for this GridFS bucket. * * @see https://php.net/manual/en/mongodb-driver-writeconcern.isdefault.php - * @return WriteConcern */ - public function getWriteConcern() + public function getWriteConcern(): WriteConcern { return $this->writeConcern; } @@ -512,7 +476,7 @@ public function getWriteConcern() * @throws FileNotFoundException if no file could be selected * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function openDownloadStream($id) + public function openDownloadStream(mixed $id) { $file = $this->collectionWrapper->findFileById($id); @@ -571,9 +535,6 @@ public function openDownloadStreamByName(string $filename, array $options = []) * * chunkSizeBytes (integer): The chunk size in bytes. Defaults to the * bucket's chunk size. * - * * disableMD5 (boolean): When true, no MD5 sum will be generated for - * the stored file. Defaults to "false". - * * * metadata (document): User data for the "metadata" field of the files * collection document. * @@ -585,7 +546,6 @@ public function openUploadStream(string $filename, array $options = []) { $options += [ 'chunkSizeBytes' => $this->chunkSizeBytes, - 'disableMD5' => $this->disableMD5, ]; $path = $this->createPathForUpload(); @@ -628,11 +588,10 @@ public function registerGlobalStreamWrapperAlias(string $alias): void * * @param mixed $id File ID * @param string $newFilename New filename - * @return void * @throws FileNotFoundException if no file could be selected * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function rename($id, string $newFilename) + public function rename(mixed $id, string $newFilename): void { $updateResult = $this->collectionWrapper->updateFilenameForId($id, $newFilename); @@ -640,20 +599,31 @@ public function rename($id, string $newFilename) return; } - /* If the update resulted in no modification, it's possible that the - * file did not exist, in which case we must raise an error. Checking - * the write result's matched count will be most efficient, but fall - * back to a findOne operation if necessary (i.e. legacy writes). - */ - $found = $updateResult->getMatchedCount() !== null - ? $updateResult->getMatchedCount() === 1 - : $this->collectionWrapper->findFileById($id) !== null; - - if (! $found) { + // If the update resulted in no modification, it's possible that the + // file did not exist, in which case we must raise an error. + if ($updateResult->getMatchedCount() !== 1) { throw FileNotFoundException::byId($id, $this->getFilesNamespace()); } } + /** + * Renames all the revisions of a file name in the GridFS bucket. + * + * @param string $filename Filename + * @param string $newFilename New filename + * + * @throws FileNotFoundException if no file could be selected + * @throws DriverRuntimeException for other driver errors (e.g. connection errors) + */ + public function renameByName(string $filename, string $newFilename): void + { + $count = $this->collectionWrapper->updateFilenameForFilename($filename, $newFilename); + + if ($count === 0) { + throw FileNotFoundException::byFilename($filename); + } + } + /** * Writes the contents of a readable stream to a GridFS file. * @@ -664,9 +634,6 @@ public function rename($id, string $newFilename) * * chunkSizeBytes (integer): The chunk size in bytes. Defaults to the * bucket's chunk size. * - * * disableMD5 (boolean): When true, no MD5 sum will be generated for - * the stored file. Defaults to "false". - * * * metadata (document): User data for the "metadata" field of the files * collection document. * @@ -678,7 +645,7 @@ public function rename($id, string $newFilename) * @throws StreamException if the file could not be uploaded * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function uploadFromStream(string $filename, $source, array $options = []) + public function uploadFromStream(string $filename, $source, array $options = []): mixed { if (! is_resource($source) || get_resource_type($source) != 'stream') { throw InvalidArgumentException::invalidType('$source', $source, 'resource'); @@ -798,9 +765,9 @@ private function registerStreamWrapper(): void * * @see StreamWrapper::setContextResolver() * - * @param string $path The full url provided to fopen(). It contains the filename. - * gridfs://database_name/collection_name.files/file_name - * @param array{revision?: int, chunkSizeBytes?: int, disableMD5?: bool} $context The options provided to fopen() + * @param string $path The full url provided to fopen(). It contains the filename. + * gridfs://database_name/collection_name.files/file_name + * @param array{revision?: int, chunkSizeBytes?: int} $context The options provided to fopen() * * @return array{collectionWrapper: CollectionWrapper, file: object}|array{collectionWrapper: CollectionWrapper, filename: string, options: array} * @@ -831,7 +798,6 @@ private function resolveStreamContext(string $path, string $mode, array $context 'filename' => $filename, 'options' => $context + [ 'chunkSizeBytes' => $this->chunkSizeBytes, - 'disableMD5' => $this->disableMD5, ], ]; } diff --git a/src/GridFS/CollectionWrapper.php b/src/GridFS/CollectionWrapper.php index 25e8b32a7..62be77fc0 100644 --- a/src/GridFS/CollectionWrapper.php +++ b/src/GridFS/CollectionWrapper.php @@ -18,7 +18,6 @@ namespace MongoDB\GridFS; use ArrayIterator; -use Iterator; use MongoDB\Collection; use MongoDB\Driver\CursorInterface; use MongoDB\Driver\Manager; @@ -39,14 +38,10 @@ * * @internal */ -class CollectionWrapper +final class CollectionWrapper { - private string $bucketName; - private Collection $chunksCollection; - private string $databaseName; - private bool $checkedIndexes = false; private Collection $filesCollection; @@ -61,21 +56,16 @@ class CollectionWrapper * @param array $collectionOptions Collection options * @throws InvalidArgumentException */ - public function __construct(Manager $manager, string $databaseName, string $bucketName, array $collectionOptions = []) + public function __construct(Manager $manager, private string $databaseName, private string $bucketName, array $collectionOptions = []) { - $this->databaseName = $databaseName; - $this->bucketName = $bucketName; - $this->filesCollection = new Collection($manager, $databaseName, sprintf('%s.files', $bucketName), $collectionOptions); $this->chunksCollection = new Collection($manager, $databaseName, sprintf('%s.chunks', $bucketName), $collectionOptions); } /** * Deletes all GridFS chunks for a given file ID. - * - * @param mixed $id */ - public function deleteChunksByFilesId($id): void + public function deleteChunksByFilesId(mixed $id): void { $this->chunksCollection->deleteMany(['files_id' => $id]); } @@ -83,7 +73,7 @@ public function deleteChunksByFilesId($id): void /** * Delete all GridFS files and chunks for a given filename. */ - public function deleteFileAndChunksByFilename(string $filename): ?int + public function deleteFileAndChunksByFilename(string $filename): int { /** @var iterable $files */ $files = $this->findFiles(['filename' => $filename], [ @@ -105,10 +95,8 @@ public function deleteFileAndChunksByFilename(string $filename): ?int /** * Deletes a GridFS file and related chunks by ID. - * - * @param mixed $id */ - public function deleteFileAndChunksById($id): void + public function deleteFileAndChunksById(mixed $id): void { $this->filesCollection->deleteOne(['_id' => $id]); $this->chunksCollection->deleteMany(['files_id' => $id]); @@ -128,9 +116,8 @@ public function dropCollections(): void * * @param mixed $id File ID * @param integer $fromChunk Starting chunk (inclusive) - * @return CursorInterface&Iterator */ - public function findChunksByFileId($id, int $fromChunk = 0) + public function findChunksByFileId(mixed $id, int $fromChunk = 0): CursorInterface { return $this->chunksCollection->find( [ @@ -161,9 +148,6 @@ public function findChunksByFileId($id, int $fromChunk = 0) */ public function findFileByFilenameAndRevision(string $filename, int $revision): ?object { - $filename = $filename; - $revision = $revision; - if ($revision < 0) { $skip = abs($revision) - 1; $sortOrder = -1; @@ -187,10 +171,8 @@ public function findFileByFilenameAndRevision(string $filename, int $revision): /** * Finds a GridFS file document for a given ID. - * - * @param mixed $id */ - public function findFileById($id): ?object + public function findFileById(mixed $id): ?object { $file = $this->filesCollection->findOne( ['_id' => $id], @@ -207,9 +189,8 @@ public function findFileById($id): ?object * @see Find::__construct() for supported options * @param array|object $filter Query by which to filter documents * @param array $options Additional options - * @return CursorInterface&Iterator */ - public function findFiles($filter, array $options = []) + public function findFiles(array|object $filter, array $options = []): CursorInterface { return $this->filesCollection->find($filter, $options); } @@ -219,9 +200,8 @@ public function findFiles($filter, array $options = []) * * @param array|object $filter Query by which to filter documents * @param array $options Additional options - * @return array|object|null */ - public function findOneFile($filter, array $options = []) + public function findOneFile(array|object $filter, array $options = []): array|object|null { return $this->filesCollection->findOne($filter, $options); } @@ -251,7 +231,7 @@ public function getFilesCollection(): Collection * * @param array|object $chunk Chunk document */ - public function insertChunk($chunk): void + public function insertChunk(array|object $chunk): void { if (! $this->checkedIndexes) { $this->ensureIndexes(); @@ -267,7 +247,7 @@ public function insertChunk($chunk): void * * @param array|object $file File document */ - public function insertFile($file): void + public function insertFile(array|object $file): void { if (! $this->checkedIndexes) { $this->ensureIndexes(); @@ -279,7 +259,7 @@ public function insertFile($file): void /** * Updates the filename field in the file document for all the files with a given filename. */ - public function updateFilenameForFilename(string $filename, string $newFilename): ?int + public function updateFilenameForFilename(string $filename, string $newFilename): int { return $this->filesCollection->updateMany( ['filename' => $filename], @@ -289,10 +269,8 @@ public function updateFilenameForFilename(string $filename, string $newFilename) /** * Updates the filename field in the file document for a given ID. - * - * @param mixed $id */ - public function updateFilenameForId($id, string $filename): UpdateResult + public function updateFilenameForId(mixed $id, string $filename): UpdateResult { return $this->filesCollection->updateOne( ['_id' => $id], diff --git a/src/GridFS/Exception/CorruptFileException.php b/src/GridFS/Exception/CorruptFileException.php index db1622908..b9feef87d 100644 --- a/src/GridFS/Exception/CorruptFileException.php +++ b/src/GridFS/Exception/CorruptFileException.php @@ -25,6 +25,8 @@ class CorruptFileException extends RuntimeException { /** * Thrown when a chunk doesn't contain valid data. + * + * @internal */ public static function invalidChunkData(int $chunkIndex): self { @@ -35,9 +37,9 @@ public static function invalidChunkData(int $chunkIndex): self * Thrown when a chunk is not found for an expected index. * * @param integer $expectedIndex Expected index number - * @return self + * @internal */ - public static function missingChunk(int $expectedIndex) + public static function missingChunk(int $expectedIndex): self { return new self(sprintf('Chunk not found for index "%d"', $expectedIndex)); } @@ -47,9 +49,9 @@ public static function missingChunk(int $expectedIndex) * * @param integer $index Actual index number (i.e. "n" field) * @param integer $expectedIndex Expected index number - * @return self + * @internal */ - public static function unexpectedIndex(int $index, int $expectedIndex) + public static function unexpectedIndex(int $index, int $expectedIndex): self { return new self(sprintf('Expected chunk to have index "%d" but found "%d"', $expectedIndex, $index)); } @@ -59,9 +61,9 @@ public static function unexpectedIndex(int $index, int $expectedIndex) * * @param integer $size Actual size (i.e. "data" field length) * @param integer $expectedSize Expected size - * @return self + * @internal */ - public static function unexpectedSize(int $size, int $expectedSize) + public static function unexpectedSize(int $size, int $expectedSize): self { return new self(sprintf('Expected chunk to have size "%d" but found "%d"', $expectedSize, $size)); } diff --git a/src/GridFS/Exception/FileNotFoundException.php b/src/GridFS/Exception/FileNotFoundException.php index 9243db6f4..4cf153c08 100644 --- a/src/GridFS/Exception/FileNotFoundException.php +++ b/src/GridFS/Exception/FileNotFoundException.php @@ -28,9 +28,9 @@ class FileNotFoundException extends RuntimeException * Thrown when a file cannot be found by its filename. * * @param string $filename Filename - * @return self + * @internal */ - public static function byFilename(string $filename) + public static function byFilename(string $filename): self { return new self(sprintf('File with name "%s" not found', $filename)); } @@ -41,9 +41,9 @@ public static function byFilename(string $filename) * @param string $filename Filename * @param integer $revision Revision * @param string $namespace Namespace for the files collection - * @return self + * @internal */ - public static function byFilenameAndRevision(string $filename, int $revision, string $namespace) + public static function byFilenameAndRevision(string $filename, int $revision, string $namespace): self { return new self(sprintf('File with name "%s" and revision "%d" not found in "%s"', $filename, $revision, $namespace)); } @@ -53,9 +53,9 @@ public static function byFilenameAndRevision(string $filename, int $revision, st * * @param mixed $id File ID * @param string $namespace Namespace for the files collection - * @return self + * @internal */ - public static function byId($id, string $namespace) + public static function byId(mixed $id, string $namespace): self { $json = Document::fromPHP(['_id' => $id])->toRelaxedExtendedJSON(); diff --git a/src/GridFS/Exception/LogicException.php b/src/GridFS/Exception/LogicException.php index a2b6378c7..a6835423c 100644 --- a/src/GridFS/Exception/LogicException.php +++ b/src/GridFS/Exception/LogicException.php @@ -39,10 +39,9 @@ public static function bucketAliasNotRegistered(string $alias): self /** * Throw when an invalid "gridfs" context option is provided. * - * @param mixed $context * @internal */ - public static function invalidContext($context): self + public static function invalidContext(mixed $context): self { return new self(sprintf('Expected "gridfs" stream context to have type "array" but found "%s"', get_debug_type($context))); } @@ -50,10 +49,9 @@ public static function invalidContext($context): self /** * Thrown when a context is provided with an incorrect collection wrapper. * - * @param mixed $object * @internal */ - public static function invalidContextCollectionWrapper($object): self + public static function invalidContextCollectionWrapper(mixed $object): self { return new self(sprintf('Expected "collectionWrapper" in "gridfs" stream context to have type "%s" but found "%s"', CollectionWrapper::class, get_debug_type($object))); } diff --git a/src/GridFS/Exception/StreamException.php b/src/GridFS/Exception/StreamException.php index 8dab6d668..3fd75ca8c 100644 --- a/src/GridFS/Exception/StreamException.php +++ b/src/GridFS/Exception/StreamException.php @@ -13,6 +13,7 @@ class StreamException extends RuntimeException /** * @param resource $source * @param resource $destination + * @internal */ public static function downloadFromFilenameFailed(string $filename, $source, $destination): self { @@ -23,11 +24,11 @@ public static function downloadFromFilenameFailed(string $filename, $source, $de } /** - * @param mixed $id * @param resource $source * @param resource $destination + * @internal */ - public static function downloadFromIdFailed($id, $source, $destination): self + public static function downloadFromIdFailed(mixed $id, $source, $destination): self { $idString = Document::fromPHP(['_id' => $id])->toRelaxedExtendedJSON(); $sourceMetadata = stream_get_meta_data($source); @@ -36,7 +37,10 @@ public static function downloadFromIdFailed($id, $source, $destination): self return new self(sprintf('Downloading file from "%s" to "%s" failed. GridFS identifier: "%s"', $sourceMetadata['uri'], $destinationMetadata['uri'], $idString)); } - /** @param resource $source */ + /** + * @param resource $source + * @internal + */ public static function uploadFailed(string $filename, $source, string $destinationUri): self { $sourceMetadata = stream_get_meta_data($source); diff --git a/src/GridFS/ReadableStream.php b/src/GridFS/ReadableStream.php index f0e433140..cdc5d2d8d 100644 --- a/src/GridFS/ReadableStream.php +++ b/src/GridFS/ReadableStream.php @@ -17,7 +17,6 @@ namespace MongoDB\GridFS; -use Iterator; use MongoDB\BSON\Binary; use MongoDB\Driver\CursorInterface; use MongoDB\Exception\InvalidArgumentException; @@ -38,7 +37,7 @@ * * @internal */ -class ReadableStream +final class ReadableStream { private ?string $buffer = null; @@ -48,15 +47,10 @@ class ReadableStream private int $chunkOffset = 0; - /** @var (CursorInterface&Iterator)|null */ - private ?Iterator $chunksIterator = null; - - private CollectionWrapper $collectionWrapper; + private ?CursorInterface $chunksIterator = null; private int $expectedLastChunkSize = 0; - private object $file; - private int $length; private int $numChunks = 0; @@ -68,7 +62,7 @@ class ReadableStream * @param object $file GridFS file document * @throws CorruptFileException */ - public function __construct(CollectionWrapper $collectionWrapper, object $file) + public function __construct(private CollectionWrapper $collectionWrapper, private object $file) { if (! isset($file->chunkSize) || ! is_integer($file->chunkSize) || $file->chunkSize < 1) { throw new CorruptFileException('file.chunkSize is not an integer >= 1'); @@ -82,14 +76,11 @@ public function __construct(CollectionWrapper $collectionWrapper, object $file) throw new CorruptFileException('file._id does not exist'); } - $this->file = $file; $this->chunkSize = $file->chunkSize; $this->length = $file->length; - $this->collectionWrapper = $collectionWrapper; - if ($this->length > 0) { - $this->numChunks = (integer) ceil($this->length / $this->chunkSize); + $this->numChunks = (int) ceil($this->length / $this->chunkSize); $this->expectedLastChunkSize = $this->length - (($this->numChunks - 1) * $this->chunkSize); } } @@ -191,7 +182,7 @@ public function seek(int $offset): void * changed, we'll also need to reset the buffer. */ $lastChunkOffset = $this->chunkOffset; - $this->chunkOffset = (integer) floor($offset / $this->chunkSize); + $this->chunkOffset = (int) floor($offset / $this->chunkSize); $this->bufferOffset = $offset % $this->chunkSize; if ($lastChunkOffset === $this->chunkOffset) { diff --git a/src/GridFS/StreamWrapper.php b/src/GridFS/StreamWrapper.php index b433c8dd6..e4f57fa85 100644 --- a/src/GridFS/StreamWrapper.php +++ b/src/GridFS/StreamWrapper.php @@ -49,13 +49,12 @@ * @see Bucket::openDownloadStream() * @psalm-type ContextOptions = array{collectionWrapper: CollectionWrapper, file: object}|array{collectionWrapper: CollectionWrapper, filename: string, options: array} */ -class StreamWrapper +final class StreamWrapper { /** @var resource|null Stream context (set by PHP) */ public $context; - /** @var ReadableStream|WritableStream|null */ - private $stream; + private ReadableStream|WritableStream|null $stream = null; /** @var array */ private static array $contextResolvers = []; @@ -90,7 +89,7 @@ public static function register(string $protocol = 'gridfs'): void stream_wrapper_unregister($protocol); } - stream_wrapper_register($protocol, static::class, STREAM_IS_URL); + stream_wrapper_register($protocol, self::class, STREAM_IS_URL); } /** @@ -316,14 +315,13 @@ public function unlink(string $path): bool return true; } - /** @return false|array */ - public function url_stat(string $path, int $flags) + public function url_stat(string $path, int $flags): false|array { assert($this->stream === null); try { $this->stream_open($path, 'r', 0, $openedPath); - } catch (FileNotFoundException $e) { + } catch (FileNotFoundException) { return false; } diff --git a/src/GridFS/WritableStream.php b/src/GridFS/WritableStream.php index 096968bb6..e7a4e0e63 100644 --- a/src/GridFS/WritableStream.php +++ b/src/GridFS/WritableStream.php @@ -17,7 +17,6 @@ namespace MongoDB\GridFS; -use HashContext; use MongoDB\BSON\Binary; use MongoDB\BSON\ObjectId; use MongoDB\BSON\UTCDateTime; @@ -25,14 +24,8 @@ use MongoDB\Exception\InvalidArgumentException; use function array_intersect_key; -use function hash_final; -use function hash_init; -use function hash_update; -use function is_bool; use function is_integer; -use function is_string; use function MongoDB\is_document; -use function MongoDB\is_string_array; use function sprintf; use function strlen; use function substr; @@ -42,7 +35,7 @@ * * @internal */ -class WritableStream +final class WritableStream { private const DEFAULT_CHUNK_SIZE_BYTES = 261120; @@ -52,14 +45,8 @@ class WritableStream private int $chunkSize; - private bool $disableMD5; - - private CollectionWrapper $collectionWrapper; - private array $file; - private ?HashContext $hashCtx = null; - private bool $isClosed = false; private int $length = 0; @@ -71,19 +58,9 @@ class WritableStream * * * _id (mixed): File document identifier. Defaults to a new ObjectId. * - * * aliases (array of strings): DEPRECATED An array of aliases. - * Applications wishing to store aliases should add an aliases field to - * the metadata document instead. - * * * chunkSizeBytes (integer): The chunk size in bytes. Defaults to * 261120 (i.e. 255 KiB). * - * * disableMD5 (boolean): When true, no MD5 sum will be generated. - * Defaults to "false". - * - * * contentType (string): DEPRECATED content type to be stored with the - * file. This information should now be added to the metadata. - * * * metadata (document): User data for the "metadata" field of the files * collection document. * @@ -92,18 +69,13 @@ class WritableStream * @param array $options Upload options * @throws InvalidArgumentException */ - public function __construct(CollectionWrapper $collectionWrapper, string $filename, array $options = []) + public function __construct(private CollectionWrapper $collectionWrapper, string $filename, array $options = []) { $options += [ '_id' => new ObjectId(), 'chunkSizeBytes' => self::DEFAULT_CHUNK_SIZE_BYTES, - 'disableMD5' => false, ]; - if (isset($options['aliases']) && ! is_string_array($options['aliases'])) { - throw InvalidArgumentException::invalidType('"aliases" option', $options['aliases'], 'array of strings'); - } - if (! is_integer($options['chunkSizeBytes'])) { throw InvalidArgumentException::invalidType('"chunkSizeBytes" option', $options['chunkSizeBytes'], 'integer'); } @@ -112,33 +84,18 @@ public function __construct(CollectionWrapper $collectionWrapper, string $filena throw new InvalidArgumentException(sprintf('Expected "chunkSizeBytes" option to be >= 1, %d given', $options['chunkSizeBytes'])); } - if (! is_bool($options['disableMD5'])) { - throw InvalidArgumentException::invalidType('"disableMD5" option', $options['disableMD5'], 'boolean'); - } - - if (isset($options['contentType']) && ! is_string($options['contentType'])) { - throw InvalidArgumentException::invalidType('"contentType" option', $options['contentType'], 'string'); - } - if (isset($options['metadata']) && ! is_document($options['metadata'])) { throw InvalidArgumentException::expectedDocumentType('"metadata" option', $options['metadata']); } $this->chunkSize = $options['chunkSizeBytes']; - $this->collectionWrapper = $collectionWrapper; - $this->disableMD5 = $options['disableMD5']; - - if (! $this->disableMD5) { - $this->hashCtx = hash_init('md5'); - } - $this->file = [ '_id' => $options['_id'], 'chunkSize' => $this->chunkSize, 'filename' => $filename, 'length' => null, 'uploadDate' => null, - ] + array_intersect_key($options, ['aliases' => 1, 'contentType' => 1, 'metadata' => 1]); + ] + array_intersect_key($options, ['metadata' => 1]); } /** @@ -239,7 +196,7 @@ private function abort(): void { try { $this->collectionWrapper->deleteChunksByFilesId($this->file['_id']); - } catch (DriverRuntimeException $e) { + } catch (DriverRuntimeException) { // We are already handling an error if abort() is called, so suppress this } @@ -251,10 +208,6 @@ private function fileCollectionInsert(): void $this->file['length'] = $this->length; $this->file['uploadDate'] = new UTCDateTime(); - if (! $this->disableMD5 && $this->hashCtx) { - $this->file['md5'] = hash_final($this->hashCtx); - } - try { $this->collectionWrapper->insertFile($this->file); } catch (DriverRuntimeException $e) { @@ -279,10 +232,6 @@ private function insertChunkFromBuffer(): void 'data' => new Binary($data), ]; - if (! $this->disableMD5 && $this->hashCtx) { - hash_update($this->hashCtx, $data); - } - try { $this->collectionWrapper->insertChunk($chunk); } catch (DriverRuntimeException $e) { diff --git a/src/InsertManyResult.php b/src/InsertManyResult.php index f8c33ad0b..2f27bd24e 100644 --- a/src/InsertManyResult.php +++ b/src/InsertManyResult.php @@ -17,25 +17,16 @@ namespace MongoDB; +use MongoDB\Driver\Exception\LogicException; use MongoDB\Driver\WriteResult; -use MongoDB\Exception\BadMethodCallException; /** * Result class for a multi-document insert operation. */ class InsertManyResult { - private WriteResult $writeResult; - - private array $insertedIds; - - private bool $isAcknowledged; - - public function __construct(WriteResult $writeResult, array $insertedIds) + public function __construct(private WriteResult $writeResult, private array $insertedIds) { - $this->writeResult = $writeResult; - $this->insertedIds = $insertedIds; - $this->isAcknowledged = $writeResult->isAcknowledged(); } /** @@ -44,16 +35,11 @@ public function __construct(WriteResult $writeResult, array $insertedIds) * This method should only be called if the write was acknowledged. * * @see InsertManyResult::isAcknowledged() - * @return integer|null - * @throws BadMethodCallException if the write result is unacknowledged + * @throws LogicException if the write result is unacknowledged */ - public function getInsertedCount() + public function getInsertedCount(): int { - if ($this->isAcknowledged) { - return $this->writeResult->getInsertedCount(); - } - - throw BadMethodCallException::unacknowledgedWriteResultAccess(__METHOD__); + return $this->writeResult->getInsertedCount(); } /** @@ -64,10 +50,8 @@ public function getInsertedCount() * the driver did not generate an ID), the index will contain its "_id" * field value. Any driver-generated ID will be a MongoDB\BSON\ObjectId * instance. - * - * @return array */ - public function getInsertedIds() + public function getInsertedIds(): array { return $this->insertedIds; } @@ -77,10 +61,8 @@ public function getInsertedIds() * * If the insert was not acknowledged, other fields from the WriteResult * (e.g. insertedCount) will be undefined. - * - * @return boolean */ - public function isAcknowledged() + public function isAcknowledged(): bool { return $this->writeResult->isAcknowledged(); } diff --git a/src/InsertOneResult.php b/src/InsertOneResult.php index da851d204..47e1d26bc 100644 --- a/src/InsertOneResult.php +++ b/src/InsertOneResult.php @@ -17,27 +17,16 @@ namespace MongoDB; +use MongoDB\Driver\Exception\LogicException; use MongoDB\Driver\WriteResult; -use MongoDB\Exception\BadMethodCallException; /** * Result class for a single-document insert operation. */ class InsertOneResult { - private WriteResult $writeResult; - - /** @var mixed */ - private $insertedId; - - private bool $isAcknowledged; - - /** @param mixed $insertedId */ - public function __construct(WriteResult $writeResult, $insertedId) + public function __construct(private WriteResult $writeResult, private mixed $insertedId) { - $this->writeResult = $writeResult; - $this->insertedId = $insertedId; - $this->isAcknowledged = $writeResult->isAcknowledged(); } /** @@ -46,16 +35,11 @@ public function __construct(WriteResult $writeResult, $insertedId) * This method should only be called if the write was acknowledged. * * @see InsertOneResult::isAcknowledged() - * @return integer|null - * @throws BadMethodCallException if the write result is unacknowledged + * @throws LogicException if the write result is unacknowledged */ - public function getInsertedCount() + public function getInsertedCount(): int { - if ($this->isAcknowledged) { - return $this->writeResult->getInsertedCount(); - } - - throw BadMethodCallException::unacknowledgedWriteResultAccess(__METHOD__); + return $this->writeResult->getInsertedCount(); } /** @@ -64,10 +48,8 @@ public function getInsertedCount() * If the document had an ID prior to inserting (i.e. the driver did not * need to generate an ID), this will contain its "_id". Any * driver-generated ID will be a MongoDB\BSON\ObjectId instance. - * - * @return mixed */ - public function getInsertedId() + public function getInsertedId(): mixed { return $this->insertedId; } @@ -81,10 +63,8 @@ public function getInsertedId() * If the insert was not acknowledged, other fields from the WriteResult * (e.g. insertedCount) will be undefined and their getter methods should * not be invoked. - * - * @return boolean */ - public function isAcknowledged() + public function isAcknowledged(): bool { return $this->writeResult->isAcknowledged(); } diff --git a/src/MapReduceResult.php b/src/MapReduceResult.php deleted file mode 100644 index 00a75116a..000000000 --- a/src/MapReduceResult.php +++ /dev/null @@ -1,111 +0,0 @@ - - * @psalm-type MapReduceCallable = callable(): Traversable - */ -class MapReduceResult implements IteratorAggregate -{ - /** - * @var callable - * @psalm-var MapReduceCallable - */ - private $getIterator; - - private int $executionTimeMS; - - private array $counts; - - private array $timing; - - /** - * Returns various count statistics from the mapReduce command. - * - * @return array - */ - public function getCounts() - { - return $this->counts; - } - - /** - * Return the command execution time in milliseconds. - * - * @return integer - */ - public function getExecutionTimeMS() - { - return $this->executionTimeMS; - } - - /** - * Return the mapReduce results as a Traversable. - * - * @see https://php.net/iteratoraggregate.getiterator - * @return Traversable - */ - #[ReturnTypeWillChange] - public function getIterator() - { - return call_user_func($this->getIterator); - } - - /** - * Returns various timing statistics from the mapReduce command. - * - * Note: timing statistics are only available if the mapReduce command's - * "verbose" option was true; otherwise, an empty array will be returned. - * - * @return array - */ - public function getTiming() - { - return $this->timing; - } - - /** - * @internal - * @param callable $getIterator Callback that returns a Traversable for mapReduce results - * @param stdClass $result Result document from the mapReduce command - * @psalm-param MapReduceCallable $getIterator - */ - public function __construct(callable $getIterator, stdClass $result) - { - $this->getIterator = $getIterator; - $this->executionTimeMS = isset($result->timeMillis) ? (integer) $result->timeMillis : 0; - $this->counts = isset($result->counts) ? (array) $result->counts : []; - $this->timing = isset($result->timing) ? (array) $result->timing : []; - } -} diff --git a/src/Model/BSONArray.php b/src/Model/BSONArray.php index f055f4cb7..040350ce4 100644 --- a/src/Model/BSONArray.php +++ b/src/Model/BSONArray.php @@ -21,7 +21,6 @@ use JsonSerializable; use MongoDB\BSON\Serializable; use MongoDB\BSON\Unserializable; -use ReturnTypeWillChange; use function array_values; use function MongoDB\recursive_copy; @@ -51,9 +50,8 @@ public function __clone() * * @see https://php.net/oop5.magic#object.set-state * @see https://php.net/var-export - * @return self */ - public static function __set_state(array $properties) + public static function __set_state(array $properties): self { $array = new self(); $array->exchangeArray($properties); @@ -68,10 +66,8 @@ public static function __set_state(array $properties) * as a BSON array. * * @see https://php.net/mongodb-bson-serializable.bsonserialize - * @return array */ - #[ReturnTypeWillChange] - public function bsonSerialize() + public function bsonSerialize(): array { return array_values($this->getArrayCopy()); } @@ -82,8 +78,7 @@ public function bsonSerialize() * @see https://php.net/mongodb-bson-unserializable.bsonunserialize * @param array $data Array data */ - #[ReturnTypeWillChange] - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data); } @@ -95,10 +90,8 @@ public function bsonUnserialize(array $data) * as a JSON array. * * @see https://php.net/jsonserializable.jsonserialize - * @return array */ - #[ReturnTypeWillChange] - public function jsonSerialize() + public function jsonSerialize(): array { return array_values($this->getArrayCopy()); } diff --git a/src/Model/BSONDocument.php b/src/Model/BSONDocument.php index b9a9c0d80..545f08dc0 100644 --- a/src/Model/BSONDocument.php +++ b/src/Model/BSONDocument.php @@ -22,7 +22,6 @@ use JsonSerializable; use MongoDB\BSON\Serializable; use MongoDB\BSON\Unserializable; -use ReturnTypeWillChange; use stdClass; use function MongoDB\recursive_copy; @@ -52,10 +51,10 @@ public function __clone() * by default. * * @see https://php.net/arrayobject.construct - * @param array $input + * @param array|stdClass $input * @psalm-param class-string>|class-string> $iteratorClass */ - public function __construct(array $input = [], int $flags = ArrayObject::ARRAY_AS_PROPS, string $iteratorClass = ArrayIterator::class) + public function __construct(array|stdClass $input = [], int $flags = ArrayObject::ARRAY_AS_PROPS, string $iteratorClass = ArrayIterator::class) { parent::__construct($input, $flags, $iteratorClass); } @@ -65,9 +64,8 @@ public function __construct(array $input = [], int $flags = ArrayObject::ARRAY_A * * @see https://php.net/oop5.magic#object.set-state * @see https://php.net/var-export - * @return self */ - public static function __set_state(array $properties) + public static function __set_state(array $properties): self { $document = new self(); $document->exchangeArray($properties); @@ -79,10 +77,8 @@ public static function __set_state(array $properties) * Serialize the document to BSON. * * @see https://php.net/mongodb-bson-serializable.bsonserialize - * @return stdClass */ - #[ReturnTypeWillChange] - public function bsonSerialize() + public function bsonSerialize(): stdClass { return (object) $this->getArrayCopy(); } @@ -93,8 +89,7 @@ public function bsonSerialize() * @see https://php.net/mongodb-bson-unserializable.bsonunserialize * @param array $data Array data */ - #[ReturnTypeWillChange] - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data, ArrayObject::ARRAY_AS_PROPS); } @@ -103,10 +98,8 @@ public function bsonUnserialize(array $data) * Serialize the array to JSON. * * @see https://php.net/jsonserializable.jsonserialize - * @return object */ - #[ReturnTypeWillChange] - public function jsonSerialize() + public function jsonSerialize(): stdClass { return (object) $this->getArrayCopy(); } diff --git a/src/Model/BSONIterator.php b/src/Model/BSONIterator.php index 43dae2ed2..e90901173 100644 --- a/src/Model/BSONIterator.php +++ b/src/Model/BSONIterator.php @@ -21,7 +21,6 @@ use MongoDB\BSON\Document; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Exception\UnexpectedValueException; -use ReturnTypeWillChange; use function assert; use function is_array; @@ -44,54 +43,34 @@ class BSONIterator implements Iterator private int $bufferLength; - /** @var array|object|null */ - private $current = null; + private array|object|null $current = null; private int $key = 0; private int $position = 0; - /** @var array{typeMap: array, ...} */ - private array $options; - - /** - * @see https://php.net/iterator.current - * @return mixed - */ - #[ReturnTypeWillChange] - public function current() + /** @see https://php.net/iterator.current */ + public function current(): mixed { return $this->current; } - /** - * @see https://php.net/iterator.key - * @return int - */ - #[ReturnTypeWillChange] - public function key() + /** @see https://php.net/iterator.key */ + public function key(): int { return $this->key; } - /** - * @see https://php.net/iterator.next - * @return void - */ - #[ReturnTypeWillChange] - public function next() + /** @see https://php.net/iterator.next */ + public function next(): void { $this->key++; $this->current = null; $this->advance(); } - /** - * @see https://php.net/iterator.rewind - * @return void - */ - #[ReturnTypeWillChange] - public function rewind() + /** @see https://php.net/iterator.rewind */ + public function rewind(): void { $this->key = 0; $this->position = 0; @@ -100,7 +79,6 @@ public function rewind() } /** @see https://php.net/iterator.valid */ - #[ReturnTypeWillChange] public function valid(): bool { return $this->current !== null; @@ -119,19 +97,18 @@ public function valid(): bool * @param array $options Iterator options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $data, array $options = []) + public function __construct(string $data, private array $options = []) { if (isset($options['typeMap']) && ! is_array($options['typeMap'])) { throw InvalidArgumentException::invalidType('"typeMap" option', $options['typeMap'], 'array'); } if (! isset($options['typeMap'])) { - $options['typeMap'] = []; + $this->options['typeMap'] = []; } $this->buffer = $data; $this->bufferLength = strlen($data); - $this->options = $options; } private function advance(): void diff --git a/src/Model/CachingIterator.php b/src/Model/CachingIterator.php index 15ba7ca1a..64c61708f 100644 --- a/src/Model/CachingIterator.php +++ b/src/Model/CachingIterator.php @@ -20,7 +20,6 @@ use Countable; use Iterator; use IteratorIterator; -use ReturnTypeWillChange; use Traversable; use function count; @@ -40,7 +39,7 @@ * @template TValue * @template-implements Iterator */ -class CachingIterator implements Countable, Iterator +final class CachingIterator implements Countable, Iterator { private const FIELD_KEY = 0; private const FIELD_VALUE = 1; @@ -79,12 +78,8 @@ public function count(): int return count($this->items); } - /** - * @see https://php.net/iterator.current - * @return mixed - */ - #[ReturnTypeWillChange] - public function current() + /** @see https://php.net/iterator.current */ + public function current(): mixed { $currentItem = current($this->items); @@ -93,11 +88,9 @@ public function current() /** * @see https://php.net/iterator.key - * @return mixed * @psalm-return TKey|null */ - #[ReturnTypeWillChange] - public function key() + public function key(): mixed { $currentItem = current($this->items); diff --git a/src/Model/CallbackIterator.php b/src/Model/CallbackIterator.php index ea429ccbc..4a8e5dda9 100644 --- a/src/Model/CallbackIterator.php +++ b/src/Model/CallbackIterator.php @@ -19,7 +19,6 @@ use Iterator; use IteratorIterator; -use ReturnTypeWillChange; use Traversable; use function call_user_func; @@ -29,12 +28,12 @@ * * @internal * - * @template TKey + * @template TKey of array-key * @template TValue * @template TCallbackValue * @template-implements Iterator */ -class CallbackIterator implements Iterator +final class CallbackIterator implements Iterator { /** @var callable(TValue, TKey): TCallbackValue */ private $callback; @@ -56,8 +55,7 @@ public function __construct(Traversable $traversable, callable $callback) * @see https://php.net/iterator.current * @return TCallbackValue */ - #[ReturnTypeWillChange] - public function current() + public function current(): mixed { return call_user_func($this->callback, $this->iterator->current(), $this->iterator->key()); } @@ -66,8 +64,7 @@ public function current() * @see https://php.net/iterator.key * @return TKey */ - #[ReturnTypeWillChange] - public function key() + public function key(): mixed { return $this->iterator->key(); } diff --git a/src/Model/ChangeStreamIterator.php b/src/Model/ChangeStreamIterator.php index d2a9b6ac8..4cd7a57af 100644 --- a/src/Model/ChangeStreamIterator.php +++ b/src/Model/ChangeStreamIterator.php @@ -17,7 +17,6 @@ namespace MongoDB\Model; -use Iterator; use IteratorIterator; use MongoDB\BSON\Document; use MongoDB\BSON\Serializable; @@ -30,7 +29,6 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Exception\ResumeTokenException; use MongoDB\Exception\UnexpectedValueException; -use ReturnTypeWillChange; use function assert; use function count; @@ -49,9 +47,9 @@ * * @internal * @template TValue of array|object - * @template-extends IteratorIterator&Iterator> + * @template-extends IteratorIterator> */ -class ChangeStreamIterator extends IteratorIterator implements CommandSubscriber +final class ChangeStreamIterator extends IteratorIterator implements CommandSubscriber { private int $batchPosition = 0; @@ -61,37 +59,31 @@ class ChangeStreamIterator extends IteratorIterator implements CommandSubscriber private bool $isValid = false; - private ?object $postBatchResumeToken = null; - - /** @var array|object|null */ - private $resumeToken; + private array|object|null $resumeToken = null; private Server $server; /** * @see https://php.net/iteratoriterator.current - * @return array|object|null * @psalm-return TValue|null */ - #[ReturnTypeWillChange] - public function current() + public function current(): array|object|null { return $this->valid() ? parent::current() : null; } /** - * Necessary to let psalm know that we're always expecting a cursor as inner - * iterator. This could be side-stepped due to the class not being final, - * but it's very much an invalid use-case. This method can be dropped in 2.0 - * once the class is final. + * This method is necessary as psalm does not properly set the return type + * of IteratorIterator::getInnerIterator to the templated iterator + * + * @see https://github.com/vimeo/psalm/pull/11100. * - * @return CursorInterface&Iterator + * @return CursorInterface */ - final public function getInnerIterator(): Iterator + public function getInnerIterator(): CursorInterface { $cursor = parent::getInnerIterator(); assert($cursor instanceof CursorInterface); - assert($cursor instanceof Iterator); return $cursor; } @@ -102,10 +94,8 @@ final public function getInnerIterator(): Iterator * Null may be returned if no change documents have been iterated and the * server did not include a postBatchResumeToken in its aggregate or getMore * command response. - * - * @return array|object|null */ - public function getResumeToken() + public function getResumeToken(): array|object|null { return $this->resumeToken; } @@ -118,12 +108,8 @@ public function getServer(): Server return $this->server; } - /** - * @see https://php.net/iteratoriterator.key - * @return int|null - */ - #[ReturnTypeWillChange] - public function key() + /** @see https://php.net/iteratoriterator.key */ + public function key(): ?int { return $this->valid() ? parent::key() : null; } @@ -176,19 +162,10 @@ public function valid(): bool /** * @internal - * @param array|object|null $initialResumeToken - * @psalm-param CursorInterface&Iterator $cursor + * @psalm-param CursorInterface $cursor */ - public function __construct(CursorInterface $cursor, int $firstBatchSize, $initialResumeToken, ?object $postBatchResumeToken) + public function __construct(CursorInterface $cursor, int $firstBatchSize, array|object|null $initialResumeToken, private ?object $postBatchResumeToken = null) { - if (! $cursor instanceof Iterator) { - throw InvalidArgumentException::invalidType( - '$cursor', - $cursor, - CursorInterface::class . '&' . Iterator::class, - ); - } - if (isset($initialResumeToken) && ! is_document($initialResumeToken)) { throw InvalidArgumentException::expectedDocumentType('$initialResumeToken', $initialResumeToken); } @@ -197,7 +174,6 @@ public function __construct(CursorInterface $cursor, int $firstBatchSize, $initi $this->batchSize = $firstBatchSize; $this->isRewindNop = ($firstBatchSize === 0); - $this->postBatchResumeToken = $postBatchResumeToken; $this->resumeToken = $initialResumeToken; $this->server = $cursor->getServer(); } @@ -243,11 +219,10 @@ final public function commandSucceeded(CommandSucceededEvent $event): void * Extracts the resume token (i.e. "_id" field) from a change document. * * @param array|object $document Change document - * @return array|object * @throws InvalidArgumentException * @throws ResumeTokenException if the resume token is not found or invalid */ - private function extractResumeToken($document) + private function extractResumeToken(array|object $document): array|object { if (! is_document($document)) { throw InvalidArgumentException::expectedDocumentType('$document', $document); @@ -295,7 +270,7 @@ private function isAtEndOfBatch(): bool /** * Perform housekeeping after an iteration event. * - * @see https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.rst#updating-the-cached-resume-token + * @see https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.md#updating-the-cached-resume-token */ private function onIteration(bool $incrementBatchPosition): void { diff --git a/src/Model/CodecCursor.php b/src/Model/CodecCursor.php index c6f0cb099..d7a3776b2 100644 --- a/src/Model/CodecCursor.php +++ b/src/Model/CodecCursor.php @@ -17,38 +17,27 @@ namespace MongoDB\Model; -use Iterator; use MongoDB\BSON\Document; use MongoDB\BSON\Int64; use MongoDB\Codec\DocumentCodec; -use MongoDB\Driver\Cursor; -use MongoDB\Driver\CursorId; use MongoDB\Driver\CursorInterface; use MongoDB\Driver\Server; -use ReturnTypeWillChange; use function assert; use function iterator_to_array; use function sprintf; use function trigger_error; -use const E_USER_DEPRECATED; use const E_USER_WARNING; /** * @template TValue of object - * @template-implements CursorInterface - * @template-implements Iterator + * @template-implements CursorInterface */ -class CodecCursor implements CursorInterface, Iterator +class CodecCursor implements CursorInterface { private const TYPEMAP = ['root' => 'bson']; - private Cursor $cursor; - - /** @var DocumentCodec */ - private DocumentCodec $codec; - /** @var TValue|null */ private ?object $current = null; @@ -69,33 +58,16 @@ public function current(): ?object * @param DocumentCodec $codec * @return self */ - public static function fromCursor(Cursor $cursor, DocumentCodec $codec): self + public static function fromCursor(CursorInterface $cursor, DocumentCodec $codec): self { $cursor->setTypeMap(self::TYPEMAP); return new self($cursor, $codec); } - /** - * @return CursorId|Int64 - * @psalm-return ($asInt64 is true ? Int64 : CursorId) - */ - #[ReturnTypeWillChange] - public function getId(bool $asInt64 = false) + public function getId(): Int64 { - if (! $asInt64) { - @trigger_error( - sprintf( - 'The method "%s" will no longer return a "%s" instance in the future. Pass "true" as argument to change to the new behavior and receive a "%s" instance instead.', - __METHOD__, - CursorId::class, - Int64::class, - ), - E_USER_DEPRECATED, - ); - } - - return $this->cursor->getId($asInt64); + return $this->cursor->getId(); } public function getServer(): Server @@ -143,9 +115,7 @@ public function valid(): bool } /** @param DocumentCodec $codec */ - private function __construct(Cursor $cursor, DocumentCodec $codec) + private function __construct(private CursorInterface $cursor, private DocumentCodec $codec) { - $this->cursor = $cursor; - $this->codec = $codec; } } diff --git a/src/Model/CollectionInfo.php b/src/Model/CollectionInfo.php index 20f72b14e..3d273e598 100644 --- a/src/Model/CollectionInfo.php +++ b/src/Model/CollectionInfo.php @@ -19,7 +19,6 @@ use ArrayAccess; use MongoDB\Exception\BadMethodCallException; -use ReturnTypeWillChange; use function array_key_exists; @@ -31,26 +30,22 @@ * collection. It provides methods to access options for the collection. * * @see \MongoDB\Database::listCollections() - * @see https://github.com/mongodb/specifications/blob/master/source/enumerate-collections.rst + * @see https://github.com/mongodb/specifications/blob/master/source/enumerate-collections.md * @template-implements ArrayAccess */ class CollectionInfo implements ArrayAccess { - private array $info; - /** @param array $info Collection info */ - public function __construct(array $info) + public function __construct(private array $info) { - $this->info = $info; } /** * Return the collection info as an array. * * @see https://php.net/oop5.magic#language.oop5.magic.debuginfo - * @return array */ - public function __debugInfo() + public function __debugInfo(): array { return $this->info; } @@ -59,26 +54,22 @@ public function __debugInfo() * Return the maximum number of documents to keep in the capped collection. * * @deprecated 1.0 Deprecated in favor of using getOptions - * - * @return integer|null */ - public function getCappedMax() + public function getCappedMax(): ?int { /* The MongoDB server might return this number as an integer or float */ - return isset($this->info['options']['max']) ? (integer) $this->info['options']['max'] : null; + return isset($this->info['options']['max']) ? (int) $this->info['options']['max'] : null; } /** * Return the maximum size (in bytes) of the capped collection. * * @deprecated 1.0 Deprecated in favor of using getOptions - * - * @return integer|null */ - public function getCappedSize() + public function getCappedSize(): ?int { /* The MongoDB server might return this number as an integer or float */ - return isset($this->info['options']['size']) ? (integer) $this->info['options']['size'] : null; + return isset($this->info['options']['size']) ? (int) $this->info['options']['size'] : null; } /** @@ -103,9 +94,8 @@ public function getInfo(): array * Return the collection name. * * @see https://mongodb.com/docs/manual/reference/command/listCollections/#output - * @return string */ - public function getName() + public function getName(): string { return (string) $this->info['name']; } @@ -114,9 +104,8 @@ public function getName() * Return the collection options. * * @see https://mongodb.com/docs/manual/reference/command/listCollections/#output - * @return array */ - public function getOptions() + public function getOptions(): array { return (array) ($this->info['options'] ?? []); } @@ -135,24 +124,27 @@ public function getType(): string * Return whether the collection is a capped collection. * * @deprecated 1.0 Deprecated in favor of using getOptions - * - * @return boolean */ - public function isCapped() + public function isCapped(): bool { return ! empty($this->info['options']['capped']); } + /** + * Determines whether the collection is a view. + */ + public function isView(): bool + { + return $this->getType() === 'view'; + } + /** * Check whether a field exists in the collection information. * * @see https://php.net/arrayaccess.offsetexists - * @param mixed $offset - * @return boolean * @psalm-param array-key $offset */ - #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists(mixed $offset): bool { return array_key_exists($offset, $this->info); } @@ -161,12 +153,9 @@ public function offsetExists($offset) * Return the field's value from the collection information. * * @see https://php.net/arrayaccess.offsetget - * @param mixed $offset - * @return mixed * @psalm-param array-key $offset */ - #[ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset): mixed { return $this->info[$offset]; } @@ -175,13 +164,9 @@ public function offsetGet($offset) * Not supported. * * @see https://php.net/arrayaccess.offsetset - * @param mixed $offset - * @param mixed $value * @throws BadMethodCallException - * @return void */ - #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet(mixed $offset, mixed $value): void { throw BadMethodCallException::classIsImmutable(self::class); } @@ -190,12 +175,9 @@ public function offsetSet($offset, $value) * Not supported. * * @see https://php.net/arrayaccess.offsetunset - * @param mixed $offset * @throws BadMethodCallException - * @return void */ - #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset(mixed $offset): void { throw BadMethodCallException::classIsImmutable(self::class); } diff --git a/src/Model/CollectionInfoCommandIterator.php b/src/Model/CollectionInfoCommandIterator.php deleted file mode 100644 index 72106eabd..000000000 --- a/src/Model/CollectionInfoCommandIterator.php +++ /dev/null @@ -1,64 +0,0 @@ -> - */ -class CollectionInfoCommandIterator extends IteratorIterator implements CollectionInfoIterator -{ - private ?string $databaseName = null; - - /** @param Traversable $iterator */ - public function __construct(Traversable $iterator, ?string $databaseName = null) - { - parent::__construct($iterator); - - $this->databaseName = $databaseName; - } - - /** - * Return the current element as a CollectionInfo instance. - * - * @see CollectionInfoIterator::current() - * @see https://php.net/iterator.current - */ - public function current(): CollectionInfo - { - $info = parent::current(); - - if ($this->databaseName !== null && isset($info['idIndex']) && ! isset($info['idIndex']['ns'])) { - $info['idIndex']['ns'] = $this->databaseName . '.' . $info['name']; - } - - return new CollectionInfo($info); - } -} diff --git a/src/Model/CollectionInfoIterator.php b/src/Model/CollectionInfoIterator.php deleted file mode 100644 index e7ebf4984..000000000 --- a/src/Model/CollectionInfoIterator.php +++ /dev/null @@ -1,41 +0,0 @@ - - */ -interface CollectionInfoIterator extends Iterator -{ - /** - * Return the current element as a CollectionInfo instance. - * - * @return CollectionInfo - */ - #[ReturnTypeWillChange] - public function current(); -} diff --git a/src/Model/DatabaseInfo.php b/src/Model/DatabaseInfo.php index 05cb312b9..4e8fd8c51 100644 --- a/src/Model/DatabaseInfo.php +++ b/src/Model/DatabaseInfo.php @@ -19,7 +19,6 @@ use ArrayAccess; use MongoDB\Exception\BadMethodCallException; -use ReturnTypeWillChange; use function array_key_exists; @@ -35,66 +34,53 @@ */ class DatabaseInfo implements ArrayAccess { - private array $info; - /** @param array $info Database info */ - public function __construct(array $info) + public function __construct(private array $info) { - $this->info = $info; } /** * Return the database info as an array. * * @see https://php.net/oop5.magic#language.oop5.magic.debuginfo - * @return array */ - public function __debugInfo() + public function __debugInfo(): array { return $this->info; } /** * Return the database name. - * - * @return string */ - public function getName() + public function getName(): string { return (string) $this->info['name']; } /** * Return the databases size on disk (in bytes). - * - * @return integer */ - public function getSizeOnDisk() + public function getSizeOnDisk(): int { /* The MongoDB server might return this number as an integer or float */ - return (integer) $this->info['sizeOnDisk']; + return (int) $this->info['sizeOnDisk']; } /** * Return whether the database is empty. - * - * @return boolean */ - public function isEmpty() + public function isEmpty(): bool { - return (boolean) $this->info['empty']; + return (bool) $this->info['empty']; } /** * Check whether a field exists in the database information. * * @see https://php.net/arrayaccess.offsetexists - * @param mixed $offset - * @return boolean * @psalm-param array-key $offset */ - #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists(mixed $offset): bool { return array_key_exists($offset, $this->info); } @@ -103,12 +89,9 @@ public function offsetExists($offset) * Return the field's value from the database information. * * @see https://php.net/arrayaccess.offsetget - * @param mixed $offset - * @return mixed * @psalm-param array-key $offset */ - #[ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset): mixed { return $this->info[$offset]; } @@ -117,13 +100,9 @@ public function offsetGet($offset) * Not supported. * * @see https://php.net/arrayaccess.offsetset - * @param mixed $offset - * @param mixed $value * @throws BadMethodCallException - * @return void */ - #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet(mixed $offset, mixed $value): void { throw BadMethodCallException::classIsImmutable(self::class); } @@ -132,12 +111,9 @@ public function offsetSet($offset, $value) * Not supported. * * @see https://php.net/arrayaccess.offsetunset - * @param mixed $offset * @throws BadMethodCallException - * @return void */ - #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset(mixed $offset): void { throw BadMethodCallException::classIsImmutable(self::class); } diff --git a/src/Model/DatabaseInfoIterator.php b/src/Model/DatabaseInfoIterator.php deleted file mode 100644 index 72199bd32..000000000 --- a/src/Model/DatabaseInfoIterator.php +++ /dev/null @@ -1,41 +0,0 @@ - - */ -interface DatabaseInfoIterator extends Iterator -{ - /** - * Return the current element as a DatabaseInfo instance. - * - * @return DatabaseInfo - */ - #[ReturnTypeWillChange] - public function current(); -} diff --git a/src/Model/DatabaseInfoLegacyIterator.php b/src/Model/DatabaseInfoLegacyIterator.php deleted file mode 100644 index cfbcedb38..000000000 --- a/src/Model/DatabaseInfoLegacyIterator.php +++ /dev/null @@ -1,95 +0,0 @@ -databases = $databases; - } - - /** - * Return the current element as a DatabaseInfo instance. - * - * @see DatabaseInfoIterator::current() - * @see https://php.net/iterator.current - */ - public function current(): DatabaseInfo - { - return new DatabaseInfo(current($this->databases)); - } - - /** - * Return the key of the current element. - * - * @see https://php.net/iterator.key - */ - public function key(): int - { - return key($this->databases); - } - - /** - * Move forward to next element. - * - * @see https://php.net/iterator.next - */ - public function next(): void - { - next($this->databases); - } - - /** - * Rewind the Iterator to the first element. - * - * @see https://php.net/iterator.rewind - */ - public function rewind(): void - { - reset($this->databases); - } - - /** - * Checks if current position is valid. - * - * @see https://php.net/iterator.valid - */ - public function valid(): bool - { - return key($this->databases) !== null; - } -} diff --git a/src/Model/IndexInfo.php b/src/Model/IndexInfo.php index 601a0a75f..86ae3dc6b 100644 --- a/src/Model/IndexInfo.php +++ b/src/Model/IndexInfo.php @@ -19,13 +19,10 @@ use ArrayAccess; use MongoDB\Exception\BadMethodCallException; -use ReturnTypeWillChange; +use Stringable; use function array_key_exists; use function array_search; -use function trigger_error; - -use const E_USER_DEPRECATED; /** * Index information model class. @@ -38,125 +35,81 @@ * db.collection.createIndex() documentation. * * @see \MongoDB\Collection::listIndexes() - * @see https://github.com/mongodb/specifications/blob/master/source/enumerate-indexes.rst + * @see https://github.com/mongodb/specifications/blob/master/source/enumerate-indexes.md * @see https://mongodb.com/docs/manual/reference/method/db.collection.createIndex/ * @template-implements ArrayAccess */ -class IndexInfo implements ArrayAccess +class IndexInfo implements ArrayAccess, Stringable { - private array $info; - /** @param array $info Index info */ - public function __construct(array $info) + public function __construct(private array $info) { - $this->info = $info; } /** * Return the collection info as an array. * * @see https://php.net/oop5.magic#language.oop5.magic.debuginfo - * @return array */ - public function __debugInfo() + public function __debugInfo(): array { return $this->info; } /** * Return the index name to allow casting IndexInfo to string. - * - * @return string */ - public function __toString() + public function __toString(): string { return $this->getName(); } /** * Return the index key. - * - * @return array */ - public function getKey() + public function getKey(): array { return (array) $this->info['key']; } /** * Return the index name. - * - * @return string */ - public function getName() + public function getName(): string { return (string) $this->info['name']; } - /** - * Return the index namespace (e.g. "db.collection"). - * - * @deprecated - * - * @return string - */ - public function getNamespace() - { - @trigger_error('MongoDB 4.4 drops support for the namespace in indexes, the method "IndexInfo::getNamespace()" will be removed in a future release', E_USER_DEPRECATED); - - return (string) $this->info['ns']; - } - /** * Return the index version. - * - * @return integer */ - public function getVersion() + public function getVersion(): int { - return (integer) $this->info['v']; + return (int) $this->info['v']; } /** * Return whether or not this index is of type 2dsphere. - * - * @return boolean */ - public function is2dSphere() + public function is2dSphere(): bool { return array_search('2dsphere', $this->getKey(), true) !== false; } - /** - * Return whether or not this index is of type geoHaystack. - * - * @return boolean - * @deprecated Since 1.16: MongoDB 5.0 removes support for geoHaystack indexes. - */ - public function isGeoHaystack() - { - @trigger_error('MongoDB 5.0 removes support for "geoHaystack" indexes, the method "IndexInfo::isGeoHaystack()" will be removed in a future release', E_USER_DEPRECATED); - - return array_search('geoHaystack', $this->getKey(), true) !== false; - } - /** * Return whether this is a sparse index. * * @see https://mongodb.com/docs/manual/core/index-sparse/ - * @return boolean */ - public function isSparse() + public function isSparse(): bool { return ! empty($this->info['sparse']); } /** * Return whether or not this index is of type text. - * - * @return boolean */ - public function isText() + public function isText(): bool { return array_search('text', $this->getKey(), true) !== false; } @@ -165,9 +118,8 @@ public function isText() * Return whether this is a TTL index. * * @see https://mongodb.com/docs/manual/core/index-ttl/ - * @return boolean */ - public function isTtl() + public function isTtl(): bool { return array_key_exists('expireAfterSeconds', $this->info); } @@ -176,9 +128,8 @@ public function isTtl() * Return whether this is a unique index. * * @see https://mongodb.com/docs/manual/core/index-unique/ - * @return boolean */ - public function isUnique() + public function isUnique(): bool { return ! empty($this->info['unique']); } @@ -187,12 +138,9 @@ public function isUnique() * Check whether a field exists in the index information. * * @see https://php.net/arrayaccess.offsetexists - * @param mixed $offset - * @return boolean * @psalm-param array-key $offset */ - #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists(mixed $offset): bool { return array_key_exists($offset, $this->info); } @@ -205,13 +153,10 @@ public function offsetExists($offset) * also be used to access fields that do not have a helper method. * * @see https://php.net/arrayaccess.offsetget - * @see https://github.com/mongodb/specifications/blob/master/source/enumerate-indexes.rst#getting-full-index-information - * @param mixed $offset - * @return mixed + * @see https://github.com/mongodb/specifications/blob/master/source/enumerate-indexes.md#getting-full-index-information * @psalm-param array-key $offset */ - #[ReturnTypeWillChange] - public function offsetGet($offset) + public function offsetGet(mixed $offset): mixed { return $this->info[$offset]; } @@ -220,13 +165,9 @@ public function offsetGet($offset) * Not supported. * * @see https://php.net/arrayaccess.offsetset - * @param mixed $offset - * @param mixed $value * @throws BadMethodCallException - * @return void */ - #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet(mixed $offset, mixed $value): void { throw BadMethodCallException::classIsImmutable(self::class); } @@ -235,12 +176,9 @@ public function offsetSet($offset, $value) * Not supported. * * @see https://php.net/arrayaccess.offsetunset - * @param mixed $offset * @throws BadMethodCallException - * @return void */ - #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset(mixed $offset): void { throw BadMethodCallException::classIsImmutable(self::class); } diff --git a/src/Model/IndexInfoIterator.php b/src/Model/IndexInfoIterator.php deleted file mode 100644 index b7929c20f..000000000 --- a/src/Model/IndexInfoIterator.php +++ /dev/null @@ -1,41 +0,0 @@ - - */ -interface IndexInfoIterator extends Iterator -{ - /** - * Return the current element as a IndexInfo instance. - * - * @return IndexInfo - */ - #[ReturnTypeWillChange] - public function current(); -} diff --git a/src/Model/IndexInfoIteratorIterator.php b/src/Model/IndexInfoIteratorIterator.php deleted file mode 100644 index e605f9276..000000000 --- a/src/Model/IndexInfoIteratorIterator.php +++ /dev/null @@ -1,68 +0,0 @@ -> - */ -class IndexInfoIteratorIterator extends IteratorIterator implements IndexInfoIterator -{ - private ?string $ns = null; - - /** @param Traversable $iterator */ - public function __construct(Traversable $iterator, ?string $ns = null) - { - parent::__construct($iterator); - - $this->ns = $ns; - } - - /** - * Return the current element as an IndexInfo instance. - * - * @see IndexInfoIterator::current() - * @see https://php.net/iterator.current - */ - public function current(): IndexInfo - { - $info = parent::current(); - - if (! array_key_exists('ns', $info) && $this->ns !== null) { - $info['ns'] = $this->ns; - } - - return new IndexInfo($info); - } -} diff --git a/src/Model/IndexInput.php b/src/Model/IndexInput.php index ae1726550..98e47369c 100644 --- a/src/Model/IndexInput.php +++ b/src/Model/IndexInput.php @@ -20,6 +20,7 @@ use MongoDB\BSON\Serializable; use MongoDB\Exception\InvalidArgumentException; use stdClass; +use Stringable; use function is_float; use function is_int; @@ -35,18 +36,16 @@ * * @internal * @see \MongoDB\Collection::createIndexes() - * @see https://github.com/mongodb/specifications/blob/master/source/enumerate-indexes.rst + * @see https://github.com/mongodb/specifications/blob/master/source/enumerate-indexes.md * @see https://mongodb.com/docs/manual/reference/method/db.collection.createIndex/ */ -class IndexInput implements Serializable +final class IndexInput implements Serializable, Stringable { - private array $index; - /** * @param array $index Index specification * @throws InvalidArgumentException */ - public function __construct(array $index) + public function __construct(private array $index) { if (! isset($index['key'])) { throw new InvalidArgumentException('Required "key" document is missing from index specification'); @@ -63,14 +62,12 @@ public function __construct(array $index) } if (! isset($index['name'])) { - $index['name'] = $this->generateIndexName($index['key']); + $this->index['name'] = $this->generateIndexName($index['key']); } - if (! is_string($index['name'])) { - throw InvalidArgumentException::invalidType('"name" option', $index['name'], 'string'); + if (! is_string($this->index['name'])) { + throw InvalidArgumentException::invalidType('"name" option', $this->index['name'], 'string'); } - - $this->index = $index; } /** @@ -99,7 +96,7 @@ public function bsonSerialize(): stdClass * which denote order or an index type * @throws InvalidArgumentException if $document is not an array or object */ - private function generateIndexName($document): string + private function generateIndexName(array|object $document): string { $document = document_to_array($document); diff --git a/src/Model/SearchIndexInput.php b/src/Model/SearchIndexInput.php index 5562b7015..073deb1a0 100644 --- a/src/Model/SearchIndexInput.php +++ b/src/Model/SearchIndexInput.php @@ -31,18 +31,16 @@ * * @internal * @see \MongoDB\Collection::createSearchIndexes() - * @see https://github.com/mongodb/specifications/blob/master/source/index-management/index-management.rst#search-indexes + * @see https://github.com/mongodb/specifications/blob/master/source/index-management/index-management.md#search-indexes * @see https://mongodb.com/docs/manual/reference/method/db.collection.createSearchIndex/ */ -class SearchIndexInput implements Serializable +final class SearchIndexInput implements Serializable { - private array $index; - /** * @param array{definition: array|object, name?: string, type?: string} $index Search index specification * @throws InvalidArgumentException */ - public function __construct(array $index) + public function __construct(private array $index) { if (! isset($index['definition'])) { throw new InvalidArgumentException('Required "definition" document is missing from search index specification'); @@ -60,8 +58,6 @@ public function __construct(array $index) if (isset($index['type']) && ! is_string($index['type'])) { throw InvalidArgumentException::invalidType('"type" option', $index['type'], 'string'); } - - $this->index = $index; } /** diff --git a/src/Operation/Aggregate.php b/src/Operation/Aggregate.php index 0b49748de..b5da6470c 100644 --- a/src/Operation/Aggregate.php +++ b/src/Operation/Aggregate.php @@ -17,10 +17,8 @@ namespace MongoDB\Operation; -use Iterator; use MongoDB\Codec\DocumentCodec; use MongoDB\Driver\Command; -use MongoDB\Driver\Cursor; use MongoDB\Driver\CursorInterface; use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; use MongoDB\Driver\ReadConcern; @@ -37,7 +35,6 @@ use function is_array; use function is_bool; use function is_integer; -use function is_object; use function is_string; use function MongoDB\is_document; use function MongoDB\is_last_pipeline_operator_write; @@ -49,16 +46,8 @@ * @see \MongoDB\Collection::aggregate() * @see https://mongodb.com/docs/manual/reference/command/aggregate/ */ -class Aggregate implements Executable, Explainable +final class Aggregate implements Explainable { - private string $databaseName; - - private ?string $collectionName = null; - - private array $pipeline; - - private array $options; - private bool $isWrite; /** @@ -126,114 +115,107 @@ class Aggregate implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, ?string $collectionName, array $pipeline, array $options = []) + public function __construct(private string $databaseName, private ?string $collectionName, private array $pipeline, private array $options = []) { if (! is_pipeline($pipeline, true /* allowEmpty */)) { throw new InvalidArgumentException('$pipeline is not a valid aggregation pipeline'); } - if (isset($options['allowDiskUse']) && ! is_bool($options['allowDiskUse'])) { - throw InvalidArgumentException::invalidType('"allowDiskUse" option', $options['allowDiskUse'], 'boolean'); + if (isset($this->options['allowDiskUse']) && ! is_bool($this->options['allowDiskUse'])) { + throw InvalidArgumentException::invalidType('"allowDiskUse" option', $this->options['allowDiskUse'], 'boolean'); } - if (isset($options['batchSize']) && ! is_integer($options['batchSize'])) { - throw InvalidArgumentException::invalidType('"batchSize" option', $options['batchSize'], 'integer'); + if (isset($this->options['batchSize']) && ! is_integer($this->options['batchSize'])) { + throw InvalidArgumentException::invalidType('"batchSize" option', $this->options['batchSize'], 'integer'); } - if (isset($options['bypassDocumentValidation']) && ! is_bool($options['bypassDocumentValidation'])) { - throw InvalidArgumentException::invalidType('"bypassDocumentValidation" option', $options['bypassDocumentValidation'], 'boolean'); + if (isset($this->options['bypassDocumentValidation']) && ! is_bool($this->options['bypassDocumentValidation'])) { + throw InvalidArgumentException::invalidType('"bypassDocumentValidation" option', $this->options['bypassDocumentValidation'], 'boolean'); } - if (isset($options['codec']) && ! $options['codec'] instanceof DocumentCodec) { - throw InvalidArgumentException::invalidType('"codec" option', $options['codec'], DocumentCodec::class); + if (isset($this->options['codec']) && ! $this->options['codec'] instanceof DocumentCodec) { + throw InvalidArgumentException::invalidType('"codec" option', $this->options['codec'], DocumentCodec::class); } - if (isset($options['collation']) && ! is_document($options['collation'])) { - throw InvalidArgumentException::expectedDocumentType('"collation" option', $options['collation']); + if (isset($this->options['collation']) && ! is_document($this->options['collation'])) { + throw InvalidArgumentException::expectedDocumentType('"collation" option', $this->options['collation']); } - if (isset($options['explain']) && ! is_bool($options['explain'])) { - throw InvalidArgumentException::invalidType('"explain" option', $options['explain'], 'boolean'); + if (isset($this->options['explain']) && ! is_bool($this->options['explain'])) { + throw InvalidArgumentException::invalidType('"explain" option', $this->options['explain'], 'boolean'); } - if (isset($options['hint']) && ! is_string($options['hint']) && ! is_array($options['hint']) && ! is_object($options['hint'])) { - throw InvalidArgumentException::invalidType('"hint" option', $options['hint'], 'string or array or object'); + if (isset($this->options['hint']) && ! is_string($this->options['hint']) && ! is_document($this->options['hint'])) { + throw InvalidArgumentException::expectedDocumentOrStringType('"hint" option', $this->options['hint']); } - if (isset($options['let']) && ! is_document($options['let'])) { - throw InvalidArgumentException::expectedDocumentType('"let" option', $options['let']); + if (isset($this->options['let']) && ! is_document($this->options['let'])) { + throw InvalidArgumentException::expectedDocumentType('"let" option', $this->options['let']); } - if (isset($options['maxAwaitTimeMS']) && ! is_integer($options['maxAwaitTimeMS'])) { - throw InvalidArgumentException::invalidType('"maxAwaitTimeMS" option', $options['maxAwaitTimeMS'], 'integer'); + if (isset($this->options['maxAwaitTimeMS']) && ! is_integer($this->options['maxAwaitTimeMS'])) { + throw InvalidArgumentException::invalidType('"maxAwaitTimeMS" option', $this->options['maxAwaitTimeMS'], 'integer'); } - if (isset($options['maxTimeMS']) && ! is_integer($options['maxTimeMS'])) { - throw InvalidArgumentException::invalidType('"maxTimeMS" option', $options['maxTimeMS'], 'integer'); + if (isset($this->options['maxTimeMS']) && ! is_integer($this->options['maxTimeMS'])) { + throw InvalidArgumentException::invalidType('"maxTimeMS" option', $this->options['maxTimeMS'], 'integer'); } - if (isset($options['readConcern']) && ! $options['readConcern'] instanceof ReadConcern) { - throw InvalidArgumentException::invalidType('"readConcern" option', $options['readConcern'], ReadConcern::class); + if (isset($this->options['readConcern']) && ! $this->options['readConcern'] instanceof ReadConcern) { + throw InvalidArgumentException::invalidType('"readConcern" option', $this->options['readConcern'], ReadConcern::class); } - if (isset($options['readPreference']) && ! $options['readPreference'] instanceof ReadPreference) { - throw InvalidArgumentException::invalidType('"readPreference" option', $options['readPreference'], ReadPreference::class); + if (isset($this->options['readPreference']) && ! $this->options['readPreference'] instanceof ReadPreference) { + throw InvalidArgumentException::invalidType('"readPreference" option', $this->options['readPreference'], ReadPreference::class); } - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - if (isset($options['typeMap']) && ! is_array($options['typeMap'])) { - throw InvalidArgumentException::invalidType('"typeMap" option', $options['typeMap'], 'array'); + if (isset($this->options['typeMap']) && ! is_array($this->options['typeMap'])) { + throw InvalidArgumentException::invalidType('"typeMap" option', $this->options['typeMap'], 'array'); } - if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) { - throw InvalidArgumentException::invalidType('"writeConcern" option', $options['writeConcern'], WriteConcern::class); + if (isset($this->options['writeConcern']) && ! $this->options['writeConcern'] instanceof WriteConcern) { + throw InvalidArgumentException::invalidType('"writeConcern" option', $this->options['writeConcern'], WriteConcern::class); } - if (isset($options['bypassDocumentValidation']) && ! $options['bypassDocumentValidation']) { - unset($options['bypassDocumentValidation']); + if (isset($this->options['bypassDocumentValidation']) && ! $this->options['bypassDocumentValidation']) { + unset($this->options['bypassDocumentValidation']); } - if (isset($options['readConcern']) && $options['readConcern']->isDefault()) { - unset($options['readConcern']); + if (isset($this->options['readConcern']) && $this->options['readConcern']->isDefault()) { + unset($this->options['readConcern']); } - if (isset($options['writeConcern']) && $options['writeConcern']->isDefault()) { - unset($options['writeConcern']); + if (isset($this->options['writeConcern']) && $this->options['writeConcern']->isDefault()) { + unset($this->options['writeConcern']); } - if (isset($options['codec']) && isset($options['typeMap'])) { + if (isset($this->options['codec']) && isset($this->options['typeMap'])) { throw InvalidArgumentException::cannotCombineCodecAndTypeMap(); } - $this->isWrite = is_last_pipeline_operator_write($pipeline) && ! ($options['explain'] ?? false); + $this->isWrite = is_last_pipeline_operator_write($pipeline) && ! ($this->options['explain'] ?? false); if ($this->isWrite) { /* Ignore batchSize for writes, since no documents are returned and * a batchSize of zero could prevent the pipeline from executing. */ - unset($options['batchSize']); + unset($this->options['batchSize']); } else { - unset($options['writeConcern']); + unset($this->options['writeConcern']); } - - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->pipeline = $pipeline; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() - * @return CursorInterface&Iterator * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if read concern or write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): CursorInterface { $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction(); if ($inTransaction) { @@ -268,9 +250,8 @@ public function execute(Server $server) * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { $cmd = $this->createCommandDocument(); @@ -333,7 +314,7 @@ private function createCommandOptions(): array * @see https://php.net/manual/en/mongodb-driver-server.executereadcommand.php * @see https://php.net/manual/en/mongodb-driver-server.executereadwritecommand.php */ - private function executeCommand(Server $server, Command $command): Cursor + private function executeCommand(Server $server, Command $command): CursorInterface { $options = []; diff --git a/src/Operation/BulkWrite.php b/src/Operation/BulkWrite.php index 4457d9930..dc6dbb4c7 100644 --- a/src/Operation/BulkWrite.php +++ b/src/Operation/BulkWrite.php @@ -17,8 +17,10 @@ namespace MongoDB\Operation; +use MongoDB\Builder\BuilderEncoder; use MongoDB\BulkWriteResult; use MongoDB\Codec\DocumentCodec; +use MongoDB\Codec\Encoder; use MongoDB\Driver\BulkWrite as Bulk; use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; use MongoDB\Driver\Server; @@ -44,7 +46,7 @@ * * @see \MongoDB\Collection::bulkWrite() */ -class BulkWrite implements Executable +final class BulkWrite { public const DELETE_MANY = 'deleteMany'; public const DELETE_ONE = 'deleteOne'; @@ -53,10 +55,6 @@ class BulkWrite implements Executable public const UPDATE_MANY = 'updateMany'; public const UPDATE_ONE = 'updateOne'; - private string $databaseName; - - private string $collectionName; - /** @var array[] */ private array $operations; @@ -91,6 +89,14 @@ class BulkWrite implements Executable * * upsert (boolean): When true, a new document is created if no document * matches the query. The default is false. * + * Supported options for replaceOne and updateOne operations: + * + * * sort (document): Determines which document the operation modifies if + * the query selects multiple documents. + * + * This is not supported for server versions < 8.0 and will result in an + * exception at execution time if used. + * * Supported options for updateMany and updateOne operations: * * * arrayFilters (document array): A set of filters specifying to which @@ -98,6 +104,9 @@ class BulkWrite implements Executable * * Supported options for the bulk write operation: * + * * builderEncoder (MongoDB\Codec\Encoder): Encoder for query and + * aggregation builders. If not given, the default encoder will be used. + * * * bypassDocumentValidation (boolean): If true, allows the write to * circumvent document level validation. The default is false. * @@ -129,7 +138,7 @@ class BulkWrite implements Executable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, array $operations, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, array $operations, array $options = []) { if (empty($operations)) { throw new InvalidArgumentException('$operations is empty'); @@ -141,6 +150,10 @@ public function __construct(string $databaseName, string $collectionName, array $options += ['ordered' => true]; + if (isset($options['builderEncoder']) && ! $options['builderEncoder'] instanceof Encoder) { + throw InvalidArgumentException::invalidType('"builderEncoder" option', $options['builderEncoder'], Encoder::class); + } + if (isset($options['bypassDocumentValidation']) && ! is_bool($options['bypassDocumentValidation'])) { throw InvalidArgumentException::invalidType('"bypassDocumentValidation" option', $options['bypassDocumentValidation'], 'boolean'); } @@ -173,21 +186,17 @@ public function __construct(string $databaseName, string $collectionName, array unset($options['writeConcern']); } - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->operations = $this->validateOperations($operations, $options['codec'] ?? null); + $this->operations = $this->validateOperations($operations, $options['codec'] ?? null, $options['builderEncoder'] ?? new BuilderEncoder()); $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() - * @return BulkWriteResult * @throws UnsupportedException if write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): BulkWriteResult { $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction(); if ($inTransaction && isset($this->options['writeConcern'])) { @@ -270,7 +279,7 @@ private function createExecuteOptions(): array * @param array[] $operations * @return array[] */ - private function validateOperations(array $operations, ?DocumentCodec $codec): array + private function validateOperations(array $operations, ?DocumentCodec $codec, Encoder $builderEncoder): array { foreach ($operations as $i => $operation) { if (! is_array($operation)) { @@ -304,6 +313,8 @@ private function validateOperations(array $operations, ?DocumentCodec $codec): a case self::DELETE_MANY: case self::DELETE_ONE: + $operations[$i][$type][0] = $builderEncoder->encodeIfSupported($args[0]); + if (! isset($args[1])) { $args[1] = []; } @@ -323,6 +334,8 @@ private function validateOperations(array $operations, ?DocumentCodec $codec): a break; case self::REPLACE_ONE: + $operations[$i][$type][0] = $builderEncoder->encodeIfSupported($args[0]); + if (! isset($args[1]) && ! array_key_exists(1, $args)) { throw new InvalidArgumentException(sprintf('Missing second argument for $operations[%d]["%s"]', $i, $type)); } @@ -363,6 +376,10 @@ private function validateOperations(array $operations, ?DocumentCodec $codec): a throw InvalidArgumentException::expectedDocumentType(sprintf('$operations[%d]["%s"][2]["collation"]', $i, $type), $args[2]['collation']); } + if (isset($args[2]['sort']) && ! is_document($args[2]['sort'])) { + throw InvalidArgumentException::expectedDocumentType(sprintf('$operations[%d]["%s"][2]["sort"]', $i, $type), $args[2]['sort']); + } + if (! is_bool($args[2]['upsert'])) { throw InvalidArgumentException::invalidType(sprintf('$operations[%d]["%s"][2]["upsert"]', $i, $type), $args[2]['upsert'], 'boolean'); } @@ -373,10 +390,14 @@ private function validateOperations(array $operations, ?DocumentCodec $codec): a case self::UPDATE_MANY: case self::UPDATE_ONE: + $operations[$i][$type][0] = $builderEncoder->encodeIfSupported($args[0]); + if (! isset($args[1]) && ! array_key_exists(1, $args)) { throw new InvalidArgumentException(sprintf('Missing second argument for $operations[%d]["%s"]', $i, $type)); } + $operations[$i][$type][1] = $args[1] = $builderEncoder->encodeIfSupported($args[1]); + if ((! is_document($args[1]) || ! is_first_key_operator($args[1])) && ! is_pipeline($args[1])) { throw new InvalidArgumentException(sprintf('Expected update operator(s) or non-empty pipeline for $operations[%d]["%s"][1]', $i, $type)); } @@ -400,6 +421,14 @@ private function validateOperations(array $operations, ?DocumentCodec $codec): a throw InvalidArgumentException::expectedDocumentType(sprintf('$operations[%d]["%s"][2]["collation"]', $i, $type), $args[2]['collation']); } + if (isset($args[2]['sort']) && ! is_document($args[2]['sort'])) { + throw InvalidArgumentException::expectedDocumentType(sprintf('$operations[%d]["%s"][2]["sort"]', $i, $type), $args[2]['sort']); + } + + if (isset($args[2]['sort']) && $args[2]['multi']) { + throw new InvalidArgumentException(sprintf('"sort" option cannot be used with $operations[%d]["%s"]', $i, $type)); + } + if (! is_bool($args[2]['upsert'])) { throw InvalidArgumentException::invalidType(sprintf('$operations[%d]["%s"][2]["upsert"]', $i, $type), $args[2]['upsert'], 'boolean'); } diff --git a/src/Operation/ClientBulkWriteCommand.php b/src/Operation/ClientBulkWriteCommand.php new file mode 100644 index 000000000..e7768adcb --- /dev/null +++ b/src/Operation/ClientBulkWriteCommand.php @@ -0,0 +1,95 @@ +options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); + } + + if (isset($this->options['writeConcern']) && ! $this->options['writeConcern'] instanceof WriteConcern) { + throw InvalidArgumentException::invalidType('"writeConcern" option', $this->options['writeConcern'], WriteConcern::class); + } + + if (isset($this->options['writeConcern']) && $this->options['writeConcern']->isDefault()) { + unset($this->options['writeConcern']); + } + } + + /** + * Execute the operation. + * + * @throws UnsupportedException if write concern is used and unsupported + * @throws DriverRuntimeException for other driver errors (e.g. connection errors) + */ + public function execute(Server $server): BulkWriteCommandResult + { + $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction(); + if ($inTransaction && isset($this->options['writeConcern'])) { + throw UnsupportedException::writeConcernNotSupportedInTransaction(); + } + + $options = array_filter($this->options, fn ($value) => $value !== null); + + return $server->executeBulkWriteCommand($this->bulkWriteCommand, $options); + } +} diff --git a/src/Operation/Count.php b/src/Operation/Count.php index e8aaf8a21..ae40c790f 100644 --- a/src/Operation/Count.php +++ b/src/Operation/Count.php @@ -41,17 +41,8 @@ * @see \MongoDB\Collection::count() * @see https://mongodb.com/docs/manual/reference/command/count/ */ -class Count implements Executable, Explainable +final class Count implements Explainable { - private string $databaseName; - - private string $collectionName; - - /** @var array|object */ - private $filter; - - private array $options; - /** * Constructs a count command. * @@ -87,64 +78,57 @@ class Count implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, $filter = [], array $options = []) + public function __construct(private string $databaseName, private string $collectionName, private array|object $filter = [], private array $options = []) { if (! is_document($filter)) { throw InvalidArgumentException::expectedDocumentType('$filter', $filter); } - if (isset($options['collation']) && ! is_document($options['collation'])) { - throw InvalidArgumentException::expectedDocumentType('"collation" option', $options['collation']); + if (isset($this->options['collation']) && ! is_document($this->options['collation'])) { + throw InvalidArgumentException::expectedDocumentType('"collation" option', $this->options['collation']); } - if (isset($options['hint']) && ! is_string($options['hint']) && ! is_array($options['hint']) && ! is_object($options['hint'])) { - throw InvalidArgumentException::invalidType('"hint" option', $options['hint'], 'string or array or object'); + if (isset($this->options['hint']) && ! is_string($this->options['hint']) && ! is_document($this->options['hint'])) { + throw InvalidArgumentException::expectedDocumentOrStringType('"hint" option', $this->options['hint']); } - if (isset($options['limit']) && ! is_integer($options['limit'])) { - throw InvalidArgumentException::invalidType('"limit" option', $options['limit'], 'integer'); + if (isset($this->options['limit']) && ! is_integer($this->options['limit'])) { + throw InvalidArgumentException::invalidType('"limit" option', $this->options['limit'], 'integer'); } - if (isset($options['maxTimeMS']) && ! is_integer($options['maxTimeMS'])) { - throw InvalidArgumentException::invalidType('"maxTimeMS" option', $options['maxTimeMS'], 'integer'); + if (isset($this->options['maxTimeMS']) && ! is_integer($this->options['maxTimeMS'])) { + throw InvalidArgumentException::invalidType('"maxTimeMS" option', $this->options['maxTimeMS'], 'integer'); } - if (isset($options['readConcern']) && ! $options['readConcern'] instanceof ReadConcern) { - throw InvalidArgumentException::invalidType('"readConcern" option', $options['readConcern'], ReadConcern::class); + if (isset($this->options['readConcern']) && ! $this->options['readConcern'] instanceof ReadConcern) { + throw InvalidArgumentException::invalidType('"readConcern" option', $this->options['readConcern'], ReadConcern::class); } - if (isset($options['readPreference']) && ! $options['readPreference'] instanceof ReadPreference) { - throw InvalidArgumentException::invalidType('"readPreference" option', $options['readPreference'], ReadPreference::class); + if (isset($this->options['readPreference']) && ! $this->options['readPreference'] instanceof ReadPreference) { + throw InvalidArgumentException::invalidType('"readPreference" option', $this->options['readPreference'], ReadPreference::class); } - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - if (isset($options['skip']) && ! is_integer($options['skip'])) { - throw InvalidArgumentException::invalidType('"skip" option', $options['skip'], 'integer'); + if (isset($this->options['skip']) && ! is_integer($this->options['skip'])) { + throw InvalidArgumentException::invalidType('"skip" option', $this->options['skip'], 'integer'); } - if (isset($options['readConcern']) && $options['readConcern']->isDefault()) { - unset($options['readConcern']); + if (isset($this->options['readConcern']) && $this->options['readConcern']->isDefault()) { + unset($this->options['readConcern']); } - - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->filter = $filter; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() - * @return integer * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if read concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): int { $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction(); if ($inTransaction && isset($this->options['readConcern'])) { @@ -159,16 +143,15 @@ public function execute(Server $server) throw new UnexpectedValueException('count command did not return a numeric "n" value'); } - return (integer) $result->n; + return (int) $result->n; } /** * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { $cmd = $this->createCommandDocument(); diff --git a/src/Operation/CountDocuments.php b/src/Operation/CountDocuments.php index fad2e94db..86046f499 100644 --- a/src/Operation/CountDocuments.php +++ b/src/Operation/CountDocuments.php @@ -35,17 +35,10 @@ * Operation for obtaining an exact count of documents in a collection * * @see \MongoDB\Collection::countDocuments() - * @see https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#countdocuments + * @see https://github.com/mongodb/specifications/blob/master/source/crud/crud.md#countdocuments */ -class CountDocuments implements Executable +final class CountDocuments { - private string $databaseName; - - private string $collectionName; - - /** @var array|object */ - private $filter; - private array $aggregateOptions; private array $countOptions; @@ -87,7 +80,7 @@ class CountDocuments implements Executable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, $filter, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, private array|object $filter, array $options = []) { if (! is_document($filter)) { throw InvalidArgumentException::expectedDocumentType('$filter', $filter); @@ -101,10 +94,6 @@ public function __construct(string $databaseName, string $collectionName, $filte throw InvalidArgumentException::invalidType('"skip" option', $options['skip'], 'integer'); } - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->filter = $filter; - $this->aggregateOptions = array_intersect_key($options, ['collation' => 1, 'comment' => 1, 'hint' => 1, 'maxTimeMS' => 1, 'readConcern' => 1, 'readPreference' => 1, 'session' => 1]); $this->countOptions = array_intersect_key($options, ['limit' => 1, 'skip' => 1]); @@ -114,13 +103,11 @@ public function __construct(string $databaseName, string $collectionName, $filte /** * Execute the operation. * - * @see Executable::execute() - * @return integer * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if collation or read concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): int { $cursor = $this->aggregate->execute($server); @@ -137,7 +124,7 @@ public function execute(Server $server) throw new UnexpectedValueException('count command did not return a numeric "n" value'); } - return (integer) $result->n; + return (int) $result->n; } private function createAggregate(): Aggregate diff --git a/src/Operation/CreateCollection.php b/src/Operation/CreateCollection.php index 470359542..45a4925d3 100644 --- a/src/Operation/CreateCollection.php +++ b/src/Operation/CreateCollection.php @@ -24,16 +24,12 @@ use MongoDB\Driver\WriteConcern; use MongoDB\Exception\InvalidArgumentException; -use function current; use function is_array; use function is_bool; use function is_integer; use function is_string; use function MongoDB\is_document; use function MongoDB\is_pipeline; -use function trigger_error; - -use const E_USER_DEPRECATED; /** * Operation for the create command. @@ -41,30 +37,13 @@ * @see \MongoDB\Database::createCollection() * @see https://mongodb.com/docs/manual/reference/command/create/ */ -class CreateCollection implements Executable +final class CreateCollection { - public const USE_POWER_OF_2_SIZES = 1; - public const NO_PADDING = 2; - - private string $databaseName; - - private string $collectionName; - - private array $options = []; - /** * Constructs a create command. * * Supported options: * - * * autoIndexId (boolean): Specify false to disable the automatic creation - * of an index on the _id field. For replica sets, this option cannot be - * false. The default is true. - * - * This option has been deprecated since MongoDB 3.2. As of MongoDB 4.0, - * this option cannot be false when creating a replicated collection - * (i.e. a collection outside of the local database in any mongod mode). - * * * capped (boolean): Specify true to create a capped collection. If set, * the size option must also be specified. The default is false. * @@ -90,11 +69,6 @@ class CreateCollection implements Executable * * This is not supported for servers versions < 5.0. * - * * flags (integer): Options for the MMAPv1 storage engine only. Must be a - * bitwise combination CreateCollection::USE_POWER_OF_2_SIZES and - * CreateCollection::NO_PADDING. The default is - * CreateCollection::USE_POWER_OF_2_SIZES. - * * * indexOptionDefaults (document): Default configuration for indexes when * creating the collection. * @@ -118,9 +92,6 @@ class CreateCollection implements Executable * * This is not supported for servers versions < 5.0. * - * * typeMap (array): Type map for BSON deserialization. This will only be - * used for the returned command result document. - * * * validationAction (string): Validation action. * * * validationLevel (string): Validation level. @@ -139,129 +110,101 @@ class CreateCollection implements Executable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, private array $options = []) { - if (isset($options['autoIndexId']) && ! is_bool($options['autoIndexId'])) { - throw InvalidArgumentException::invalidType('"autoIndexId" option', $options['autoIndexId'], 'boolean'); - } - - if (isset($options['capped']) && ! is_bool($options['capped'])) { - throw InvalidArgumentException::invalidType('"capped" option', $options['capped'], 'boolean'); + if (isset($this->options['capped']) && ! is_bool($this->options['capped'])) { + throw InvalidArgumentException::invalidType('"capped" option', $this->options['capped'], 'boolean'); } - if (isset($options['changeStreamPreAndPostImages']) && ! is_document($options['changeStreamPreAndPostImages'])) { - throw InvalidArgumentException::expectedDocumentType('"changeStreamPreAndPostImages" option', $options['changeStreamPreAndPostImages']); + if (isset($this->options['changeStreamPreAndPostImages']) && ! is_document($this->options['changeStreamPreAndPostImages'])) { + throw InvalidArgumentException::expectedDocumentType('"changeStreamPreAndPostImages" option', $this->options['changeStreamPreAndPostImages']); } - if (isset($options['clusteredIndex']) && ! is_document($options['clusteredIndex'])) { - throw InvalidArgumentException::expectedDocumentType('"clusteredIndex" option', $options['clusteredIndex']); + if (isset($this->options['clusteredIndex']) && ! is_document($this->options['clusteredIndex'])) { + throw InvalidArgumentException::expectedDocumentType('"clusteredIndex" option', $this->options['clusteredIndex']); } - if (isset($options['collation']) && ! is_document($options['collation'])) { - throw InvalidArgumentException::expectedDocumentType('"collation" option', $options['collation']); + if (isset($this->options['collation']) && ! is_document($this->options['collation'])) { + throw InvalidArgumentException::expectedDocumentType('"collation" option', $this->options['collation']); } - if (isset($options['encryptedFields']) && ! is_document($options['encryptedFields'])) { - throw InvalidArgumentException::expectedDocumentType('"encryptedFields" option', $options['encryptedFields']); + if (isset($this->options['encryptedFields']) && ! is_document($this->options['encryptedFields'])) { + throw InvalidArgumentException::expectedDocumentType('"encryptedFields" option', $this->options['encryptedFields']); } - if (isset($options['expireAfterSeconds']) && ! is_integer($options['expireAfterSeconds'])) { - throw InvalidArgumentException::invalidType('"expireAfterSeconds" option', $options['expireAfterSeconds'], 'integer'); + if (isset($this->options['expireAfterSeconds']) && ! is_integer($this->options['expireAfterSeconds'])) { + throw InvalidArgumentException::invalidType('"expireAfterSeconds" option', $this->options['expireAfterSeconds'], 'integer'); } - if (isset($options['flags']) && ! is_integer($options['flags'])) { - throw InvalidArgumentException::invalidType('"flags" option', $options['flags'], 'integer'); + if (isset($this->options['indexOptionDefaults']) && ! is_document($this->options['indexOptionDefaults'])) { + throw InvalidArgumentException::expectedDocumentType('"indexOptionDefaults" option', $this->options['indexOptionDefaults']); } - if (isset($options['indexOptionDefaults']) && ! is_document($options['indexOptionDefaults'])) { - throw InvalidArgumentException::expectedDocumentType('"indexOptionDefaults" option', $options['indexOptionDefaults']); + if (isset($this->options['max']) && ! is_integer($this->options['max'])) { + throw InvalidArgumentException::invalidType('"max" option', $this->options['max'], 'integer'); } - if (isset($options['max']) && ! is_integer($options['max'])) { - throw InvalidArgumentException::invalidType('"max" option', $options['max'], 'integer'); + if (isset($this->options['maxTimeMS']) && ! is_integer($this->options['maxTimeMS'])) { + throw InvalidArgumentException::invalidType('"maxTimeMS" option', $this->options['maxTimeMS'], 'integer'); } - if (isset($options['maxTimeMS']) && ! is_integer($options['maxTimeMS'])) { - throw InvalidArgumentException::invalidType('"maxTimeMS" option', $options['maxTimeMS'], 'integer'); + if (isset($this->options['pipeline']) && ! is_array($this->options['pipeline'])) { + throw InvalidArgumentException::invalidType('"pipeline" option', $this->options['pipeline'], 'array'); } - if (isset($options['pipeline']) && ! is_array($options['pipeline'])) { - throw InvalidArgumentException::invalidType('"pipeline" option', $options['pipeline'], 'array'); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); + if (isset($this->options['size']) && ! is_integer($this->options['size'])) { + throw InvalidArgumentException::invalidType('"size" option', $this->options['size'], 'integer'); } - if (isset($options['size']) && ! is_integer($options['size'])) { - throw InvalidArgumentException::invalidType('"size" option', $options['size'], 'integer'); + if (isset($this->options['storageEngine']) && ! is_document($this->options['storageEngine'])) { + throw InvalidArgumentException::expectedDocumentType('"storageEngine" option', $this->options['storageEngine']); } - if (isset($options['storageEngine']) && ! is_document($options['storageEngine'])) { - throw InvalidArgumentException::expectedDocumentType('"storageEngine" option', $options['storageEngine']); + if (isset($this->options['timeseries']) && ! is_document($this->options['timeseries'])) { + throw InvalidArgumentException::expectedDocumentType('"timeseries" option', $this->options['timeseries']); } - if (isset($options['timeseries']) && ! is_document($options['timeseries'])) { - throw InvalidArgumentException::expectedDocumentType('"timeseries" option', $options['timeseries']); + if (isset($this->options['validationAction']) && ! is_string($this->options['validationAction'])) { + throw InvalidArgumentException::invalidType('"validationAction" option', $this->options['validationAction'], 'string'); } - if (isset($options['typeMap']) && ! is_array($options['typeMap'])) { - throw InvalidArgumentException::invalidType('"typeMap" option', $options['typeMap'], 'array'); + if (isset($this->options['validationLevel']) && ! is_string($this->options['validationLevel'])) { + throw InvalidArgumentException::invalidType('"validationLevel" option', $this->options['validationLevel'], 'string'); } - if (isset($options['validationAction']) && ! is_string($options['validationAction'])) { - throw InvalidArgumentException::invalidType('"validationAction" option', $options['validationAction'], 'string'); + if (isset($this->options['validator']) && ! is_document($this->options['validator'])) { + throw InvalidArgumentException::expectedDocumentType('"validator" option', $this->options['validator']); } - if (isset($options['validationLevel']) && ! is_string($options['validationLevel'])) { - throw InvalidArgumentException::invalidType('"validationLevel" option', $options['validationLevel'], 'string'); + if (isset($this->options['viewOn']) && ! is_string($this->options['viewOn'])) { + throw InvalidArgumentException::invalidType('"viewOn" option', $this->options['viewOn'], 'string'); } - if (isset($options['validator']) && ! is_document($options['validator'])) { - throw InvalidArgumentException::expectedDocumentType('"validator" option', $options['validator']); + if (isset($this->options['writeConcern']) && ! $this->options['writeConcern'] instanceof WriteConcern) { + throw InvalidArgumentException::invalidType('"writeConcern" option', $this->options['writeConcern'], WriteConcern::class); } - if (isset($options['viewOn']) && ! is_string($options['viewOn'])) { - throw InvalidArgumentException::invalidType('"viewOn" option', $options['viewOn'], 'string'); + if (isset($this->options['writeConcern']) && $this->options['writeConcern']->isDefault()) { + unset($this->options['writeConcern']); } - if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) { - throw InvalidArgumentException::invalidType('"writeConcern" option', $options['writeConcern'], WriteConcern::class); - } - - if (isset($options['writeConcern']) && $options['writeConcern']->isDefault()) { - unset($options['writeConcern']); - } - - if (isset($options['autoIndexId'])) { - trigger_error('The "autoIndexId" option is deprecated and will be removed in a future release', E_USER_DEPRECATED); - } - - if (isset($options['pipeline']) && ! is_pipeline($options['pipeline'], true /* allowEmpty */)) { + if (isset($this->options['pipeline']) && ! is_pipeline($this->options['pipeline'], true /* allowEmpty */)) { throw new InvalidArgumentException('"pipeline" option is not a valid aggregation pipeline'); } - - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() - * @return array|object Command result document * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): void { - $cursor = $server->executeWriteCommand($this->databaseName, $this->createCommand(), $this->createOptions()); - - if (isset($this->options['typeMap'])) { - $cursor->setTypeMap($this->options['typeMap']); - } - - return current($cursor->toArray()); + $server->executeWriteCommand($this->databaseName, $this->createCommand(), $this->createOptions()); } /** @@ -271,7 +214,7 @@ private function createCommand(): Command { $cmd = ['create' => $this->collectionName]; - foreach (['autoIndexId', 'capped', 'comment', 'expireAfterSeconds', 'flags', 'max', 'maxTimeMS', 'pipeline', 'size', 'validationAction', 'validationLevel', 'viewOn'] as $option) { + foreach (['capped', 'comment', 'expireAfterSeconds', 'max', 'maxTimeMS', 'pipeline', 'size', 'validationAction', 'validationLevel', 'viewOn'] as $option) { if (isset($this->options[$option])) { $cmd[$option] = $this->options[$option]; } diff --git a/src/Operation/CreateEncryptedCollection.php b/src/Operation/CreateEncryptedCollection.php index 113b83171..01729c0c7 100644 --- a/src/Operation/CreateEncryptedCollection.php +++ b/src/Operation/CreateEncryptedCollection.php @@ -44,11 +44,11 @@ * @internal * @see \MongoDB\Database::createCollection() * @see \MongoDB\Database::createEncryptedCollection() - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#create-collection-helper - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#create-encrypted-collection-helper + * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.md#create-collection-helper + * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.md#create-encrypted-collection-helper * @see https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/manage-collections/ */ -class CreateEncryptedCollection implements Executable +final class CreateEncryptedCollection { private const WIRE_VERSION_FOR_QUERYABLE_ENCRYPTION_V2 = 21; @@ -59,12 +59,6 @@ class CreateEncryptedCollection implements Executable private CreateIndexes $createSafeContentIndex; - private string $databaseName; - - private string $collectionName; - - private array $options; - /** * @see CreateCollection::__construct() for supported options * @param string $databaseName Database name @@ -72,20 +66,20 @@ class CreateEncryptedCollection implements Executable * @param array $options CreateCollection options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, array $options) + public function __construct(private string $databaseName, private string $collectionName, private array $options) { - if (! isset($options['encryptedFields'])) { + if (! isset($this->options['encryptedFields'])) { throw new InvalidArgumentException('"encryptedFields" option is required'); } - if (! is_document($options['encryptedFields'])) { - throw InvalidArgumentException::expectedDocumentType('"encryptedFields" option', $options['encryptedFields']); + if (! is_document($this->options['encryptedFields'])) { + throw InvalidArgumentException::expectedDocumentType('"encryptedFields" option', $this->options['encryptedFields']); } - $this->createCollection = new CreateCollection($databaseName, $collectionName, $options); + $this->createCollection = new CreateCollection($databaseName, $collectionName, $this->options); /** @psalm-var array{ecocCollection?: ?string, escCollection?: ?string} */ - $encryptedFields = document_to_array($options['encryptedFields']); + $encryptedFields = document_to_array($this->options['encryptedFields']); $enxcolOptions = ['clusteredIndex' => ['key' => ['_id' => 1], 'unique' => true]]; $this->createMetadataCollections = [ @@ -94,10 +88,6 @@ public function __construct(string $databaseName, string $collectionName, array ]; $this->createSafeContentIndex = new CreateIndexes($databaseName, $collectionName, [['key' => ['__safeContent__' => 1]]]); - - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->options = $options; } /** @@ -107,21 +97,20 @@ public function __construct(string $databaseName, string $collectionName, array * "encryptedFields" option and reconstruct the internal CreateCollection * operation used for creating the encrypted collection. * - * The $encryptedFields reference parameter may be used to determine which - * data keys have been created. + * Returns the data keys that have been created. * * @see \MongoDB\Database::createEncryptedCollection() * @see https://www.php.net/manual/en/mongodb-driver-clientencryption.createdatakey.php * @throws DriverRuntimeException for errors creating a data key */ - public function createDataKeys(ClientEncryption $clientEncryption, string $kmsProvider, ?array $masterKey, ?array &$encryptedFields = null): void + public function createDataKeys(ClientEncryption $clientEncryption, string $kmsProvider, ?array $masterKey): array { /** @psalm-var array{fields: list|Serializable|PackedArray} */ $encryptedFields = document_to_array($this->options['encryptedFields']); // NOP if there are no fields to examine if (! isset($encryptedFields['fields'])) { - return; + return $encryptedFields; } // Allow PackedArray or Serializable object for the fields array @@ -138,7 +127,7 @@ public function createDataKeys(ClientEncryption $clientEncryption, string $kmsPr // Skip invalid types and defer to the server to raise an error if (! is_array($encryptedFields['fields'])) { - return; + return $encryptedFields; } $createDataKeyArgs = [ @@ -162,15 +151,15 @@ public function createDataKeys(ClientEncryption $clientEncryption, string $kmsPr $this->options['encryptedFields'] = $encryptedFields; $this->createCollection = new CreateCollection($this->databaseName, $this->collectionName, $this->options); + + return $encryptedFields; } /** - * @see Executable::execute() - * @return array|object Command result document from creating the encrypted collection * @throws DriverRuntimeException for other driver errors (e.g. connection errors) * @throws UnsupportedException if the server does not support Queryable Encryption */ - public function execute(Server $server) + public function execute(Server $server): void { if (! server_supports_feature($server, self::WIRE_VERSION_FOR_QUERYABLE_ENCRYPTION_V2)) { throw new UnsupportedException('Driver support of Queryable Encryption is incompatible with server. Upgrade server to use Queryable Encryption.'); @@ -180,10 +169,8 @@ public function execute(Server $server) $createMetadataCollection->execute($server); } - $result = $this->createCollection->execute($server); + $this->createCollection->execute($server); $this->createSafeContentIndex->execute($server); - - return $result; } } diff --git a/src/Operation/CreateIndexes.php b/src/Operation/CreateIndexes.php index e5fc9b73c..6591270b7 100644 --- a/src/Operation/CreateIndexes.php +++ b/src/Operation/CreateIndexes.php @@ -41,19 +41,13 @@ * @see \MongoDB\Collection::createIndexes() * @see https://mongodb.com/docs/manual/reference/command/createIndexes/ */ -class CreateIndexes implements Executable +final class CreateIndexes { private const WIRE_VERSION_FOR_COMMIT_QUORUM = 9; - private string $databaseName; - - private string $collectionName; - /** @var list */ private array $indexes = []; - private array $options = []; - /** * Constructs a createIndexes command. * @@ -80,7 +74,7 @@ class CreateIndexes implements Executable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, array $indexes, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, array $indexes, private array $options = []) { if (empty($indexes)) { throw new InvalidArgumentException('$indexes is empty'); @@ -98,40 +92,35 @@ public function __construct(string $databaseName, string $collectionName, array $this->indexes[] = new IndexInput($index); } - if (isset($options['commitQuorum']) && ! is_string($options['commitQuorum']) && ! is_integer($options['commitQuorum'])) { - throw InvalidArgumentException::invalidType('"commitQuorum" option', $options['commitQuorum'], ['integer', 'string']); + if (isset($this->options['commitQuorum']) && ! is_string($this->options['commitQuorum']) && ! is_integer($this->options['commitQuorum'])) { + throw InvalidArgumentException::invalidType('"commitQuorum" option', $this->options['commitQuorum'], ['integer', 'string']); } - if (isset($options['maxTimeMS']) && ! is_integer($options['maxTimeMS'])) { - throw InvalidArgumentException::invalidType('"maxTimeMS" option', $options['maxTimeMS'], 'integer'); + if (isset($this->options['maxTimeMS']) && ! is_integer($this->options['maxTimeMS'])) { + throw InvalidArgumentException::invalidType('"maxTimeMS" option', $this->options['maxTimeMS'], 'integer'); } - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) { - throw InvalidArgumentException::invalidType('"writeConcern" option', $options['writeConcern'], WriteConcern::class); + if (isset($this->options['writeConcern']) && ! $this->options['writeConcern'] instanceof WriteConcern) { + throw InvalidArgumentException::invalidType('"writeConcern" option', $this->options['writeConcern'], WriteConcern::class); } - if (isset($options['writeConcern']) && $options['writeConcern']->isDefault()) { - unset($options['writeConcern']); + if (isset($this->options['writeConcern']) && $this->options['writeConcern']->isDefault()) { + unset($this->options['writeConcern']); } - - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() * @return string[] The names of the created indexes * @throws UnsupportedException if write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): array { $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction(); if ($inTransaction && isset($this->options['writeConcern'])) { diff --git a/src/Operation/CreateSearchIndexes.php b/src/Operation/CreateSearchIndexes.php index 96e529b08..d21ed9428 100644 --- a/src/Operation/CreateSearchIndexes.php +++ b/src/Operation/CreateSearchIndexes.php @@ -37,12 +37,9 @@ * @see \MongoDB\Collection::createSearchIndexes() * @see https://mongodb.com/docs/manual/reference/command/createSearchIndexes/ */ -class CreateSearchIndexes implements Executable +final class CreateSearchIndexes { - private string $databaseName; - private string $collectionName; private array $indexes = []; - private array $options; /** * Constructs a createSearchIndexes command. @@ -53,7 +50,7 @@ class CreateSearchIndexes implements Executable * @param array{comment?: mixed} $options Command options * @throws InvalidArgumentException for parameter parsing errors */ - public function __construct(string $databaseName, string $collectionName, array $indexes, array $options) + public function __construct(private string $databaseName, private string $collectionName, array $indexes, private array $options) { if (! array_is_list($indexes)) { throw new InvalidArgumentException('$indexes is not a list'); @@ -66,16 +63,11 @@ public function __construct(string $databaseName, string $collectionName, array $this->indexes[] = new SearchIndexInput($index); } - - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() * @return string[] The names of the created indexes * @throws UnsupportedException if write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) diff --git a/src/Operation/DatabaseCommand.php b/src/Operation/DatabaseCommand.php index adcccca37..567bbff9e 100644 --- a/src/Operation/DatabaseCommand.php +++ b/src/Operation/DatabaseCommand.php @@ -18,7 +18,7 @@ namespace MongoDB\Operation; use MongoDB\Driver\Command; -use MongoDB\Driver\Cursor; +use MongoDB\Driver\CursorInterface; use MongoDB\Driver\ReadPreference; use MongoDB\Driver\Server; use MongoDB\Driver\Session; @@ -32,14 +32,10 @@ * * @see \MongoDB\Database::command() */ -class DatabaseCommand implements Executable +final class DatabaseCommand { - private string $databaseName; - private Command $command; - private array $options; - /** * Constructs a command. * @@ -61,36 +57,28 @@ class DatabaseCommand implements Executable * @param array $options Options for command execution * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, $command, array $options = []) + public function __construct(private string $databaseName, array|object $command, private array $options = []) { if (! is_document($command)) { throw InvalidArgumentException::expectedDocumentType('$command', $command); } - if (isset($options['readPreference']) && ! $options['readPreference'] instanceof ReadPreference) { - throw InvalidArgumentException::invalidType('"readPreference" option', $options['readPreference'], ReadPreference::class); + if (isset($this->options['readPreference']) && ! $this->options['readPreference'] instanceof ReadPreference) { + throw InvalidArgumentException::invalidType('"readPreference" option', $this->options['readPreference'], ReadPreference::class); } - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - if (isset($options['typeMap']) && ! is_array($options['typeMap'])) { - throw InvalidArgumentException::invalidType('"typeMap" option', $options['typeMap'], 'array'); + if (isset($this->options['typeMap']) && ! is_array($this->options['typeMap'])) { + throw InvalidArgumentException::invalidType('"typeMap" option', $this->options['typeMap'], 'array'); } - $this->databaseName = $databaseName; $this->command = $command instanceof Command ? $command : new Command($command); - $this->options = $options; } - /** - * Execute the operation. - * - * @see Executable::execute() - * @return Cursor - */ - public function execute(Server $server) + public function execute(Server $server): CursorInterface { $cursor = $server->executeCommand($this->databaseName, $this->command, $this->createOptions()); diff --git a/src/Operation/Delete.php b/src/Operation/Delete.php index b23e1eac9..84a803c79 100644 --- a/src/Operation/Delete.php +++ b/src/Operation/Delete.php @@ -26,8 +26,6 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Exception\UnsupportedException; -use function is_array; -use function is_object; use function is_string; use function MongoDB\is_document; use function MongoDB\is_write_concern_acknowledged; @@ -42,21 +40,10 @@ * @internal * @see https://mongodb.com/docs/manual/reference/command/delete/ */ -class Delete implements Executable, Explainable +final class Delete implements Explainable { private const WIRE_VERSION_FOR_HINT = 9; - private string $databaseName; - - private string $collectionName; - - /** @var array|object */ - private $filter; - - private int $limit; - - private array $options; - /** * Constructs a delete command. * @@ -93,7 +80,7 @@ class Delete implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, $filter, int $limit, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, private array|object $filter, private int $limit, private array $options = []) { if (! is_document($filter)) { throw InvalidArgumentException::expectedDocumentType('$filter', $filter); @@ -103,46 +90,38 @@ public function __construct(string $databaseName, string $collectionName, $filte throw new InvalidArgumentException('$limit must be 0 or 1'); } - if (isset($options['collation']) && ! is_document($options['collation'])) { - throw InvalidArgumentException::expectedDocumentType('"collation" option', $options['collation']); + if (isset($this->options['collation']) && ! is_document($this->options['collation'])) { + throw InvalidArgumentException::expectedDocumentType('"collation" option', $this->options['collation']); } - if (isset($options['hint']) && ! is_string($options['hint']) && ! is_array($options['hint']) && ! is_object($options['hint'])) { - throw InvalidArgumentException::invalidType('"hint" option', $options['hint'], ['string', 'array', 'object']); + if (isset($this->options['hint']) && ! is_string($this->options['hint']) && ! is_document($this->options['hint'])) { + throw InvalidArgumentException::expectedDocumentOrStringType('"hint" option', $this->options['hint']); } - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) { - throw InvalidArgumentException::invalidType('"writeConcern" option', $options['writeConcern'], WriteConcern::class); + if (isset($this->options['writeConcern']) && ! $this->options['writeConcern'] instanceof WriteConcern) { + throw InvalidArgumentException::invalidType('"writeConcern" option', $this->options['writeConcern'], WriteConcern::class); } - if (isset($options['let']) && ! is_document($options['let'])) { - throw InvalidArgumentException::expectedDocumentType('"let" option', $options['let']); + if (isset($this->options['let']) && ! is_document($this->options['let'])) { + throw InvalidArgumentException::expectedDocumentType('"let" option', $this->options['let']); } - if (isset($options['writeConcern']) && $options['writeConcern']->isDefault()) { - unset($options['writeConcern']); + if (isset($this->options['writeConcern']) && $this->options['writeConcern']->isDefault()) { + unset($this->options['writeConcern']); } - - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->filter = $filter; - $this->limit = $limit; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() - * @return DeleteResult * @throws UnsupportedException if hint or write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): DeleteResult { /* CRUD spec requires a client-side error when using "hint" with an * unacknowledged write concern on an unsupported server. */ @@ -170,9 +149,8 @@ public function execute(Server $server) * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { $cmd = ['delete' => $this->collectionName, 'deletes' => [['q' => $this->filter] + $this->createDeleteOptions()]]; diff --git a/src/Operation/DeleteMany.php b/src/Operation/DeleteMany.php index 9f580133e..5278ee08a 100644 --- a/src/Operation/DeleteMany.php +++ b/src/Operation/DeleteMany.php @@ -29,7 +29,7 @@ * @see \MongoDB\Collection::deleteOne() * @see https://mongodb.com/docs/manual/reference/command/delete/ */ -class DeleteMany implements Executable, Explainable +final class DeleteMany implements Explainable { private Delete $delete; @@ -66,7 +66,7 @@ class DeleteMany implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, $filter, array $options = []) + public function __construct(string $databaseName, string $collectionName, array|object $filter, array $options = []) { $this->delete = new Delete($databaseName, $collectionName, $filter, 0, $options); } @@ -74,12 +74,10 @@ public function __construct(string $databaseName, string $collectionName, $filte /** * Execute the operation. * - * @see Executable::execute() - * @return DeleteResult * @throws UnsupportedException if collation is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): DeleteResult { return $this->delete->execute($server); } @@ -88,9 +86,8 @@ public function execute(Server $server) * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { return $this->delete->getCommandDocument(); } diff --git a/src/Operation/DeleteOne.php b/src/Operation/DeleteOne.php index 3e2c3e089..44dd47ba5 100644 --- a/src/Operation/DeleteOne.php +++ b/src/Operation/DeleteOne.php @@ -29,7 +29,7 @@ * @see \MongoDB\Collection::deleteOne() * @see https://mongodb.com/docs/manual/reference/command/delete/ */ -class DeleteOne implements Executable, Explainable +final class DeleteOne implements Explainable { private Delete $delete; @@ -66,7 +66,7 @@ class DeleteOne implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, $filter, array $options = []) + public function __construct(string $databaseName, string $collectionName, array|object $filter, array $options = []) { $this->delete = new Delete($databaseName, $collectionName, $filter, 1, $options); } @@ -74,12 +74,10 @@ public function __construct(string $databaseName, string $collectionName, $filte /** * Execute the operation. * - * @see Executable::execute() - * @return DeleteResult * @throws UnsupportedException if collation is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): DeleteResult { return $this->delete->execute($server); } @@ -88,9 +86,8 @@ public function execute(Server $server) * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { return $this->delete->getCommandDocument(); } diff --git a/src/Operation/Distinct.php b/src/Operation/Distinct.php index 6397c300e..c2aa3ef23 100644 --- a/src/Operation/Distinct.php +++ b/src/Operation/Distinct.php @@ -31,6 +31,7 @@ use function is_array; use function is_integer; use function is_object; +use function is_string; use function MongoDB\create_field_path_type_map; use function MongoDB\is_document; @@ -40,19 +41,8 @@ * @see \MongoDB\Collection::distinct() * @see https://mongodb.com/docs/manual/reference/command/distinct/ */ -class Distinct implements Executable, Explainable +final class Distinct implements Explainable { - private string $databaseName; - - private string $collectionName; - - private string $fieldName; - - /** @var array|object */ - private $filter; - - private array $options; - /** * Constructs a distinct command. * @@ -62,7 +52,13 @@ class Distinct implements Executable, Explainable * * * comment (mixed): BSON value to attach as a comment to this command. * - * This is not supported for servers versions < 4.4. + * This is not supported for server versions < 4.4. + * + * * hint (string|document): The index to use. Specify either the index + * name as a string or the index key pattern as a document. If specified, + * then the query system will only consider plans using the hinted index. + * + * This is not supported for server versions < 7.1. * * * maxTimeMS (integer): The maximum amount of time to allow the query to * run. @@ -82,57 +78,53 @@ class Distinct implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, string $fieldName, $filter = [], array $options = []) + public function __construct(private string $databaseName, private string $collectionName, private string $fieldName, private array|object $filter = [], private array $options = []) { if (! is_document($filter)) { throw InvalidArgumentException::expectedDocumentType('$filter', $filter); } - if (isset($options['collation']) && ! is_document($options['collation'])) { - throw InvalidArgumentException::expectedDocumentType('"collation" option', $options['collation']); + if (isset($this->options['collation']) && ! is_document($this->options['collation'])) { + throw InvalidArgumentException::expectedDocumentType('"collation" option', $this->options['collation']); } - if (isset($options['maxTimeMS']) && ! is_integer($options['maxTimeMS'])) { - throw InvalidArgumentException::invalidType('"maxTimeMS" option', $options['maxTimeMS'], 'integer'); + if (isset($this->options['hint']) && ! is_string($this->options['hint']) && ! is_document($this->options['hint'])) { + throw InvalidArgumentException::expectedDocumentOrStringType('"hint" option', $this->options['hint']); } - if (isset($options['readConcern']) && ! $options['readConcern'] instanceof ReadConcern) { - throw InvalidArgumentException::invalidType('"readConcern" option', $options['readConcern'], ReadConcern::class); + if (isset($this->options['maxTimeMS']) && ! is_integer($this->options['maxTimeMS'])) { + throw InvalidArgumentException::invalidType('"maxTimeMS" option', $this->options['maxTimeMS'], 'integer'); } - if (isset($options['readPreference']) && ! $options['readPreference'] instanceof ReadPreference) { - throw InvalidArgumentException::invalidType('"readPreference" option', $options['readPreference'], ReadPreference::class); + if (isset($this->options['readConcern']) && ! $this->options['readConcern'] instanceof ReadConcern) { + throw InvalidArgumentException::invalidType('"readConcern" option', $this->options['readConcern'], ReadConcern::class); } - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); + if (isset($this->options['readPreference']) && ! $this->options['readPreference'] instanceof ReadPreference) { + throw InvalidArgumentException::invalidType('"readPreference" option', $this->options['readPreference'], ReadPreference::class); } - if (isset($options['typeMap']) && ! is_array($options['typeMap'])) { - throw InvalidArgumentException::invalidType('"typeMap" option', $options['typeMap'], 'array'); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - if (isset($options['readConcern']) && $options['readConcern']->isDefault()) { - unset($options['readConcern']); + if (isset($this->options['typeMap']) && ! is_array($this->options['typeMap'])) { + throw InvalidArgumentException::invalidType('"typeMap" option', $this->options['typeMap'], 'array'); } - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->fieldName = $fieldName; - $this->filter = $filter; - $this->options = $options; + if (isset($this->options['readConcern']) && $this->options['readConcern']->isDefault()) { + unset($this->options['readConcern']); + } } /** * Execute the operation. * - * @see Executable::execute() - * @return array * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if read concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): array { $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction(); if ($inTransaction && isset($this->options['readConcern'])) { @@ -158,9 +150,8 @@ public function execute(Server $server) * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { $cmd = $this->createCommandDocument(); @@ -190,6 +181,11 @@ private function createCommandDocument(): array $cmd['collation'] = (object) $this->options['collation']; } + if (isset($this->options['hint'])) { + /** @psalm-var string|object */ + $cmd['hint'] = is_array($this->options['hint']) ? (object) $this->options['hint'] : $this->options['hint']; + } + foreach (['comment', 'maxTimeMS'] as $option) { if (isset($this->options[$option])) { $cmd[$option] = $this->options[$option]; diff --git a/src/Operation/DropCollection.php b/src/Operation/DropCollection.php index d24f9fd88..0c520801c 100644 --- a/src/Operation/DropCollection.php +++ b/src/Operation/DropCollection.php @@ -26,9 +26,6 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Exception\UnsupportedException; -use function current; -use function is_array; - /** * Operation for the drop command. * @@ -36,16 +33,10 @@ * @see \MongoDB\Database::dropCollection() * @see https://mongodb.com/docs/manual/reference/command/drop/ */ -class DropCollection implements Executable +final class DropCollection { private const ERROR_CODE_NAMESPACE_NOT_FOUND = 26; - private string $databaseName; - - private string $collectionName; - - private array $options; - /** * Constructs a drop command. * @@ -57,9 +48,6 @@ class DropCollection implements Executable * * * session (MongoDB\Driver\Session): Client session. * - * * typeMap (array): Type map for BSON deserialization. This will be used - * for the returned command result document. - * * * writeConcern (MongoDB\Driver\WriteConcern): Write concern. * * @param string $databaseName Database name @@ -67,38 +55,28 @@ class DropCollection implements Executable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, private array $options = []) { - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - if (isset($options['typeMap']) && ! is_array($options['typeMap'])) { - throw InvalidArgumentException::invalidType('"typeMap" option', $options['typeMap'], 'array'); + if (isset($this->options['writeConcern']) && ! $this->options['writeConcern'] instanceof WriteConcern) { + throw InvalidArgumentException::invalidType('"writeConcern" option', $this->options['writeConcern'], WriteConcern::class); } - if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) { - throw InvalidArgumentException::invalidType('"writeConcern" option', $options['writeConcern'], WriteConcern::class); + if (isset($this->options['writeConcern']) && $this->options['writeConcern']->isDefault()) { + unset($this->options['writeConcern']); } - - if (isset($options['writeConcern']) && $options['writeConcern']->isDefault()) { - unset($options['writeConcern']); - } - - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() - * @return array|object Command result document * @throws UnsupportedException if write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): void { $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction(); if ($inTransaction && isset($this->options['writeConcern'])) { @@ -106,23 +84,16 @@ public function execute(Server $server) } try { - $cursor = $server->executeWriteCommand($this->databaseName, $this->createCommand(), $this->createOptions()); + $server->executeWriteCommand($this->databaseName, $this->createCommand(), $this->createOptions()); } catch (CommandException $e) { /* The server may return an error if the collection does not exist. - * Check for an error code and return the command reply instead of - * throwing. */ + * Ignore the exception to make the drop operation idempotent */ if ($e->getCode() === self::ERROR_CODE_NAMESPACE_NOT_FOUND) { - return $e->getResultDocument(); + return; } throw $e; } - - if (isset($this->options['typeMap'])) { - $cursor->setTypeMap($this->options['typeMap']); - } - - return current($cursor->toArray()); } /** diff --git a/src/Operation/DropDatabase.php b/src/Operation/DropDatabase.php index 76a3d772f..1cc71a4c0 100644 --- a/src/Operation/DropDatabase.php +++ b/src/Operation/DropDatabase.php @@ -24,9 +24,6 @@ use MongoDB\Driver\WriteConcern; use MongoDB\Exception\InvalidArgumentException; -use function current; -use function is_array; - /** * Operation for the dropDatabase command. * @@ -34,12 +31,8 @@ * @see \MongoDB\Database::drop() * @see https://mongodb.com/docs/manual/reference/command/dropDatabase/ */ -class DropDatabase implements Executable +final class DropDatabase { - private string $databaseName; - - private array $options; - /** * Constructs a dropDatabase command. * @@ -51,53 +44,35 @@ class DropDatabase implements Executable * * * session (MongoDB\Driver\Session): Client session. * - * * typeMap (array): Type map for BSON deserialization. This will be used - * for the returned command result document. - * * * writeConcern (MongoDB\Driver\WriteConcern): Write concern. * * @param string $databaseName Database name * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, array $options = []) + public function __construct(private string $databaseName, private array $options = []) { - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); - } - - if (isset($options['typeMap']) && ! is_array($options['typeMap'])) { - throw InvalidArgumentException::invalidType('"typeMap" option', $options['typeMap'], 'array'); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) { - throw InvalidArgumentException::invalidType('"writeConcern" option', $options['writeConcern'], WriteConcern::class); + if (isset($this->options['writeConcern']) && ! $this->options['writeConcern'] instanceof WriteConcern) { + throw InvalidArgumentException::invalidType('"writeConcern" option', $this->options['writeConcern'], WriteConcern::class); } - if (isset($options['writeConcern']) && $options['writeConcern']->isDefault()) { - unset($options['writeConcern']); + if (isset($this->options['writeConcern']) && $this->options['writeConcern']->isDefault()) { + unset($this->options['writeConcern']); } - - $this->databaseName = $databaseName; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() - * @return array|object Command result document * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): void { - $cursor = $server->executeWriteCommand($this->databaseName, $this->createCommand(), $this->createOptions()); - - if (isset($this->options['typeMap'])) { - $cursor->setTypeMap($this->options['typeMap']); - } - - return current($cursor->toArray()); + $server->executeWriteCommand($this->databaseName, $this->createCommand(), $this->createOptions()); } /** diff --git a/src/Operation/DropEncryptedCollection.php b/src/Operation/DropEncryptedCollection.php index 491a8e9eb..646844a3a 100644 --- a/src/Operation/DropEncryptedCollection.php +++ b/src/Operation/DropEncryptedCollection.php @@ -34,10 +34,10 @@ * @internal * @see \MongoDB\Database::dropCollection() * @see \MongoDB\Collection::drop() - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#drop-collection-helper + * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.md#drop-collection-helper * @see https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/manage-collections/ */ -class DropEncryptedCollection implements Executable +final class DropEncryptedCollection { private DropCollection $dropCollection; @@ -84,17 +84,13 @@ public function __construct(string $databaseName, string $collectionName, array $this->dropCollection = new DropCollection($databaseName, $collectionName, $options); } - /** - * @see Executable::execute() - * @return array|object Command result document from dropping the encrypted collection - * @throws DriverRuntimeException for other driver errors (e.g. connection errors) - */ - public function execute(Server $server) + /** @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ + public function execute(Server $server): void { foreach ($this->dropMetadataCollections as $dropMetadataCollection) { $dropMetadataCollection->execute($server); } - return $this->dropCollection->execute($server); + $this->dropCollection->execute($server); } } diff --git a/src/Operation/DropIndexes.php b/src/Operation/DropIndexes.php index 0bbd08247..46a89f22f 100644 --- a/src/Operation/DropIndexes.php +++ b/src/Operation/DropIndexes.php @@ -25,8 +25,6 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Exception\UnsupportedException; -use function current; -use function is_array; use function is_integer; /** @@ -35,16 +33,8 @@ * @see \MongoDB\Collection::dropIndexes() * @see https://mongodb.com/docs/manual/reference/command/dropIndexes/ */ -class DropIndexes implements Executable +final class DropIndexes { - private string $databaseName; - - private string $collectionName; - - private string $indexName; - - private array $options; - /** * Constructs a dropIndexes command. * @@ -59,9 +49,6 @@ class DropIndexes implements Executable * * * session (MongoDB\Driver\Session): Client session. * - * * typeMap (array): Type map for BSON deserialization. This will be used - * for the returned command result document. - * * * writeConcern (MongoDB\Driver\WriteConcern): Write concern. * * @param string $databaseName Database name @@ -70,60 +57,43 @@ class DropIndexes implements Executable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, string $indexName, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, private string $indexName, private array $options = []) { if ($indexName === '') { throw new InvalidArgumentException('$indexName cannot be empty'); } - if (isset($options['maxTimeMS']) && ! is_integer($options['maxTimeMS'])) { - throw InvalidArgumentException::invalidType('"maxTimeMS" option', $options['maxTimeMS'], 'integer'); + if (isset($this->options['maxTimeMS']) && ! is_integer($this->options['maxTimeMS'])) { + throw InvalidArgumentException::invalidType('"maxTimeMS" option', $this->options['maxTimeMS'], 'integer'); } - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - if (isset($options['typeMap']) && ! is_array($options['typeMap'])) { - throw InvalidArgumentException::invalidType('"typeMap" option', $options['typeMap'], 'array'); + if (isset($this->options['writeConcern']) && ! $this->options['writeConcern'] instanceof WriteConcern) { + throw InvalidArgumentException::invalidType('"writeConcern" option', $this->options['writeConcern'], WriteConcern::class); } - if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) { - throw InvalidArgumentException::invalidType('"writeConcern" option', $options['writeConcern'], WriteConcern::class); + if (isset($this->options['writeConcern']) && $this->options['writeConcern']->isDefault()) { + unset($this->options['writeConcern']); } - - if (isset($options['writeConcern']) && $options['writeConcern']->isDefault()) { - unset($options['writeConcern']); - } - - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->indexName = $indexName; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() - * @return array|object Command result document * @throws UnsupportedException if write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): void { $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction(); if ($inTransaction && isset($this->options['writeConcern'])) { throw UnsupportedException::writeConcernNotSupportedInTransaction(); } - $cursor = $server->executeWriteCommand($this->databaseName, $this->createCommand(), $this->createOptions()); - - if (isset($this->options['typeMap'])) { - $cursor->setTypeMap($this->options['typeMap']); - } - - return current($cursor->toArray()); + $server->executeWriteCommand($this->databaseName, $this->createCommand(), $this->createOptions()); } /** diff --git a/src/Operation/DropSearchIndex.php b/src/Operation/DropSearchIndex.php index a8a6ff1b7..c79025fbb 100644 --- a/src/Operation/DropSearchIndex.php +++ b/src/Operation/DropSearchIndex.php @@ -30,15 +30,10 @@ * @see \MongoDB\Collection::dropSearchIndexes() * @see https://mongodb.com/docs/manual/reference/command/dropSearchIndexes/ */ -class DropSearchIndex implements Executable +final class DropSearchIndex { private const ERROR_CODE_NAMESPACE_NOT_FOUND = 26; - private string $databaseName; - private string $collectionName; - private string $name; - private array $options; - /** * Constructs a dropSearchIndex command. * @@ -48,22 +43,16 @@ class DropSearchIndex implements Executable * @param array{comment?: mixed} $options Command options * @throws InvalidArgumentException for parameter parsing errors */ - public function __construct(string $databaseName, string $collectionName, string $name, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, private string $name, private array $options = []) { if ($name === '') { throw new InvalidArgumentException('Index name cannot be empty'); } - - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->name = $name; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() * @throws UnsupportedException if write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ diff --git a/src/Operation/EstimatedDocumentCount.php b/src/Operation/EstimatedDocumentCount.php index 718a0142c..716996541 100644 --- a/src/Operation/EstimatedDocumentCount.php +++ b/src/Operation/EstimatedDocumentCount.php @@ -35,12 +35,8 @@ * @see \MongoDB\Collection::estimatedDocumentCount() * @see https://mongodb.com/docs/manual/reference/command/count/ */ -class EstimatedDocumentCount implements Executable, Explainable +final class EstimatedDocumentCount implements Explainable { - private string $databaseName; - - private string $collectionName; - private array $options; /** @@ -67,11 +63,8 @@ class EstimatedDocumentCount implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, array $options = []) { - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - if (isset($options['maxTimeMS']) && ! is_integer($options['maxTimeMS'])) { throw InvalidArgumentException::invalidType('"maxTimeMS" option', $options['maxTimeMS'], 'integer'); } @@ -94,13 +87,11 @@ public function __construct(string $databaseName, string $collectionName, array /** * Execute the operation. * - * @see Executable::execute() - * @return integer * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if collation or read concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): int { return $this->createCount()->execute($server); } @@ -109,9 +100,8 @@ public function execute(Server $server) * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { return $this->createCount()->getCommandDocument(); } diff --git a/src/Operation/Executable.php b/src/Operation/Executable.php deleted file mode 100644 index 5bd8c68b3..000000000 --- a/src/Operation/Executable.php +++ /dev/null @@ -1,38 +0,0 @@ -options['readPreference']) && ! $this->options['readPreference'] instanceof ReadPreference) { + throw InvalidArgumentException::invalidType('"readPreference" option', $this->options['readPreference'], ReadPreference::class); } - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - if (isset($options['typeMap']) && ! is_array($options['typeMap'])) { - throw InvalidArgumentException::invalidType('"typeMap" option', $options['typeMap'], 'array'); + if (isset($this->options['typeMap']) && ! is_array($this->options['typeMap'])) { + throw InvalidArgumentException::invalidType('"typeMap" option', $this->options['typeMap'], 'array'); } - if (isset($options['verbosity']) && ! is_string($options['verbosity'])) { - throw InvalidArgumentException::invalidType('"verbosity" option', $options['verbosity'], 'string'); + if (isset($this->options['verbosity']) && ! is_string($this->options['verbosity'])) { + throw InvalidArgumentException::invalidType('"verbosity" option', $this->options['verbosity'], 'string'); } - - $this->databaseName = $databaseName; - $this->explainable = $explainable; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() - * @return array|object * @throws UnsupportedException if the server does not support explaining the operation * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): array|object { $cursor = $server->executeCommand($this->databaseName, $this->createCommand(), $this->createOptions()); diff --git a/src/Operation/Explainable.php b/src/Operation/Explainable.php index f380e1c32..0f8717f4b 100644 --- a/src/Operation/Explainable.php +++ b/src/Operation/Explainable.php @@ -23,12 +23,10 @@ * * @internal */ -interface Explainable extends Executable +interface Explainable { /** * Returns the command document for this operation. - * - * @return array */ - public function getCommandDocument(); + public function getCommandDocument(): array; } diff --git a/src/Operation/Find.php b/src/Operation/Find.php index 23b33d482..8d84c7bf0 100644 --- a/src/Operation/Find.php +++ b/src/Operation/Find.php @@ -17,7 +17,6 @@ namespace MongoDB\Operation; -use Iterator; use MongoDB\Codec\DocumentCodec; use MongoDB\Driver\CursorInterface; use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; @@ -30,16 +29,12 @@ use MongoDB\Exception\UnsupportedException; use MongoDB\Model\CodecCursor; +use function assert; use function is_array; use function is_bool; use function is_integer; -use function is_object; use function is_string; -use function MongoDB\document_to_array; use function MongoDB\is_document; -use function trigger_error; - -use const E_USER_DEPRECATED; /** * Operation for the find command. @@ -48,21 +43,12 @@ * @see https://mongodb.com/docs/manual/tutorial/query-documents/ * @see https://mongodb.com/docs/manual/reference/operator/query-modifier/ */ -class Find implements Executable, Explainable +final class Find implements Explainable { public const NON_TAILABLE = 1; public const TAILABLE = 2; public const TAILABLE_AWAIT = 3; - private string $databaseName; - - private string $collectionName; - - /** @var array|object */ - private $filter; - - private array $options; - /** * Constructs a find command. * @@ -101,28 +87,15 @@ class Find implements Executable, Explainable * * maxAwaitTimeMS (integer): The maxium amount of time for the server to wait * on new documents to satisfy a query, if cursorType is TAILABLE_AWAIT. * - * * maxScan (integer): Maximum number of documents or index keys to scan - * when executing the query. - * - * This option has been deprecated since version 1.4. - * * * maxTimeMS (integer): The maximum amount of time to allow the query to - * run. If "$maxTimeMS" also exists in the modifiers document, this - * option will take precedence. + * run. * * * min (document): The inclusive upper bound for a specific index. * - * * modifiers (document): Meta operators that modify the output or - * behavior of a query. Use of these operators is deprecated in favor of - * named options. - * * * noCursorTimeout (boolean): The server normally times out idle cursors * after an inactivity period (10 minutes) to prevent excess memory use. * Set this option to prevent that. * - * * oplogReplay (boolean): Internal replication use only. The driver - * should not set this. This option is deprecated as of MongoDB 4.4. - * * * projection (document): Limits the fields to return for the matching * document. * @@ -141,14 +114,7 @@ class Find implements Executable, Explainable * * * skip (integer): The number of documents to skip before returning. * - * * snapshot (boolean): Prevents the cursor from returning a document more - * than once because of an intervening write operation. - * - * This options has been deprecated since version 1.4. - * - * * sort (document): The order in which to return matching documents. If - * "$orderby" also exists in the modifiers document, this option will - * take precedence. + * * sort (document): The order in which to return matching documents. * * * let (document): Map of parameter names and values. Values must be * constant or closed expressions that do not reference document fields. @@ -164,161 +130,130 @@ class Find implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, $filter, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, private array|object $filter, private array $options = []) { if (! is_document($filter)) { throw InvalidArgumentException::expectedDocumentType('$filter', $filter); } - if (isset($options['allowDiskUse']) && ! is_bool($options['allowDiskUse'])) { - throw InvalidArgumentException::invalidType('"allowDiskUse" option', $options['allowDiskUse'], 'boolean'); + if (isset($this->options['allowDiskUse']) && ! is_bool($this->options['allowDiskUse'])) { + throw InvalidArgumentException::invalidType('"allowDiskUse" option', $this->options['allowDiskUse'], 'boolean'); } - if (isset($options['allowPartialResults']) && ! is_bool($options['allowPartialResults'])) { - throw InvalidArgumentException::invalidType('"allowPartialResults" option', $options['allowPartialResults'], 'boolean'); + if (isset($this->options['allowPartialResults']) && ! is_bool($this->options['allowPartialResults'])) { + throw InvalidArgumentException::invalidType('"allowPartialResults" option', $this->options['allowPartialResults'], 'boolean'); } - if (isset($options['batchSize']) && ! is_integer($options['batchSize'])) { - throw InvalidArgumentException::invalidType('"batchSize" option', $options['batchSize'], 'integer'); + if (isset($this->options['batchSize']) && ! is_integer($this->options['batchSize'])) { + throw InvalidArgumentException::invalidType('"batchSize" option', $this->options['batchSize'], 'integer'); } - if (isset($options['codec']) && ! $options['codec'] instanceof DocumentCodec) { - throw InvalidArgumentException::invalidType('"codec" option', $options['codec'], DocumentCodec::class); + if (isset($this->options['codec']) && ! $this->options['codec'] instanceof DocumentCodec) { + throw InvalidArgumentException::invalidType('"codec" option', $this->options['codec'], DocumentCodec::class); } - if (isset($options['collation']) && ! is_document($options['collation'])) { - throw InvalidArgumentException::expectedDocumentType('"collation" option', $options['collation']); + if (isset($this->options['collation']) && ! is_document($this->options['collation'])) { + throw InvalidArgumentException::expectedDocumentType('"collation" option', $this->options['collation']); } - if (isset($options['cursorType'])) { - if (! is_integer($options['cursorType'])) { - throw InvalidArgumentException::invalidType('"cursorType" option', $options['cursorType'], 'integer'); + if (isset($this->options['cursorType'])) { + if (! is_integer($this->options['cursorType'])) { + throw InvalidArgumentException::invalidType('"cursorType" option', $this->options['cursorType'], 'integer'); } if ( - $options['cursorType'] !== self::NON_TAILABLE && - $options['cursorType'] !== self::TAILABLE && - $options['cursorType'] !== self::TAILABLE_AWAIT + $this->options['cursorType'] !== self::NON_TAILABLE && + $this->options['cursorType'] !== self::TAILABLE && + $this->options['cursorType'] !== self::TAILABLE_AWAIT ) { - throw new InvalidArgumentException('Invalid value for "cursorType" option: ' . $options['cursorType']); + throw new InvalidArgumentException('Invalid value for "cursorType" option: ' . $this->options['cursorType']); } } - if (isset($options['hint']) && ! is_string($options['hint']) && ! is_array($options['hint']) && ! is_object($options['hint'])) { - throw InvalidArgumentException::invalidType('"hint" option', $options['hint'], 'string or array or object'); - } - - if (isset($options['limit']) && ! is_integer($options['limit'])) { - throw InvalidArgumentException::invalidType('"limit" option', $options['limit'], 'integer'); - } - - if (isset($options['max']) && ! is_document($options['max'])) { - throw InvalidArgumentException::expectedDocumentType('"max" option', $options['max']); + if (isset($this->options['hint']) && ! is_string($this->options['hint']) && ! is_document($this->options['hint'])) { + throw InvalidArgumentException::expectedDocumentOrStringType('"hint" option', $this->options['hint']); } - if (isset($options['maxAwaitTimeMS']) && ! is_integer($options['maxAwaitTimeMS'])) { - throw InvalidArgumentException::invalidType('"maxAwaitTimeMS" option', $options['maxAwaitTimeMS'], 'integer'); + if (isset($this->options['limit']) && ! is_integer($this->options['limit'])) { + throw InvalidArgumentException::invalidType('"limit" option', $this->options['limit'], 'integer'); } - if (isset($options['maxScan']) && ! is_integer($options['maxScan'])) { - throw InvalidArgumentException::invalidType('"maxScan" option', $options['maxScan'], 'integer'); + if (isset($this->options['max']) && ! is_document($this->options['max'])) { + throw InvalidArgumentException::expectedDocumentType('"max" option', $this->options['max']); } - if (isset($options['maxTimeMS']) && ! is_integer($options['maxTimeMS'])) { - throw InvalidArgumentException::invalidType('"maxTimeMS" option', $options['maxTimeMS'], 'integer'); + if (isset($this->options['maxAwaitTimeMS']) && ! is_integer($this->options['maxAwaitTimeMS'])) { + throw InvalidArgumentException::invalidType('"maxAwaitTimeMS" option', $this->options['maxAwaitTimeMS'], 'integer'); } - if (isset($options['min']) && ! is_document($options['min'])) { - throw InvalidArgumentException::expectedDocumentType('"min" option', $options['min']); + if (isset($this->options['maxTimeMS']) && ! is_integer($this->options['maxTimeMS'])) { + throw InvalidArgumentException::invalidType('"maxTimeMS" option', $this->options['maxTimeMS'], 'integer'); } - if (isset($options['modifiers']) && ! is_document($options['modifiers'])) { - throw InvalidArgumentException::expectedDocumentType('"modifiers" option', $options['modifiers']); + if (isset($this->options['min']) && ! is_document($this->options['min'])) { + throw InvalidArgumentException::expectedDocumentType('"min" option', $this->options['min']); } - if (isset($options['noCursorTimeout']) && ! is_bool($options['noCursorTimeout'])) { - throw InvalidArgumentException::invalidType('"noCursorTimeout" option', $options['noCursorTimeout'], 'boolean'); + if (isset($this->options['noCursorTimeout']) && ! is_bool($this->options['noCursorTimeout'])) { + throw InvalidArgumentException::invalidType('"noCursorTimeout" option', $this->options['noCursorTimeout'], 'boolean'); } - if (isset($options['oplogReplay']) && ! is_bool($options['oplogReplay'])) { - throw InvalidArgumentException::invalidType('"oplogReplay" option', $options['oplogReplay'], 'boolean'); + if (isset($this->options['projection']) && ! is_document($this->options['projection'])) { + throw InvalidArgumentException::expectedDocumentType('"projection" option', $this->options['projection']); } - if (isset($options['projection']) && ! is_document($options['projection'])) { - throw InvalidArgumentException::expectedDocumentType('"projection" option', $options['projection']); + if (isset($this->options['readConcern']) && ! $this->options['readConcern'] instanceof ReadConcern) { + throw InvalidArgumentException::invalidType('"readConcern" option', $this->options['readConcern'], ReadConcern::class); } - if (isset($options['readConcern']) && ! $options['readConcern'] instanceof ReadConcern) { - throw InvalidArgumentException::invalidType('"readConcern" option', $options['readConcern'], ReadConcern::class); + if (isset($this->options['readPreference']) && ! $this->options['readPreference'] instanceof ReadPreference) { + throw InvalidArgumentException::invalidType('"readPreference" option', $this->options['readPreference'], ReadPreference::class); } - if (isset($options['readPreference']) && ! $options['readPreference'] instanceof ReadPreference) { - throw InvalidArgumentException::invalidType('"readPreference" option', $options['readPreference'], ReadPreference::class); + if (isset($this->options['returnKey']) && ! is_bool($this->options['returnKey'])) { + throw InvalidArgumentException::invalidType('"returnKey" option', $this->options['returnKey'], 'boolean'); } - if (isset($options['returnKey']) && ! is_bool($options['returnKey'])) { - throw InvalidArgumentException::invalidType('"returnKey" option', $options['returnKey'], 'boolean'); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); + if (isset($this->options['showRecordId']) && ! is_bool($this->options['showRecordId'])) { + throw InvalidArgumentException::invalidType('"showRecordId" option', $this->options['showRecordId'], 'boolean'); } - if (isset($options['showRecordId']) && ! is_bool($options['showRecordId'])) { - throw InvalidArgumentException::invalidType('"showRecordId" option', $options['showRecordId'], 'boolean'); + if (isset($this->options['skip']) && ! is_integer($this->options['skip'])) { + throw InvalidArgumentException::invalidType('"skip" option', $this->options['skip'], 'integer'); } - if (isset($options['skip']) && ! is_integer($options['skip'])) { - throw InvalidArgumentException::invalidType('"skip" option', $options['skip'], 'integer'); + if (isset($this->options['sort']) && ! is_document($this->options['sort'])) { + throw InvalidArgumentException::expectedDocumentType('"sort" option', $this->options['sort']); } - if (isset($options['snapshot']) && ! is_bool($options['snapshot'])) { - throw InvalidArgumentException::invalidType('"snapshot" option', $options['snapshot'], 'boolean'); + if (isset($this->options['typeMap']) && ! is_array($this->options['typeMap'])) { + throw InvalidArgumentException::invalidType('"typeMap" option', $this->options['typeMap'], 'array'); } - if (isset($options['sort']) && ! is_document($options['sort'])) { - throw InvalidArgumentException::expectedDocumentType('"sort" option', $options['sort']); + if (isset($this->options['let']) && ! is_document($this->options['let'])) { + throw InvalidArgumentException::expectedDocumentType('"let" option', $this->options['let']); } - if (isset($options['typeMap']) && ! is_array($options['typeMap'])) { - throw InvalidArgumentException::invalidType('"typeMap" option', $options['typeMap'], 'array'); + if (isset($this->options['readConcern']) && $this->options['readConcern']->isDefault()) { + unset($this->options['readConcern']); } - if (isset($options['let']) && ! is_document($options['let'])) { - throw InvalidArgumentException::expectedDocumentType('"let" option', $options['let']); - } - - if (isset($options['readConcern']) && $options['readConcern']->isDefault()) { - unset($options['readConcern']); - } - - if (isset($options['snapshot'])) { - trigger_error('The "snapshot" option is deprecated and will be removed in a future release', E_USER_DEPRECATED); - } - - if (isset($options['maxScan'])) { - trigger_error('The "maxScan" option is deprecated and will be removed in a future release', E_USER_DEPRECATED); - } - - if (isset($options['codec']) && isset($options['typeMap'])) { + if (isset($this->options['codec']) && isset($this->options['typeMap'])) { throw InvalidArgumentException::cannotCombineCodecAndTypeMap(); } - - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->filter = $filter; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() - * @return CursorInterface&Iterator * @throws UnsupportedException if read concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): CursorInterface { $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction(); if ($inTransaction && isset($this->options['readConcern'])) { @@ -342,9 +277,8 @@ public function execute(Server $server) * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { $cmd = ['find' => $this->collectionName, 'filter' => (object) $this->filter]; @@ -357,28 +291,6 @@ public function getCommandDocument() // maxAwaitTimeMS is a Query level option so should not be considered here unset($options['maxAwaitTimeMS']); - $modifierFallback = [ - ['allowPartialResults', 'partial'], - ['comment', '$comment'], - ['hint', '$hint'], - ['maxScan', '$maxScan'], - ['max', '$max'], - ['maxTimeMS', '$maxTimeMS'], - ['min', '$min'], - ['returnKey', '$returnKey'], - ['showRecordId', '$showDiskLoc'], - ['sort', '$orderby'], - ['snapshot', '$snapshot'], - ]; - - foreach ($modifierFallback as $modifier) { - if (! isset($options[$modifier[0]]) && isset($options['modifiers'][$modifier[1]])) { - $options[$modifier[0]] = $options['modifiers'][$modifier[1]]; - } - } - - unset($options['modifiers']); - return $cmd + $options; } @@ -423,7 +335,7 @@ private function createQueryOptions(): array } } - foreach (['allowDiskUse', 'allowPartialResults', 'batchSize', 'comment', 'hint', 'limit', 'maxAwaitTimeMS', 'maxScan', 'maxTimeMS', 'noCursorTimeout', 'oplogReplay', 'projection', 'readConcern', 'returnKey', 'showRecordId', 'skip', 'snapshot', 'sort'] as $option) { + foreach (['allowDiskUse', 'allowPartialResults', 'batchSize', 'comment', 'hint', 'limit', 'maxAwaitTimeMS', 'maxTimeMS', 'noCursorTimeout', 'projection', 'readConcern', 'returnKey', 'showRecordId', 'skip', 'sort'] as $option) { if (isset($this->options[$option])) { $options[$option] = $this->options[$option]; } @@ -435,10 +347,14 @@ private function createQueryOptions(): array } } - if (! empty($this->options['modifiers'])) { - /** @psalm-var array|object */ - $modifiers = $this->options['modifiers']; - $options['modifiers'] = is_object($modifiers) ? document_to_array($modifiers) : $modifiers; + // Ensure no cursor is left behind when limit == batchSize by increasing batchSize + if (isset($options['limit'], $options['batchSize']) && $options['limit'] === $options['batchSize']) { + assert(is_integer($options['batchSize'])); + $options['batchSize']++; + } + + if (isset($options['limit']) && $options['limit'] === 1) { + $options['singleBatch'] = true; } return $options; diff --git a/src/Operation/FindAndModify.php b/src/Operation/FindAndModify.php index 300f4e97a..3d77dd643 100644 --- a/src/Operation/FindAndModify.php +++ b/src/Operation/FindAndModify.php @@ -51,16 +51,12 @@ * @internal * @see https://mongodb.com/docs/manual/reference/command/findAndModify/ */ -class FindAndModify implements Executable, Explainable +final class FindAndModify implements Explainable { private const WIRE_VERSION_FOR_HINT = 9; private const WIRE_VERSION_FOR_UNSUPPORTED_OPTION_SERVER_SIDE_ERROR = 8; - private string $databaseName; - - private string $collectionName; - private array $options; /** @@ -131,7 +127,7 @@ class FindAndModify implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, array $options) + public function __construct(private string $databaseName, private string $collectionName, array $options) { $options += ['remove' => false]; @@ -155,8 +151,8 @@ public function __construct(string $databaseName, string $collectionName, array throw InvalidArgumentException::expectedDocumentType('"fields" option', $options['fields']); } - if (isset($options['hint']) && ! is_string($options['hint']) && ! is_array($options['hint']) && ! is_object($options['hint'])) { - throw InvalidArgumentException::invalidType('"hint" option', $options['hint'], ['string', 'array', 'object']); + if (isset($options['hint']) && ! is_string($options['hint']) && ! is_document($options['hint'])) { + throw InvalidArgumentException::expectedDocumentOrStringType('"hint" option', $options['hint']); } if (isset($options['maxTimeMS']) && ! is_integer($options['maxTimeMS'])) { @@ -219,21 +215,17 @@ public function __construct(string $databaseName, string $collectionName, array throw InvalidArgumentException::cannotCombineCodecAndTypeMap(); } - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() - * @return array|object|null * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if hint or write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): array|object|null { /* Server versions >= 4.2.0 raise errors for unsupported update options. * For previous versions, the CRUD spec requires a client-side error. */ @@ -280,9 +272,8 @@ public function execute(Server $server) * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { return $this->createCommandDocument(); } diff --git a/src/Operation/FindOne.php b/src/Operation/FindOne.php index 48f931fab..f685de5ae 100644 --- a/src/Operation/FindOne.php +++ b/src/Operation/FindOne.php @@ -31,7 +31,7 @@ * @see https://mongodb.com/docs/manual/tutorial/query-documents/ * @see https://mongodb.com/docs/manual/reference/operator/query-modifier/ */ -class FindOne implements Executable, Explainable +final class FindOne implements Explainable { private Find $find; @@ -55,20 +55,11 @@ class FindOne implements Executable, Explainable * * * max (document): The exclusive upper bound for a specific index. * - * * maxScan (integer): Maximum number of documents or index keys to scan - * when executing the query. - * - * This option has been deprecated since version 1.4. - * * * maxTimeMS (integer): The maximum amount of time to allow the query to - * run. If "$maxTimeMS" also exists in the modifiers document, this - * option will take precedence. + * run. * * * min (document): The inclusive upper bound for a specific index. * - * * modifiers (document): Meta-operators modifying the output or behavior - * of a query. - * * * projection (document): Limits the fields to return for the matching * document. * @@ -87,9 +78,7 @@ class FindOne implements Executable, Explainable * * * skip (integer): The number of documents to skip before returning. * - * * sort (document): The order in which to return matching documents. If - * "$orderby" also exists in the modifiers document, this option will - * take precedence. + * * sort (document): The order in which to return matching documents. * * * let (document): Map of parameter names and values. Values must be * constant or closed expressions that do not reference document fields. @@ -104,7 +93,7 @@ class FindOne implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, $filter, array $options = []) + public function __construct(string $databaseName, string $collectionName, array|object $filter, array $options = []) { $this->find = new Find( $databaseName, @@ -117,12 +106,10 @@ public function __construct(string $databaseName, string $collectionName, $filte /** * Execute the operation. * - * @see Executable::execute() - * @return array|object|null * @throws UnsupportedException if collation or read concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): array|object|null { $cursor = $this->find->execute($server); $document = current($cursor->toArray()); @@ -134,9 +121,8 @@ public function execute(Server $server) * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { return $this->find->getCommandDocument(); } diff --git a/src/Operation/FindOneAndDelete.php b/src/Operation/FindOneAndDelete.php index cae2a1788..7c0f22ad0 100644 --- a/src/Operation/FindOneAndDelete.php +++ b/src/Operation/FindOneAndDelete.php @@ -30,7 +30,7 @@ * @see \MongoDB\Collection::findOneAndDelete() * @see https://mongodb.com/docs/manual/reference/command/findAndModify/ */ -class FindOneAndDelete implements Executable, Explainable +final class FindOneAndDelete implements Explainable { private FindAndModify $findAndModify; @@ -81,7 +81,7 @@ class FindOneAndDelete implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, $filter, array $options = []) + public function __construct(string $databaseName, string $collectionName, array|object $filter, array $options = []) { if (! is_document($filter)) { throw InvalidArgumentException::expectedDocumentType('$filter', $filter); @@ -107,12 +107,10 @@ public function __construct(string $databaseName, string $collectionName, $filte /** * Execute the operation. * - * @see Executable::execute() - * @return array|object|null * @throws UnsupportedException if collation or write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): array|object|null { return $this->findAndModify->execute($server); } @@ -121,9 +119,8 @@ public function execute(Server $server) * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { return $this->findAndModify->getCommandDocument(); } diff --git a/src/Operation/FindOneAndReplace.php b/src/Operation/FindOneAndReplace.php index 20412d645..5ea0c5a34 100644 --- a/src/Operation/FindOneAndReplace.php +++ b/src/Operation/FindOneAndReplace.php @@ -35,7 +35,7 @@ * @see \MongoDB\Collection::findOneAndReplace() * @see https://mongodb.com/docs/manual/reference/command/findAndModify/ */ -class FindOneAndReplace implements Executable, Explainable +final class FindOneAndReplace implements Explainable { public const RETURN_DOCUMENT_BEFORE = 1; public const RETURN_DOCUMENT_AFTER = 2; @@ -102,7 +102,7 @@ class FindOneAndReplace implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, $filter, $replacement, array $options = []) + public function __construct(string $databaseName, string $collectionName, array|object $filter, array|object $replacement, array $options = []) { if (! is_document($filter)) { throw InvalidArgumentException::expectedDocumentType('$filter', $filter); @@ -150,12 +150,10 @@ public function __construct(string $databaseName, string $collectionName, $filte /** * Execute the operation. * - * @see Executable::execute() - * @return array|object|null * @throws UnsupportedException if collation or write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): array|object|null { return $this->findAndModify->execute($server); } @@ -164,18 +162,13 @@ public function execute(Server $server) * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { return $this->findAndModify->getCommandDocument(); } - /** - * @param array|object $replacement - * @return array|object - */ - private function validateReplacement($replacement, ?DocumentCodec $codec) + private function validateReplacement(array|object $replacement, ?DocumentCodec $codec): array|object { if (isset($codec)) { $replacement = $codec->encode($replacement); diff --git a/src/Operation/FindOneAndUpdate.php b/src/Operation/FindOneAndUpdate.php index 783888b1f..00e97972b 100644 --- a/src/Operation/FindOneAndUpdate.php +++ b/src/Operation/FindOneAndUpdate.php @@ -23,9 +23,7 @@ use MongoDB\Exception\UnsupportedException; use function array_key_exists; -use function is_array; use function is_integer; -use function is_object; use function MongoDB\is_document; use function MongoDB\is_first_key_operator; use function MongoDB\is_pipeline; @@ -36,7 +34,7 @@ * @see \MongoDB\Collection::findOneAndUpdate() * @see https://mongodb.com/docs/manual/reference/command/findAndModify/ */ -class FindOneAndUpdate implements Executable, Explainable +final class FindOneAndUpdate implements Explainable { public const RETURN_DOCUMENT_BEFORE = 1; public const RETURN_DOCUMENT_AFTER = 2; @@ -106,16 +104,12 @@ class FindOneAndUpdate implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, $filter, $update, array $options = []) + public function __construct(string $databaseName, string $collectionName, array|object $filter, array|object $update, array $options = []) { if (! is_document($filter)) { throw InvalidArgumentException::expectedDocumentType('$filter', $filter); } - if (! is_array($update) && ! is_object($update)) { - throw InvalidArgumentException::invalidType('$update', $update, 'array or object'); - } - if (! is_first_key_operator($update) && ! is_pipeline($update)) { throw new InvalidArgumentException('Expected update operator(s) or non-empty pipeline for $update'); } @@ -156,12 +150,10 @@ public function __construct(string $databaseName, string $collectionName, $filte /** * Execute the operation. * - * @see Executable::execute() - * @return array|object|null * @throws UnsupportedException if collation or write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): array|object|null { return $this->findAndModify->execute($server); } @@ -170,9 +162,8 @@ public function execute(Server $server) * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { return $this->findAndModify->getCommandDocument(); } diff --git a/src/Operation/InsertMany.php b/src/Operation/InsertMany.php index 42b3a344f..70e149076 100644 --- a/src/Operation/InsertMany.php +++ b/src/Operation/InsertMany.php @@ -38,12 +38,8 @@ * @see \MongoDB\Collection::insertMany() * @see https://mongodb.com/docs/manual/reference/command/insert/ */ -class InsertMany implements Executable +final class InsertMany { - private string $databaseName; - - private string $collectionName; - /** @var list */ private array $documents; @@ -79,7 +75,7 @@ class InsertMany implements Executable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, array $documents, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, array $documents, array $options = []) { $options += ['ordered' => true]; @@ -111,8 +107,6 @@ public function __construct(string $databaseName, string $collectionName, array unset($options['writeConcern']); } - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; $this->documents = $this->validateDocuments($documents, $options['codec'] ?? null); $this->options = $options; } @@ -120,12 +114,10 @@ public function __construct(string $databaseName, string $collectionName, array /** * Execute the operation. * - * @see Executable::execute() - * @return InsertManyResult * @throws UnsupportedException if write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): InsertManyResult { $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction(); if ($inTransaction && isset($this->options['writeConcern'])) { diff --git a/src/Operation/InsertOne.php b/src/Operation/InsertOne.php index f745664d7..dff9f79f6 100644 --- a/src/Operation/InsertOne.php +++ b/src/Operation/InsertOne.php @@ -36,16 +36,9 @@ * @see \MongoDB\Collection::insertOne() * @see https://mongodb.com/docs/manual/reference/command/insert/ */ -class InsertOne implements Executable +final class InsertOne { - private string $databaseName; - - private string $collectionName; - - /** @var array|object */ - private $document; - - private array $options; + private array|object $document; /** * Constructs an insert command. @@ -72,47 +65,42 @@ class InsertOne implements Executable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, $document, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, array|object $document, private array $options = []) { - if (isset($options['bypassDocumentValidation']) && ! is_bool($options['bypassDocumentValidation'])) { - throw InvalidArgumentException::invalidType('"bypassDocumentValidation" option', $options['bypassDocumentValidation'], 'boolean'); + if (isset($this->options['bypassDocumentValidation']) && ! is_bool($this->options['bypassDocumentValidation'])) { + throw InvalidArgumentException::invalidType('"bypassDocumentValidation" option', $this->options['bypassDocumentValidation'], 'boolean'); } - if (isset($options['codec']) && ! $options['codec'] instanceof DocumentCodec) { - throw InvalidArgumentException::invalidType('"codec" option', $options['codec'], DocumentCodec::class); + if (isset($this->options['codec']) && ! $this->options['codec'] instanceof DocumentCodec) { + throw InvalidArgumentException::invalidType('"codec" option', $this->options['codec'], DocumentCodec::class); } - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) { - throw InvalidArgumentException::invalidType('"writeConcern" option', $options['writeConcern'], WriteConcern::class); + if (isset($this->options['writeConcern']) && ! $this->options['writeConcern'] instanceof WriteConcern) { + throw InvalidArgumentException::invalidType('"writeConcern" option', $this->options['writeConcern'], WriteConcern::class); } - if (isset($options['bypassDocumentValidation']) && ! $options['bypassDocumentValidation']) { - unset($options['bypassDocumentValidation']); + if (isset($this->options['bypassDocumentValidation']) && ! $this->options['bypassDocumentValidation']) { + unset($this->options['bypassDocumentValidation']); } - if (isset($options['writeConcern']) && $options['writeConcern']->isDefault()) { - unset($options['writeConcern']); + if (isset($this->options['writeConcern']) && $this->options['writeConcern']->isDefault()) { + unset($this->options['writeConcern']); } - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->document = $this->validateDocument($document, $options['codec'] ?? null); - $this->options = $options; + $this->document = $this->validateDocument($document, $this->options['codec'] ?? null); } /** * Execute the operation. * - * @see Executable::execute() - * @return InsertOneResult * @throws UnsupportedException if write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): InsertOneResult { $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction(); if (isset($this->options['writeConcern']) && $inTransaction) { @@ -166,11 +154,7 @@ private function createExecuteOptions(): array return $options; } - /** - * @param array|object $document - * @return array|object - */ - private function validateDocument($document, ?DocumentCodec $codec) + private function validateDocument(array|object $document, ?DocumentCodec $codec): array|object { if ($codec) { $document = $codec->encode($document); diff --git a/src/Operation/ListCollectionNames.php b/src/Operation/ListCollectionNames.php index f2124c4d4..3b32cd589 100644 --- a/src/Operation/ListCollectionNames.php +++ b/src/Operation/ListCollectionNames.php @@ -22,6 +22,7 @@ use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; use MongoDB\Driver\Server; use MongoDB\Exception\InvalidArgumentException; +use MongoDB\Model\CachingIterator; use MongoDB\Model\CallbackIterator; /** @@ -30,7 +31,7 @@ * @see \MongoDB\Database::listCollectionNames() * @see https://mongodb.com/docs/manual/reference/command/listCollections/ */ -class ListCollectionNames implements Executable +final class ListCollectionNames { private ListCollectionsCommand $listCollections; @@ -67,15 +68,16 @@ public function __construct(string $databaseName, array $options = []) /** * Execute the operation. * - * @see Executable::execute() - * @return Iterator + * @return Iterator * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ public function execute(Server $server): Iterator { - return new CallbackIterator( - $this->listCollections->execute($server), - fn (array $collectionInfo): string => (string) $collectionInfo['name'], + return new CachingIterator( + new CallbackIterator( + $this->listCollections->execute($server), + fn (array $collectionInfo): string => (string) $collectionInfo['name'], + ), ); } } diff --git a/src/Operation/ListCollections.php b/src/Operation/ListCollections.php index 4dfb15a6c..a86b0a1e5 100644 --- a/src/Operation/ListCollections.php +++ b/src/Operation/ListCollections.php @@ -22,8 +22,9 @@ use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; use MongoDB\Driver\Server; use MongoDB\Exception\InvalidArgumentException; +use MongoDB\Model\CachingIterator; +use MongoDB\Model\CallbackIterator; use MongoDB\Model\CollectionInfo; -use MongoDB\Model\CollectionInfoCommandIterator; /** * Operation for the listCollections command. @@ -31,10 +32,8 @@ * @see \MongoDB\Database::listCollections() * @see https://mongodb.com/docs/manual/reference/command/listCollections/ */ -class ListCollections implements Executable +final class ListCollections { - private string $databaseName; - private ListCollectionsCommand $listCollections; /** @@ -64,19 +63,25 @@ class ListCollections implements Executable */ public function __construct(string $databaseName, array $options = []) { - $this->databaseName = $databaseName; $this->listCollections = new ListCollectionsCommand($databaseName, ['nameOnly' => false] + $options); } /** * Execute the operation. * - * @see Executable::execute() * @return Iterator * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): Iterator { - return new CollectionInfoCommandIterator($this->listCollections->execute($server), $this->databaseName); + /** @var Iterator $collections */ + $collections = $this->listCollections->execute($server); + + return new CachingIterator( + new CallbackIterator( + $collections, + fn (array $collectionInfo, int $key): CollectionInfo => new CollectionInfo($collectionInfo), + ), + ); } } diff --git a/src/Operation/ListDatabaseNames.php b/src/Operation/ListDatabaseNames.php index 7b6a529b4..74263fb53 100644 --- a/src/Operation/ListDatabaseNames.php +++ b/src/Operation/ListDatabaseNames.php @@ -33,7 +33,7 @@ * @see \MongoDB\Client::listDatabaseNames() * @see https://mongodb.com/docs/manual/reference/command/listDatabases/#mongodb-dbcommand-dbcmd.listDatabases */ -class ListDatabaseNames implements Executable +final class ListDatabaseNames { private ListDatabasesCommand $listDatabases; @@ -69,7 +69,7 @@ public function __construct(array $options = []) /** * Execute the operation. * - * @see Executable::execute() + * @return Iterator * @throws UnexpectedValueException if the command response was malformed * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ diff --git a/src/Operation/ListDatabases.php b/src/Operation/ListDatabases.php index 00834b248..ab32ef7e6 100644 --- a/src/Operation/ListDatabases.php +++ b/src/Operation/ListDatabases.php @@ -17,14 +17,15 @@ namespace MongoDB\Operation; +use ArrayIterator; use Iterator; use MongoDB\Command\ListDatabases as ListDatabasesCommand; use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; use MongoDB\Driver\Server; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Exception\UnexpectedValueException; +use MongoDB\Model\CallbackIterator; use MongoDB\Model\DatabaseInfo; -use MongoDB\Model\DatabaseInfoLegacyIterator; /** * Operation for the ListDatabases command. @@ -32,7 +33,7 @@ * @see \MongoDB\Client::listDatabases() * @see https://mongodb.com/docs/manual/reference/command/listDatabases/#mongodb-dbcommand-dbcmd.listDatabases` */ -class ListDatabases implements Executable +final class ListDatabases { private ListDatabasesCommand $listDatabases; @@ -68,13 +69,18 @@ public function __construct(array $options = []) /** * Execute the operation. * - * @see Executable::execute() * @return Iterator * @throws UnexpectedValueException if the command response was malformed * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): Iterator { - return new DatabaseInfoLegacyIterator($this->listDatabases->execute($server)); + /** @var list $databases */ + $databases = $this->listDatabases->execute($server); + + return new CallbackIterator( + new ArrayIterator($databases), + fn (array $databaseInfo): DatabaseInfo => new DatabaseInfo($databaseInfo), + ); } } diff --git a/src/Operation/ListIndexes.php b/src/Operation/ListIndexes.php index 130a53a16..8fab516fc 100644 --- a/src/Operation/ListIndexes.php +++ b/src/Operation/ListIndexes.php @@ -20,14 +20,15 @@ use EmptyIterator; use Iterator; use MongoDB\Driver\Command; +use MongoDB\Driver\CursorInterface; use MongoDB\Driver\Exception\CommandException; use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; use MongoDB\Driver\Server; use MongoDB\Driver\Session; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Model\CachingIterator; +use MongoDB\Model\CallbackIterator; use MongoDB\Model\IndexInfo; -use MongoDB\Model\IndexInfoIteratorIterator; use function is_integer; @@ -37,17 +38,11 @@ * @see \MongoDB\Collection::listIndexes() * @see https://mongodb.com/docs/manual/reference/command/listIndexes/ */ -class ListIndexes implements Executable +final class ListIndexes { private const ERROR_CODE_DATABASE_NOT_FOUND = 60; private const ERROR_CODE_NAMESPACE_NOT_FOUND = 26; - private string $databaseName; - - private string $collectionName; - - private array $options; - /** * Constructs a listIndexes command. * @@ -67,59 +62,24 @@ class ListIndexes implements Executable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, private array $options = []) { - if (isset($options['maxTimeMS']) && ! is_integer($options['maxTimeMS'])) { - throw InvalidArgumentException::invalidType('"maxTimeMS" option', $options['maxTimeMS'], 'integer'); + if (isset($this->options['maxTimeMS']) && ! is_integer($this->options['maxTimeMS'])) { + throw InvalidArgumentException::invalidType('"maxTimeMS" option', $this->options['maxTimeMS'], 'integer'); } - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() * @return Iterator * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) - { - return $this->executeCommand($server); - } - - /** - * Create options for executing the command. - * - * Note: read preference is intentionally omitted, as the spec requires that - * the command be executed on the primary. - * - * @see https://php.net/manual/en/mongodb-driver-server.executecommand.php - */ - private function createOptions(): array - { - $options = []; - - if (isset($this->options['session'])) { - $options['session'] = $this->options['session']; - } - - return $options; - } - - /** - * Returns information for all indexes for this collection using the - * listIndexes command. - * - * @throws DriverRuntimeException for other driver errors (e.g. connection errors) - */ - private function executeCommand(Server $server): IndexInfoIteratorIterator + public function execute(Server $server): Iterator { $cmd = ['listIndexes' => $this->collectionName]; @@ -130,24 +90,45 @@ private function executeCommand(Server $server): IndexInfoIteratorIterator } try { + /** @var CursorInterface $cursor */ $cursor = $server->executeReadCommand($this->databaseName, new Command($cmd), $this->createOptions()); + $cursor->setTypeMap(['root' => 'array', 'document' => 'array']); } catch (CommandException $e) { /* The server may return an error if the collection does not exist. * Check for possible error codes (see: SERVER-20463) and return an * empty iterator instead of throwing. */ if ($e->getCode() === self::ERROR_CODE_NAMESPACE_NOT_FOUND || $e->getCode() === self::ERROR_CODE_DATABASE_NOT_FOUND) { - return new IndexInfoIteratorIterator(new EmptyIterator()); + return new EmptyIterator(); } throw $e; } - $cursor->setTypeMap(['root' => 'array', 'document' => 'array']); + return new CachingIterator( + new CallbackIterator( + $cursor, + fn (array $indexInfo): IndexInfo => new IndexInfo($indexInfo), + ), + ); + } - /** @var CachingIterator $iterator */ - $iterator = new CachingIterator($cursor); + /** + * Create options for executing the command. + * + * Note: read preference is intentionally omitted, as the spec requires that + * the command be executed on the primary. + * + * @see https://php.net/manual/en/mongodb-driver-server.executecommand.php + */ + private function createOptions(): array + { + $options = []; - return new IndexInfoIteratorIterator($iterator, $this->databaseName . '.' . $this->collectionName); + if (isset($this->options['session'])) { + $options['session'] = $this->options['session']; + } + + return $options; } } diff --git a/src/Operation/ListSearchIndexes.php b/src/Operation/ListSearchIndexes.php index 8cf7f1e56..ae0eb6d6f 100644 --- a/src/Operation/ListSearchIndexes.php +++ b/src/Operation/ListSearchIndexes.php @@ -35,10 +35,8 @@ * @see \MongoDB\Collection::listSearchIndexes() * @see https://mongodb.com/docs/manual/reference/command/listSearchIndexes/ */ -class ListSearchIndexes implements Executable +final class ListSearchIndexes { - private string $databaseName; - private string $collectionName; private array $listSearchIndexesOptions; private array $aggregateOptions; private Aggregate $aggregate; @@ -46,11 +44,11 @@ class ListSearchIndexes implements Executable /** * Constructs an aggregate command for listing Atlas Search indexes * - * @param string $databaseName Database name - * @param string $collectionName Collection name - * @param array{name?: string} $options Command options + * @param string $databaseName Database name + * @param string $collectionName Collection name + * @param array $options Command options */ - public function __construct(string $databaseName, string $collectionName, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, array $options = []) { if (isset($options['name']) && ! is_string($options['name'])) { throw InvalidArgumentException::invalidType('"name" option', $options['name'], 'string'); @@ -60,8 +58,6 @@ public function __construct(string $databaseName, string $collectionName, array throw new InvalidArgumentException('"name" option cannot be empty'); } - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; $this->listSearchIndexesOptions = array_intersect_key($options, ['name' => 1]); $this->aggregateOptions = array_intersect_key($options, ['batchSize' => 1, 'codec' => 1, 'collation' => 1, 'comment' => 1, 'maxTimeMS' => 1, 'readConcern' => 1, 'readPreference' => 1, 'session' => 1, 'typeMap' => 1]); @@ -72,7 +68,6 @@ public function __construct(string $databaseName, string $collectionName, array * Execute the operation. * * @return Iterator&Countable - * @see Executable::execute() * @throws UnexpectedValueException if the command response was malformed * @throws UnsupportedException if collation or read concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) diff --git a/src/Operation/MapReduce.php b/src/Operation/MapReduce.php deleted file mode 100644 index 211b20176..000000000 --- a/src/Operation/MapReduce.php +++ /dev/null @@ -1,410 +0,0 @@ -isDefault()) { - unset($options['readConcern']); - } - - if (isset($options['writeConcern']) && $options['writeConcern']->isDefault()) { - unset($options['writeConcern']); - } - - // Handle deprecation of CodeWScope - if ($map->getScope() !== null) { - @trigger_error('Use of Javascript with scope in "$map" argument for MapReduce is deprecated. Put all scope variables in the "scope" option of the MapReduce operation.', E_USER_DEPRECATED); - } - - if ($reduce->getScope() !== null) { - @trigger_error('Use of Javascript with scope in "$reduce" argument for MapReduce is deprecated. Put all scope variables in the "scope" option of the MapReduce operation.', E_USER_DEPRECATED); - } - - if (isset($options['finalize']) && $options['finalize']->getScope() !== null) { - @trigger_error('Use of Javascript with scope in "finalize" option for MapReduce is deprecated. Put all scope variables in the "scope" option of the MapReduce operation.', E_USER_DEPRECATED); - } - - $this->checkOutDeprecations($out); - - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->map = $map; - $this->reduce = $reduce; - $this->out = $out; - $this->options = $options; - } - - /** - * Execute the operation. - * - * @see Executable::execute() - * @return MapReduceResult - * @throws UnexpectedValueException if the command response was malformed - * @throws UnsupportedException if read concern or write concern is used and unsupported - * @throws DriverRuntimeException for other driver errors (e.g. connection errors) - */ - public function execute(Server $server) - { - $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction(); - if ($inTransaction) { - if (isset($this->options['readConcern'])) { - throw UnsupportedException::readConcernNotSupportedInTransaction(); - } - - if (isset($this->options['writeConcern'])) { - throw UnsupportedException::writeConcernNotSupportedInTransaction(); - } - } - - $hasOutputCollection = ! is_mapreduce_output_inline($this->out); - - $command = $this->createCommand(); - $options = $this->createOptions($hasOutputCollection); - - /* If the mapReduce operation results in a write, use - * executeReadWriteCommand to ensure we're handling the writeConcern - * option. - * In other cases, we use executeCommand as this will prevent the - * mapReduce operation from being retried when retryReads is enabled. - * See https://github.com/mongodb/specifications/blob/master/source/retryable-reads/retryable-reads.rst#unsupported-read-operations. */ - $cursor = $hasOutputCollection - ? $server->executeReadWriteCommand($this->databaseName, $command, $options) - : $server->executeCommand($this->databaseName, $command, $options); - - if (isset($this->options['typeMap']) && ! $hasOutputCollection) { - $cursor->setTypeMap(create_field_path_type_map($this->options['typeMap'], 'results.$')); - } - - $result = current($cursor->toArray()); - assert($result instanceof stdClass); - - $getIterator = $this->createGetIteratorCallable($result, $server); - - return new MapReduceResult($getIterator, $result); - } - - /** @param string|array|object $out */ - private function checkOutDeprecations($out): void - { - if (is_string($out)) { - return; - } - - $out = document_to_array($out); - - if (isset($out['nonAtomic']) && ! $out['nonAtomic']) { - @trigger_error('Specifying false for "out.nonAtomic" is deprecated.', E_USER_DEPRECATED); - } - - if (isset($out['sharded']) && ! $out['sharded']) { - @trigger_error('Specifying false for "out.sharded" is deprecated.', E_USER_DEPRECATED); - } - } - - /** - * Create the mapReduce command. - */ - private function createCommand(): Command - { - $cmd = [ - 'mapReduce' => $this->collectionName, - 'map' => $this->map, - 'reduce' => $this->reduce, - 'out' => $this->out, - ]; - - foreach (['bypassDocumentValidation', 'comment', 'finalize', 'jsMode', 'limit', 'maxTimeMS', 'verbose'] as $option) { - if (isset($this->options[$option])) { - $cmd[$option] = $this->options[$option]; - } - } - - foreach (['collation', 'query', 'scope', 'sort'] as $option) { - if (isset($this->options[$option])) { - $cmd[$option] = (object) $this->options[$option]; - } - } - - return new Command($cmd); - } - - /** - * Creates a callable for MapReduceResult::getIterator(). - * - * @psalm-return MapReduceCallable - * @throws UnexpectedValueException if the command response was malformed - */ - private function createGetIteratorCallable(stdClass $result, Server $server): callable - { - // Inline results can be wrapped with an ArrayIterator - if (isset($result->results) && is_array($result->results)) { - $results = $result->results; - - return fn () => new ArrayIterator($results); - } - - if (isset($result->result) && (is_string($result->result) || is_object($result->result))) { - $options = isset($this->options['typeMap']) ? ['typeMap' => $this->options['typeMap']] : []; - - $find = is_string($result->result) - ? new Find($this->databaseName, $result->result, [], $options) - : new Find($result->result->db, $result->result->collection, [], $options); - - return fn () => $find->execute($server); - } - - throw new UnexpectedValueException('mapReduce command did not return inline results or an output collection'); - } - - /** - * Create options for executing the command. - * - * @see https://php.net/manual/en/mongodb-driver-server.executereadcommand.php - * @see https://php.net/manual/en/mongodb-driver-server.executereadwritecommand.php - */ - private function createOptions(bool $hasOutputCollection): array - { - $options = []; - - if (isset($this->options['readConcern'])) { - $options['readConcern'] = $this->options['readConcern']; - } - - if (! $hasOutputCollection && isset($this->options['readPreference'])) { - $options['readPreference'] = $this->options['readPreference']; - } - - if (isset($this->options['session'])) { - $options['session'] = $this->options['session']; - } - - if ($hasOutputCollection && isset($this->options['writeConcern'])) { - $options['writeConcern'] = $this->options['writeConcern']; - } - - return $options; - } -} diff --git a/src/Operation/ModifyCollection.php b/src/Operation/ModifyCollection.php index a10bce5e8..7b40f2f8c 100644 --- a/src/Operation/ModifyCollection.php +++ b/src/Operation/ModifyCollection.php @@ -33,16 +33,8 @@ * @see \MongoDB\Database::modifyCollection() * @see https://mongodb.com/docs/manual/reference/command/collMod/ */ -class ModifyCollection implements Executable +final class ModifyCollection { - private string $databaseName; - - private string $collectionName; - - private array $collectionOptions; - - private array $options; - /** * Constructs a collMod command. * @@ -65,42 +57,36 @@ class ModifyCollection implements Executable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, array $collectionOptions, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, private array $collectionOptions, private array $options = []) { if (empty($collectionOptions)) { throw new InvalidArgumentException('$collectionOptions is empty'); } - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - if (isset($options['typeMap']) && ! is_array($options['typeMap'])) { - throw InvalidArgumentException::invalidType('"typeMap" option', $options['typeMap'], 'array'); + if (isset($this->options['typeMap']) && ! is_array($this->options['typeMap'])) { + throw InvalidArgumentException::invalidType('"typeMap" option', $this->options['typeMap'], 'array'); } - if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) { - throw InvalidArgumentException::invalidType('"writeConcern" option', $options['writeConcern'], WriteConcern::class); + if (isset($this->options['writeConcern']) && ! $this->options['writeConcern'] instanceof WriteConcern) { + throw InvalidArgumentException::invalidType('"writeConcern" option', $this->options['writeConcern'], WriteConcern::class); } - if (isset($options['writeConcern']) && $options['writeConcern']->isDefault()) { - unset($options['writeConcern']); + if (isset($this->options['writeConcern']) && $this->options['writeConcern']->isDefault()) { + unset($this->options['writeConcern']); } - - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->collectionOptions = $collectionOptions; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() * @return array|object Command result document * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): array|object { $cursor = $server->executeWriteCommand($this->databaseName, $this->createCommand(), $this->createOptions()); diff --git a/src/Operation/RenameCollection.php b/src/Operation/RenameCollection.php index 5be7d4dff..b3848c67e 100644 --- a/src/Operation/RenameCollection.php +++ b/src/Operation/RenameCollection.php @@ -25,8 +25,6 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Exception\UnsupportedException; -use function current; -use function is_array; use function is_bool; /** @@ -36,14 +34,12 @@ * @see \MongoDB\Database::renameCollection() * @see https://mongodb.com/docs/manual/reference/command/renameCollection/ */ -class RenameCollection implements Executable +final class RenameCollection { private string $fromNamespace; private string $toNamespace; - private array $options; - /** * Constructs a renameCollection command. * @@ -55,9 +51,6 @@ class RenameCollection implements Executable * * * session (MongoDB\Driver\Session): Client session. * - * * typeMap (array): Type map for BSON deserialization. This will be used - * for the returned command result document. - * * * writeConcern (MongoDB\Driver\WriteConcern): Write concern. * * * dropTarget (boolean): If true, MongoDB will drop the target before @@ -70,55 +63,42 @@ class RenameCollection implements Executable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $fromDatabaseName, string $fromCollectionName, string $toDatabaseName, string $toCollectionName, array $options = []) + public function __construct(string $fromDatabaseName, string $fromCollectionName, string $toDatabaseName, string $toCollectionName, private array $options = []) { - if (isset($options['session']) && ! $options['session'] instanceof Session) { - throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class); - } - - if (isset($options['typeMap']) && ! is_array($options['typeMap'])) { - throw InvalidArgumentException::invalidType('"typeMap" option', $options['typeMap'], 'array'); + if (isset($this->options['session']) && ! $this->options['session'] instanceof Session) { + throw InvalidArgumentException::invalidType('"session" option', $this->options['session'], Session::class); } - if (isset($options['writeConcern']) && ! $options['writeConcern'] instanceof WriteConcern) { - throw InvalidArgumentException::invalidType('"writeConcern" option', $options['writeConcern'], WriteConcern::class); + if (isset($this->options['writeConcern']) && ! $this->options['writeConcern'] instanceof WriteConcern) { + throw InvalidArgumentException::invalidType('"writeConcern" option', $this->options['writeConcern'], WriteConcern::class); } - if (isset($options['writeConcern']) && $options['writeConcern']->isDefault()) { - unset($options['writeConcern']); + if (isset($this->options['writeConcern']) && $this->options['writeConcern']->isDefault()) { + unset($this->options['writeConcern']); } - if (isset($options['dropTarget']) && ! is_bool($options['dropTarget'])) { - throw InvalidArgumentException::invalidType('"dropTarget" option', $options['dropTarget'], 'boolean'); + if (isset($this->options['dropTarget']) && ! is_bool($this->options['dropTarget'])) { + throw InvalidArgumentException::invalidType('"dropTarget" option', $this->options['dropTarget'], 'boolean'); } $this->fromNamespace = $fromDatabaseName . '.' . $fromCollectionName; $this->toNamespace = $toDatabaseName . '.' . $toCollectionName; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() - * @return array|object Command result document * @throws UnsupportedException if write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): void { $inTransaction = isset($this->options['session']) && $this->options['session']->isInTransaction(); if ($inTransaction && isset($this->options['writeConcern'])) { throw UnsupportedException::writeConcernNotSupportedInTransaction(); } - $cursor = $server->executeWriteCommand('admin', $this->createCommand(), $this->createOptions()); - - if (isset($this->options['typeMap'])) { - $cursor->setTypeMap($this->options['typeMap']); - } - - return current($cursor->toArray()); + $server->executeWriteCommand('admin', $this->createCommand(), $this->createOptions()); } /** diff --git a/src/Operation/ReplaceOne.php b/src/Operation/ReplaceOne.php index 943206761..70bfd8f77 100644 --- a/src/Operation/ReplaceOne.php +++ b/src/Operation/ReplaceOne.php @@ -34,7 +34,7 @@ * @see \MongoDB\Collection::replaceOne() * @see https://mongodb.com/docs/manual/reference/command/update/ */ -class ReplaceOne implements Executable +final class ReplaceOne { private Update $update; @@ -72,6 +72,12 @@ class ReplaceOne implements Executable * Parameters can then be accessed as variables in an aggregate * expression context (e.g. "$$var"). * + * * sort (document): Determines which document the operation modifies if + * the query selects multiple documents. + * + * This is not supported for server versions < 8.0 and will result in an + * exception at execution time if used. + * * * writeConcern (MongoDB\Driver\WriteConcern): Write concern. * * @param string $databaseName Database name @@ -81,7 +87,7 @@ class ReplaceOne implements Executable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, $filter, $replacement, array $options = []) + public function __construct(string $databaseName, string $collectionName, array|object $filter, array|object $replacement, array $options = []) { if (isset($options['codec']) && ! $options['codec'] instanceof DocumentCodec) { throw InvalidArgumentException::invalidType('"codec" option', $options['codec'], DocumentCodec::class); @@ -103,21 +109,15 @@ public function __construct(string $databaseName, string $collectionName, $filte /** * Execute the operation. * - * @see Executable::execute() - * @return UpdateResult * @throws UnsupportedException if collation is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): UpdateResult { return $this->update->execute($server); } - /** - * @param array|object $replacement - * @return array|object - */ - private function validateReplacement($replacement, ?DocumentCodec $codec) + private function validateReplacement(array|object $replacement, ?DocumentCodec $codec): array|object { if ($codec) { $replacement = $codec->encode($replacement); diff --git a/src/Operation/Update.php b/src/Operation/Update.php index a026ec7e4..3c8118b81 100644 --- a/src/Operation/Update.php +++ b/src/Operation/Update.php @@ -28,7 +28,6 @@ use function is_array; use function is_bool; -use function is_object; use function is_string; use function MongoDB\is_document; use function MongoDB\is_first_key_operator; @@ -45,20 +44,10 @@ * @internal * @see https://mongodb.com/docs/manual/reference/command/update/ */ -class Update implements Executable, Explainable +final class Update implements Explainable { private const WIRE_VERSION_FOR_HINT = 8; - private string $databaseName; - - private string $collectionName; - - /** @var array|object */ - private $filter; - - /** @var array|object */ - private $update; - private array $options; /** @@ -109,16 +98,12 @@ class Update implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, $filter, $update, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, private array|object $filter, private array|object $update, array $options = []) { if (! is_document($filter)) { throw InvalidArgumentException::expectedDocumentType('$filter', $filter); } - if (! is_array($update) && ! is_object($update)) { - throw InvalidArgumentException::invalidType('$update', $filter, 'array or object'); - } - $options += [ 'multi' => false, 'upsert' => false, @@ -136,8 +121,8 @@ public function __construct(string $databaseName, string $collectionName, $filte throw InvalidArgumentException::expectedDocumentType('"collation" option', $options['collation']); } - if (isset($options['hint']) && ! is_string($options['hint']) && ! is_array($options['hint']) && ! is_object($options['hint'])) { - throw InvalidArgumentException::invalidType('"hint" option', $options['hint'], ['string', 'array', 'object']); + if (isset($options['hint']) && ! is_string($options['hint']) && ! is_document($options['hint'])) { + throw InvalidArgumentException::expectedDocumentOrStringType('"hint" option', $options['hint']); } if (! is_bool($options['multi'])) { @@ -164,6 +149,14 @@ public function __construct(string $databaseName, string $collectionName, $filte throw InvalidArgumentException::expectedDocumentType('"let" option', $options['let']); } + if (isset($options['sort']) && ! is_document($options['sort'])) { + throw InvalidArgumentException::expectedDocumentType('"sort" option', $options['sort']); + } + + if (isset($options['sort']) && $options['multi']) { + throw new InvalidArgumentException('"sort" option cannot be used with multi-document updates'); + } + if (isset($options['bypassDocumentValidation']) && ! $options['bypassDocumentValidation']) { unset($options['bypassDocumentValidation']); } @@ -172,22 +165,16 @@ public function __construct(string $databaseName, string $collectionName, $filte unset($options['writeConcern']); } - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->filter = $filter; - $this->update = $update; $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() - * @return UpdateResult * @throws UnsupportedException if hint or write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): UpdateResult { /* CRUD spec requires a client-side error when using "hint" with an * unacknowledged write concern on an unsupported server. */ @@ -215,9 +202,8 @@ public function execute(Server $server) * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { $cmd = ['update' => $this->collectionName, 'updates' => [['q' => $this->filter, 'u' => $this->update] + $this->createUpdateOptions()]]; @@ -289,8 +275,10 @@ private function createUpdateOptions(): array } } - if (isset($this->options['collation'])) { - $updateOptions['collation'] = (object) $this->options['collation']; + foreach (['collation', 'sort'] as $option) { + if (isset($this->options[$option])) { + $updateOptions[$option] = (object) $this->options[$option]; + } } return $updateOptions; diff --git a/src/Operation/UpdateMany.php b/src/Operation/UpdateMany.php index d836a7c83..97865288c 100644 --- a/src/Operation/UpdateMany.php +++ b/src/Operation/UpdateMany.php @@ -23,8 +23,6 @@ use MongoDB\Exception\UnsupportedException; use MongoDB\UpdateResult; -use function is_array; -use function is_object; use function MongoDB\is_first_key_operator; use function MongoDB\is_pipeline; @@ -34,7 +32,7 @@ * @see \MongoDB\Collection::updateMany() * @see https://mongodb.com/docs/manual/reference/command/update/ */ -class UpdateMany implements Executable, Explainable +final class UpdateMany implements Explainable { private Update $update; @@ -81,12 +79,8 @@ class UpdateMany implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, $filter, $update, array $options = []) + public function __construct(string $databaseName, string $collectionName, array|object $filter, array|object $update, array $options = []) { - if (! is_array($update) && ! is_object($update)) { - throw InvalidArgumentException::invalidType('$update', $update, 'array or object'); - } - if (! is_first_key_operator($update) && ! is_pipeline($update)) { throw new InvalidArgumentException('Expected update operator(s) or non-empty pipeline for $update'); } @@ -103,12 +97,10 @@ public function __construct(string $databaseName, string $collectionName, $filte /** * Execute the operation. * - * @see Executable::execute() - * @return UpdateResult * @throws UnsupportedException if collation is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): UpdateResult { return $this->update->execute($server); } @@ -117,9 +109,8 @@ public function execute(Server $server) * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { return $this->update->getCommandDocument(); } diff --git a/src/Operation/UpdateOne.php b/src/Operation/UpdateOne.php index ff0c53f7a..7ead97312 100644 --- a/src/Operation/UpdateOne.php +++ b/src/Operation/UpdateOne.php @@ -23,8 +23,6 @@ use MongoDB\Exception\UnsupportedException; use MongoDB\UpdateResult; -use function is_array; -use function is_object; use function MongoDB\is_first_key_operator; use function MongoDB\is_pipeline; @@ -34,7 +32,7 @@ * @see \MongoDB\Collection::updateOne() * @see https://mongodb.com/docs/manual/reference/command/update/ */ -class UpdateOne implements Executable, Explainable +final class UpdateOne implements Explainable { private Update $update; @@ -72,6 +70,12 @@ class UpdateOne implements Executable, Explainable * Parameters can then be accessed as variables in an aggregate * expression context (e.g. "$$var"). * + * * sort (document): Determines which document the operation modifies if + * the query selects multiple documents. + * + * This is not supported for server versions < 8.0 and will result in an + * exception at execution time if used. + * * * writeConcern (MongoDB\Driver\WriteConcern): Write concern. * * @param string $databaseName Database name @@ -81,12 +85,8 @@ class UpdateOne implements Executable, Explainable * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(string $databaseName, string $collectionName, $filter, $update, array $options = []) + public function __construct(string $databaseName, string $collectionName, array|object $filter, array|object $update, array $options = []) { - if (! is_array($update) && ! is_object($update)) { - throw InvalidArgumentException::invalidType('$update', $update, 'array or object'); - } - if (! is_first_key_operator($update) && ! is_pipeline($update)) { throw new InvalidArgumentException('Expected update operator(s) or non-empty pipeline for $update'); } @@ -103,12 +103,10 @@ public function __construct(string $databaseName, string $collectionName, $filte /** * Execute the operation. * - * @see Executable::execute() - * @return UpdateResult * @throws UnsupportedException if collation is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): UpdateResult { return $this->update->execute($server); } @@ -117,9 +115,8 @@ public function execute(Server $server) * Returns the command document for this operation. * * @see Explainable::getCommandDocument() - * @return array */ - public function getCommandDocument() + public function getCommandDocument(): array { return $this->update->getCommandDocument(); } diff --git a/src/Operation/UpdateSearchIndex.php b/src/Operation/UpdateSearchIndex.php index a44bc4103..4543914bb 100644 --- a/src/Operation/UpdateSearchIndex.php +++ b/src/Operation/UpdateSearchIndex.php @@ -31,13 +31,9 @@ * @see \MongoDB\Collection::updateSearchIndexes() * @see https://mongodb.com/docs/manual/reference/command/updateSearchIndexes/ */ -class UpdateSearchIndex implements Executable +final class UpdateSearchIndex { - private string $databaseName; - private string $collectionName; - private string $name; private object $definition; - private array $options = []; /** * Constructs a createSearchIndexes command. @@ -49,7 +45,7 @@ class UpdateSearchIndex implements Executable * @param array{comment?: mixed} $options Command options * @throws InvalidArgumentException for parameter parsing errors */ - public function __construct(string $databaseName, string $collectionName, string $name, $definition, array $options = []) + public function __construct(private string $databaseName, private string $collectionName, private string $name, array|object $definition, private array $options = []) { if ($name === '') { throw new InvalidArgumentException('Index name cannot be empty'); @@ -59,17 +55,12 @@ public function __construct(string $databaseName, string $collectionName, string throw InvalidArgumentException::expectedDocumentType('$definition', $definition); } - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->name = $name; $this->definition = (object) $definition; - $this->options = $options; } /** * Execute the operation. * - * @see Executable::execute() * @throws UnsupportedException if write concern is used and unsupported * @throws DriverRuntimeException for other driver errors (e.g. connection errors) */ diff --git a/src/Operation/Watch.php b/src/Operation/Watch.php index f6f51f73d..a46d5de57 100644 --- a/src/Operation/Watch.php +++ b/src/Operation/Watch.php @@ -17,7 +17,6 @@ namespace MongoDB\Operation; -use Iterator; use MongoDB\BSON\TimestampInterface; use MongoDB\ChangeStream; use MongoDB\Codec\DocumentCodec; @@ -57,9 +56,8 @@ * @see \MongoDB\Collection::watch() * @see https://mongodb.com/docs/manual/changeStreams/ */ -class Watch implements Executable, /* @internal */ CommandSubscriber +final class Watch implements /* @internal */ CommandSubscriber { - public const FULL_DOCUMENT_DEFAULT = 'default'; public const FULL_DOCUMENT_UPDATE_LOOKUP = 'updateLookup'; public const FULL_DOCUMENT_WHEN_AVAILABLE = 'whenAvailable'; public const FULL_DOCUMENT_REQUIRED = 'required'; @@ -74,20 +72,14 @@ class Watch implements Executable, /* @internal */ CommandSubscriber private array $changeStreamOptions; - private ?string $collectionName = null; - private string $databaseName; private int $firstBatchSize = 0; private bool $hasResumed = false; - private Manager $manager; - private ?TimestampInterface $operationTime = null; - private array $pipeline; - private ?object $postBatchResumeToken = null; private ?DocumentCodec $codec; @@ -193,7 +185,7 @@ class Watch implements Executable, /* @internal */ CommandSubscriber * @param array $options Command options * @throws InvalidArgumentException for parameter/option parsing errors */ - public function __construct(Manager $manager, ?string $databaseName, ?string $collectionName, array $pipeline, array $options = []) + public function __construct(private Manager $manager, ?string $databaseName, private ?string $collectionName, private array $pipeline, array $options = []) { if (isset($collectionName) && ! isset($databaseName)) { throw new InvalidArgumentException('$collectionName should also be null if $databaseName is null'); @@ -247,7 +239,7 @@ public function __construct(Manager $manager, ?string $databaseName, ?string $co if (! isset($options['session'])) { try { $options['session'] = $manager->startSession(['causalConsistency' => false]); - } catch (RuntimeException $e) { + } catch (RuntimeException) { /* We can ignore the exception, as libmongoc likely cannot * create its own session and there is no risk of a mismatch. */ } @@ -262,10 +254,7 @@ public function __construct(Manager $manager, ?string $databaseName, ?string $co $this->changeStreamOptions['allChangesForCluster'] = true; } - $this->manager = $manager; $this->databaseName = $databaseName; - $this->collectionName = $collectionName; - $this->pipeline = $pipeline; $this->codec = $options['codec'] ?? null; $this->aggregate = $this->createAggregate(); @@ -274,12 +263,10 @@ public function __construct(Manager $manager, ?string $databaseName, ?string $co /** * Execute the operation. * - * @see Executable::execute() - * @return ChangeStream * @throws UnsupportedException if collation or read concern is used and unsupported * @throws RuntimeException for other driver errors (e.g. connection errors) */ - public function execute(Server $server) + public function execute(Server $server): ChangeStream { return new ChangeStream( $this->createChangeStreamIterator($server), @@ -362,10 +349,8 @@ private function createChangeStreamIterator(Server $server): ChangeStreamIterato * * The command will be executed using APM so that we can capture data from * its response (e.g. firstBatch size, postBatchResumeToken). - * - * @return CursorInterface&Iterator */ - private function executeAggregate(Server $server) + private function executeAggregate(Server $server): CursorInterface { addSubscriber($this); @@ -379,10 +364,9 @@ private function executeAggregate(Server $server) /** * Return the initial resume token for creating the ChangeStreamIterator. * - * @see https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.rst#updating-the-cached-resume-token - * @return array|object|null + * @see https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.md#updating-the-cached-resume-token */ - private function getInitialResumeToken() + private function getInitialResumeToken(): array|object|null { if ($this->firstBatchSize === 0 && isset($this->postBatchResumeToken)) { return $this->postBatchResumeToken; @@ -402,16 +386,11 @@ private function getInitialResumeToken() /** * Resumes a change stream. * - * @see https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.rst#resume-process - * @param array|object|null $resumeToken + * @see https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.md#resume-process * @throws InvalidArgumentException */ - private function resume($resumeToken = null, bool $hasAdvanced = false): ChangeStreamIterator + private function resume(array|object|null $resumeToken = null, bool $hasAdvanced = false): ChangeStreamIterator { - if (isset($resumeToken) && ! is_array($resumeToken) && ! is_object($resumeToken)) { - throw InvalidArgumentException::invalidType('$resumeToken', $resumeToken, 'array or object'); - } - $this->hasResumed = true; /* Select a new server using the original read preference. While watch @@ -443,7 +422,7 @@ private function resume($resumeToken = null, bool $hasAdvanced = false): ChangeS /** * Determine whether to capture operation time from an aggregate response. * - * @see https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.rst#startatoperationtime + * @see https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.md#startatoperationtime */ private function shouldCaptureOperationTime(): bool { diff --git a/src/Operation/WithTransaction.php b/src/Operation/WithTransaction.php index de5644073..760825946 100644 --- a/src/Operation/WithTransaction.php +++ b/src/Operation/WithTransaction.php @@ -11,23 +11,20 @@ use function time; /** @internal */ -class WithTransaction +final class WithTransaction { /** @var callable */ private $callback; - private array $transactionOptions; - /** * @see Session::startTransaction for supported transaction options * * @param callable $callback A callback that will be invoked within the transaction * @param array $transactionOptions Additional options that are passed to Session::startTransaction */ - public function __construct(callable $callback, array $transactionOptions = []) + public function __construct(callable $callback, private array $transactionOptions = []) { $this->callback = $callback; - $this->transactionOptions = $transactionOptions; } /** diff --git a/src/UpdateResult.php b/src/UpdateResult.php index 76f042ae1..a9d50b751 100644 --- a/src/UpdateResult.php +++ b/src/UpdateResult.php @@ -17,22 +17,16 @@ namespace MongoDB; +use MongoDB\Driver\Exception\LogicException; use MongoDB\Driver\WriteResult; -use MongoDB\Exception\BadMethodCallException; /** * Result class for an update operation. */ class UpdateResult { - private WriteResult $writeResult; - - private bool $isAcknowledged; - - public function __construct(WriteResult $writeResult) + public function __construct(private WriteResult $writeResult) { - $this->writeResult = $writeResult; - $this->isAcknowledged = $writeResult->isAcknowledged(); } /** @@ -41,16 +35,11 @@ public function __construct(WriteResult $writeResult) * This method should only be called if the write was acknowledged. * * @see UpdateResult::isAcknowledged() - * @return integer|null - * @throws BadMethodCallException if the write result is unacknowledged + * @throws LogicException if the write result is unacknowledged */ - public function getMatchedCount() + public function getMatchedCount(): int { - if ($this->isAcknowledged) { - return $this->writeResult->getMatchedCount(); - } - - throw BadMethodCallException::unacknowledgedWriteResultAccess(__METHOD__); + return $this->writeResult->getMatchedCount(); } /** @@ -62,16 +51,11 @@ public function getMatchedCount() * This method should only be called if the write was acknowledged. * * @see UpdateResult::isAcknowledged() - * @return integer|null - * @throws BadMethodCallException if the write result is unacknowledged + * @throws LogicException if the write result is unacknowledged */ - public function getModifiedCount() + public function getModifiedCount(): int { - if ($this->isAcknowledged) { - return $this->writeResult->getModifiedCount(); - } - - throw BadMethodCallException::unacknowledgedWriteResultAccess(__METHOD__); + return $this->writeResult->getModifiedCount(); } /** @@ -80,16 +64,11 @@ public function getModifiedCount() * This method should only be called if the write was acknowledged. * * @see UpdateResult::isAcknowledged() - * @return integer|null - * @throws BadMethodCallException if the write result is unacknowledged + * @throws LogicException if the write result is unacknowledged */ - public function getUpsertedCount() + public function getUpsertedCount(): int { - if ($this->isAcknowledged) { - return $this->writeResult->getUpsertedCount(); - } - - throw BadMethodCallException::unacknowledgedWriteResultAccess(__METHOD__); + return $this->writeResult->getUpsertedCount(); } /** @@ -104,20 +83,15 @@ public function getUpsertedCount() * This method should only be called if the write was acknowledged. * * @see UpdateResult::isAcknowledged() - * @return mixed|null - * @throws BadMethodCallException if the write result is unacknowledged + * @throws LogicException if the write result is unacknowledged */ - public function getUpsertedId() + public function getUpsertedId(): mixed { - if ($this->isAcknowledged) { - foreach ($this->writeResult->getUpsertedIds() as $id) { - return $id; - } - - return null; + foreach ($this->writeResult->getUpsertedIds() as $id) { + return $id; } - throw BadMethodCallException::unacknowledgedWriteResultAccess(__METHOD__); + return null; } /** @@ -126,11 +100,9 @@ public function getUpsertedId() * If the update was not acknowledged, other fields from the WriteResult * (e.g. matchedCount) will be undefined and their getter methods should not * be invoked. - * - * @return boolean */ - public function isAcknowledged() + public function isAcknowledged(): bool { - return $this->isAcknowledged; + return $this->writeResult->isAcknowledged(); } } diff --git a/src/functions.php b/src/functions.php index b3b5167e7..2e68987c6 100644 --- a/src/functions.php +++ b/src/functions.php @@ -21,6 +21,7 @@ use MongoDB\BSON\Document; use MongoDB\BSON\PackedArray; use MongoDB\BSON\Serializable; +use MongoDB\Builder\Type\StageInterface; use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException; use MongoDB\Driver\Manager; use MongoDB\Driver\ReadPreference; @@ -34,6 +35,7 @@ use Psr\Log\LoggerInterface; use ReflectionClass; use ReflectionException; +use stdClass; use function array_is_list; use function array_key_first; @@ -68,6 +70,22 @@ function remove_logger(LoggerInterface $logger): void PsrLogAdapter::removeLogger($logger); } +/** + * Create a new stdClass instance with the provided properties. + * Use named arguments to specify the property names. + * object( property1: value1, property2: value2 ) + * + * If property names contain a dot or a dollar characters, use array unpacking syntax. + * object( ...[ 'author.name' => 1, 'array.$' => 1 ] ) + * + * @psalm-suppress MoreSpecificReturnType + * @psalm-suppress LessSpecificReturnStatement + */ +function object(mixed ...$values): stdClass +{ + return (object) $values; +} + /** * Check whether all servers support executing a write stage on a secondary. * @@ -104,10 +122,9 @@ function all_servers_support_write_stage_on_secondary(array $servers): bool * @internal * @param array|object $document Document to which the type map will be applied * @param array $typeMap Type map for BSON deserialization. - * @return array|object * @throws InvalidArgumentException */ -function apply_type_map_to_document($document, array $typeMap) +function apply_type_map_to_document(array|object $document, array $typeMap): array|object { if (! is_document($document)) { throw InvalidArgumentException::expectedDocumentType('$document', $document); @@ -127,10 +144,9 @@ function apply_type_map_to_document($document, array $typeMap) * encode as BSON arrays. * * @internal - * @param array|object $document * @throws InvalidArgumentException if $document is not an array or object */ -function document_to_array($document): array +function document_to_array(array|object $document): array { if ($document instanceof Document || $document instanceof PackedArray) { /* Nested documents and arrays are intentionally left as BSON. We avoid @@ -154,10 +170,6 @@ function document_to_array($document): array $document = get_object_vars($document); } - if (! is_array($document)) { - throw InvalidArgumentException::expectedDocumentType('$document', $document); - } - return $document; } @@ -166,13 +178,12 @@ function document_to_array($document): array * autoEncryption driver option (if available). * * @internal - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#collection-encryptedfields-lookup-getencryptedfields + * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.md#collection-encryptedfields-lookup-getencryptedfields * @see Collection::drop() * @see Database::createCollection() * @see Database::dropCollection() - * @return array|object|null */ -function get_encrypted_fields_from_driver(string $databaseName, string $collectionName, Manager $manager) +function get_encrypted_fields_from_driver(string $databaseName, string $collectionName, Manager $manager): array|object|null { $encryptedFieldsMap = (array) $manager->getEncryptedFieldsMap(); @@ -183,18 +194,12 @@ function get_encrypted_fields_from_driver(string $databaseName, string $collecti * Return a collection's encryptedFields option from the server (if any). * * @internal - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#collection-encryptedfields-lookup-getencryptedfields + * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.md#collection-encryptedfields-lookup-getencryptedfields * @see Collection::drop() * @see Database::dropCollection() - * @return array|object|null */ -function get_encrypted_fields_from_server(string $databaseName, string $collectionName, Manager $manager, Server $server) +function get_encrypted_fields_from_server(string $databaseName, string $collectionName, Server $server): array|object|null { - // No-op if the encryptedFieldsMap autoEncryption driver option was omitted - if ($manager->getEncryptedFieldsMap() === null) { - return null; - } - $collectionInfoIterator = (new ListCollections($databaseName, ['filter' => ['name' => $collectionName]]))->execute($server); foreach ($collectionInfoIterator as $collectionInfo) { @@ -215,9 +220,8 @@ function get_encrypted_fields_from_server(string $databaseName, string $collecti * BSON PackedArray instances * * @internal - * @param mixed $document */ -function is_document($document): bool +function is_document(mixed $document): bool { return is_array($document) || (is_object($document) && ! $document instanceof PackedArray); } @@ -231,10 +235,9 @@ function is_document($document): bool * $document has an unexpected type instead of returning false. * * @internal - * @param array|object $document * @throws InvalidArgumentException if $document is not an array or object */ -function is_first_key_operator($document): bool +function is_first_key_operator(array|object $document): bool { if ($document instanceof PackedArray) { return false; @@ -274,10 +277,9 @@ function is_first_key_operator($document): bool * returns a non-array, non-object value from its bsonSerialize() method. * * @internal - * @param array|object $pipeline * @throws InvalidArgumentException */ -function is_pipeline($pipeline, bool $allowEmpty = false): bool +function is_pipeline(array|object $pipeline, bool $allowEmpty = false): bool { if ($pipeline instanceof PackedArray) { /* Nested documents and arrays are intentionally left as BSON. We avoid @@ -318,6 +320,27 @@ function is_pipeline($pipeline, bool $allowEmpty = false): bool return true; } +/** + * Returns whether the argument is a list that contains at least one + * {@see StageInterface} object. + * + * @internal + */ +function is_builder_pipeline(array $pipeline): bool +{ + if (! $pipeline || ! array_is_list($pipeline)) { + return false; + } + + foreach ($pipeline as $stage) { + if (is_object($stage) && $stage instanceof StageInterface) { + return true; + } + } + + return false; +} + /** * Returns whether we are currently in a transaction. * @@ -359,24 +382,6 @@ function is_last_pipeline_operator_write(array $pipeline): bool return $key === '$merge' || $key === '$out'; } -/** - * Return whether the "out" option for a mapReduce operation is "inline". - * - * This is used to determine if a mapReduce command requires a primary. - * - * @internal - * @see https://mongodb.com/docs/manual/reference/command/mapReduce/#output-inline - * @param string|array|object $out Output specification - */ -function is_mapreduce_output_inline($out): bool -{ - if (! is_array($out) && ! is_object($out)) { - return false; - } - - return array_key_first(document_to_array($out)) === 'inline'; -} - /** * Return whether the write concern is acknowledged. * @@ -404,8 +409,8 @@ function is_write_concern_acknowledged(WriteConcern $writeConcern): bool function server_supports_feature(Server $server, int $feature): bool { $info = $server->getInfo(); - $maxWireVersion = isset($info['maxWireVersion']) ? (integer) $info['maxWireVersion'] : 0; - $minWireVersion = isset($info['minWireVersion']) ? (integer) $info['minWireVersion'] : 0; + $maxWireVersion = isset($info['maxWireVersion']) ? (int) $info['maxWireVersion'] : 0; + $minWireVersion = isset($info['minWireVersion']) ? (int) $info['minWireVersion'] : 0; return $minWireVersion <= $feature && $maxWireVersion >= $feature; } @@ -414,9 +419,8 @@ function server_supports_feature(Server $server, int $feature): bool * Return whether the input is an array of strings. * * @internal - * @param mixed $input */ -function is_string_array($input): bool +function is_string_array(mixed $input): bool { if (! is_array($input)) { return false; @@ -439,10 +443,9 @@ function is_string_array($input): bool * @internal * @see https://bugs.php.net/bug.php?id=49664 * @param mixed $element Value to be copied - * @return mixed * @throws ReflectionException */ -function recursive_copy($element) +function recursive_copy(mixed $element): mixed { if (is_array($element)) { foreach ($element as $key => $value) { @@ -603,7 +606,7 @@ function select_server(Manager $manager, array $options): Server * must be forced due to the existence of pre-5.0 servers in the topology. * * @internal - * @see https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#aggregation-pipelines-with-write-stages + * @see https://github.com/mongodb/specifications/blob/master/source/crud/crud.md#aggregation-pipelines-with-write-stages */ function select_server_for_aggregate_write_stage(Manager $manager, array &$options): Server { diff --git a/stubs/BSON/Document.stub.php b/stubs/BSON/Document.stub.php deleted file mode 100644 index b1b3c60fb..000000000 --- a/stubs/BSON/Document.stub.php +++ /dev/null @@ -1,49 +0,0 @@ - - */ -final class Document implements \IteratorAggregate, \Serializable -{ - private function __construct() {} - - final static public function fromBSON(string $bson): Document {} - - final static public function fromJSON(string $json): Document {} - - /** @param array|object $value */ - final static public function fromPHP($value): Document {} - - /** @return TValue */ - final public function get(string $key) {} - - /** @return Iterator */ - final public function getIterator(): Iterator {} - - final public function has(string $key): bool {} - - /** @return array|object */ - final public function toPHP(?array $typeMap = null) {} - - final public function toCanonicalExtendedJSON(): string {} - - final public function toRelaxedExtendedJSON(): string {} - - final public function __toString(): string {} - - final public static function __set_state(array $properties): Document {} - - final public function serialize(): string {} - - /** @param string $serialized */ - final public function unserialize($serialized): void {} - - final public function __unserialize(array $data): void {} - - final public function __serialize(): array {} -} diff --git a/stubs/BSON/Iterator.stub.php b/stubs/BSON/Iterator.stub.php deleted file mode 100644 index cc8f699e4..000000000 --- a/stubs/BSON/Iterator.stub.php +++ /dev/null @@ -1,29 +0,0 @@ - - */ -final class Iterator implements \Iterator -{ - final private function __construct() {} - - /** @return TValue */ - final public function current() {} - - /** @return TKey */ - final public function key() {} - - final public function next(): void {} - - final public function rewind(): void {} - - final public function valid(): bool {} - - final public function __wakeup(): void {} -} diff --git a/stubs/BSON/PackedArray.stub.php b/stubs/BSON/PackedArray.stub.php deleted file mode 100644 index 231a55019..000000000 --- a/stubs/BSON/PackedArray.stub.php +++ /dev/null @@ -1,40 +0,0 @@ - - */ -final class PackedArray implements \IteratorAggregate, \Serializable -{ - private function __construct() {} - - final static public function fromPHP(array $value): PackedArray {} - - /** @return TValue */ - final public function get(int $index) {} - - /** @return Iterator */ - final public function getIterator(): Iterator {} - - final public function has(int $index): bool {} - - /** @return array|object */ - final public function toPHP(?array $typeMap = null) {} - - final public function __toString(): string {} - - final public static function __set_state(array $properties): PackedArray {} - - final public function serialize(): string {} - - /** @param string $serialized */ - final public function unserialize($serialized): void {} - - final public function __unserialize(array $data): void {} - - final public function __serialize(): array {} -} diff --git a/stubs/Driver/BulkWriteCommand.stub.php b/stubs/Driver/BulkWriteCommand.stub.php new file mode 100644 index 000000000..464b3f1ae --- /dev/null +++ b/stubs/Driver/BulkWriteCommand.stub.php @@ -0,0 +1,40 @@ + + */ +final class Cursor implements CursorInterface +{ + /** + * @return TValue|null + * @psalm-ignore-nullable-return + */ + public function current(): array|object|null + { + } + + public function next(): void + { + } + + /** @psalm-ignore-nullable-return */ + public function key(): ?int + { + } + + public function valid(): bool + { + } + + public function rewind(): void + { + } + + /** @return array */ + public function toArray(): array + { + } + + public function getId(): Int64 + { + } + + public function getServer(): Server + { + } + + public function isDead(): bool + { + } + + public function setTypeMap(array $typemap): void + { + } +} diff --git a/stubs/Driver/CursorInterface.stub.php b/stubs/Driver/CursorInterface.stub.php new file mode 100644 index 000000000..d2a89737a --- /dev/null +++ b/stubs/Driver/CursorInterface.stub.php @@ -0,0 +1,33 @@ + + */ +interface CursorInterface extends Iterator +{ + /** + * @return TValue|null + * @psalm-ignore-nullable-return + */ + public function current(): array|object|null; + + public function getId(): Int64; + + public function getServer(): Server; + + public function isDead(): bool; + + /** @psalm-ignore-nullable-return */ + public function key(): ?int; + + public function setTypeMap(array $typemap): void; + + /** @return array */ + public function toArray(): array; +} diff --git a/stubs/Driver/WriteResult.stub.php b/stubs/Driver/WriteResult.stub.php new file mode 100644 index 000000000..daa2f4eb1 --- /dev/null +++ b/stubs/Driver/WriteResult.stub.php @@ -0,0 +1,32 @@ +assertSamePipeline(Pipelines::AccumulatorUseAccumulatorToImplementTheAvgOperator, $pipeline); + } + + public function testUseInitArgsToVaryTheInitialStateByGroup(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: object(city: Expression::fieldPath('city')), + restaurants: Accumulator::accumulator( + init: <<<'JS' + function(city, userProfileCity) { + return { max: city === userProfileCity ? 3 : 1, restaurants: [] } + } + JS, + accumulate: <<<'JS' + function(state, restaurantName) { + if (state.restaurants.length < state.max) { + state.restaurants.push(restaurantName); + } + return state; + } + JS, + accumulateArgs: [Expression::fieldPath('name')], + merge: <<<'JS' + function(state1, state2) { + return { + max: state1.max, + restaurants: state1.restaurants.concat(state2.restaurants).slice(0, state1.max) + } + } + JS, + lang: 'js', + initArgs: [ + Expression::fieldPath('city'), + 'Bettles', + ], + finalize: <<<'JS' + function(state) { + return state.restaurants + } + JS, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::AccumulatorUseInitArgsToVaryTheInitialStateByGroup, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/AddToSetAccumulatorTest.php b/tests/Builder/Accumulator/AddToSetAccumulatorTest.php new file mode 100644 index 000000000..bd3b20912 --- /dev/null +++ b/tests/Builder/Accumulator/AddToSetAccumulatorTest.php @@ -0,0 +1,58 @@ +assertSamePipeline(Pipelines::AddToSetUseInGroupStage, $pipeline); + } + + public function testUseInSetWindowFieldsStage(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::fieldPath('state'), + sortBy: object( + orderDate: Sort::Asc, + ), + output: object( + cakeTypesForState: Accumulator::outputWindow( + Accumulator::addToSet(Expression::fieldPath('type')), + documents: [ + 'unbounded', + 'current', + ], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::AddToSetUseInSetWindowFieldsStage, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/AvgAccumulatorTest.php b/tests/Builder/Accumulator/AvgAccumulatorTest.php new file mode 100644 index 000000000..78e37a905 --- /dev/null +++ b/tests/Builder/Accumulator/AvgAccumulatorTest.php @@ -0,0 +1,62 @@ +assertSamePipeline(Pipelines::AvgUseInGroupStage, $pipeline); + } + + public function testUseInSetWindowFieldsStage(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::fieldPath('state'), + sortBy: object( + orderDate: Sort::Asc, + ), + output: object( + averageQuantityForState: Accumulator::outputWindow( + Accumulator::avg( + Expression::intFieldPath('quantity'), + ), + documents: ['unbounded', 'current'], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::AvgUseInSetWindowFieldsStage, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/BottomAccumulatorTest.php b/tests/Builder/Accumulator/BottomAccumulatorTest.php new file mode 100644 index 000000000..674c60ddb --- /dev/null +++ b/tests/Builder/Accumulator/BottomAccumulatorTest.php @@ -0,0 +1,63 @@ +assertSamePipeline(Pipelines::BottomFindTheBottomScore, $pipeline); + } + + public function testFindingTheBottomScoreAcrossMultipleGames(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: Expression::fieldPath('gameId'), + playerId: Accumulator::bottom( + output: [ + Expression::fieldPath('playerId'), + Expression::fieldPath('score'), + ], + sortBy: object( + score: Sort::Desc, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::BottomFindingTheBottomScoreAcrossMultipleGames, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/BottomNAccumulatorTest.php b/tests/Builder/Accumulator/BottomNAccumulatorTest.php new file mode 100644 index 000000000..8ea89f669 --- /dev/null +++ b/tests/Builder/Accumulator/BottomNAccumulatorTest.php @@ -0,0 +1,92 @@ +assertSamePipeline(Pipelines::BottomNComputingNBasedOnTheGroupKeyForGroup, $pipeline); + } + + public function testFindTheThreeLowestScores(): void + { + $pipeline = new Pipeline( + Stage::match( + gameId: 'G1', + ), + Stage::group( + _id: Expression::fieldPath('gameId'), + playerId: Accumulator::bottomN( + output: [ + Expression::fieldPath('playerId'), + Expression::fieldPath('score'), + ], + sortBy: object( + score: Sort::Desc, + ), + n: 3, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::BottomNFindTheThreeLowestScores, $pipeline); + } + + public function testFindingTheThreeLowestScoreDocumentsAcrossMultipleGames(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: Expression::fieldPath('gameId'), + playerId: Accumulator::bottomN( + output: [ + Expression::fieldPath('playerId'), + Expression::fieldPath('score'), + ], + sortBy: object( + score: Sort::Desc, + ), + n: 3, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::BottomNFindingTheThreeLowestScoreDocumentsAcrossMultipleGames, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/ConcatArraysAccumulatorTest.php b/tests/Builder/Accumulator/ConcatArraysAccumulatorTest.php new file mode 100644 index 000000000..24d811d30 --- /dev/null +++ b/tests/Builder/Accumulator/ConcatArraysAccumulatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::ConcatArraysWarehouseCollection, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/CountAccumulatorTest.php b/tests/Builder/Accumulator/CountAccumulatorTest.php new file mode 100644 index 000000000..6c33d7293 --- /dev/null +++ b/tests/Builder/Accumulator/CountAccumulatorTest.php @@ -0,0 +1,52 @@ +assertSamePipeline(Pipelines::CountUseInGroupStage, $pipeline); + } + + public function testUseInSetWindowFieldsStage(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::fieldPath('state'), + sortBy: object( + orderDate: Sort::Asc, + ), + output: object( + countNumberOfDocumentsForState: Accumulator::outputWindow( + Accumulator::count(), + documents: ['unbounded', 'current'], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::CountUseInSetWindowFieldsStage, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/CovariancePopAccumulatorTest.php b/tests/Builder/Accumulator/CovariancePopAccumulatorTest.php new file mode 100644 index 000000000..516ecca95 --- /dev/null +++ b/tests/Builder/Accumulator/CovariancePopAccumulatorTest.php @@ -0,0 +1,45 @@ +assertSamePipeline(Pipelines::CovariancePopExample, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/CovarianceSampAccumulatorTest.php b/tests/Builder/Accumulator/CovarianceSampAccumulatorTest.php new file mode 100644 index 000000000..d2f176006 --- /dev/null +++ b/tests/Builder/Accumulator/CovarianceSampAccumulatorTest.php @@ -0,0 +1,45 @@ +assertSamePipeline(Pipelines::CovarianceSampExample, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/DenseRankAccumulatorTest.php b/tests/Builder/Accumulator/DenseRankAccumulatorTest.php new file mode 100644 index 000000000..7ba7b8a54 --- /dev/null +++ b/tests/Builder/Accumulator/DenseRankAccumulatorTest.php @@ -0,0 +1,57 @@ +assertSamePipeline(Pipelines::DenseRankDenseRankPartitionsByADateField, $pipeline); + } + + public function testDenseRankPartitionsByAnIntegerField(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::stringFieldPath('state'), + sortBy: object( + quantity: Sort::Desc, + ), + output: object( + // The outputWindow is optional when no window property is set. + denseRankQuantityForState: Accumulator::denseRank(), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::DenseRankDenseRankPartitionsByAnIntegerField, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/DerivativeAccumulatorTest.php b/tests/Builder/Accumulator/DerivativeAccumulatorTest.php new file mode 100644 index 000000000..7941c4b6a --- /dev/null +++ b/tests/Builder/Accumulator/DerivativeAccumulatorTest.php @@ -0,0 +1,49 @@ +assertSamePipeline(Pipelines::DerivativeExample, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/DocumentNumberAccumulatorTest.php b/tests/Builder/Accumulator/DocumentNumberAccumulatorTest.php new file mode 100644 index 000000000..fbc13c4cb --- /dev/null +++ b/tests/Builder/Accumulator/DocumentNumberAccumulatorTest.php @@ -0,0 +1,37 @@ +assertSamePipeline(Pipelines::DocumentNumberDocumentNumberForEachState, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/ExpMovingAvgAccumulatorTest.php b/tests/Builder/Accumulator/ExpMovingAvgAccumulatorTest.php new file mode 100644 index 000000000..59a6156d4 --- /dev/null +++ b/tests/Builder/Accumulator/ExpMovingAvgAccumulatorTest.php @@ -0,0 +1,60 @@ +assertSamePipeline(Pipelines::ExpMovingAvgExponentialMovingAverageUsingAlpha, $pipeline); + } + + public function testExponentialMovingAverageUsingN(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::stringFieldPath('stock'), + sortBy: object( + date: Sort::Asc, + ), + output: object( + expMovingAvgForStock: Accumulator::expMovingAvg( + input: Expression::numberFieldPath('price'), + N: 2, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ExpMovingAvgExponentialMovingAverageUsingN, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/FirstAccumulatorTest.php b/tests/Builder/Accumulator/FirstAccumulatorTest.php new file mode 100644 index 000000000..e78f9c53d --- /dev/null +++ b/tests/Builder/Accumulator/FirstAccumulatorTest.php @@ -0,0 +1,56 @@ +assertSamePipeline(Pipelines::FirstUseInGroupStage, $pipeline); + } + + public function testUseInSetWindowFieldsStage(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::fieldPath('state'), + sortBy: object( + orderDate: Sort::Asc, + ), + output: object( + firstOrderTypeForState: Accumulator::outputWindow( + Accumulator::first(Expression::stringFieldPath('type')), + documents: ['unbounded', 'current'], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::FirstUseInSetWindowFieldsStage, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/FirstNAccumulatorTest.php b/tests/Builder/Accumulator/FirstNAccumulatorTest.php new file mode 100644 index 000000000..fe4f36384 --- /dev/null +++ b/tests/Builder/Accumulator/FirstNAccumulatorTest.php @@ -0,0 +1,126 @@ +assertSamePipeline(Pipelines::FirstNComputingNBasedOnTheGroupKeyForGroup, $pipeline); + } + + public function testFindTheFirstThreePlayerScoresForASingleGame(): void + { + $pipeline = new Pipeline( + Stage::match( + gameId: 'G1', + ), + Stage::group( + _id: Expression::fieldPath('gameId'), + firstThreeScores: Accumulator::firstN( + input: [ + Expression::fieldPath('playerId'), + Expression::fieldPath('score'), + ], + n: 3, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::FirstNFindTheFirstThreePlayerScoresForASingleGame, $pipeline); + } + + public function testFindingTheFirstThreePlayerScoresAcrossMultipleGames(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: Expression::fieldPath('gameId'), + playerId: Accumulator::firstN( + input: [ + Expression::fieldPath('playerId'), + Expression::fieldPath('score'), + ], + n: 3, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::FirstNFindingTheFirstThreePlayerScoresAcrossMultipleGames, $pipeline); + } + + public function testNullAndMissingValues(): void + { + $pipeline = new Pipeline( + Stage::documents([ + object(playerId: 'PlayerA', gameId: 'G1', score: 1), + object(playerId: 'PlayerB', gameId: 'G1', score: 2), + object(playerId: 'PlayerC', gameId: 'G1', score: 3), + object(playerId: 'PlayerD', gameId: 'G1'), + object(playerId: 'PlayerE', gameId: 'G1', score: null), + ]), + Stage::group( + _id: Expression::stringFieldPath('gameId'), + firstFiveScores: Accumulator::firstN( + input: Expression::fieldPath('score'), + n: 5, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::FirstNNullAndMissingValues, $pipeline); + } + + public function testUsingSortWithFirstN(): void + { + $pipeline = new Pipeline( + Stage::sort( + score: Sort::Desc, + ), + Stage::group( + _id: Expression::fieldPath('gameId'), + playerId: Accumulator::firstN( + input: [ + Expression::fieldPath('playerId'), + Expression::fieldPath('score'), + ], + n: 3, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::FirstNUsingSortWithFirstN, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/IntegralAccumulatorTest.php b/tests/Builder/Accumulator/IntegralAccumulatorTest.php new file mode 100644 index 000000000..636456518 --- /dev/null +++ b/tests/Builder/Accumulator/IntegralAccumulatorTest.php @@ -0,0 +1,45 @@ +assertSamePipeline(Pipelines::IntegralExample, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/LastAccumulatorTest.php b/tests/Builder/Accumulator/LastAccumulatorTest.php new file mode 100644 index 000000000..e0439b662 --- /dev/null +++ b/tests/Builder/Accumulator/LastAccumulatorTest.php @@ -0,0 +1,56 @@ +assertSamePipeline(Pipelines::LastUseInGroupStage, $pipeline); + } + + public function testUseInSetWindowFieldsStage(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::fieldPath('state'), + sortBy: object( + orderDate: Sort::Asc, + ), + output: object( + lastOrderTypeForState: Accumulator::outputWindow( + Accumulator::last(Expression::stringFieldPath('type')), + documents: ['current', 'unbounded'], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::LastUseInSetWindowFieldsStage, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/LastNAccumulatorTest.php b/tests/Builder/Accumulator/LastNAccumulatorTest.php new file mode 100644 index 000000000..caf957fde --- /dev/null +++ b/tests/Builder/Accumulator/LastNAccumulatorTest.php @@ -0,0 +1,100 @@ + Expression::arrayFieldPath('gameId')], + gamescores: Accumulator::lastN( + input: Expression::arrayFieldPath('score'), + n: Expression::cond( + if: Expression::eq( + Expression::arrayFieldPath('gameId'), + 'G2', + ), + then: 1, + else: 3, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::LastNComputingNBasedOnTheGroupKeyForGroup, $pipeline); + } + + public function testFindTheLastThreePlayerScoresForASingleGame(): void + { + $pipeline = new Pipeline( + Stage::match( + gameId: 'G1', + ), + Stage::group( + _id: Expression::fieldPath('gameId'), + lastThreeScores: Accumulator::lastN( + input: [ + Expression::arrayFieldPath('playerId'), + Expression::arrayFieldPath('score'), + ], + n: 3, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::LastNFindTheLastThreePlayerScoresForASingleGame, $pipeline); + } + + public function testFindingTheLastThreePlayerScoresAcrossMultipleGames(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: Expression::fieldPath('gameId'), + playerId: Accumulator::lastN( + input: [ + Expression::arrayFieldPath('playerId'), + Expression::arrayFieldPath('score'), + ], + n: 3, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::LastNFindingTheLastThreePlayerScoresAcrossMultipleGames, $pipeline); + } + + public function testUsingSortWithLastN(): void + { + $pipeline = new Pipeline( + Stage::sort( + score: Sort::Desc, + ), + Stage::group( + _id: Expression::fieldPath('gameId'), + playerId: Accumulator::lastN( + input: [ + Expression::arrayFieldPath('playerId'), + Expression::arrayFieldPath('score'), + ], + n: 3, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::LastNUsingSortWithLastN, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/LinearFillAccumulatorTest.php b/tests/Builder/Accumulator/LinearFillAccumulatorTest.php new file mode 100644 index 000000000..0142d0d68 --- /dev/null +++ b/tests/Builder/Accumulator/LinearFillAccumulatorTest.php @@ -0,0 +1,59 @@ +assertSamePipeline(Pipelines::LinearFillFillMissingValuesWithLinearInterpolation, $pipeline); + } + + public function testUseMultipleFillMethodsInASingleStage(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + sortBy: object( + time: Sort::Asc, + ), + output: object( + linearFillPrice: Accumulator::linearFill( + Expression::numberFieldPath('price'), + ), + locfPrice: Accumulator::locf( + Expression::numberFieldPath('price'), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::LinearFillUseMultipleFillMethodsInASingleStage, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/LocfAccumulatorTest.php b/tests/Builder/Accumulator/LocfAccumulatorTest.php new file mode 100644 index 000000000..259a92aff --- /dev/null +++ b/tests/Builder/Accumulator/LocfAccumulatorTest.php @@ -0,0 +1,38 @@ +assertSamePipeline(Pipelines::LocfFillMissingValuesWithTheLastObservedValue, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/MaxAccumulatorTest.php b/tests/Builder/Accumulator/MaxAccumulatorTest.php new file mode 100644 index 000000000..6a75d85c9 --- /dev/null +++ b/tests/Builder/Accumulator/MaxAccumulatorTest.php @@ -0,0 +1,62 @@ +assertSamePipeline(Pipelines::MaxUseInGroupStage, $pipeline); + } + + public function testUseInSetWindowFieldsStage(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::fieldPath('state'), + sortBy: object( + orderDate: Sort::Asc, + ), + output: object( + maximumQuantityForState: Accumulator::outputWindow( + Accumulator::max( + Expression::intFieldPath('quantity'), + ), + documents: ['unbounded', 'current'], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::MaxUseInSetWindowFieldsStage, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/MaxNAccumulatorTest.php b/tests/Builder/Accumulator/MaxNAccumulatorTest.php new file mode 100644 index 000000000..19617834c --- /dev/null +++ b/tests/Builder/Accumulator/MaxNAccumulatorTest.php @@ -0,0 +1,85 @@ +assertSamePipeline(Pipelines::MaxNComputingNBasedOnTheGroupKeyForGroup, $pipeline); + } + + public function testFindTheMaximumThreeScoresForASingleGame(): void + { + $pipeline = new Pipeline( + Stage::match( + gameId: 'G1', + ), + Stage::group( + _id: Expression::fieldPath('gameId'), + maxThreeScores: Accumulator::maxN( + input: [ + Expression::fieldPath('score'), + Expression::fieldPath('playerId'), + ], + n: 3, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::MaxNFindTheMaximumThreeScoresForASingleGame, $pipeline); + } + + public function testFindingTheMaximumThreeScoresAcrossMultipleGames(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: Expression::fieldPath('gameId'), + maxScores: Accumulator::maxN( + input: [ + Expression::fieldPath('score'), + Expression::fieldPath('playerId'), + ], + n: 3, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::MaxNFindingTheMaximumThreeScoresAcrossMultipleGames, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/MedianAccumulatorTest.php b/tests/Builder/Accumulator/MedianAccumulatorTest.php new file mode 100644 index 000000000..c1f453347 --- /dev/null +++ b/tests/Builder/Accumulator/MedianAccumulatorTest.php @@ -0,0 +1,62 @@ +assertSamePipeline(Pipelines::MedianUseMedianAsAnAccumulator, $pipeline); + } + + public function testUseMedianInASetWindowFieldStage(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + sortBy: object( + test01: Sort::Asc, + ), + output: object( + test01_median: Accumulator::outputWindow( + Accumulator::median( + input: Expression::intFieldPath('test01'), + method: 'approximate', + ), + range: [-3, 3], + ), + ), + ), + Stage::project( + _id: 0, + studentId: 1, + test01_median: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::MedianUseMedianInASetWindowFieldStage, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/MergeObjectsAccumulatorTest.php b/tests/Builder/Accumulator/MergeObjectsAccumulatorTest.php new file mode 100644 index 000000000..62fabc4f1 --- /dev/null +++ b/tests/Builder/Accumulator/MergeObjectsAccumulatorTest.php @@ -0,0 +1,31 @@ +assertSamePipeline(Pipelines::MergeObjectsMergeObjectsAsAnAccumulator, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/MinAccumulatorTest.php b/tests/Builder/Accumulator/MinAccumulatorTest.php new file mode 100644 index 000000000..442a643a3 --- /dev/null +++ b/tests/Builder/Accumulator/MinAccumulatorTest.php @@ -0,0 +1,56 @@ +assertSamePipeline(Pipelines::MinUseInGroupStage, $pipeline); + } + + public function testUseInSetWindowFieldsStage(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::fieldPath('state'), + sortBy: object( + orderDate: Sort::Asc, + ), + output: object( + minimumQuantityForState: Accumulator::outputWindow( + Accumulator::min( + Expression::intFieldPath('quantity'), + ), + documents: ['unbounded', 'current'], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::MinUseInSetWindowFieldsStage, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/MinNAccumulatorTest.php b/tests/Builder/Accumulator/MinNAccumulatorTest.php new file mode 100644 index 000000000..c44c1f6d2 --- /dev/null +++ b/tests/Builder/Accumulator/MinNAccumulatorTest.php @@ -0,0 +1,85 @@ +assertSamePipeline(Pipelines::MinNComputingNBasedOnTheGroupKeyForGroup, $pipeline); + } + + public function testFindTheMinimumThreeScoresForASingleGame(): void + { + $pipeline = new Pipeline( + Stage::match( + gameId: 'G1', + ), + Stage::group( + _id: Expression::fieldPath('gameId'), + minScores: Accumulator::minN( + input: [ + Expression::fieldPath('score'), + Expression::fieldPath('playerId'), + ], + n: 3, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::MinNFindTheMinimumThreeScoresForASingleGame, $pipeline); + } + + public function testFindingTheMinimumThreeDocumentsAcrossMultipleGames(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: Expression::fieldPath('gameId'), + minScores: Accumulator::minN( + input: [ + Expression::fieldPath('score'), + Expression::fieldPath('playerId'), + ], + n: 3, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::MinNFindingTheMinimumThreeDocumentsAcrossMultipleGames, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/PercentileAccumulatorTest.php b/tests/Builder/Accumulator/PercentileAccumulatorTest.php new file mode 100644 index 000000000..a3fc1708d --- /dev/null +++ b/tests/Builder/Accumulator/PercentileAccumulatorTest.php @@ -0,0 +1,95 @@ +assertSamePipeline(Pipelines::PercentileCalculateASingleValueAsAnAccumulator, $pipeline); + } + + public function testCalculateMultipleValuesAsAnAccumulator(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: null, + test01_percentiles: Accumulator::percentile( + input: Expression::numberFieldPath('test01'), + p: [0.5, 0.75, 0.9, 0.95], + method: 'approximate', + ), + test02_percentiles: Accumulator::percentile( + input: Expression::numberFieldPath('test02'), + p: [0.5, 0.75, 0.9, 0.95], + method: 'approximate', + ), + test03_percentiles: Accumulator::percentile( + input: Expression::numberFieldPath('test03'), + p: [0.5, 0.75, 0.9, 0.95], + method: 'approximate', + ), + test03_percent_alt: Accumulator::percentile( + input: Expression::numberFieldPath('test03'), + p: [0.9, 0.5, 0.75, 0.95], + method: 'approximate', + ), + ), + ); + + $this->assertSamePipeline(Pipelines::PercentileCalculateMultipleValuesAsAnAccumulator, $pipeline); + } + + public function testUsePercentileInASetWindowFieldStage(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + sortBy: object( + test01: Sort::Asc, + ), + output: object( + test01_95percentile: Accumulator::outputWindow( + Accumulator::percentile( + input: Expression::numberFieldPath('test01'), + p: [0.95], + method: 'approximate', + ), + range: [-3, 3], + ), + ), + ), + Stage::project( + _id: 0, + studentId: 1, + test01_95percentile: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::PercentileUsePercentileInASetWindowFieldStage, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/Pipelines.php b/tests/Builder/Accumulator/Pipelines.php new file mode 100644 index 000000000..23b313828 --- /dev/null +++ b/tests/Builder/Accumulator/Pipelines.php @@ -0,0 +1,2372 @@ +assertSamePipeline(Pipelines::PushUseInGroupStage, $pipeline); + } + + public function testUseInSetWindowFieldsStage(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::fieldPath('state'), + sortBy: object( + orderDate: Sort::Asc, + ), + output: object( + quantitiesForState: Accumulator::outputWindow( + Accumulator::push( + Expression::numberFieldPath('quantity'), + ), + documents: ['unbounded', 'current'], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::PushUseInSetWindowFieldsStage, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/RankAccumulatorTest.php b/tests/Builder/Accumulator/RankAccumulatorTest.php new file mode 100644 index 000000000..3be7e63aa --- /dev/null +++ b/tests/Builder/Accumulator/RankAccumulatorTest.php @@ -0,0 +1,54 @@ +assertSamePipeline(Pipelines::RankRankPartitionsByADateField, $pipeline); + } + + public function testRankPartitionsByAnIntegerField(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::stringFieldPath('state'), + sortBy: object( + quantity: Sort::Desc, + ), + output: object( + rankQuantityForState: Accumulator::rank(), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::RankRankPartitionsByAnIntegerField, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/SetUnionAccumulatorTest.php b/tests/Builder/Accumulator/SetUnionAccumulatorTest.php new file mode 100644 index 000000000..a6b83c5c2 --- /dev/null +++ b/tests/Builder/Accumulator/SetUnionAccumulatorTest.php @@ -0,0 +1,36 @@ +assertSamePipeline(Pipelines::SetUnionFlowersCollection, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/ShiftAccumulatorTest.php b/tests/Builder/Accumulator/ShiftAccumulatorTest.php new file mode 100644 index 000000000..7d8c58856 --- /dev/null +++ b/tests/Builder/Accumulator/ShiftAccumulatorTest.php @@ -0,0 +1,62 @@ +assertSamePipeline(Pipelines::ShiftShiftUsingANegativeInteger, $pipeline); + } + + public function testShiftUsingAPositiveInteger(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::stringFieldPath('state'), + sortBy: object( + quantity: Sort::Desc, + ), + output: object( + shiftQuantityForState: Accumulator::shift( + output: Expression::fieldPath('quantity'), + by: 1, + default: 'Not available', + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ShiftShiftUsingAPositiveInteger, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/StdDevPopAccumulatorTest.php b/tests/Builder/Accumulator/StdDevPopAccumulatorTest.php new file mode 100644 index 000000000..7d38829e4 --- /dev/null +++ b/tests/Builder/Accumulator/StdDevPopAccumulatorTest.php @@ -0,0 +1,56 @@ +assertSamePipeline(Pipelines::StdDevPopUseInGroupStage, $pipeline); + } + + public function testUseInSetWindowFieldsStage(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::fieldPath('state'), + sortBy: object( + orderDate: Sort::Asc, + ), + output: object( + stdDevPopQuantityForState: Accumulator::outputWindow( + Accumulator::stdDevPop( + Expression::numberFieldPath('quantity'), + ), + documents: ['unbounded', 'current'], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::StdDevPopUseInSetWindowFieldsStage, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/StdDevSampAccumulatorTest.php b/tests/Builder/Accumulator/StdDevSampAccumulatorTest.php new file mode 100644 index 000000000..c1f49e00a --- /dev/null +++ b/tests/Builder/Accumulator/StdDevSampAccumulatorTest.php @@ -0,0 +1,57 @@ +assertSamePipeline(Pipelines::StdDevSampUseInGroupStage, $pipeline); + } + + public function testUseInSetWindowFieldsStage(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::fieldPath('state'), + sortBy: object( + orderDate: Sort::Asc, + ), + output: object( + stdDevSampQuantityForState: Accumulator::outputWindow( + Accumulator::stdDevSamp( + Expression::numberFieldPath('quantity'), + ), + documents: ['unbounded', 'current'], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::StdDevSampUseInSetWindowFieldsStage, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/SumAccumulatorTest.php b/tests/Builder/Accumulator/SumAccumulatorTest.php new file mode 100644 index 000000000..21be6da72 --- /dev/null +++ b/tests/Builder/Accumulator/SumAccumulatorTest.php @@ -0,0 +1,67 @@ +assertSamePipeline(Pipelines::SumUseInGroupStage, $pipeline); + } + + public function testUseInSetWindowFieldsStage(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::fieldPath('state'), + sortBy: object( + orderDate: Sort::Asc, + ), + output: object( + sumQuantityForState: Accumulator::outputWindow( + Accumulator::sum( + Expression::intFieldPath('quantity'), + ), + documents: ['unbounded', 'current'], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SumUseInSetWindowFieldsStage, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/TopAccumulatorTest.php b/tests/Builder/Accumulator/TopAccumulatorTest.php new file mode 100644 index 000000000..c6d32edb5 --- /dev/null +++ b/tests/Builder/Accumulator/TopAccumulatorTest.php @@ -0,0 +1,63 @@ +assertSamePipeline(Pipelines::TopFindTheTopScore, $pipeline); + } + + public function testFindTheTopScoreAcrossMultipleGames(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: Expression::fieldPath('gameId'), + playerId: Accumulator::top( + output: [ + Expression::fieldPath('playerId'), + Expression::fieldPath('score'), + ], + sortBy: object( + score: Sort::Desc, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::TopFindTheTopScoreAcrossMultipleGames, $pipeline); + } +} diff --git a/tests/Builder/Accumulator/TopNAccumulatorTest.php b/tests/Builder/Accumulator/TopNAccumulatorTest.php new file mode 100644 index 000000000..6d14a9c6f --- /dev/null +++ b/tests/Builder/Accumulator/TopNAccumulatorTest.php @@ -0,0 +1,92 @@ +assertSamePipeline(Pipelines::TopNComputingNBasedOnTheGroupKeyForGroup, $pipeline); + } + + public function testFindTheThreeHighestScores(): void + { + $pipeline = new Pipeline( + Stage::match( + gameId: 'G1', + ), + Stage::group( + _id: Expression::fieldPath('gameId'), + playerId: Accumulator::topN( + output: [ + Expression::fieldPath('playerId'), + Expression::fieldPath('score'), + ], + sortBy: object( + score: Sort::Desc, + ), + n: 3, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::TopNFindTheThreeHighestScores, $pipeline); + } + + public function testFindingTheThreeHighestScoreDocumentsAcrossMultipleGames(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: Expression::fieldPath('gameId'), + playerId: Accumulator::topN( + output: [ + Expression::fieldPath('playerId'), + Expression::fieldPath('score'), + ], + sortBy: object( + score: Sort::Desc, + ), + n: 3, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::TopNFindingTheThreeHighestScoreDocumentsAcrossMultipleGames, $pipeline); + } +} diff --git a/tests/Builder/BuilderEncoderTest.php b/tests/Builder/BuilderEncoderTest.php new file mode 100644 index 000000000..53080ab9e --- /dev/null +++ b/tests/Builder/BuilderEncoderTest.php @@ -0,0 +1,480 @@ + ['author' => 'dave']], + ['$limit' => 1], + ]; + + $this->assertSamePipeline($expected, $pipeline); + } + + public function testMatchNumericFieldName(): void + { + $pipeline = new Pipeline( + Stage::match(['1' => Query::eq('dave')]), + Stage::match(['1' => Query::not(Query::eq('dave'))]), + Stage::match( + Query::and( + Query::query(['2' => Query::gt(3)]), + Query::query(['2' => Query::lt(4)]), + ), + ), + Stage::match( + Query::or( + Query::query(['2' => Query::gt(3)]), + Query::query(['2' => Query::lt(4)]), + ), + ), + Stage::match( + Query::nor( + Query::query(['2' => Query::gt(3)]), + Query::query(['2' => Query::lt(4)]), + ), + ), + ); + + $expected = [ + ['$match' => ['1' => ['$eq' => 'dave']]], + ['$match' => ['1' => ['$not' => ['$eq' => 'dave']]]], + [ + '$match' => [ + '$and' => [ + ['2' => ['$gt' => 3]], + ['2' => ['$lt' => 4]], + ], + ], + ], + [ + '$match' => [ + '$or' => [ + ['2' => ['$gt' => 3]], + ['2' => ['$lt' => 4]], + ], + ], + ], + [ + '$match' => [ + '$nor' => [ + ['2' => ['$gt' => 3]], + ['2' => ['$lt' => 4]], + ], + ], + ], + ]; + + $this->assertSamePipeline($expected, $pipeline); + } + + /** @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sort/#ascending-descending-sort */ + public function testSort(): void + { + $pipeline = new Pipeline( + Stage::sort( + age: Sort::Desc, + posts: Sort::Asc, + ), + ); + + $expected = [ + ['$sort' => ['age' => -1, 'posts' => 1]], + ]; + + $this->assertSamePipeline($expected, $pipeline); + } + + /** @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/match/#perform-a-count */ + public function testPerformCount(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::or( + Query::query(score: [Query::gt(70), Query::lt(90)]), + Query::query(views: Query::gte(1000)), + ), + ), + Stage::group( + _id: null, + count: Accumulator::sum(1), + ), + ); + + $expected = [ + [ + '$match' => [ + '$or' => [ + ['score' => ['$gt' => 70, '$lt' => 90]], + ['views' => ['$gte' => 1000]], + ], + ], + ], + [ + '$group' => [ + '_id' => null, + 'count' => ['$sum' => 1], + ], + ], + ]; + + $this->assertSamePipeline($expected, $pipeline); + } + + /** + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/filter/#examples + * + * @param list $limit + * @param array $expectedLimit + */ + #[DataProvider('provideExpressionFilterLimit')] + public function testExpressionFilter(array $limit, array $expectedLimit): void + { + $pipeline = new Pipeline( + Stage::project( + items: Expression::filter( + ...$limit, + input: Expression::arrayFieldPath('items'), + cond: Expression::gte(Expression::variable('item.price'), 100), + as:'item', + ), + ), + ); + + $expected = [ + [ + '$project' => [ + 'items' => [ + '$filter' => array_merge([ + 'input' => '$items', + 'as' => 'item', + 'cond' => ['$gte' => ['$$item.price', 100]], + ], $expectedLimit), + ], + ], + ], + ]; + + $this->assertSamePipeline($expected, $pipeline); + } + + public static function provideExpressionFilterLimit(): Generator + { + yield 'unspecified limit' => [ + [], + [], + ]; + + yield 'int limit' => [ + ['limit' => 1], + ['limit' => 1], + ]; + } + + /** @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/slice/#example */ + public function testSlice(): void + { + $pipeline = new Pipeline( + Stage::project( + name: 1, + threeFavorites: Expression::slice( + Expression::arrayFieldPath('items'), + n: 3, + ), + ), + ); + + $expected = [ + [ + '$project' => [ + 'name' => 1, + 'threeFavorites' => [ + '$slice' => ['$items', 3], + ], + ], + ], + ]; + + $this->assertSamePipeline($expected, $pipeline); + } + + /** @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/#use-documents-window-to-obtain-cumulative-and-maximum-quantity-for-each-year */ + public function testSetWindowFields(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::year(Expression::dateFieldPath('orderDate')), + sortBy: object(orderDate: Sort::Asc), + output: object( + cumulativeQuantityForYear: Accumulator::outputWindow( + Accumulator::sum(Expression::intFieldPath('quantity')), + documents: ['unbounded', 'current'], + ), + maximumQuantityForYear: Accumulator::outputWindow( + Accumulator::max(Expression::intFieldPath('quantity')), + documents: ['unbounded', 'unbounded'], + ), + ), + ), + ); + + $expected = [ + [ + '$setWindowFields' => [ + // "date" key is optional for $year, but we always add it for consistency + 'partitionBy' => ['$year' => ['date' => '$orderDate']], + 'sortBy' => ['orderDate' => 1], + 'output' => [ + 'cumulativeQuantityForYear' => [ + '$sum' => '$quantity', + 'window' => ['documents' => ['unbounded', 'current']], + ], + 'maximumQuantityForYear' => [ + '$max' => '$quantity', + 'window' => ['documents' => ['unbounded', 'unbounded']], + ], + ], + ], + ], + ]; + + $this->assertSamePipeline($expected, $pipeline); + } + + public function testUnionWith(): void + { + $pipeline = new Pipeline( + Stage::unionWith( + coll: 'orders', + pipeline: new Pipeline( + Stage::match(status: 'A'), + Stage::project( + item: 1, + status: 1, + ), + ), + ), + ); + + $expected = [ + [ + '$unionWith' => [ + 'coll' => 'orders', + 'pipeline' => [ + [ + '$match' => ['status' => 'A'], + ], + [ + '$project' => [ + 'item' => 1, + 'status' => 1, + ], + ], + ], + ], + ], + ]; + + $this->assertSamePipeline($expected, $pipeline); + } + + /** @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/redact/ */ + public function testRedactStage(): void + { + $pipeline = new Pipeline( + Stage::match(status: 'A'), + Stage::redact( + Expression::cond( + if: Expression::eq(Expression::fieldPath('level'), 5), + then: Variable::prune(), + else: Variable::descend(), + ), + ), + ); + $expected = [ + [ + '$match' => ['status' => 'A'], + ], + [ + '$redact' => [ + '$cond' => [ + 'if' => ['$eq' => ['$level', 5]], + 'then' => '$$PRUNE', + 'else' => '$$DESCEND', + ], + ], + ], + ]; + + $this->assertSamePipeline($expected, $pipeline); + } + + public function testDateTimeEncoding(): void + { + $dateTimeImmutable = new DateTimeImmutable(); + $dateTime = DateTime::createFromImmutable($dateTimeImmutable); + $utcDateTime = new UTCDateTime($dateTime); + + $pipeline = new Pipeline( + Stage::match( + utc: $utcDateTime, + mutable: $dateTime, + immutable: $dateTimeImmutable, + ), + Stage::addFields( + utc: Expression::dateToString($utcDateTime), + mutable: Expression::dateToString($dateTime), + immutable: Expression::dateToString($dateTimeImmutable), + ), + ); + + $expected = [ + [ + '$match' => [ + 'utc' => $utcDateTime, + 'mutable' => $utcDateTime, + 'immutable' => $utcDateTime, + ], + ], + [ + '$addFields' => [ + 'utc' => ['$dateToString' => ['date' => $utcDateTime]], + 'mutable' => ['$dateToString' => ['date' => $utcDateTime]], + 'immutable' => ['$dateToString' => ['date' => $utcDateTime]], + ], + ], + ]; + + $this->assertSamePipeline($expected, $pipeline); + } + + public function testCustomEncoder(): void + { + $customEncoders = [ + FieldPathInterface::class => new class implements Encoder { + use EncodeIfSupported; + + public function canEncode(mixed $value): bool + { + return $value instanceof FieldPathInterface; + } + + public function encode(mixed $value): mixed + { + return '$prefix.' . $value->name; + } + }, + ]; + $codec = new BuilderEncoder($customEncoders); + + $pipeline = new Pipeline( + Stage::project( + threeFavorites: Expression::slice( + Expression::arrayFieldPath('items'), + n: 3, + ), + ), + ); + + $expected = [ + [ + '$project' => [ + 'threeFavorites' => [ + '$slice' => ['$prefix.items', 3], + ], + ], + ], + ]; + + $this->assertSamePipeline($expected, $pipeline, $codec); + } + + public function testCustomEncoderIterable(): void + { + $customEncoders = static function (): Generator { + yield FieldPathInterface::class => new class implements Encoder { + use EncodeIfSupported; + + public function canEncode(mixed $value): bool + { + return $value instanceof FieldPathInterface; + } + + public function encode(mixed $value): mixed + { + return '$prefix.' . $value->name; + } + }; + }; + + $codec = new BuilderEncoder($customEncoders()); + + $pipeline = new Pipeline( + Stage::project( + threeFavorites: Expression::slice( + Expression::arrayFieldPath('items'), + n: 3, + ), + ), + ); + + $expected = [ + [ + '$project' => [ + 'threeFavorites' => [ + '$slice' => ['$prefix.items', 3], + ], + ], + ], + ]; + + $this->assertSamePipeline($expected, $pipeline, $codec); + } + + /** @param list> $expected */ + private static function assertSamePipeline(array $expected, Pipeline $pipeline, $codec = new BuilderEncoder()): void + { + $actual = $codec->encode($pipeline); + + // Normalize with BSON round-trip + // BSON Documents doesn't support top-level arrays. + $actual = Document::fromPHP(['root' => $actual])->toCanonicalExtendedJSON(); + $expected = Document::fromPHP(['root' => $expected])->toCanonicalExtendedJSON(); + + self::assertJsonStringEqualsJsonString($expected, $actual, var_export($actual, true)); + } +} diff --git a/tests/Builder/Expression/AbsOperatorTest.php b/tests/Builder/Expression/AbsOperatorTest.php new file mode 100644 index 000000000..829c9c551 --- /dev/null +++ b/tests/Builder/Expression/AbsOperatorTest.php @@ -0,0 +1,32 @@ +assertSamePipeline(Pipelines::AbsExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/AcosOperatorTest.php b/tests/Builder/Expression/AcosOperatorTest.php new file mode 100644 index 000000000..21b4f4ff0 --- /dev/null +++ b/tests/Builder/Expression/AcosOperatorTest.php @@ -0,0 +1,34 @@ +assertSamePipeline(Pipelines::AcosExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/AcoshOperatorTest.php b/tests/Builder/Expression/AcoshOperatorTest.php new file mode 100644 index 000000000..4ba41cf59 --- /dev/null +++ b/tests/Builder/Expression/AcoshOperatorTest.php @@ -0,0 +1,33 @@ + Expression::radiansToDegrees( + Expression::acosh( + Expression::numberFieldPath('x-coordinate'), + ), + ), + ], + ), + ); + + $this->assertSamePipeline(Pipelines::AcoshExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/AddOperatorTest.php b/tests/Builder/Expression/AddOperatorTest.php new file mode 100644 index 000000000..b6fd43935 --- /dev/null +++ b/tests/Builder/Expression/AddOperatorTest.php @@ -0,0 +1,46 @@ +assertSamePipeline(Pipelines::AddAddNumbers, $pipeline); + } + + public function testPerformAdditionOnADate(): void + { + $pipeline = new Pipeline( + Stage::project( + item: 1, + billing_date: Expression::add( + Expression::fieldPath('date'), + 3 * 24 * 60 * 60000, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::AddPerformAdditionOnADate, $pipeline); + } +} diff --git a/tests/Builder/Expression/AllElementsTrueOperatorTest.php b/tests/Builder/Expression/AllElementsTrueOperatorTest.php new file mode 100644 index 000000000..b3591dc3f --- /dev/null +++ b/tests/Builder/Expression/AllElementsTrueOperatorTest.php @@ -0,0 +1,31 @@ +assertSamePipeline(Pipelines::AllElementsTrueExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/AndOperatorTest.php b/tests/Builder/Expression/AndOperatorTest.php new file mode 100644 index 000000000..3956d29e0 --- /dev/null +++ b/tests/Builder/Expression/AndOperatorTest.php @@ -0,0 +1,38 @@ +assertSamePipeline(Pipelines::AndExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/AnyElementTrueOperatorTest.php b/tests/Builder/Expression/AnyElementTrueOperatorTest.php new file mode 100644 index 000000000..a99fd1654 --- /dev/null +++ b/tests/Builder/Expression/AnyElementTrueOperatorTest.php @@ -0,0 +1,31 @@ +assertSamePipeline(Pipelines::AnyElementTrueExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ArrayElemAtOperatorTest.php b/tests/Builder/Expression/ArrayElemAtOperatorTest.php new file mode 100644 index 000000000..0dbe768ec --- /dev/null +++ b/tests/Builder/Expression/ArrayElemAtOperatorTest.php @@ -0,0 +1,35 @@ +assertSamePipeline(Pipelines::ArrayElemAtExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ArrayToObjectOperatorTest.php b/tests/Builder/Expression/ArrayToObjectOperatorTest.php new file mode 100644 index 000000000..c18d7bdcb --- /dev/null +++ b/tests/Builder/Expression/ArrayToObjectOperatorTest.php @@ -0,0 +1,60 @@ +assertSamePipeline(Pipelines::ArrayToObjectArrayToObjectExample, $pipeline); + } + + public function testObjectToArrayAndArrayToObjectExample(): void + { + $pipeline = new Pipeline( + Stage::addFields( + instock: Expression::objectToArray( + Expression::objectFieldPath('instock'), + ), + ), + Stage::addFields( + instock: Expression::concatArrays( + Expression::arrayFieldPath('instock'), + [ + object(k: 'total', v: Expression::sum( + Expression::fieldPath('instock.v'), + )), + ], + ), + ), + Stage::addFields( + instock: Expression::arrayToObject( + Expression::arrayFieldPath('instock'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ArrayToObjectObjectToArrayAndArrayToObjectExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/AsinOperatorTest.php b/tests/Builder/Expression/AsinOperatorTest.php new file mode 100644 index 000000000..c74dc75c7 --- /dev/null +++ b/tests/Builder/Expression/AsinOperatorTest.php @@ -0,0 +1,34 @@ +assertSamePipeline(Pipelines::AsinExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/AsinhOperatorTest.php b/tests/Builder/Expression/AsinhOperatorTest.php new file mode 100644 index 000000000..138030e54 --- /dev/null +++ b/tests/Builder/Expression/AsinhOperatorTest.php @@ -0,0 +1,33 @@ + Expression::radiansToDegrees( + Expression::asinh( + Expression::numberFieldPath('x-coordinate'), + ), + ), + ], + ), + ); + + $this->assertSamePipeline(Pipelines::AsinhExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/Atan2OperatorTest.php b/tests/Builder/Expression/Atan2OperatorTest.php new file mode 100644 index 000000000..442e0150f --- /dev/null +++ b/tests/Builder/Expression/Atan2OperatorTest.php @@ -0,0 +1,32 @@ +assertSamePipeline(Pipelines::Atan2Example, $pipeline); + } +} diff --git a/tests/Builder/Expression/AtanOperatorTest.php b/tests/Builder/Expression/AtanOperatorTest.php new file mode 100644 index 000000000..3040823b1 --- /dev/null +++ b/tests/Builder/Expression/AtanOperatorTest.php @@ -0,0 +1,34 @@ +assertSamePipeline(Pipelines::AtanExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/AtanhOperatorTest.php b/tests/Builder/Expression/AtanhOperatorTest.php new file mode 100644 index 000000000..3194a8e94 --- /dev/null +++ b/tests/Builder/Expression/AtanhOperatorTest.php @@ -0,0 +1,33 @@ + Expression::radiansToDegrees( + Expression::atanh( + Expression::numberFieldPath('x-coordinate'), + ), + ), + ], + ), + ); + + $this->assertSamePipeline(Pipelines::AtanhExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/AvgOperatorTest.php b/tests/Builder/Expression/AvgOperatorTest.php new file mode 100644 index 000000000..595c49f1b --- /dev/null +++ b/tests/Builder/Expression/AvgOperatorTest.php @@ -0,0 +1,36 @@ +assertSamePipeline(Pipelines::AvgUseInProjectStage, $pipeline); + } +} diff --git a/tests/Builder/Expression/BinarySizeOperatorTest.php b/tests/Builder/Expression/BinarySizeOperatorTest.php new file mode 100644 index 000000000..8b0653315 --- /dev/null +++ b/tests/Builder/Expression/BinarySizeOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::BinarySizeExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/BitAndOperatorTest.php b/tests/Builder/Expression/BitAndOperatorTest.php new file mode 100644 index 000000000..e46fbb55a --- /dev/null +++ b/tests/Builder/Expression/BitAndOperatorTest.php @@ -0,0 +1,45 @@ +assertSamePipeline(Pipelines::BitAndBitwiseANDWithALongAndInteger, $pipeline); + } + + public function testBitwiseANDWithTwoIntegers(): void + { + $pipeline = new Pipeline( + Stage::project( + result: Expression::bitAnd( + Expression::intFieldPath('a'), + Expression::intFieldPath('b'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::BitAndBitwiseANDWithTwoIntegers, $pipeline); + } +} diff --git a/tests/Builder/Expression/BitNotOperatorTest.php b/tests/Builder/Expression/BitNotOperatorTest.php new file mode 100644 index 000000000..9407a2861 --- /dev/null +++ b/tests/Builder/Expression/BitNotOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::BitNotExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/BitOrOperatorTest.php b/tests/Builder/Expression/BitOrOperatorTest.php new file mode 100644 index 000000000..2558432e9 --- /dev/null +++ b/tests/Builder/Expression/BitOrOperatorTest.php @@ -0,0 +1,45 @@ +assertSamePipeline(Pipelines::BitOrBitwiseORWithALongAndInteger, $pipeline); + } + + public function testBitwiseORWithTwoIntegers(): void + { + $pipeline = new Pipeline( + Stage::project( + result: Expression::bitOr( + Expression::intFieldPath('a'), + Expression::intFieldPath('b'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::BitOrBitwiseORWithTwoIntegers, $pipeline); + } +} diff --git a/tests/Builder/Expression/BitXorOperatorTest.php b/tests/Builder/Expression/BitXorOperatorTest.php new file mode 100644 index 000000000..1fffe2c18 --- /dev/null +++ b/tests/Builder/Expression/BitXorOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::BitXorExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/BsonSizeOperatorTest.php b/tests/Builder/Expression/BsonSizeOperatorTest.php new file mode 100644 index 000000000..49707b120 --- /dev/null +++ b/tests/Builder/Expression/BsonSizeOperatorTest.php @@ -0,0 +1,66 @@ +assertSamePipeline(Pipelines::BsonSizeReturnCombinedSizeOfAllDocumentsInACollection, $pipeline); + } + + public function testReturnDocumentWithLargestSpecifiedField(): void + { + $pipeline = new Pipeline( + Stage::project( + name: Expression::stringFieldPath('name'), + task_object_size: Expression::bsonSize( + Expression::objectFieldPath('current_task'), + ), + ), + Stage::sort( + task_object_size: Sort::Desc, + ), + Stage::limit(1), + ); + + $this->assertSamePipeline(Pipelines::BsonSizeReturnDocumentWithLargestSpecifiedField, $pipeline); + } + + public function testReturnSizesOfDocuments(): void + { + $pipeline = new Pipeline( + Stage::project( + name: 1, + object_size: Expression::bsonSize( + Expression::variable('ROOT'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::BsonSizeReturnSizesOfDocuments, $pipeline); + } +} diff --git a/tests/Builder/Expression/CeilOperatorTest.php b/tests/Builder/Expression/CeilOperatorTest.php new file mode 100644 index 000000000..6d78af6a3 --- /dev/null +++ b/tests/Builder/Expression/CeilOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::CeilExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/CmpOperatorTest.php b/tests/Builder/Expression/CmpOperatorTest.php new file mode 100644 index 000000000..e7bb5bc09 --- /dev/null +++ b/tests/Builder/Expression/CmpOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::CmpExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ConcatArraysOperatorTest.php b/tests/Builder/Expression/ConcatArraysOperatorTest.php new file mode 100644 index 000000000..ba7dffb4c --- /dev/null +++ b/tests/Builder/Expression/ConcatArraysOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::ConcatArraysExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ConcatOperatorTest.php b/tests/Builder/Expression/ConcatOperatorTest.php new file mode 100644 index 000000000..d96f17685 --- /dev/null +++ b/tests/Builder/Expression/ConcatOperatorTest.php @@ -0,0 +1,31 @@ +assertSamePipeline(Pipelines::ConcatExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/CondOperatorTest.php b/tests/Builder/Expression/CondOperatorTest.php new file mode 100644 index 000000000..725ab1c50 --- /dev/null +++ b/tests/Builder/Expression/CondOperatorTest.php @@ -0,0 +1,35 @@ +assertSamePipeline(Pipelines::CondExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ConvertOperatorTest.php b/tests/Builder/Expression/ConvertOperatorTest.php new file mode 100644 index 000000000..ab559c38a --- /dev/null +++ b/tests/Builder/Expression/ConvertOperatorTest.php @@ -0,0 +1,73 @@ +assertSamePipeline(Pipelines::ConvertExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/CosOperatorTest.php b/tests/Builder/Expression/CosOperatorTest.php new file mode 100644 index 000000000..0124b88c1 --- /dev/null +++ b/tests/Builder/Expression/CosOperatorTest.php @@ -0,0 +1,34 @@ +assertSamePipeline(Pipelines::CosExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/CoshOperatorTest.php b/tests/Builder/Expression/CoshOperatorTest.php new file mode 100644 index 000000000..37ec83724 --- /dev/null +++ b/tests/Builder/Expression/CoshOperatorTest.php @@ -0,0 +1,31 @@ +assertSamePipeline(Pipelines::CoshExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/CreateObjectIdOperatorTest.php b/tests/Builder/Expression/CreateObjectIdOperatorTest.php new file mode 100644 index 000000000..687d80638 --- /dev/null +++ b/tests/Builder/Expression/CreateObjectIdOperatorTest.php @@ -0,0 +1,27 @@ +assertSamePipeline(Pipelines::CreateObjectIdExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/DateAddOperatorTest.php b/tests/Builder/Expression/DateAddOperatorTest.php new file mode 100644 index 000000000..32ecac36b --- /dev/null +++ b/tests/Builder/Expression/DateAddOperatorTest.php @@ -0,0 +1,125 @@ +assertSamePipeline(Pipelines::DateAddAddAFutureDate, $pipeline); + } + + public function testAdjustForDaylightSavingsTime(): void + { + $pipeline = new Pipeline( + Stage::project( + _id: 0, + location: 1, + start: Expression::dateToString( + format: '%Y-%m-%d %H:%M', + date: Expression::dateFieldPath('login'), + ), + days: Expression::dateToString( + format: '%Y-%m-%d %H:%M', + date: Expression::dateAdd( + startDate: Expression::dateFieldPath('login'), + unit: TimeUnit::Day, + amount: 1, + timezone: Expression::stringFieldPath('location'), + ), + ), + hours: Expression::dateToString( + format: '%Y-%m-%d %H:%M', + date: Expression::dateAdd( + startDate: Expression::dateFieldPath('login'), + unit: TimeUnit::Hour, + amount: 24, + timezone: Expression::stringFieldPath('location'), + ), + ), + startTZInfo: Expression::dateToString( + format: '%Y-%m-%d %H:%M', + date: Expression::dateFieldPath('login'), + timezone: Expression::stringFieldPath('location'), + ), + daysTZInfo: Expression::dateToString( + format: '%Y-%m-%d %H:%M', + date: Expression::dateAdd( + startDate: Expression::dateFieldPath('login'), + unit: TimeUnit::Day, + amount: 1, + timezone: Expression::stringFieldPath('location'), + ), + timezone: Expression::stringFieldPath('location'), + ), + hoursTZInfo: Expression::dateToString( + format: '%Y-%m-%d %H:%M', + date: Expression::dateAdd( + startDate: Expression::dateFieldPath('login'), + unit: TimeUnit::Hour, + amount: 24, + timezone: Expression::stringFieldPath('location'), + ), + timezone: Expression::stringFieldPath('location'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::DateAddAdjustForDaylightSavingsTime, $pipeline); + } + + public function testFilterOnADateRange(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::expr( + Expression::gt( + Expression::dateFieldPath('deliveryDate'), + Expression::dateAdd( + startDate: Expression::dateFieldPath('purchaseDate'), + unit: TimeUnit::Day, + amount: 5, + ), + ), + ), + ), + Stage::project( + _id: 0, + custId: 1, + purchased: Expression::dateToString( + format: '%Y-%m-%d', + date: Expression::dateFieldPath('purchaseDate'), + ), + delivery: Expression::dateToString( + format: '%Y-%m-%d', + date: Expression::dateFieldPath('deliveryDate'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::DateAddFilterOnADateRange, $pipeline); + } +} diff --git a/tests/Builder/Expression/DateDiffOperatorTest.php b/tests/Builder/Expression/DateDiffOperatorTest.php new file mode 100644 index 000000000..571e0473c --- /dev/null +++ b/tests/Builder/Expression/DateDiffOperatorTest.php @@ -0,0 +1,99 @@ +assertSamePipeline(Pipelines::DateDiffElapsedTime, $pipeline); + } + + public function testResultPrecision(): void + { + $pipeline = new Pipeline( + Stage::project( + Start: Expression::dateFieldPath('start'), + End: Expression::dateFieldPath('end'), + years: Expression::dateDiff( + startDate: Expression::dateFieldPath('start'), + endDate: Expression::dateFieldPath('end'), + unit: TimeUnit::Year, + ), + months: Expression::dateDiff( + startDate: Expression::dateFieldPath('start'), + endDate: Expression::dateFieldPath('end'), + unit: TimeUnit::Month, + ), + days: Expression::dateDiff( + startDate: Expression::dateFieldPath('start'), + endDate: Expression::dateFieldPath('end'), + unit: TimeUnit::Day, + ), + _id: 0, + ), + ); + + $this->assertSamePipeline(Pipelines::DateDiffResultPrecision, $pipeline); + } + + public function testWeeksPerMonth(): void + { + $pipeline = new Pipeline( + Stage::project( + wks_default: Expression::dateDiff( + startDate: Expression::dateFieldPath('start'), + endDate: Expression::dateFieldPath('end'), + unit: TimeUnit::Week, + ), + wks_monday: Expression::dateDiff( + startDate: Expression::dateFieldPath('start'), + endDate: Expression::dateFieldPath('end'), + unit: TimeUnit::Week, + startOfWeek: 'Monday', + ), + wks_friday: Expression::dateDiff( + startDate: Expression::dateFieldPath('start'), + endDate: Expression::dateFieldPath('end'), + unit: TimeUnit::Week, + startOfWeek: 'fri', + ), + _id: 0, + ), + ); + + $this->assertSamePipeline(Pipelines::DateDiffWeeksPerMonth, $pipeline); + } +} diff --git a/tests/Builder/Expression/DateFromPartsOperatorTest.php b/tests/Builder/Expression/DateFromPartsOperatorTest.php new file mode 100644 index 000000000..aa8a471e1 --- /dev/null +++ b/tests/Builder/Expression/DateFromPartsOperatorTest.php @@ -0,0 +1,47 @@ +assertSamePipeline(Pipelines::DateFromPartsExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/DateFromStringOperatorTest.php b/tests/Builder/Expression/DateFromStringOperatorTest.php new file mode 100644 index 000000000..ce5e53a21 --- /dev/null +++ b/tests/Builder/Expression/DateFromStringOperatorTest.php @@ -0,0 +1,61 @@ +assertSamePipeline(Pipelines::DateFromStringConvertingDates, $pipeline); + } + + public function testOnError(): void + { + $pipeline = new Pipeline( + Stage::project( + date: Expression::dateFromString( + dateString: Expression::stringFieldPath('date'), + timezone: Expression::stringFieldPath('timezone'), + onError: Expression::stringFieldPath('date'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::DateFromStringOnError, $pipeline); + } + + public function testOnNull(): void + { + $pipeline = new Pipeline( + Stage::project( + date: Expression::dateFromString( + dateString: Expression::stringFieldPath('date'), + timezone: Expression::stringFieldPath('timezone'), + onNull: new UTCDateTime(0), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::DateFromStringOnNull, $pipeline); + } +} diff --git a/tests/Builder/Expression/DateSubtractOperatorTest.php b/tests/Builder/Expression/DateSubtractOperatorTest.php new file mode 100644 index 000000000..013a3db74 --- /dev/null +++ b/tests/Builder/Expression/DateSubtractOperatorTest.php @@ -0,0 +1,131 @@ +assertSamePipeline(Pipelines::DateSubtractAdjustForDaylightSavingsTime, $pipeline); + } + + public function testFilterByRelativeDates(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::expr( + Expression::gt( + Expression::dateFieldPath('logoutTime'), + Expression::dateSubtract( + startDate: Expression::variable('NOW'), + unit: TimeUnit::Week, + amount: 1, + ), + ), + ), + ), + Stage::project( + _id: 0, + custId: 1, + loggedOut: Expression::dateToString( + format: '%Y-%m-%d', + date: Expression::dateFieldPath('logoutTime'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::DateSubtractFilterByRelativeDates, $pipeline); + } + + public function testSubtractAFixedAmount(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::expr( + Expression::eq( + Expression::month( + Expression::dateFieldPath('logout'), + ), + 1, + ), + ), + ), + Stage::project( + logoutTime: Expression::dateSubtract( + startDate: Expression::dateFieldPath('logout'), + unit: TimeUnit::Hour, + amount: 3, + ), + ), + Stage::merge('connectionTime'), + ); + + $this->assertSamePipeline(Pipelines::DateSubtractSubtractAFixedAmount, $pipeline); + } +} diff --git a/tests/Builder/Expression/DateToPartsOperatorTest.php b/tests/Builder/Expression/DateToPartsOperatorTest.php new file mode 100644 index 000000000..3df3ae827 --- /dev/null +++ b/tests/Builder/Expression/DateToPartsOperatorTest.php @@ -0,0 +1,37 @@ +assertSamePipeline(Pipelines::DateToPartsExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/DateToStringOperatorTest.php b/tests/Builder/Expression/DateToStringOperatorTest.php new file mode 100644 index 000000000..a8a24a148 --- /dev/null +++ b/tests/Builder/Expression/DateToStringOperatorTest.php @@ -0,0 +1,60 @@ +assertSamePipeline(Pipelines::DateToStringExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/DateTruncOperatorTest.php b/tests/Builder/Expression/DateTruncOperatorTest.php new file mode 100644 index 000000000..37bf8592a --- /dev/null +++ b/tests/Builder/Expression/DateTruncOperatorTest.php @@ -0,0 +1,59 @@ +assertSamePipeline(Pipelines::DateTruncTruncateOrderDatesAndObtainQuantitySumInAGroupPipelineStage, $pipeline); + } + + public function testTruncateOrderDatesInAProjectPipelineStage(): void + { + $pipeline = new Pipeline( + Stage::project( + _id: 1, + orderDate: 1, + truncatedOrderDate: Expression::dateTrunc( + date: Expression::dateFieldPath('orderDate'), + unit: TimeUnit::Week, + binSize: 2, + timezone: 'America/Los_Angeles', + startOfWeek: 'Monday', + ), + ), + ); + + $this->assertSamePipeline(Pipelines::DateTruncTruncateOrderDatesInAProjectPipelineStage, $pipeline); + } +} diff --git a/tests/Builder/Expression/DayOfMonthOperatorTest.php b/tests/Builder/Expression/DayOfMonthOperatorTest.php new file mode 100644 index 000000000..07b22ae70 --- /dev/null +++ b/tests/Builder/Expression/DayOfMonthOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::DayOfMonthExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/DayOfWeekOperatorTest.php b/tests/Builder/Expression/DayOfWeekOperatorTest.php new file mode 100644 index 000000000..54c5d5402 --- /dev/null +++ b/tests/Builder/Expression/DayOfWeekOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::DayOfWeekExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/DayOfYearOperatorTest.php b/tests/Builder/Expression/DayOfYearOperatorTest.php new file mode 100644 index 000000000..494ec4365 --- /dev/null +++ b/tests/Builder/Expression/DayOfYearOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::DayOfYearExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/DegreesToRadiansOperatorTest.php b/tests/Builder/Expression/DegreesToRadiansOperatorTest.php new file mode 100644 index 000000000..82e9797a2 --- /dev/null +++ b/tests/Builder/Expression/DegreesToRadiansOperatorTest.php @@ -0,0 +1,35 @@ +assertSamePipeline(Pipelines::DegreesToRadiansExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/DivideOperatorTest.php b/tests/Builder/Expression/DivideOperatorTest.php new file mode 100644 index 000000000..dfccd98eb --- /dev/null +++ b/tests/Builder/Expression/DivideOperatorTest.php @@ -0,0 +1,31 @@ +assertSamePipeline(Pipelines::DivideExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/EqOperatorTest.php b/tests/Builder/Expression/EqOperatorTest.php new file mode 100644 index 000000000..0c9b72bef --- /dev/null +++ b/tests/Builder/Expression/EqOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::EqExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ExpOperatorTest.php b/tests/Builder/Expression/ExpOperatorTest.php new file mode 100644 index 000000000..daa582518 --- /dev/null +++ b/tests/Builder/Expression/ExpOperatorTest.php @@ -0,0 +1,32 @@ +assertSamePipeline(Pipelines::ExpExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/FilterOperatorTest.php b/tests/Builder/Expression/FilterOperatorTest.php new file mode 100644 index 000000000..1cb3af584 --- /dev/null +++ b/tests/Builder/Expression/FilterOperatorTest.php @@ -0,0 +1,91 @@ +assertSamePipeline(Pipelines::FilterExample, $pipeline); + } + + public function testLimitAsANumericExpression(): void + { + $pipeline = new Pipeline( + Stage::project( + items: Expression::filter( + input: Expression::arrayFieldPath('items'), + cond: Expression::lte( + Expression::variable('item.price'), + 150, + ), + as: 'item', + limit: 2, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::FilterLimitAsANumericExpression, $pipeline); + } + + public function testLimitGreaterThanPossibleMatches(): void + { + $pipeline = new Pipeline( + Stage::project( + items: Expression::filter( + input: Expression::arrayFieldPath('items'), + cond: Expression::gte( + Expression::variable('item.price'), + 100, + ), + as: 'item', + limit: 5, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::FilterLimitGreaterThanPossibleMatches, $pipeline); + } + + public function testUsingTheLimitField(): void + { + $pipeline = new Pipeline( + Stage::project( + items: Expression::filter( + input: Expression::arrayFieldPath('items'), + cond: Expression::gte( + Expression::variable('item.price'), + 100, + ), + as: 'item', + limit: 1, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::FilterUsingTheLimitField, $pipeline); + } +} diff --git a/tests/Builder/Expression/FirstNOperatorTest.php b/tests/Builder/Expression/FirstNOperatorTest.php new file mode 100644 index 000000000..a09c356d7 --- /dev/null +++ b/tests/Builder/Expression/FirstNOperatorTest.php @@ -0,0 +1,48 @@ +assertSamePipeline(Pipelines::FirstNExample, $pipeline); + } + + public function testUsingFirstNAsAnAggregationExpression(): void + { + $pipeline = new Pipeline( + Stage::documents([ + object( + array: [10, 20, 30, 40], + ), + ]), + Stage::project( + firstThreeElements: Expression::firstN( + input: Expression::arrayFieldPath('array'), + n: 3, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::FirstNUsingFirstNAsAnAggregationExpression, $pipeline); + } +} diff --git a/tests/Builder/Expression/FirstOperatorTest.php b/tests/Builder/Expression/FirstOperatorTest.php new file mode 100644 index 000000000..10fab6cdc --- /dev/null +++ b/tests/Builder/Expression/FirstOperatorTest.php @@ -0,0 +1,27 @@ +assertSamePipeline(Pipelines::FirstUseInAddFieldsStage, $pipeline); + } +} diff --git a/tests/Builder/Expression/FloorOperatorTest.php b/tests/Builder/Expression/FloorOperatorTest.php new file mode 100644 index 000000000..8aa3c8393 --- /dev/null +++ b/tests/Builder/Expression/FloorOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::FloorExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/FunctionOperatorTest.php b/tests/Builder/Expression/FunctionOperatorTest.php new file mode 100644 index 000000000..97ee7c3c7 --- /dev/null +++ b/tests/Builder/Expression/FunctionOperatorTest.php @@ -0,0 +1,71 @@ +assertSamePipeline(Pipelines::FunctionAlternativeToWhere, $pipeline); + } + + public function testUsageExample(): void + { + $pipeline = new Pipeline( + Stage::addFields( + isFound: Expression::function( + body: <<<'JS' + function(name) { + return hex_md5(name) == "15b0a220baa16331e8d80e15367677ad" + } + JS, + args: [ + Expression::stringFieldPath('name'), + ], + ), + message: Expression::function( + body: <<<'JS' + function(name, scores) { + let total = Array.sum(scores); + return `Hello ${name}. Your total score is ${total}.` + } + JS, + args: [ + Expression::stringFieldPath('name'), + Expression::stringFieldPath('scores'), + ], + ), + ), + ); + + $this->assertSamePipeline(Pipelines::FunctionUsageExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/GetFieldOperatorTest.php b/tests/Builder/Expression/GetFieldOperatorTest.php new file mode 100644 index 000000000..117149ddf --- /dev/null +++ b/tests/Builder/Expression/GetFieldOperatorTest.php @@ -0,0 +1,70 @@ +assertSamePipeline(Pipelines::GetFieldQueryAFieldInASubdocument, $pipeline); + } + + public function testQueryFieldsThatContainPeriods(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::expr( + Expression::gt( + Expression::getField('price.usd'), + 200, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::GetFieldQueryFieldsThatContainPeriods, $pipeline); + } + + public function testQueryFieldsThatStartWithADollarSign(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::expr( + Expression::gt( + Expression::getField( + Expression::literal('$price'), + ), + 200, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::GetFieldQueryFieldsThatStartWithADollarSign, $pipeline); + } +} diff --git a/tests/Builder/Expression/GtOperatorTest.php b/tests/Builder/Expression/GtOperatorTest.php new file mode 100644 index 000000000..a8cecfd84 --- /dev/null +++ b/tests/Builder/Expression/GtOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::GtExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/GteOperatorTest.php b/tests/Builder/Expression/GteOperatorTest.php new file mode 100644 index 000000000..abc89743f --- /dev/null +++ b/tests/Builder/Expression/GteOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::GteExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/HourOperatorTest.php b/tests/Builder/Expression/HourOperatorTest.php new file mode 100644 index 000000000..32234ea91 --- /dev/null +++ b/tests/Builder/Expression/HourOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::HourExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/IfNullOperatorTest.php b/tests/Builder/Expression/IfNullOperatorTest.php new file mode 100644 index 000000000..2bd046e8c --- /dev/null +++ b/tests/Builder/Expression/IfNullOperatorTest.php @@ -0,0 +1,47 @@ +assertSamePipeline(Pipelines::IfNullMultipleInputExpressions, $pipeline); + } + + public function testSingleInputExpression(): void + { + $pipeline = new Pipeline( + Stage::project( + item: 1, + description: Expression::ifNull( + Expression::fieldPath('description'), + 'Unspecified', + ), + ), + ); + + $this->assertSamePipeline(Pipelines::IfNullSingleInputExpression, $pipeline); + } +} diff --git a/tests/Builder/Expression/InOperatorTest.php b/tests/Builder/Expression/InOperatorTest.php new file mode 100644 index 000000000..27722f856 --- /dev/null +++ b/tests/Builder/Expression/InOperatorTest.php @@ -0,0 +1,33 @@ + Expression::fieldPath('location'), + 'has bananas' => Expression::in( + 'bananas', + Expression::arrayFieldPath('in_stock'), + ), + ], + ), + ); + + $this->assertSamePipeline(Pipelines::InExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/IndexOfArrayOperatorTest.php b/tests/Builder/Expression/IndexOfArrayOperatorTest.php new file mode 100644 index 000000000..a18343ea2 --- /dev/null +++ b/tests/Builder/Expression/IndexOfArrayOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::IndexOfArrayExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/IndexOfBytesOperatorTest.php b/tests/Builder/Expression/IndexOfBytesOperatorTest.php new file mode 100644 index 000000000..51c7720e9 --- /dev/null +++ b/tests/Builder/Expression/IndexOfBytesOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::IndexOfBytesExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/IndexOfCPOperatorTest.php b/tests/Builder/Expression/IndexOfCPOperatorTest.php new file mode 100644 index 000000000..4d5e3b6da --- /dev/null +++ b/tests/Builder/Expression/IndexOfCPOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::IndexOfCPExamples, $pipeline); + } +} diff --git a/tests/Builder/Expression/IsArrayOperatorTest.php b/tests/Builder/Expression/IsArrayOperatorTest.php new file mode 100644 index 000000000..983f4490d --- /dev/null +++ b/tests/Builder/Expression/IsArrayOperatorTest.php @@ -0,0 +1,37 @@ +assertSamePipeline(Pipelines::IsArrayExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/IsNumberOperatorTest.php b/tests/Builder/Expression/IsNumberOperatorTest.php new file mode 100644 index 000000000..0d7d2d4bc --- /dev/null +++ b/tests/Builder/Expression/IsNumberOperatorTest.php @@ -0,0 +1,94 @@ +assertSamePipeline(Pipelines::IsNumberConditionallyModifyFieldsUsingIsNumber, $pipeline); + } + + public function testUseIsNumberToCheckIfAFieldIsNumeric(): void + { + $pipeline = new Pipeline( + Stage::addFields( + isNumber: Expression::isNumber( + Expression::fieldPath('reading'), + ), + hasType: Expression::type( + Expression::fieldPath('reading'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::IsNumberUseIsNumberToCheckIfAFieldIsNumeric, $pipeline); + } +} diff --git a/tests/Builder/Expression/IsoDayOfWeekOperatorTest.php b/tests/Builder/Expression/IsoDayOfWeekOperatorTest.php new file mode 100644 index 000000000..0169b97dc --- /dev/null +++ b/tests/Builder/Expression/IsoDayOfWeekOperatorTest.php @@ -0,0 +1,31 @@ +assertSamePipeline(Pipelines::IsoDayOfWeekExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/IsoWeekOperatorTest.php b/tests/Builder/Expression/IsoWeekOperatorTest.php new file mode 100644 index 000000000..adc00f640 --- /dev/null +++ b/tests/Builder/Expression/IsoWeekOperatorTest.php @@ -0,0 +1,31 @@ +assertSamePipeline(Pipelines::IsoWeekExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/IsoWeekYearOperatorTest.php b/tests/Builder/Expression/IsoWeekYearOperatorTest.php new file mode 100644 index 000000000..613f32090 --- /dev/null +++ b/tests/Builder/Expression/IsoWeekYearOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::IsoWeekYearExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/LastNOperatorTest.php b/tests/Builder/Expression/LastNOperatorTest.php new file mode 100644 index 000000000..485721135 --- /dev/null +++ b/tests/Builder/Expression/LastNOperatorTest.php @@ -0,0 +1,43 @@ +assertSamePipeline(Pipelines::LastNExample, $pipeline); + } + + public function testUsingLastNAsAnAggregationExpression(): void + { + $pipeline = new Pipeline( + Stage::documents([ + [ + 'array' => [10, 20, 30, 40], + ], + ]), + Stage::project( + lastThreeElements: Expression::lastN(input: Expression::arrayFieldPath('array'), n: 3), + ), + ); + + $this->assertSamePipeline(Pipelines::LastNUsingLastNAsAnAggregationExpression, $pipeline); + } +} diff --git a/tests/Builder/Expression/LastOperatorTest.php b/tests/Builder/Expression/LastOperatorTest.php new file mode 100644 index 000000000..7383819d6 --- /dev/null +++ b/tests/Builder/Expression/LastOperatorTest.php @@ -0,0 +1,27 @@ +assertSamePipeline(Pipelines::LastUseInAddFieldsStage, $pipeline); + } +} diff --git a/tests/Builder/Expression/LetOperatorTest.php b/tests/Builder/Expression/LetOperatorTest.php new file mode 100644 index 000000000..602a69adf --- /dev/null +++ b/tests/Builder/Expression/LetOperatorTest.php @@ -0,0 +1,45 @@ +assertSamePipeline(Pipelines::LetExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/LnOperatorTest.php b/tests/Builder/Expression/LnOperatorTest.php new file mode 100644 index 000000000..cbbb85ce2 --- /dev/null +++ b/tests/Builder/Expression/LnOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::LnExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/Log10OperatorTest.php b/tests/Builder/Expression/Log10OperatorTest.php new file mode 100644 index 000000000..eb7e6b693 --- /dev/null +++ b/tests/Builder/Expression/Log10OperatorTest.php @@ -0,0 +1,32 @@ +assertSamePipeline(Pipelines::Log10Example, $pipeline); + } +} diff --git a/tests/Builder/Expression/LogOperatorTest.php b/tests/Builder/Expression/LogOperatorTest.php new file mode 100644 index 000000000..f1215d53e --- /dev/null +++ b/tests/Builder/Expression/LogOperatorTest.php @@ -0,0 +1,35 @@ +assertSamePipeline(Pipelines::LogExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/LtOperatorTest.php b/tests/Builder/Expression/LtOperatorTest.php new file mode 100644 index 000000000..86a7815aa --- /dev/null +++ b/tests/Builder/Expression/LtOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::LtExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/LteOperatorTest.php b/tests/Builder/Expression/LteOperatorTest.php new file mode 100644 index 000000000..4a65cd593 --- /dev/null +++ b/tests/Builder/Expression/LteOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::LteExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/LtrimOperatorTest.php b/tests/Builder/Expression/LtrimOperatorTest.php new file mode 100644 index 000000000..96045dd32 --- /dev/null +++ b/tests/Builder/Expression/LtrimOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::LtrimExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/MapOperatorTest.php b/tests/Builder/Expression/MapOperatorTest.php new file mode 100644 index 000000000..347801c3a --- /dev/null +++ b/tests/Builder/Expression/MapOperatorTest.php @@ -0,0 +1,75 @@ + [ + '$$grade', + 2, + ], + ], + ), + ), + ); + + $this->assertSamePipeline(Pipelines::MapAddToEachElementOfAnArray, $pipeline); + } + + public function testConvertCelsiusTemperaturesToFahrenheit(): void + { + $pipeline = new Pipeline( + Stage::addFields( + tempsF: Expression::map( + input: Expression::arrayFieldPath('tempsC'), + as: 'tempInCelsius', + in: Expression::add( + Expression::multiply( + Expression::variable('tempInCelsius'), + 1.8, + ), + 32, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::MapConvertCelsiusTemperaturesToFahrenheit, $pipeline); + } + + public function testTruncateEachArrayElement(): void + { + $pipeline = new Pipeline( + Stage::project( + city: Expression::stringFieldPath('city'), + integerValues: Expression::map( + input: Expression::arrayFieldPath('distances'), + as: 'decimalValue', + in: Expression::trunc( + Expression::variable('decimalValue'), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::MapTruncateEachArrayElement, $pipeline); + } +} diff --git a/tests/Builder/Expression/MaxNOperatorTest.php b/tests/Builder/Expression/MaxNOperatorTest.php new file mode 100644 index 000000000..1f94cd31f --- /dev/null +++ b/tests/Builder/Expression/MaxNOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::MaxNExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/MaxOperatorTest.php b/tests/Builder/Expression/MaxOperatorTest.php new file mode 100644 index 000000000..eb88daa85 --- /dev/null +++ b/tests/Builder/Expression/MaxOperatorTest.php @@ -0,0 +1,36 @@ +assertSamePipeline(Pipelines::MaxUseInProjectStage, $pipeline); + } +} diff --git a/tests/Builder/Expression/MedianOperatorTest.php b/tests/Builder/Expression/MedianOperatorTest.php new file mode 100644 index 000000000..f231344f3 --- /dev/null +++ b/tests/Builder/Expression/MedianOperatorTest.php @@ -0,0 +1,36 @@ +assertSamePipeline(Pipelines::MedianUseMedianInAProjectStage, $pipeline); + } +} diff --git a/tests/Builder/Expression/MergeObjectsOperatorTest.php b/tests/Builder/Expression/MergeObjectsOperatorTest.php new file mode 100644 index 000000000..0ca4f313f --- /dev/null +++ b/tests/Builder/Expression/MergeObjectsOperatorTest.php @@ -0,0 +1,39 @@ +assertSamePipeline(Pipelines::MergeObjectsMergeObjects, $pipeline); + } +} diff --git a/tests/Builder/Expression/MetaOperatorTest.php b/tests/Builder/Expression/MetaOperatorTest.php new file mode 100644 index 000000000..b8bc3d933 --- /dev/null +++ b/tests/Builder/Expression/MetaOperatorTest.php @@ -0,0 +1,49 @@ +assertSamePipeline(Pipelines::MetaIndexKey, $pipeline); + } + + public function testTextScore(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::text( + search: 'cake', + ), + ), + Stage::group( + _id: Expression::meta('textScore'), + count: Accumulator::sum(1), + ), + ); + + $this->assertSamePipeline(Pipelines::MetaTextScore, $pipeline); + } +} diff --git a/tests/Builder/Expression/MillisecondOperatorTest.php b/tests/Builder/Expression/MillisecondOperatorTest.php new file mode 100644 index 000000000..4d6bd1f57 --- /dev/null +++ b/tests/Builder/Expression/MillisecondOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::MillisecondExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/MinNOperatorTest.php b/tests/Builder/Expression/MinNOperatorTest.php new file mode 100644 index 000000000..f6fc34eff --- /dev/null +++ b/tests/Builder/Expression/MinNOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::MinNExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/MinOperatorTest.php b/tests/Builder/Expression/MinOperatorTest.php new file mode 100644 index 000000000..11e1416a5 --- /dev/null +++ b/tests/Builder/Expression/MinOperatorTest.php @@ -0,0 +1,36 @@ +assertSamePipeline(Pipelines::MinUseInProjectStage, $pipeline); + } +} diff --git a/tests/Builder/Expression/MinuteOperatorTest.php b/tests/Builder/Expression/MinuteOperatorTest.php new file mode 100644 index 000000000..adf1d47e6 --- /dev/null +++ b/tests/Builder/Expression/MinuteOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::MinuteExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ModOperatorTest.php b/tests/Builder/Expression/ModOperatorTest.php new file mode 100644 index 000000000..5951779c4 --- /dev/null +++ b/tests/Builder/Expression/ModOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::ModExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/MonthOperatorTest.php b/tests/Builder/Expression/MonthOperatorTest.php new file mode 100644 index 000000000..0945b172a --- /dev/null +++ b/tests/Builder/Expression/MonthOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::MonthExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/MultiplyOperatorTest.php b/tests/Builder/Expression/MultiplyOperatorTest.php new file mode 100644 index 000000000..546c4185c --- /dev/null +++ b/tests/Builder/Expression/MultiplyOperatorTest.php @@ -0,0 +1,32 @@ +assertSamePipeline(Pipelines::MultiplyExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/NeOperatorTest.php b/tests/Builder/Expression/NeOperatorTest.php new file mode 100644 index 000000000..b052be640 --- /dev/null +++ b/tests/Builder/Expression/NeOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::NeExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/NotOperatorTest.php b/tests/Builder/Expression/NotOperatorTest.php new file mode 100644 index 000000000..cd816a0a7 --- /dev/null +++ b/tests/Builder/Expression/NotOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::NotExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ObjectToArrayOperatorTest.php b/tests/Builder/Expression/ObjectToArrayOperatorTest.php new file mode 100644 index 000000000..0abbde2ef --- /dev/null +++ b/tests/Builder/Expression/ObjectToArrayOperatorTest.php @@ -0,0 +1,53 @@ +assertSamePipeline(Pipelines::ObjectToArrayObjectToArrayExample, $pipeline); + } + + public function testObjectToArrayToSumNestedFields(): void + { + $pipeline = new Pipeline( + Stage::project( + warehouses: Expression::objectToArray( + Expression::objectFieldPath('instock'), + ), + ), + Stage::unwind( + Expression::arrayFieldPath('warehouses'), + ), + Stage::group( + _id: Expression::fieldPath('warehouses.k'), + total: Accumulator::sum( + Expression::fieldPath('warehouses.v'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ObjectToArrayObjectToArrayToSumNestedFields, $pipeline); + } +} diff --git a/tests/Builder/Expression/OrOperatorTest.php b/tests/Builder/Expression/OrOperatorTest.php new file mode 100644 index 000000000..feb544c1c --- /dev/null +++ b/tests/Builder/Expression/OrOperatorTest.php @@ -0,0 +1,37 @@ +assertSamePipeline(Pipelines::OrExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/PercentileOperatorTest.php b/tests/Builder/Expression/PercentileOperatorTest.php new file mode 100644 index 000000000..9d1538bce --- /dev/null +++ b/tests/Builder/Expression/PercentileOperatorTest.php @@ -0,0 +1,37 @@ +assertSamePipeline(Pipelines::PercentileUsePercentileInAProjectStage, $pipeline); + } +} diff --git a/tests/Builder/Expression/Pipelines.php b/tests/Builder/Expression/Pipelines.php new file mode 100644 index 000000000..e5bdd225e --- /dev/null +++ b/tests/Builder/Expression/Pipelines.php @@ -0,0 +1,6239 @@ +assertSamePipeline(Pipelines::PowExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/RadiansToDegreesOperatorTest.php b/tests/Builder/Expression/RadiansToDegreesOperatorTest.php new file mode 100644 index 000000000..b52375936 --- /dev/null +++ b/tests/Builder/Expression/RadiansToDegreesOperatorTest.php @@ -0,0 +1,35 @@ +assertSamePipeline(Pipelines::RadiansToDegreesExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/RandOperatorTest.php b/tests/Builder/Expression/RandOperatorTest.php new file mode 100644 index 000000000..b4964df69 --- /dev/null +++ b/tests/Builder/Expression/RandOperatorTest.php @@ -0,0 +1,61 @@ +assertSamePipeline(Pipelines::RandGenerateRandomDataPoints, $pipeline); + } + + public function testSelectRandomItemsFromACollection(): void + { + $pipeline = new Pipeline( + Stage::match( + district: 3, + ), + Stage::match( + Query::expr( + Expression::lt( + 0.5, + Expression::rand(), + ), + ), + ), + Stage::project( + _id: 0, + name: 1, + registered: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::RandSelectRandomItemsFromACollection, $pipeline); + } +} diff --git a/tests/Builder/Expression/RangeOperatorTest.php b/tests/Builder/Expression/RangeOperatorTest.php new file mode 100644 index 000000000..be9a1a3a7 --- /dev/null +++ b/tests/Builder/Expression/RangeOperatorTest.php @@ -0,0 +1,36 @@ + Expression::range( + 0, + Expression::intFieldPath('distance'), + 25, + ), + ], + _id: 0, + city: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::RangeExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ReduceOperatorTest.php b/tests/Builder/Expression/ReduceOperatorTest.php new file mode 100644 index 000000000..ee1f70720 --- /dev/null +++ b/tests/Builder/Expression/ReduceOperatorTest.php @@ -0,0 +1,141 @@ +assertSamePipeline(Pipelines::ReduceArrayConcatenation, $pipeline); + } + + public function testComputingAMultipleReductions(): void + { + $pipeline = new Pipeline( + Stage::project( + results: Expression::reduce( + Expression::arrayFieldPath('arr'), + [], + object( + collapsed: Expression::concatArrays( + Expression::variable('value.collapsed'), + Expression::variable('this'), + ), + firstValues: Expression::concatArrays( + Expression::variable('value.firstValues'), + Expression::slice( + Expression::variable('this'), + 1, + ), + ), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ReduceComputingAMultipleReductions, $pipeline); + } + + public function testDiscountedMerchandise(): void + { + $pipeline = new Pipeline( + Stage::project( + discountedPrice: Expression::reduce( + input: Expression::arrayFieldPath('discounts'), + initialValue: Expression::numberFieldPath('price'), + in: Expression::multiply( + Expression::variable('value'), + Expression::subtract( + 1, + Expression::variable('this'), + ), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ReduceDiscountedMerchandise, $pipeline); + } + + public function testMultiplication(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: Expression::objectIdFieldPath('experimentId'), + probabilityArr: Accumulator::push( + Expression::fieldPath('probability'), + ), + ), + Stage::project( + description: 1, + results: Expression::reduce( + input: Expression::arrayFieldPath('probabilityArr'), + initialValue: 1, + in: Expression::multiply( + Expression::variable('value'), + Expression::variable('this'), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ReduceMultiplication, $pipeline); + } + + public function testStringConcatenation(): void + { + $pipeline = new Pipeline( + Stage::match( + hobbies: Query::gt([]), + ), + Stage::project( + name: 1, + bio: Expression::reduce( + input: Expression::arrayFieldPath('hobbies'), + initialValue: 'My hobbies include:', + in: Expression::concat( + Expression::variable('value'), + Expression::cond( + if: Expression::eq( + Expression::variable('value'), + 'My hobbies include:', + ), + then: ' ', + else: ', ', + ), + Expression::variable('this'), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ReduceStringConcatenation, $pipeline); + } +} diff --git a/tests/Builder/Expression/RegexFindAllOperatorTest.php b/tests/Builder/Expression/RegexFindAllOperatorTest.php new file mode 100644 index 000000000..df8286c11 --- /dev/null +++ b/tests/Builder/Expression/RegexFindAllOperatorTest.php @@ -0,0 +1,100 @@ +assertSamePipeline(Pipelines::RegexFindAllIOption, $pipeline); + } + + public function testRegexFindAllAndItsOptions(): void + { + $pipeline = new Pipeline( + Stage::addFields( + returnObject: Expression::regexFindAll( + input: Expression::stringFieldPath('description'), + regex: new Regex('line'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::RegexFindAllRegexFindAllAndItsOptions, $pipeline); + } + + public function testUseCapturedGroupingsToParseUserName(): void + { + $pipeline = new Pipeline( + Stage::addFields( + names: Expression::regexFindAll( + input: Expression::stringFieldPath('comment'), + regex: new Regex('([a-z0-9_.+-]+)@[a-z0-9_.+-]+\\.[a-z0-9_.+-]+', 'i'), + ), + ), + Stage::set( + names: Expression::reduce( + input: Expression::arrayFieldPath('names.captures'), + initialValue: [], + in: Expression::concatArrays( + Expression::variable('value'), + Expression::variable('this'), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::RegexFindAllUseCapturedGroupingsToParseUserName, $pipeline); + } + + public function testUseRegexFindAllToParseEmailFromString(): void + { + $pipeline = new Pipeline( + Stage::addFields( + email: Expression::regexFindAll( + input: Expression::stringFieldPath('comment'), + regex: new Regex('[a-z0-9_.+-]+@[a-z0-9_.+-]+\\.[a-z0-9_.+-]+', 'i'), + ), + ), + Stage::set( + email: Expression::stringFieldPath('email.match'), + ), + ); + + $this->assertSamePipeline(Pipelines::RegexFindAllUseRegexFindAllToParseEmailFromString, $pipeline); + } +} diff --git a/tests/Builder/Expression/RegexFindOperatorTest.php b/tests/Builder/Expression/RegexFindOperatorTest.php new file mode 100644 index 000000000..d2ed7b453 --- /dev/null +++ b/tests/Builder/Expression/RegexFindOperatorTest.php @@ -0,0 +1,59 @@ +assertSamePipeline(Pipelines::RegexFindIOption, $pipeline); + } + + public function testRegexFindAndItsOptions(): void + { + $pipeline = new Pipeline( + Stage::addFields( + returnObject: Expression::regexFind( + input: Expression::stringFieldPath('description'), + regex: new Regex('line'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::RegexFindRegexFindAndItsOptions, $pipeline); + } +} diff --git a/tests/Builder/Expression/RegexMatchOperatorTest.php b/tests/Builder/Expression/RegexMatchOperatorTest.php new file mode 100644 index 000000000..55f39faf4 --- /dev/null +++ b/tests/Builder/Expression/RegexMatchOperatorTest.php @@ -0,0 +1,77 @@ +assertSamePipeline(Pipelines::RegexMatchIOption, $pipeline); + } + + public function testRegexMatchAndItsOptions(): void + { + $pipeline = new Pipeline( + Stage::addFields( + result: Expression::regexMatch( + input: Expression::stringFieldPath('description'), + regex: new Regex('line', ''), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::RegexMatchRegexMatchAndItsOptions, $pipeline); + } + + public function testUseRegexMatchToCheckEmailAddress(): void + { + $pipeline = new Pipeline( + Stage::addFields( + category: Expression::cond( + if: Expression::regexMatch( + input: Expression::stringFieldPath('comment'), + regex: new Regex('[a-z0-9_.+-]+@mongodb.com', 'i'), + ), + then: 'Employee', + else: 'External', + ), + ), + ); + + $this->assertSamePipeline(Pipelines::RegexMatchUseRegexMatchToCheckEmailAddress, $pipeline); + } +} diff --git a/tests/Builder/Expression/ReplaceAllOperatorTest.php b/tests/Builder/Expression/ReplaceAllOperatorTest.php new file mode 100644 index 000000000..d2247daec --- /dev/null +++ b/tests/Builder/Expression/ReplaceAllOperatorTest.php @@ -0,0 +1,47 @@ +assertSamePipeline(Pipelines::ReplaceAllExample, $pipeline); + } + + public function testSupportRegexSearchString(): void + { + $pipeline = new Pipeline( + Stage::project( + item: Expression::replaceAll( + input: '123-456-7890', + find: new Regex('\d{3}'), + replacement: 'xxx', + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ReplaceAllSupportRegexSearchString, $pipeline); + } +} diff --git a/tests/Builder/Expression/ReplaceOneOperatorTest.php b/tests/Builder/Expression/ReplaceOneOperatorTest.php new file mode 100644 index 000000000..90bf8082b --- /dev/null +++ b/tests/Builder/Expression/ReplaceOneOperatorTest.php @@ -0,0 +1,31 @@ +assertSamePipeline(Pipelines::ReplaceOneExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ReverseArrayOperatorTest.php b/tests/Builder/Expression/ReverseArrayOperatorTest.php new file mode 100644 index 000000000..f620cb4cc --- /dev/null +++ b/tests/Builder/Expression/ReverseArrayOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::ReverseArrayExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/RoundOperatorTest.php b/tests/Builder/Expression/RoundOperatorTest.php new file mode 100644 index 000000000..758668818 --- /dev/null +++ b/tests/Builder/Expression/RoundOperatorTest.php @@ -0,0 +1,48 @@ +assertSamePipeline(Pipelines::RoundExample, $pipeline); + } + + public function testRoundAverageRating(): void + { + $pipeline = new Pipeline( + Stage::project( + roundedAverageRating: Expression::avg( + Expression::round( + Expression::avg( + Expression::doubleFieldPath('averageRating'), + ), + 2, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::RoundRoundAverageRating, $pipeline); + } +} diff --git a/tests/Builder/Expression/RtrimOperatorTest.php b/tests/Builder/Expression/RtrimOperatorTest.php new file mode 100644 index 000000000..077fe8dd4 --- /dev/null +++ b/tests/Builder/Expression/RtrimOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::RtrimExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/SecondOperatorTest.php b/tests/Builder/Expression/SecondOperatorTest.php new file mode 100644 index 000000000..370686876 --- /dev/null +++ b/tests/Builder/Expression/SecondOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::SecondExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/SetDifferenceOperatorTest.php b/tests/Builder/Expression/SetDifferenceOperatorTest.php new file mode 100644 index 000000000..1a1fafcc4 --- /dev/null +++ b/tests/Builder/Expression/SetDifferenceOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::SetDifferenceExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/SetEqualsOperatorTest.php b/tests/Builder/Expression/SetEqualsOperatorTest.php new file mode 100644 index 000000000..e3974dad7 --- /dev/null +++ b/tests/Builder/Expression/SetEqualsOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::SetEqualsExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/SetFieldOperatorTest.php b/tests/Builder/Expression/SetFieldOperatorTest.php new file mode 100644 index 000000000..eb844334a --- /dev/null +++ b/tests/Builder/Expression/SetFieldOperatorTest.php @@ -0,0 +1,114 @@ +assertSamePipeline(Pipelines::SetFieldAddFieldsThatContainPeriods, $pipeline); + } + + public function testAddFieldsThatStartWithADollarSign(): void + { + $pipeline = new Pipeline( + Stage::replaceWith( + Expression::setField( + field: Expression::literal('$price'), + input: Expression::variable('ROOT'), + value: Expression::fieldPath('price'), + ), + ), + Stage::unset('price'), + ); + + $this->assertSamePipeline(Pipelines::SetFieldAddFieldsThatStartWithADollarSign, $pipeline); + } + + public function testRemoveFieldsThatContainPeriods(): void + { + $pipeline = new Pipeline( + Stage::replaceWith( + Expression::setField( + field: 'price.usd', + input: Expression::variable('ROOT'), + value: Expression::variable('REMOVE'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SetFieldRemoveFieldsThatContainPeriods, $pipeline); + } + + public function testRemoveFieldsThatStartWithADollarSign(): void + { + $pipeline = new Pipeline( + Stage::replaceWith( + Expression::setField( + field: Expression::literal('$price'), + input: Expression::variable('ROOT'), + value: Expression::variable('REMOVE'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SetFieldRemoveFieldsThatStartWithADollarSign, $pipeline); + } + + public function testUpdateFieldsThatContainPeriods(): void + { + $pipeline = new Pipeline( + Stage::match( + _id: 1, + ), + Stage::replaceWith( + Expression::setField( + field: 'price.usd', + input: Expression::variable('ROOT'), + value: 49.99, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SetFieldUpdateFieldsThatContainPeriods, $pipeline); + } + + public function testUpdateFieldsThatStartWithADollarSign(): void + { + $pipeline = new Pipeline( + Stage::match( + _id: 1, + ), + Stage::replaceWith( + Expression::setField( + field: Expression::literal('$price'), + input: Expression::variable('ROOT'), + value: 49.99, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SetFieldUpdateFieldsThatStartWithADollarSign, $pipeline); + } +} diff --git a/tests/Builder/Expression/SetIntersectionOperatorTest.php b/tests/Builder/Expression/SetIntersectionOperatorTest.php new file mode 100644 index 000000000..7bce31d1c --- /dev/null +++ b/tests/Builder/Expression/SetIntersectionOperatorTest.php @@ -0,0 +1,55 @@ +assertSamePipeline(Pipelines::SetIntersectionElementsArrayExample, $pipeline); + } + + public function testRetrieveDocumentsForRolesGrantedToTheCurrentUser(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::expr( + Expression::not( + Expression::eq( + Expression::setIntersection( + Expression::arrayFieldPath('allowedRoles'), + Expression::variable('USER_ROLES.role'), + ), + [], + ), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SetIntersectionRetrieveDocumentsForRolesGrantedToTheCurrentUser, $pipeline); + } +} diff --git a/tests/Builder/Expression/SetIsSubsetOperatorTest.php b/tests/Builder/Expression/SetIsSubsetOperatorTest.php new file mode 100644 index 000000000..b54e6bde6 --- /dev/null +++ b/tests/Builder/Expression/SetIsSubsetOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::SetIsSubsetExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/SetUnionOperatorTest.php b/tests/Builder/Expression/SetUnionOperatorTest.php new file mode 100644 index 000000000..56bf8694c --- /dev/null +++ b/tests/Builder/Expression/SetUnionOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::SetUnionExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/SinOperatorTest.php b/tests/Builder/Expression/SinOperatorTest.php new file mode 100644 index 000000000..5a585f3c9 --- /dev/null +++ b/tests/Builder/Expression/SinOperatorTest.php @@ -0,0 +1,34 @@ +assertSamePipeline(Pipelines::SinExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/SinhOperatorTest.php b/tests/Builder/Expression/SinhOperatorTest.php new file mode 100644 index 000000000..5ba2241f3 --- /dev/null +++ b/tests/Builder/Expression/SinhOperatorTest.php @@ -0,0 +1,31 @@ +assertSamePipeline(Pipelines::SinhExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/SizeOperatorTest.php b/tests/Builder/Expression/SizeOperatorTest.php new file mode 100644 index 000000000..edd2c6cb4 --- /dev/null +++ b/tests/Builder/Expression/SizeOperatorTest.php @@ -0,0 +1,36 @@ +assertSamePipeline(Pipelines::SizeExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/SliceOperatorTest.php b/tests/Builder/Expression/SliceOperatorTest.php new file mode 100644 index 000000000..b6326b051 --- /dev/null +++ b/tests/Builder/Expression/SliceOperatorTest.php @@ -0,0 +1,31 @@ +assertSamePipeline(Pipelines::SliceExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/SortArrayOperatorTest.php b/tests/Builder/Expression/SortArrayOperatorTest.php new file mode 100644 index 000000000..a2b738f38 --- /dev/null +++ b/tests/Builder/Expression/SortArrayOperatorTest.php @@ -0,0 +1,116 @@ +assertSamePipeline(Pipelines::SortArraySortAnArrayOfIntegers, $pipeline); + } + + public function testSortOnAField(): void + { + $pipeline = new Pipeline( + Stage::project( + _id: 0, + result: Expression::sortArray( + input: Expression::arrayFieldPath('team'), + // @todo This object should be typed as "sort spec" + sortBy: object( + name: Sort::Asc, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SortArraySortOnAField, $pipeline); + } + + public function testSortOnASubfield(): void + { + $pipeline = new Pipeline( + Stage::project( + _id: 0, + result: Expression::sortArray( + input: Expression::arrayFieldPath('team'), + sortBy: [ + 'address.city' => Sort::Desc, + ], + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SortArraySortOnASubfield, $pipeline); + } + + public function testSortOnMixedTypeFields(): void + { + $pipeline = new Pipeline( + Stage::project( + _id: 0, + result: Expression::sortArray( + input: [ + 20, + 4, + object(a: 'Free'), + 6, + 21, + 5, + 'Gratis', + ['a' => null], + object(a: object(sale: true, price: 19)), + new Decimal128('10.23'), + ['a' => 'On sale'], + ], + sortBy: Sort::Asc, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SortArraySortOnMixedTypeFields, $pipeline); + } + + public function testSortOnMultipleFields(): void + { + $pipeline = new Pipeline( + Stage::project( + _id: 0, + result: Expression::sortArray( + input: Expression::arrayFieldPath('team'), + // @todo This array should be typed as "sort spec" + sortBy: object( + age: Sort::Desc, + name: Sort::Asc, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SortArraySortOnMultipleFields, $pipeline); + } +} diff --git a/tests/Builder/Expression/SplitOperatorTest.php b/tests/Builder/Expression/SplitOperatorTest.php new file mode 100644 index 000000000..ee997d539 --- /dev/null +++ b/tests/Builder/Expression/SplitOperatorTest.php @@ -0,0 +1,67 @@ +assertSamePipeline(Pipelines::SplitExample, $pipeline); + } + + public function testSupportRegexDelimiter(): void + { + $pipeline = new Pipeline( + Stage::project( + split: Expression::split( + string: 'abc', + delimiter: new Regex('b'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SplitSupportRegexDelimiter, $pipeline); + } +} diff --git a/tests/Builder/Expression/SqrtOperatorTest.php b/tests/Builder/Expression/SqrtOperatorTest.php new file mode 100644 index 000000000..de33969f5 --- /dev/null +++ b/tests/Builder/Expression/SqrtOperatorTest.php @@ -0,0 +1,44 @@ +assertSamePipeline(Pipelines::SqrtExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/StdDevPopOperatorTest.php b/tests/Builder/Expression/StdDevPopOperatorTest.php new file mode 100644 index 000000000..fdff25f99 --- /dev/null +++ b/tests/Builder/Expression/StdDevPopOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::StdDevPopUseInProjectStage, $pipeline); + } +} diff --git a/tests/Builder/Expression/StrLenBytesOperatorTest.php b/tests/Builder/Expression/StrLenBytesOperatorTest.php new file mode 100644 index 000000000..1c465b672 --- /dev/null +++ b/tests/Builder/Expression/StrLenBytesOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::StrLenBytesSingleByteAndMultibyteCharacterSet, $pipeline); + } +} diff --git a/tests/Builder/Expression/StrLenCPOperatorTest.php b/tests/Builder/Expression/StrLenCPOperatorTest.php new file mode 100644 index 000000000..78e995479 --- /dev/null +++ b/tests/Builder/Expression/StrLenCPOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::StrLenCPSingleByteAndMultibyteCharacterSet, $pipeline); + } +} diff --git a/tests/Builder/Expression/StrcasecmpOperatorTest.php b/tests/Builder/Expression/StrcasecmpOperatorTest.php new file mode 100644 index 000000000..543ac54d0 --- /dev/null +++ b/tests/Builder/Expression/StrcasecmpOperatorTest.php @@ -0,0 +1,31 @@ +assertSamePipeline(Pipelines::StrcasecmpExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/SubstrBytesOperatorTest.php b/tests/Builder/Expression/SubstrBytesOperatorTest.php new file mode 100644 index 000000000..34d4d6f61 --- /dev/null +++ b/tests/Builder/Expression/SubstrBytesOperatorTest.php @@ -0,0 +1,58 @@ +assertSamePipeline(Pipelines::SubstrBytesSingleByteAndMultibyteCharacterSet, $pipeline); + } + + public function testSingleByteCharacterSet(): void + { + $pipeline = new Pipeline( + Stage::project( + item: 1, + yearSubstring: Expression::substrBytes( + Expression::stringFieldPath('quarter'), + 0, + 2, + ), + quarterSubtring: Expression::substrBytes( + Expression::stringFieldPath('quarter'), + 2, + Expression::subtract( + Expression::strLenBytes( + Expression::stringFieldPath('quarter'), + ), + 2, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SubstrBytesSingleByteCharacterSet, $pipeline); + } +} diff --git a/tests/Builder/Expression/SubstrCPOperatorTest.php b/tests/Builder/Expression/SubstrCPOperatorTest.php new file mode 100644 index 000000000..9a24b1fa9 --- /dev/null +++ b/tests/Builder/Expression/SubstrCPOperatorTest.php @@ -0,0 +1,58 @@ +assertSamePipeline(Pipelines::SubstrCPSingleByteAndMultibyteCharacterSet, $pipeline); + } + + public function testSingleByteCharacterSet(): void + { + $pipeline = new Pipeline( + Stage::project( + item: 1, + yearSubstring: Expression::substrCP( + Expression::stringFieldPath('quarter'), + 0, + 2, + ), + quarterSubtring: Expression::substrCP( + Expression::stringFieldPath('quarter'), + 2, + Expression::subtract( + Expression::strLenCP( + Expression::stringFieldPath('quarter'), + ), + 2, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SubstrCPSingleByteCharacterSet, $pipeline); + } +} diff --git a/tests/Builder/Expression/SubstrOperatorTest.php b/tests/Builder/Expression/SubstrOperatorTest.php new file mode 100644 index 000000000..f2a6f432d --- /dev/null +++ b/tests/Builder/Expression/SubstrOperatorTest.php @@ -0,0 +1,37 @@ +assertSamePipeline(Pipelines::SubstrExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/SubtractOperatorTest.php b/tests/Builder/Expression/SubtractOperatorTest.php new file mode 100644 index 000000000..95b691a95 --- /dev/null +++ b/tests/Builder/Expression/SubtractOperatorTest.php @@ -0,0 +1,64 @@ +assertSamePipeline(Pipelines::SubtractSubtractMillisecondsFromADate, $pipeline); + } + + public function testSubtractNumbers(): void + { + $pipeline = new Pipeline( + Stage::project( + item: 1, + total: Expression::subtract( + Expression::add( + Expression::numberFieldPath('price'), + Expression::numberFieldPath('fee'), + ), + Expression::numberFieldPath('discount'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SubtractSubtractNumbers, $pipeline); + } + + public function testSubtractTwoDates(): void + { + $pipeline = new Pipeline( + Stage::project( + item: 1, + dateDifference: Expression::subtract( + Expression::variable('NOW'), + Expression::dateFieldPath('date'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SubtractSubtractTwoDates, $pipeline); + } +} diff --git a/tests/Builder/Expression/SumOperatorTest.php b/tests/Builder/Expression/SumOperatorTest.php new file mode 100644 index 000000000..923162a20 --- /dev/null +++ b/tests/Builder/Expression/SumOperatorTest.php @@ -0,0 +1,36 @@ +assertSamePipeline(Pipelines::SumUseInProjectStage, $pipeline); + } +} diff --git a/tests/Builder/Expression/SwitchOperatorTest.php b/tests/Builder/Expression/SwitchOperatorTest.php new file mode 100644 index 000000000..1d288ea7a --- /dev/null +++ b/tests/Builder/Expression/SwitchOperatorTest.php @@ -0,0 +1,67 @@ +assertSamePipeline(Pipelines::SwitchExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/TanOperatorTest.php b/tests/Builder/Expression/TanOperatorTest.php new file mode 100644 index 000000000..34b210d0a --- /dev/null +++ b/tests/Builder/Expression/TanOperatorTest.php @@ -0,0 +1,34 @@ +assertSamePipeline(Pipelines::TanExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/TanhOperatorTest.php b/tests/Builder/Expression/TanhOperatorTest.php new file mode 100644 index 000000000..4ae799e55 --- /dev/null +++ b/tests/Builder/Expression/TanhOperatorTest.php @@ -0,0 +1,32 @@ +assertSamePipeline(Pipelines::TanhExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ToBoolOperatorTest.php b/tests/Builder/Expression/ToBoolOperatorTest.php new file mode 100644 index 000000000..2b1aad9f9 --- /dev/null +++ b/tests/Builder/Expression/ToBoolOperatorTest.php @@ -0,0 +1,50 @@ +assertSamePipeline(Pipelines::ToBoolExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ToDateOperatorTest.php b/tests/Builder/Expression/ToDateOperatorTest.php new file mode 100644 index 000000000..9b03b1121 --- /dev/null +++ b/tests/Builder/Expression/ToDateOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::ToDateExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ToDecimalOperatorTest.php b/tests/Builder/Expression/ToDecimalOperatorTest.php new file mode 100644 index 000000000..d12a72755 --- /dev/null +++ b/tests/Builder/Expression/ToDecimalOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::ToDecimalExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ToDoubleOperatorTest.php b/tests/Builder/Expression/ToDoubleOperatorTest.php new file mode 100644 index 000000000..d0819e79d --- /dev/null +++ b/tests/Builder/Expression/ToDoubleOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::ToDoubleExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ToHashedIndexKeyOperatorTest.php b/tests/Builder/Expression/ToHashedIndexKeyOperatorTest.php new file mode 100644 index 000000000..8bb4bb852 --- /dev/null +++ b/tests/Builder/Expression/ToHashedIndexKeyOperatorTest.php @@ -0,0 +1,34 @@ +assertSamePipeline(Pipelines::ToHashedIndexKeyExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ToIntOperatorTest.php b/tests/Builder/Expression/ToIntOperatorTest.php new file mode 100644 index 000000000..cc88ca63d --- /dev/null +++ b/tests/Builder/Expression/ToIntOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::ToIntExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ToLongOperatorTest.php b/tests/Builder/Expression/ToLongOperatorTest.php new file mode 100644 index 000000000..53c6f1f07 --- /dev/null +++ b/tests/Builder/Expression/ToLongOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::ToLongExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ToLowerOperatorTest.php b/tests/Builder/Expression/ToLowerOperatorTest.php new file mode 100644 index 000000000..6f8cc154d --- /dev/null +++ b/tests/Builder/Expression/ToLowerOperatorTest.php @@ -0,0 +1,32 @@ +assertSamePipeline(Pipelines::ToLowerExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ToObjectIdOperatorTest.php b/tests/Builder/Expression/ToObjectIdOperatorTest.php new file mode 100644 index 000000000..396507241 --- /dev/null +++ b/tests/Builder/Expression/ToObjectIdOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::ToObjectIdExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ToStringOperatorTest.php b/tests/Builder/Expression/ToStringOperatorTest.php new file mode 100644 index 000000000..d33cb2e3b --- /dev/null +++ b/tests/Builder/Expression/ToStringOperatorTest.php @@ -0,0 +1,33 @@ +assertSamePipeline(Pipelines::ToStringExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ToUpperOperatorTest.php b/tests/Builder/Expression/ToUpperOperatorTest.php new file mode 100644 index 000000000..529892ea1 --- /dev/null +++ b/tests/Builder/Expression/ToUpperOperatorTest.php @@ -0,0 +1,32 @@ +assertSamePipeline(Pipelines::ToUpperExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/TrimOperatorTest.php b/tests/Builder/Expression/TrimOperatorTest.php new file mode 100644 index 000000000..81c2e2353 --- /dev/null +++ b/tests/Builder/Expression/TrimOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::TrimExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/TruncOperatorTest.php b/tests/Builder/Expression/TruncOperatorTest.php new file mode 100644 index 000000000..45f1826be --- /dev/null +++ b/tests/Builder/Expression/TruncOperatorTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::TruncExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/TsIncrementOperatorTest.php b/tests/Builder/Expression/TsIncrementOperatorTest.php new file mode 100644 index 000000000..092f57660 --- /dev/null +++ b/tests/Builder/Expression/TsIncrementOperatorTest.php @@ -0,0 +1,53 @@ +assertSamePipeline(Pipelines::TsIncrementObtainTheIncrementingOrdinalFromATimestampField, $pipeline); + } + + public function testUseTsSecondInAChangeStreamCursorToMonitorCollectionChanges(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::expr( + Expression::eq( + Expression::mod( + Expression::tsIncrement( + Expression::timestampFieldPath('clusterTime'), + ), + 2, + ), + 0, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::TsIncrementUseTsSecondInAChangeStreamCursorToMonitorCollectionChanges, $pipeline); + } +} diff --git a/tests/Builder/Expression/TsSecondOperatorTest.php b/tests/Builder/Expression/TsSecondOperatorTest.php new file mode 100644 index 000000000..16f5b59e6 --- /dev/null +++ b/tests/Builder/Expression/TsSecondOperatorTest.php @@ -0,0 +1,44 @@ +assertSamePipeline(Pipelines::TsSecondObtainTheNumberOfSecondsFromATimestampField, $pipeline); + } + + public function testUseTsSecondInAChangeStreamCursorToMonitorCollectionChanges(): void + { + $pipeline = new Pipeline( + Stage::addFields( + clusterTimeSeconds: Expression::tsSecond( + Expression::timestampFieldPath('clusterTime'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::TsSecondUseTsSecondInAChangeStreamCursorToMonitorCollectionChanges, $pipeline); + } +} diff --git a/tests/Builder/Expression/TypeOperatorTest.php b/tests/Builder/Expression/TypeOperatorTest.php new file mode 100644 index 000000000..797536c27 --- /dev/null +++ b/tests/Builder/Expression/TypeOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::TypeExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/UnsetFieldOperatorTest.php b/tests/Builder/Expression/UnsetFieldOperatorTest.php new file mode 100644 index 000000000..fba80d191 --- /dev/null +++ b/tests/Builder/Expression/UnsetFieldOperatorTest.php @@ -0,0 +1,62 @@ +assertSamePipeline(Pipelines::UnsetFieldRemoveASubfield, $pipeline); + } + + public function testRemoveFieldsThatContainPeriods(): void + { + $pipeline = new Pipeline( + Stage::replaceWith( + Expression::unsetField( + field: 'price.usd', + input: Expression::variable('ROOT'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::UnsetFieldRemoveFieldsThatContainPeriods, $pipeline); + } + + public function testRemoveFieldsThatStartWithADollarSign(): void + { + $pipeline = new Pipeline( + Stage::replaceWith( + Expression::unsetField( + field: Expression::literal('$price'), + input: Expression::variable('ROOT'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::UnsetFieldRemoveFieldsThatStartWithADollarSign, $pipeline); + } +} diff --git a/tests/Builder/Expression/WeekOperatorTest.php b/tests/Builder/Expression/WeekOperatorTest.php new file mode 100644 index 000000000..334cc26ff --- /dev/null +++ b/tests/Builder/Expression/WeekOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::WeekExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/YearOperatorTest.php b/tests/Builder/Expression/YearOperatorTest.php new file mode 100644 index 000000000..a8d02fea6 --- /dev/null +++ b/tests/Builder/Expression/YearOperatorTest.php @@ -0,0 +1,29 @@ +assertSamePipeline(Pipelines::YearExample, $pipeline); + } +} diff --git a/tests/Builder/Expression/ZipOperatorTest.php b/tests/Builder/Expression/ZipOperatorTest.php new file mode 100644 index 000000000..d0039c5d6 --- /dev/null +++ b/tests/Builder/Expression/ZipOperatorTest.php @@ -0,0 +1,58 @@ +assertSamePipeline(Pipelines::ZipFilteringAndPreservingIndexes, $pipeline); + } + + public function testMatrixTransposition(): void + { + $pipeline = new Pipeline( + Stage::project( + _id: false, + transposed: Expression::zip([ + Expression::arrayElemAt(Expression::arrayFieldPath('matrix'), 0), + Expression::arrayElemAt(Expression::arrayFieldPath('matrix'), 1), + Expression::arrayElemAt(Expression::arrayFieldPath('matrix'), 2), + ]), + ), + ); + + $this->assertSamePipeline(Pipelines::ZipMatrixTransposition, $pipeline); + } +} diff --git a/tests/Builder/FieldPathTest.php b/tests/Builder/FieldPathTest.php new file mode 100644 index 000000000..90ccef804 --- /dev/null +++ b/tests/Builder/FieldPathTest.php @@ -0,0 +1,73 @@ +assertSame('foo', $fieldPath->name); + $this->assertInstanceOf($resolveClass, $fieldPath); + $this->assertInstanceOf(FieldPathInterface::class, $fieldPath); + + // Ensure FieldPath resolves to any type + $this->assertTrue(is_subclass_of(Expression\FieldPath::class, $resolveClass), sprintf('%s instanceof %s', Expression\FieldPath::class, $resolveClass)); + } + + #[DataProvider('provideFieldPath')] + public function testRejectDollarPrefix(string $fieldPathClass): void + { + $this->expectException(InvalidArgumentException::class); + + Expression::{$fieldPathClass}('$foo'); + } + + public static function provideFieldPath(): Generator + { + yield 'double' => ['doubleFieldPath', Expression\ResolvesToDouble::class]; + yield 'string' => ['stringFieldPath', Expression\ResolvesToString::class]; + yield 'object' => ['objectFieldPath', Expression\ResolvesToObject::class]; + yield 'array' => ['arrayFieldPath', Expression\ResolvesToArray::class]; + yield 'binData' => ['binDataFieldPath', Expression\ResolvesToBinData::class]; + yield 'objectId' => ['objectIdFieldPath', Expression\ResolvesToObjectId::class]; + yield 'bool' => ['boolFieldPath', Expression\ResolvesToBool::class]; + yield 'date' => ['dateFieldPath', Expression\ResolvesToDate::class]; + yield 'null' => ['nullFieldPath', Expression\ResolvesToNull::class]; + yield 'regex' => ['regexFieldPath', Expression\ResolvesToRegex::class]; + yield 'javascript' => ['javascriptFieldPath', Expression\ResolvesToJavascript::class]; + yield 'int' => ['intFieldPath', Expression\ResolvesToInt::class]; + yield 'timestamp' => ['timestampFieldPath', Expression\ResolvesToTimestamp::class]; + yield 'long' => ['longFieldPath', Expression\ResolvesToLong::class]; + yield 'decimal' => ['decimalFieldPath', Expression\ResolvesToDecimal::class]; + yield 'number' => ['numberFieldPath', Expression\ResolvesToNumber::class]; + yield 'any' => ['fieldPath', Expression\ResolvesToAny::class]; + } + + public function testStringFieldPathAcceptedAsExpression(): void + { + $operator = Expression::abs('$foo'); + + $this->assertSame('$foo', $operator->value); + } + + public function testNonDollarPrefixedStringRejected(): void + { + self::expectException(InvalidArgumentException::class); + + Expression::abs('foo'); + } +} diff --git a/tests/Builder/FluentPipelineFactoryTest.php b/tests/Builder/FluentPipelineFactoryTest.php new file mode 100644 index 000000000..e1d84a2e4 --- /dev/null +++ b/tests/Builder/FluentPipelineFactoryTest.php @@ -0,0 +1,34 @@ +match(x: Query::eq(1)) + ->project(_id: false, x: true) + ->sort(x: Sort::Asc) + ->getPipeline(); + + $expected = <<<'json' + [ + {"$match": {"x": {"$eq": {"$numberInt": "1"}}}}, + {"$project": {"_id": false, "x": true}}, + {"$sort": {"x": {"$numberInt": "1"}}} + ] + json; + + $this->assertSamePipeline($expected, $pipeline); + } +} diff --git a/tests/Builder/PipelineTest.php b/tests/Builder/PipelineTest.php new file mode 100644 index 000000000..b274fecab --- /dev/null +++ b/tests/Builder/PipelineTest.php @@ -0,0 +1,75 @@ +assertSame([], iterator_to_array($pipeline)); + } + + public function testFromArray(): void + { + $pipeline = new Pipeline( + ['$match' => ['tag' => 'foo']], + [ + ['$sort' => ['_id' => 1]], + ['$skip' => 10], + ], + ['$limit' => 5], + ); + + $expected = [ + ['$match' => ['tag' => 'foo']], + ['$sort' => ['_id' => 1]], + ['$skip' => 10], + ['$limit' => 5], + ]; + + $this->assertSame($expected, iterator_to_array($pipeline)); + } + + public function testMergingPipeline(): void + { + $stages = array_map( + fn (int $i) => $this->createMock(StageInterface::class), + range(0, 7), + ); + + $pipeline = new Pipeline( + $stages[0], + $stages[1], + new Pipeline($stages[2], $stages[3]), + [$stages[4], $stages[5]], + new Pipeline($stages[6]), + [$stages[7]], + ); + + $this->assertSame($stages, iterator_to_array($pipeline)); + } + + public function testRejectNamedArguments(): void + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Named arguments are not supported for pipelines'); + + new Pipeline( + $this->createMock(StageInterface::class), + foo: $this->createMock(StageInterface::class), + ); + } +} diff --git a/tests/Builder/PipelineTestCase.php b/tests/Builder/PipelineTestCase.php new file mode 100644 index 000000000..1975a4ab3 --- /dev/null +++ b/tests/Builder/PipelineTestCase.php @@ -0,0 +1,31 @@ +value; + } + + // BSON Documents doesn't support top-level arrays. + $expected = '{"pipeline":' . $expectedJson . '}'; + + $codec = new BuilderEncoder(); + $actual = $codec->encode($pipeline); + // Normalize with BSON round-trip + $actual = Document::fromPHP(['pipeline' => $actual])->toCanonicalExtendedJSON(); + + self::assertJsonStringEqualsJsonString($expected, $actual); + } +} diff --git a/tests/Builder/Query/AllOperatorTest.php b/tests/Builder/Query/AllOperatorTest.php new file mode 100644 index 000000000..ce0dbe0c8 --- /dev/null +++ b/tests/Builder/Query/AllOperatorTest.php @@ -0,0 +1,51 @@ +assertSamePipeline(Pipelines::AllUseAllToMatchValues, $pipeline); + } + + public function testUseAllWithElemMatch(): void + { + $pipeline = new Pipeline( + Stage::match( + qty: Query::all( + Query::elemMatch( + Query::query( + size: 'M', + num: Query::gt(50), + ), + ), + Query::elemMatch( + Query::query( + num: 100, + color: 'green', + ), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::AllUseAllWithElemMatch, $pipeline); + } +} diff --git a/tests/Builder/Query/AndOperatorTest.php b/tests/Builder/Query/AndOperatorTest.php new file mode 100644 index 000000000..778aa3f97 --- /dev/null +++ b/tests/Builder/Query/AndOperatorTest.php @@ -0,0 +1,62 @@ +assertSamePipeline(Pipelines::AndANDQueriesWithMultipleExpressionsSpecifyingTheSameField, $pipeline); + } + + public function testANDQueriesWithMultipleExpressionsSpecifyingTheSameOperator(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::and( + Query::or( + Query::query( + qty: Query::lt(10), + ), + Query::query( + qty: Query::gt(50), + ), + ), + Query::or( + Query::query( + sale: true, + ), + Query::query( + price: Query::lt(5), + ), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::AndANDQueriesWithMultipleExpressionsSpecifyingTheSameOperator, $pipeline); + } +} diff --git a/tests/Builder/Query/BitsAllClearOperatorTest.php b/tests/Builder/Query/BitsAllClearOperatorTest.php new file mode 100644 index 000000000..ccc670fba --- /dev/null +++ b/tests/Builder/Query/BitsAllClearOperatorTest.php @@ -0,0 +1,54 @@ +assertSamePipeline(Pipelines::BitsAllClearBinDataBitmask, $pipeline); + } + + public function testBitPositionArray(): void + { + $pipeline = new Pipeline( + Stage::match( + a: Query::bitsAllClear([1, 5]), + ), + ); + + $this->assertSamePipeline(Pipelines::BitsAllClearBitPositionArray, $pipeline); + } + + public function testIntegerBitmask(): void + { + $pipeline = new Pipeline( + Stage::match( + a: Query::bitsAllClear(35), + ), + ); + + $this->assertSamePipeline(Pipelines::BitsAllClearIntegerBitmask, $pipeline); + } +} diff --git a/tests/Builder/Query/BitsAllSetOperatorTest.php b/tests/Builder/Query/BitsAllSetOperatorTest.php new file mode 100644 index 000000000..c1eaa0e47 --- /dev/null +++ b/tests/Builder/Query/BitsAllSetOperatorTest.php @@ -0,0 +1,54 @@ +assertSamePipeline(Pipelines::BitsAllSetBinDataBitmask, $pipeline); + } + + public function testBitPositionArray(): void + { + $pipeline = new Pipeline( + Stage::match( + a: Query::bitsAllSet([1, 5]), + ), + ); + + $this->assertSamePipeline(Pipelines::BitsAllSetBitPositionArray, $pipeline); + } + + public function testIntegerBitmask(): void + { + $pipeline = new Pipeline( + Stage::match( + a: Query::bitsAllSet(50), + ), + ); + + $this->assertSamePipeline(Pipelines::BitsAllSetIntegerBitmask, $pipeline); + } +} diff --git a/tests/Builder/Query/BitsAnyClearOperatorTest.php b/tests/Builder/Query/BitsAnyClearOperatorTest.php new file mode 100644 index 000000000..3f32fdb86 --- /dev/null +++ b/tests/Builder/Query/BitsAnyClearOperatorTest.php @@ -0,0 +1,54 @@ +assertSamePipeline(Pipelines::BitsAnyClearBinDataBitmask, $pipeline); + } + + public function testBitPositionArray(): void + { + $pipeline = new Pipeline( + Stage::match( + a: Query::bitsAnyClear([1, 5]), + ), + ); + + $this->assertSamePipeline(Pipelines::BitsAnyClearBitPositionArray, $pipeline); + } + + public function testIntegerBitmask(): void + { + $pipeline = new Pipeline( + Stage::match( + a: Query::bitsAnyClear(35), + ), + ); + + $this->assertSamePipeline(Pipelines::BitsAnyClearIntegerBitmask, $pipeline); + } +} diff --git a/tests/Builder/Query/BitsAnySetOperatorTest.php b/tests/Builder/Query/BitsAnySetOperatorTest.php new file mode 100644 index 000000000..1d90c6893 --- /dev/null +++ b/tests/Builder/Query/BitsAnySetOperatorTest.php @@ -0,0 +1,54 @@ +assertSamePipeline(Pipelines::BitsAnySetBinDataBitmask, $pipeline); + } + + public function testBitPositionArray(): void + { + $pipeline = new Pipeline( + Stage::match( + a: Query::bitsAnySet([1, 5]), + ), + ); + + $this->assertSamePipeline(Pipelines::BitsAnySetBitPositionArray, $pipeline); + } + + public function testIntegerBitmask(): void + { + $pipeline = new Pipeline( + Stage::match( + a: Query::bitsAnySet(35), + ), + ); + + $this->assertSamePipeline(Pipelines::BitsAnySetIntegerBitmask, $pipeline); + } +} diff --git a/tests/Builder/Query/CommentOperatorTest.php b/tests/Builder/Query/CommentOperatorTest.php new file mode 100644 index 000000000..4b94bb56b --- /dev/null +++ b/tests/Builder/Query/CommentOperatorTest.php @@ -0,0 +1,39 @@ +assertSamePipeline(Pipelines::CommentAttachACommentToAnAggregationExpression, $pipeline); + } +} diff --git a/tests/Builder/Query/ElemMatchOperatorTest.php b/tests/Builder/Query/ElemMatchOperatorTest.php new file mode 100644 index 000000000..b179df446 --- /dev/null +++ b/tests/Builder/Query/ElemMatchOperatorTest.php @@ -0,0 +1,92 @@ +assertSamePipeline(Pipelines::ElemMatchArrayOfEmbeddedDocuments, $pipeline); + } + + public function testElementMatch(): void + { + $pipeline = new Pipeline( + Stage::match( + results: Query::elemMatch( + Query::fieldQuery( + Query::gte(80), + Query::lt(85), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ElemMatchElementMatch, $pipeline); + } + + public function testSingleFieldOperator(): void + { + $pipeline = new Pipeline( + Stage::match( + results: Query::elemMatch( + Query::gt(10), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ElemMatchSingleFieldOperator, $pipeline); + } + + public function testSingleQueryCondition(): void + { + $pipeline = new Pipeline( + Stage::match( + results: Query::elemMatch( + Query::query( + product: Query::ne('xyz'), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ElemMatchSingleQueryCondition, $pipeline); + } + + public function testUsingOrWithElemMatch(): void + { + $pipeline = new Pipeline( + Stage::match( + game: Query::elemMatch( + Query::or( + Query::query(score: Query::gt(10)), + Query::query(score: Query::lt(5)), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ElemMatchUsingOrWithElemMatch, $pipeline); + } +} diff --git a/tests/Builder/Query/EqOperatorTest.php b/tests/Builder/Query/EqOperatorTest.php new file mode 100644 index 000000000..813c780ac --- /dev/null +++ b/tests/Builder/Query/EqOperatorTest.php @@ -0,0 +1,70 @@ +assertSamePipeline(Pipelines::EqEqualsASpecifiedValue, $pipeline); + } + + public function testEqualsAnArrayValue(): void + { + $pipeline = new Pipeline( + Stage::match( + tags: Query::eq(['A', 'B']), + ), + ); + + $this->assertSamePipeline(Pipelines::EqEqualsAnArrayValue, $pipeline); + } + + public function testFieldInEmbeddedDocumentEqualsAValue(): void + { + $pipeline = new Pipeline( + Stage::match( + ...['item.name' => Query::eq('ab')], + ), + ); + + $this->assertSamePipeline(Pipelines::EqFieldInEmbeddedDocumentEqualsAValue, $pipeline); + } + + public function testRegexMatchBehaviour(): void + { + $pipeline = new Pipeline( + Stage::match( + company: 'MongoDB', + ), + Stage::match( + company: Query::eq('MongoDB'), + ), + Stage::match( + company: new Regex('^MongoDB'), + ), + Stage::match( + company: Query::eq(new Regex('^MongoDB')), + ), + ); + + $this->assertSamePipeline(Pipelines::EqRegexMatchBehaviour, $pipeline); + } +} diff --git a/tests/Builder/Query/ExistsOperatorTest.php b/tests/Builder/Query/ExistsOperatorTest.php new file mode 100644 index 000000000..27ebeec77 --- /dev/null +++ b/tests/Builder/Query/ExistsOperatorTest.php @@ -0,0 +1,52 @@ +assertSamePipeline(Pipelines::ExistsExistsAndNotEqualTo, $pipeline); + } + + public function testMissingField(): void + { + $pipeline = new Pipeline( + Stage::match( + qty: Query::exists(false), + ), + ); + + $this->assertSamePipeline(Pipelines::ExistsMissingField, $pipeline); + } + + public function testNullValues(): void + { + $pipeline = new Pipeline( + Stage::match( + qty: Query::exists(), + ), + ); + + $this->assertSamePipeline(Pipelines::ExistsNullValues, $pipeline); + } +} diff --git a/tests/Builder/Query/ExprOperatorTest.php b/tests/Builder/Query/ExprOperatorTest.php new file mode 100644 index 000000000..3b87fc35b --- /dev/null +++ b/tests/Builder/Query/ExprOperatorTest.php @@ -0,0 +1,58 @@ +assertSamePipeline(Pipelines::ExprCompareTwoFieldsFromASingleDocument, $pipeline); + } + + public function testUsingExprWithConditionalStatements(): void + { + $discountedPrice = Expression::cond( + if: Expression::gte(Expression::fieldPath('qty'), 100), + then: Expression::multiply( + Expression::numberfieldPath('price'), + 0.5, + ), + else: Expression::multiply( + Expression::numberfieldPath('price'), + 0.75, + ), + ); + + $pipeline = new Pipeline( + Stage::match( + Query::expr( + Expression::lt($discountedPrice, 5), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ExprUsingExprWithConditionalStatements, $pipeline); + } +} diff --git a/tests/Builder/Query/GeoIntersectsOperatorTest.php b/tests/Builder/Query/GeoIntersectsOperatorTest.php new file mode 100644 index 000000000..92fc88c83 --- /dev/null +++ b/tests/Builder/Query/GeoIntersectsOperatorTest.php @@ -0,0 +1,56 @@ +assertSamePipeline(Pipelines::GeoIntersectsIntersectsABigPolygon, $pipeline); + } + + public function testIntersectsAPolygon(): void + { + $pipeline = new Pipeline( + Stage::match( + loc: Query::geoIntersects( + Query::geometry( + type: 'Polygon', + coordinates: [[[0, 0], [3, 6], [6, 1], [0, 0]]], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::GeoIntersectsIntersectsAPolygon, $pipeline); + } +} diff --git a/tests/Builder/Query/GeoWithinOperatorTest.php b/tests/Builder/Query/GeoWithinOperatorTest.php new file mode 100644 index 000000000..d510b6cea --- /dev/null +++ b/tests/Builder/Query/GeoWithinOperatorTest.php @@ -0,0 +1,56 @@ +assertSamePipeline(Pipelines::GeoWithinWithinABigPolygon, $pipeline); + } + + public function testWithinAPolygon(): void + { + $pipeline = new Pipeline( + Stage::match( + loc: Query::geoWithin( + Query::geometry( + type: 'Polygon', + coordinates: [[[0, 0], [3, 6], [6, 1], [0, 0]]], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::GeoWithinWithinAPolygon, $pipeline); + } +} diff --git a/tests/Builder/Query/GtOperatorTest.php b/tests/Builder/Query/GtOperatorTest.php new file mode 100644 index 000000000..c2838d00c --- /dev/null +++ b/tests/Builder/Query/GtOperatorTest.php @@ -0,0 +1,27 @@ +assertSamePipeline(Pipelines::GtMatchDocumentFields, $pipeline); + } +} diff --git a/tests/Builder/Query/GteOperatorTest.php b/tests/Builder/Query/GteOperatorTest.php new file mode 100644 index 000000000..48198adf8 --- /dev/null +++ b/tests/Builder/Query/GteOperatorTest.php @@ -0,0 +1,27 @@ +assertSamePipeline(Pipelines::GteMatchDocumentFields, $pipeline); + } +} diff --git a/tests/Builder/Query/InOperatorTest.php b/tests/Builder/Query/InOperatorTest.php new file mode 100644 index 000000000..25a9001fd --- /dev/null +++ b/tests/Builder/Query/InOperatorTest.php @@ -0,0 +1,39 @@ +assertSamePipeline(Pipelines::InUseTheInOperatorToMatchValuesInAnArray, $pipeline); + } + + public function testUseTheInOperatorWithARegularExpression(): void + { + $pipeline = new Pipeline( + Stage::match( + tags: Query::in([new Regex('^be'), new Regex('^st')]), + ), + ); + + $this->assertSamePipeline(Pipelines::InUseTheInOperatorWithARegularExpression, $pipeline); + } +} diff --git a/tests/Builder/Query/JsonSchemaOperatorTest.php b/tests/Builder/Query/JsonSchemaOperatorTest.php new file mode 100644 index 000000000..0d4b1a92f --- /dev/null +++ b/tests/Builder/Query/JsonSchemaOperatorTest.php @@ -0,0 +1,45 @@ +assertSamePipeline(Pipelines::JsonSchemaExample, $pipeline); + } +} diff --git a/tests/Builder/Query/LtOperatorTest.php b/tests/Builder/Query/LtOperatorTest.php new file mode 100644 index 000000000..119f08a4b --- /dev/null +++ b/tests/Builder/Query/LtOperatorTest.php @@ -0,0 +1,27 @@ +assertSamePipeline(Pipelines::LtMatchDocumentFields, $pipeline); + } +} diff --git a/tests/Builder/Query/LteOperatorTest.php b/tests/Builder/Query/LteOperatorTest.php new file mode 100644 index 000000000..5a0d5da7f --- /dev/null +++ b/tests/Builder/Query/LteOperatorTest.php @@ -0,0 +1,27 @@ +assertSamePipeline(Pipelines::LteMatchDocumentFields, $pipeline); + } +} diff --git a/tests/Builder/Query/ModOperatorTest.php b/tests/Builder/Query/ModOperatorTest.php new file mode 100644 index 000000000..e4bbf90dc --- /dev/null +++ b/tests/Builder/Query/ModOperatorTest.php @@ -0,0 +1,44 @@ +assertSamePipeline(Pipelines::ModFloatingPointArguments, $pipeline); + } + + public function testUseModToSelectDocuments(): void + { + $pipeline = new Pipeline( + Stage::match( + qty: Query::mod(4, 0), + ), + ); + + $this->assertSamePipeline(Pipelines::ModUseModToSelectDocuments, $pipeline); + } +} diff --git a/tests/Builder/Query/NeOperatorTest.php b/tests/Builder/Query/NeOperatorTest.php new file mode 100644 index 000000000..dd6196293 --- /dev/null +++ b/tests/Builder/Query/NeOperatorTest.php @@ -0,0 +1,27 @@ +assertSamePipeline(Pipelines::NeMatchDocumentFields, $pipeline); + } +} diff --git a/tests/Builder/Query/NearOperatorTest.php b/tests/Builder/Query/NearOperatorTest.php new file mode 100644 index 000000000..3ca7a16c7 --- /dev/null +++ b/tests/Builder/Query/NearOperatorTest.php @@ -0,0 +1,34 @@ +assertSamePipeline(Pipelines::NearQueryOnGeoJSONData, $pipeline); + } +} diff --git a/tests/Builder/Query/NearSphereOperatorTest.php b/tests/Builder/Query/NearSphereOperatorTest.php new file mode 100644 index 000000000..40ef97a6c --- /dev/null +++ b/tests/Builder/Query/NearSphereOperatorTest.php @@ -0,0 +1,34 @@ +assertSamePipeline(Pipelines::NearSphereSpecifyCenterPointUsingGeoJSON, $pipeline); + } +} diff --git a/tests/Builder/Query/NinOperatorTest.php b/tests/Builder/Query/NinOperatorTest.php new file mode 100644 index 000000000..04799b791 --- /dev/null +++ b/tests/Builder/Query/NinOperatorTest.php @@ -0,0 +1,38 @@ +assertSamePipeline(Pipelines::NinSelectOnElementsNotInAnArray, $pipeline); + } + + public function testSelectOnUnmatchingDocuments(): void + { + $pipeline = new Pipeline( + Stage::match( + quantity: Query::nin([5, 15]), + ), + ); + + $this->assertSamePipeline(Pipelines::NinSelectOnUnmatchingDocuments, $pipeline); + } +} diff --git a/tests/Builder/Query/NorOperatorTest.php b/tests/Builder/Query/NorOperatorTest.php new file mode 100644 index 000000000..db03502dc --- /dev/null +++ b/tests/Builder/Query/NorOperatorTest.php @@ -0,0 +1,79 @@ +assertSamePipeline(Pipelines::NorAdditionalComparisons, $pipeline); + } + + public function testNorAndExists(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::nor( + Query::query( + price: 1.99, + ), + Query::query( + price: Query::exists(false), + ), + Query::query( + sale: true, + ), + Query::query( + sale: Query::exists(false), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::NorNorAndExists, $pipeline); + } + + public function testQueryWithTwoExpressions(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::nor( + Query::query( + price: 1.99, + ), + Query::query( + sale: true, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::NorQueryWithTwoExpressions, $pipeline); + } +} diff --git a/tests/Builder/Query/NotOperatorTest.php b/tests/Builder/Query/NotOperatorTest.php new file mode 100644 index 000000000..e69062f9c --- /dev/null +++ b/tests/Builder/Query/NotOperatorTest.php @@ -0,0 +1,43 @@ +assertSamePipeline(Pipelines::NotRegularExpressions, $pipeline); + } + + public function testSyntax(): void + { + $pipeline = new Pipeline( + Stage::match( + price: Query::not( + Query::gt(1.99), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::NotSyntax, $pipeline); + } +} diff --git a/tests/Builder/Query/OrOperatorTest.php b/tests/Builder/Query/OrOperatorTest.php new file mode 100644 index 000000000..3ad68b20b --- /dev/null +++ b/tests/Builder/Query/OrOperatorTest.php @@ -0,0 +1,59 @@ +assertSamePipeline(Pipelines::OrErrorHandling, $pipeline); + } + + public function testOrClauses(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::or( + Query::query( + quantity: Query::lt(20), + ), + Query::query( + price: 10, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::OrOrClauses, $pipeline); + } +} diff --git a/tests/Builder/Query/Pipelines.php b/tests/Builder/Query/Pipelines.php new file mode 100644 index 000000000..78611649d --- /dev/null +++ b/tests/Builder/Query/Pipelines.php @@ -0,0 +1,2073 @@ +assertSamePipeline(Pipelines::RandSelectRandomItemsFromACollection, $pipeline); + } +} diff --git a/tests/Builder/Query/RegexOperatorTest.php b/tests/Builder/Query/RegexOperatorTest.php new file mode 100644 index 000000000..6f9109387 --- /dev/null +++ b/tests/Builder/Query/RegexOperatorTest.php @@ -0,0 +1,38 @@ +assertSamePipeline(Pipelines::RegexPerformALIKEMatch, $pipeline); + } + + public function testPerformCaseInsensitiveRegularExpressionMatch(): void + { + $pipeline = new Pipeline( + Stage::match( + sku: Query::regex('^ABC', 'i'), + ), + ); + + $this->assertSamePipeline(Pipelines::RegexPerformCaseInsensitiveRegularExpressionMatch, $pipeline); + } +} diff --git a/tests/Builder/Query/SampleRateOperatorTest.php b/tests/Builder/Query/SampleRateOperatorTest.php new file mode 100644 index 000000000..95abec400 --- /dev/null +++ b/tests/Builder/Query/SampleRateOperatorTest.php @@ -0,0 +1,28 @@ +assertSamePipeline(Pipelines::SampleRateExample, $pipeline); + } +} diff --git a/tests/Builder/Query/SizeOperatorTest.php b/tests/Builder/Query/SizeOperatorTest.php new file mode 100644 index 000000000..ea612dbe7 --- /dev/null +++ b/tests/Builder/Query/SizeOperatorTest.php @@ -0,0 +1,27 @@ +assertSamePipeline(Pipelines::SizeQueryAnArrayByArrayLength, $pipeline); + } +} diff --git a/tests/Builder/Query/TextOperatorTest.php b/tests/Builder/Query/TextOperatorTest.php new file mode 100644 index 000000000..813c5460c --- /dev/null +++ b/tests/Builder/Query/TextOperatorTest.php @@ -0,0 +1,120 @@ +assertSamePipeline(Pipelines::TextCaseAndDiacriticInsensitiveSearch, $pipeline); + } + + public function testDiacriticSensitiveSearch(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::text( + search: 'CAFÉ', + diacriticSensitive: true, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::TextDiacriticSensitiveSearch, $pipeline); + } + + public function testMatchAnyOfTheSearchTerms(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::text('bake coffee cake'), + ), + ); + + $this->assertSamePipeline(Pipelines::TextMatchAnyOfTheSearchTerms, $pipeline); + } + + public function testPerformCaseSensitiveSearch(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::text( + search: 'Coffee', + caseSensitive: true, + ), + ), + Stage::match( + Query::text( + search: '\"Café Con Leche\"', + caseSensitive: true, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::TextPerformCaseSensitiveSearch, $pipeline); + } + + public function testSearchADifferentLanguage(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::text( + search: 'leche', + language: 'es', + ), + ), + ); + + $this->assertSamePipeline(Pipelines::TextSearchADifferentLanguage, $pipeline); + } + + public function testSearchForASingleWord(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::text('coffee'), + ), + ); + + $this->assertSamePipeline(Pipelines::TextSearchForASingleWord, $pipeline); + } + + public function testTextSearchScoreExamples(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::text( + search: 'CAFÉ', + diacriticSensitive: true, + ), + ), + Stage::project( + score: Expression::meta('textScore'), + ), + Stage::sort( + score: Sort::TextScore, + ), + Stage::limit(5), + ); + + $this->assertSamePipeline(Pipelines::TextTextSearchScoreExamples, $pipeline); + } +} diff --git a/tests/Builder/Query/TypeOperatorTest.php b/tests/Builder/Query/TypeOperatorTest.php new file mode 100644 index 000000000..21d727414 --- /dev/null +++ b/tests/Builder/Query/TypeOperatorTest.php @@ -0,0 +1,78 @@ +assertSamePipeline(Pipelines::TypeQueryingByArrayType, $pipeline); + } + + public function testQueryingByDataType(): void + { + $pipeline = new Pipeline( + Stage::match( + zipCode: Query::type(2), + ), + Stage::match( + zipCode: Query::type('string'), + ), + Stage::match( + zipCode: Query::type(1), + ), + Stage::match( + zipCode: Query::type('double'), + ), + Stage::match( + zipCode: Query::type('number'), + ), + ); + + $this->assertSamePipeline(Pipelines::TypeQueryingByDataType, $pipeline); + } + + public function testQueryingByMinKeyAndMaxKey(): void + { + $pipeline = new Pipeline( + Stage::match( + zipCode: Query::type('minKey'), + ), + Stage::match( + zipCode: Query::type('maxKey'), + ), + ); + + $this->assertSamePipeline(Pipelines::TypeQueryingByMinKeyAndMaxKey, $pipeline); + } + + public function testQueryingByMultipleDataType(): void + { + $pipeline = new Pipeline( + Stage::match( + zipCode: Query::type(2, 1), + ), + Stage::match( + zipCode: Query::type('string', 'double'), + ), + ); + + $this->assertSamePipeline(Pipelines::TypeQueryingByMultipleDataType, $pipeline); + } +} diff --git a/tests/Builder/Query/WhereOperatorTest.php b/tests/Builder/Query/WhereOperatorTest.php new file mode 100644 index 000000000..ed87faa4a --- /dev/null +++ b/tests/Builder/Query/WhereOperatorTest.php @@ -0,0 +1,45 @@ +assertSamePipeline(Pipelines::WhereExample, $pipeline); + } +} diff --git a/tests/Builder/Search/AutocompleteOperatorTest.php b/tests/Builder/Search/AutocompleteOperatorTest.php new file mode 100644 index 000000000..46c98f18d --- /dev/null +++ b/tests/Builder/Search/AutocompleteOperatorTest.php @@ -0,0 +1,138 @@ +assertSamePipeline(Pipelines::AutocompleteAcrossMultipleFields, $pipeline); + } + + public function testBasic(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::autocomplete( + query: 'off', + path: 'title', + ), + ), + Stage::limit(10), + Stage::project(_id: 0, title: 1), + ); + + $this->assertSamePipeline(Pipelines::AutocompleteBasic, $pipeline); + } + + public function testFuzzy(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::autocomplete( + query: 'pre', + path: 'title', + fuzzy: object( + maxEdits: 1, + prefixLength: 1, + maxExpansions: 256, + ), + ), + ), + Stage::limit(10), + Stage::project(_id: 0, title: 1), + ); + + $this->assertSamePipeline(Pipelines::AutocompleteFuzzy, $pipeline); + } + + public function testHighlighting(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::autocomplete( + query: 'ger', + path: 'title', + ), + highlight: object( + path: 'title', + ), + ), + Stage::limit(5), + Stage::project( + score: ['$meta' => 'searchScore'], + _id: 0, + title: 1, + highlights: ['$meta' => 'searchHighlights'], + ), + ); + + $this->assertSamePipeline(Pipelines::AutocompleteHighlighting, $pipeline); + } + + public function testTokenOrderAny(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::autocomplete( + query: 'men with', + path: 'title', + tokenOrder: 'any', + ), + ), + Stage::limit(4), + Stage::project(_id: 0, title: 1), + ); + + $this->assertSamePipeline(Pipelines::AutocompleteTokenOrderAny, $pipeline); + } + + public function testTokenOrderSequential(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::autocomplete( + query: 'men with', + path: 'title', + tokenOrder: 'sequential', + ), + ), + Stage::limit(4), + Stage::project(_id: 0, title: 1), + ); + + $this->assertSamePipeline(Pipelines::AutocompleteTokenOrderSequential, $pipeline); + } +} diff --git a/tests/Builder/Search/CompoundOperatorTest.php b/tests/Builder/Search/CompoundOperatorTest.php new file mode 100644 index 000000000..8d5d69aed --- /dev/null +++ b/tests/Builder/Search/CompoundOperatorTest.php @@ -0,0 +1,157 @@ +assertSamePipeline(Pipelines::CompoundFilter, $pipeline); + } + + public function testMinimumShouldMatch(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::compound( + must: [ + Search::text( + path: 'description', + query: 'varieties', + ), + ], + should: [ + Search::text( + path: 'description', + query: 'Fuji', + ), + Search::text( + path: 'description', + query: 'Golden Delicious', + ), + ], + minimumShouldMatch: 1, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::CompoundMinimumShouldMatch, $pipeline); + } + + public function testMustAndMustNot(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::compound( + must: [ + Search::text( + path: 'description', + query: 'varieties', + ), + ], + mustNot: [ + Search::text( + path: 'description', + query: 'apples', + ), + ], + ), + ), + ); + + $this->assertSamePipeline(Pipelines::CompoundMustAndMustNot, $pipeline); + } + + public function testMustAndShould(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::compound( + must: [ + Search::text( + path: 'description', + query: 'varieties', + ), + ], + should: [ + Search::text( + path: 'description', + query: 'Fuji', + ), + ], + ), + ), + Stage::project( + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::CompoundMustAndShould, $pipeline); + } + + public function testNested(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::compound( + should: [ + Search::text( + path: 'type', + query: 'apple', + ), + Search::compound( + must: [ + Search::text( + path: 'category', + query: 'organic', + ), + Search::equals( + path: 'in_stock', + value: true, + ), + ], + ), + ], + minimumShouldMatch: 1, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::CompoundNested, $pipeline); + } +} diff --git a/tests/Builder/Search/EmbeddedDocumentOperatorTest.php b/tests/Builder/Search/EmbeddedDocumentOperatorTest.php new file mode 100644 index 000000000..b83790c83 --- /dev/null +++ b/tests/Builder/Search/EmbeddedDocumentOperatorTest.php @@ -0,0 +1,167 @@ + 1, + 'items.tags' => 1, + ], + _id: 0, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::EmbeddedDocumentBasic, $pipeline); + } + + public function testFacet(): void + { + $pipeline = new Pipeline( + Stage::searchMeta( + Search::facet( + facets: object( + purchaseMethodFacet: object( + type: 'string', + path: 'purchaseMethod', + ), + ), + operator: Search::embeddedDocument( + path: 'items', + operator: Search::compound( + must: [ + Search::text( + path: 'items.tags', + query: 'school', + ), + ], + should: [ + Search::text( + path: 'items.name', + query: 'backpack', + ), + ], + ), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::EmbeddedDocumentFacet, $pipeline); + } + + public function testQueryAndSort(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::embeddedDocument( + path: 'items', + operator: + Search::text( + path: 'items.name', + query: 'laptop', + ), + ), + sort: ['items.tags' => Sort::Asc], + ), + Stage::limit(5), + Stage::project( + ...[ + 'items.name' => 1, + 'items.tags' => 1, + ], + _id: 0, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::EmbeddedDocumentQueryAndSort, $pipeline); + } + + public function testQueryForMatchingEmbeddedDocumentsOnly(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::embeddedDocument( + path: 'items', + operator: + Search::compound( + must: [ + Search::range( + path: 'items.quantity', + gt: 2, + ), + Search::exists( + path: 'items.price', + ), + Search::text( + path: 'items.tags', + query: 'school', + ), + ], + ), + ), + ), + Stage::limit(2), + Stage::project( + _id: 0, + storeLocation: 1, + items: Expression::filter( + input: Expression::arrayFieldPath('items'), + cond: Expression::and( + Expression::ifNull('$$this.price', 'false'), + Expression::gt(Expression::variable('this.quantity'), 2), + Expression::in('office', Expression::variable('this.tags')), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::EmbeddedDocumentQueryForMatchingEmbeddedDocumentsOnly, $pipeline); + } +} diff --git a/tests/Builder/Search/EqualsOperatorTest.php b/tests/Builder/Search/EqualsOperatorTest.php new file mode 100644 index 000000000..6cd8ae9e1 --- /dev/null +++ b/tests/Builder/Search/EqualsOperatorTest.php @@ -0,0 +1,125 @@ + 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::EqualsBoolean, $pipeline); + } + + public function testDate(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::equals( + path: 'account_created', + value: new UTCDateTime(new DateTimeImmutable('2022-05-04T05:01:08')), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::EqualsDate, $pipeline); + } + + public function testNull(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::equals( + path: 'job_title', + value: null, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::EqualsNull, $pipeline); + } + + public function testNumber(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::equals( + path: 'employee_number', + value: 259, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::EqualsNumber, $pipeline); + } + + public function testObjectId(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::equals( + path: 'teammates', + value: new ObjectId('5a9427648b0beebeb69589a1'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::EqualsObjectId, $pipeline); + } + + public function testString(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::equals( + path: 'name', + value: 'jim hall', + ), + ), + ); + + $this->assertSamePipeline(Pipelines::EqualsString, $pipeline); + } + + public function testUUID(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::equals( + path: 'uuid', + value: new Binary(hex2bin('fac32260b5114c698485a2be5b7dda9e'), Binary::TYPE_UUID), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::EqualsUUID, $pipeline); + } +} diff --git a/tests/Builder/Search/ExistsOperatorTest.php b/tests/Builder/Search/ExistsOperatorTest.php new file mode 100644 index 000000000..5666a1099 --- /dev/null +++ b/tests/Builder/Search/ExistsOperatorTest.php @@ -0,0 +1,67 @@ +assertSamePipeline(Pipelines::ExistsBasic, $pipeline); + } + + public function testCompound(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::compound( + must: [ + Search::exists( + path: 'type', + ), + Search::text( + path: 'type', + query: 'apple', + ), + ], + should: Search::text( + path: 'description', + query: 'fuji', + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ExistsCompound, $pipeline); + } + + public function testEmbedded(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::exists( + path: 'quantities.lemons', + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ExistsEmbedded, $pipeline); + } +} diff --git a/tests/Builder/Search/FacetOperatorTest.php b/tests/Builder/Search/FacetOperatorTest.php new file mode 100644 index 000000000..3be124bec --- /dev/null +++ b/tests/Builder/Search/FacetOperatorTest.php @@ -0,0 +1,61 @@ +assertSamePipeline(Pipelines::FacetFacet, $pipeline); + } +} diff --git a/tests/Builder/Search/GeoShapeOperatorTest.php b/tests/Builder/Search/GeoShapeOperatorTest.php new file mode 100644 index 000000000..b5e748660 --- /dev/null +++ b/tests/Builder/Search/GeoShapeOperatorTest.php @@ -0,0 +1,204 @@ + 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::GeoShapeDisjoint, $pipeline); + } + + public function testIntersect(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::geoShape( + relation: 'intersects', + geometry: object( + type: 'MultiPolygon', + coordinates: [ + [ + [ + [ + 2.16942, + 41.40082, + ], + [ + 2.17963, + 41.40087, + ], + [ + 2.18146, + 41.39716, + ], + [ + 2.15533, + 41.40686, + ], + [ + 2.14596, + 41.38475, + ], + [ + 2.17519, + 41.41035, + ], + [ + 2.16942, + 41.40082, + ], + ], + ], + [ + [ + [ + 2.16365, + 41.39416, + ], + [ + 2.16963, + 41.39726, + ], + [ + 2.15395, + 41.38005, + ], + [ + 2.17935, + 41.43038, + ], + [ + 2.16365, + 41.39416, + ], + ], + ], + ], + ), + path: 'address.location', + ), + ), + Stage::limit(3), + Stage::project( + _id: 0, + name: 1, + address: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::GeoShapeIntersect, $pipeline); + } + + public function testWithin(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::geoShape( + relation: 'within', + geometry: object( + type: 'Polygon', + coordinates: [ + [ + [ + -74.3994140625, + 40.5305017757, + ], + [ + -74.7290039063, + 40.5805846641, + ], + [ + -74.7729492188, + 40.9467136651, + ], + [ + -74.0698242188, + 41.1290213475, + ], + [ + -73.65234375, + 40.9964840144, + ], + [ + -72.6416015625, + 40.9467136651, + ], + [ + -72.3559570313, + 40.7971774152, + ], + [ + -74.3994140625, + 40.5305017757, + ], + ], + ], + ), + path: 'address.location', + ), + ), + Stage::limit(3), + Stage::project( + _id: 0, + name: 1, + address: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::GeoShapeWithin, $pipeline); + } +} diff --git a/tests/Builder/Search/GeoWithinOperatorTest.php b/tests/Builder/Search/GeoWithinOperatorTest.php new file mode 100644 index 000000000..3a6a6b0af --- /dev/null +++ b/tests/Builder/Search/GeoWithinOperatorTest.php @@ -0,0 +1,124 @@ +assertSamePipeline(Pipelines::GeoWithinBox, $pipeline); + } + + public function testCircle(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::geoWithin( + path: 'address.location', + circle: object( + center: object( + type: 'Point', + coordinates: [ + -73.54, + 45.54, + ], + ), + radius: 1600, + ), + ), + ), + Stage::limit(3), + Stage::project( + _id: 0, + name: 1, + address: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::GeoWithinCircle, $pipeline); + } + + public function testGeometry(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::geoWithin( + path: 'address.location', + geometry: object( + type: 'Polygon', + coordinates: [ + [ + [ + -161.323242, + 22.512557, + ], + [ + -152.446289, + 22.065278, + ], + [ + -156.09375, + 17.811456, + ], + [ + -161.323242, + 22.512557, + ], + ], + ], + ), + ), + ), + Stage::limit(3), + Stage::project( + _id: 0, + name: 1, + address: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::GeoWithinGeometry, $pipeline); + } +} diff --git a/tests/Builder/Search/InOperatorTest.php b/tests/Builder/Search/InOperatorTest.php new file mode 100644 index 000000000..e6d1af57c --- /dev/null +++ b/tests/Builder/Search/InOperatorTest.php @@ -0,0 +1,101 @@ +assertSamePipeline(Pipelines::InArrayValueFieldMatch, $pipeline); + } + + public function testCompoundQueryMatch(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::compound( + must: [ + Search::in( + path: 'name', + value: [ + 'james sanchez', + 'jennifer lawrence', + ], + ), + ], + should: [ + Search::in( + path: '_id', + value: [ + new ObjectId('5ca4bbcea2dd94ee58162a72'), + new ObjectId('5ca4bbcea2dd94ee58162a91'), + ], + ), + ], + ), + ), + Stage::limit(5), + Stage::project( + _id: 1, + name: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::InCompoundQueryMatch, $pipeline); + } + + public function testSingleValueFieldMatch(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::in( + path: 'birthdate', + value: [ + new UTCDateTime(new DateTimeImmutable('1977-03-02T02:20:31')), + new UTCDateTime(new DateTimeImmutable('1977-03-01T00:00:00')), + new UTCDateTime(new DateTimeImmutable('1977-05-06T21:57:35')), + ], + ), + ), + Stage::project( + _id: 0, + name: 1, + birthdate: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::InSingleValueFieldMatch, $pipeline); + } +} diff --git a/tests/Builder/Search/MoreLikeThisOperatorTest.php b/tests/Builder/Search/MoreLikeThisOperatorTest.php new file mode 100644 index 000000000..a83c03559 --- /dev/null +++ b/tests/Builder/Search/MoreLikeThisOperatorTest.php @@ -0,0 +1,115 @@ +assertSamePipeline(Pipelines::MoreLikeThisInputDocumentExcludedInResults, $pipeline); + } + + public function testMultipleAnalyzers(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::compound( + mustNot: [ + Search::equals( + path: '_id', + value: new ObjectId('573a1394f29313caabcde9ef'), + ), + ], + should: [ + Search::moreLikeThis( + like: object( + _id: new ObjectId('573a1396f29313caabce4a9a'), + genres: [ + 'Crime', + 'Drama', + ], + title: 'The Godfather', + ), + ), + ], + ), + ), + Stage::limit(10), + Stage::project( + title: 1, + genres: 1, + _id: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::MoreLikeThisMultipleAnalyzers, $pipeline); + } + + public function testSingleDocumentWithMultipleFields(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::moreLikeThis( + like: object( + title: 'The Godfather', + genres: 'action', + ), + ), + ), + Stage::limit(5), + Stage::project( + _id: 0, + title: 1, + released: 1, + genres: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::MoreLikeThisSingleDocumentWithMultipleFields, $pipeline); + } +} diff --git a/tests/Builder/Search/NearOperatorTest.php b/tests/Builder/Search/NearOperatorTest.php new file mode 100644 index 000000000..45a48e0d5 --- /dev/null +++ b/tests/Builder/Search/NearOperatorTest.php @@ -0,0 +1,128 @@ + 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::NearCompound, $pipeline); + } + + public function testDate(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::near( + path: 'released', + origin: new UTCDateTime(new DateTimeImmutable('1915-09-13T00:00:00.000+00:00')), + pivot: 7776000000, + ), + index: 'releaseddate', + ), + Stage::limit(3), + Stage::project( + _id: 0, + title: 1, + released: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::NearDate, $pipeline); + } + + public function testGeoJSONPoint(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::near( + path: 'address.location', + origin: object( + type: 'Point', + coordinates: [ + -8.61308, + 41.1413, + ], + ), + pivot: 1000, + ), + ), + Stage::limit(3), + Stage::project( + _id: 0, + name: 1, + address: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::NearGeoJSONPoint, $pipeline); + } + + public function testNumber(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::near( + path: 'runtime', + origin: 279, + pivot: 2, + ), + index: 'runtimes', + ), + Stage::limit(7), + Stage::project( + _id: 0, + title: 1, + runtime: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::NearNumber, $pipeline); + } +} diff --git a/tests/Builder/Search/PhraseOperatorTest.php b/tests/Builder/Search/PhraseOperatorTest.php new file mode 100644 index 000000000..a045e9c12 --- /dev/null +++ b/tests/Builder/Search/PhraseOperatorTest.php @@ -0,0 +1,102 @@ + 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::PhraseMultiplePhrase, $pipeline); + } + + public function testPhraseSlop(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::phrase( + path: 'title', + query: 'men women', + slop: 5, + ), + ), + Stage::project( + _id: 0, + title: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::PhrasePhraseSlop, $pipeline); + } + + public function testPhraseSynonyms(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::phrase( + path: 'plot', + query: 'automobile race', + slop: 5, + synonyms: 'my_synonyms', + ), + ), + Stage::limit(5), + Stage::project( + _id: 0, + plot: 1, + title: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::PhrasePhraseSynonyms, $pipeline); + } + + public function testSinglePhrase(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::phrase( + path: 'title', + query: 'new york', + ), + ), + Stage::limit(10), + Stage::project( + _id: 0, + title: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::PhraseSinglePhrase, $pipeline); + } +} diff --git a/tests/Builder/Search/Pipelines.php b/tests/Builder/Search/Pipelines.php new file mode 100644 index 000000000..fa94f8c9a --- /dev/null +++ b/tests/Builder/Search/Pipelines.php @@ -0,0 +1,2814 @@ +assertSamePipeline(Pipelines::QueryStringBooleanOperatorQueries, $pipeline); + } +} diff --git a/tests/Builder/Search/RangeOperatorTest.php b/tests/Builder/Search/RangeOperatorTest.php new file mode 100644 index 000000000..9606014ed --- /dev/null +++ b/tests/Builder/Search/RangeOperatorTest.php @@ -0,0 +1,122 @@ +assertSamePipeline(Pipelines::RangeDate, $pipeline); + } + + public function testNumberGteLte(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::range( + path: 'runtime', + gte: 2, + lte: 3, + ), + ), + Stage::limit(5), + Stage::project( + _id: 0, + title: 1, + runtime: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::RangeNumberGteLte, $pipeline); + } + + public function testNumberLte(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::range( + path: 'runtime', + lte: 2, + ), + ), + Stage::limit(5), + Stage::project( + _id: 0, + title: 1, + runtime: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::RangeNumberLte, $pipeline); + } + + public function testObjectId(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::range( + path: '_id', + gte: new ObjectId('573a1396f29313caabce4a9a'), + lte: new ObjectId('573a1396f29313caabce4ae7'), + ), + ), + Stage::project( + _id: 1, + title: 1, + released: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::RangeObjectId, $pipeline); + } + + public function testString(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::range( + path: 'title', + gt: 'city', + lt: 'country', + ), + ), + Stage::limit(5), + Stage::project( + _id: 0, + title: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::RangeString, $pipeline); + } +} diff --git a/tests/Builder/Search/RegexOperatorTest.php b/tests/Builder/Search/RegexOperatorTest.php new file mode 100644 index 000000000..b95f518a0 --- /dev/null +++ b/tests/Builder/Search/RegexOperatorTest.php @@ -0,0 +1,34 @@ +assertSamePipeline(Pipelines::RegexRegex, $pipeline); + } +} diff --git a/tests/Builder/Search/TextOperatorTest.php b/tests/Builder/Search/TextOperatorTest.php new file mode 100644 index 000000000..12709740e --- /dev/null +++ b/tests/Builder/Search/TextOperatorTest.php @@ -0,0 +1,194 @@ + 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::TextBasic, $pipeline); + } + + public function testFuzzyDefault(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::text( + path: 'title', + query: 'naw yark', + fuzzy: object(), + ), + ), + Stage::limit(10), + Stage::project( + _id: 0, + title: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::TextFuzzyDefault, $pipeline); + } + + public function testFuzzyMaxExpansions(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::text( + path: 'title', + query: 'naw yark', + fuzzy: object( + maxEdits: 1, + maxExpansions: 100, + ), + ), + ), + Stage::limit(10), + Stage::project( + _id: 0, + title: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::TextFuzzyMaxExpansions, $pipeline); + } + + public function testFuzzyPrefixLength(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::text( + path: 'title', + query: 'naw yark', + fuzzy: object( + maxEdits: 1, + prefixLength: 2, + ), + ), + ), + Stage::limit(8), + Stage::project( + _id: 1, + title: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::TextFuzzyPrefixLength, $pipeline); + } + + public function testMatchAllUsingSynonyms(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::text( + path: 'plot', + query: 'automobile race', + matchCriteria: 'all', + synonyms: 'my_synonyms', + ), + ), + Stage::limit(20), + Stage::project( + _id: 0, + plot: 1, + title: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::TextMatchAllUsingSynonyms, $pipeline); + } + + public function testMatchAnyUsingEquivalentMapping(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::text( + path: 'plot', + query: 'attire', + synonyms: 'my_synonyms', + matchCriteria: 'any', + ), + ), + Stage::limit(5), + Stage::project( + _id: 0, + plot: 1, + title: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::TextMatchAnyUsingEquivalentMapping, $pipeline); + } + + public function testMatchAnyUsingExplicitMapping(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::text( + path: 'plot', + query: 'boat race', + synonyms: 'my_synonyms', + matchCriteria: 'any', + ), + ), + Stage::limit(10), + Stage::project( + _id: 0, + plot: 1, + title: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::TextMatchAnyUsingExplicitMapping, $pipeline); + } + + public function testWildcardPath(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::text( + path: ['wildcard' => '*'], + query: 'surfer', + ), + ), + Stage::project( + _id: 0, + title: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::TextWildcardPath, $pipeline); + } +} diff --git a/tests/Builder/Search/WildcardOperatorTest.php b/tests/Builder/Search/WildcardOperatorTest.php new file mode 100644 index 000000000..18103b75d --- /dev/null +++ b/tests/Builder/Search/WildcardOperatorTest.php @@ -0,0 +1,54 @@ +assertSamePipeline(Pipelines::WildcardEscapeCharacterExample, $pipeline); + } + + public function testWildcardPath(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::wildcard( + query: 'Wom?n *', + path: ['wildcard' => '*'], + ), + ), + Stage::limit(5), + Stage::project( + _id: 0, + title: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::WildcardWildcardPath, $pipeline); + } +} diff --git a/tests/Builder/Stage/AddFieldsStageTest.php b/tests/Builder/Stage/AddFieldsStageTest.php new file mode 100644 index 000000000..970471ba2 --- /dev/null +++ b/tests/Builder/Stage/AddFieldsStageTest.php @@ -0,0 +1,74 @@ +assertSamePipeline(Pipelines::AddFieldsAddElementToAnArray, $pipeline); + } + + public function testAddingFieldsToAnEmbeddedDocument(): void + { + $pipeline = new Pipeline( + Stage::addFields( + ...['specs.fuel_type' => 'unleaded'], + ), + ); + + $this->assertSamePipeline(Pipelines::AddFieldsAddingFieldsToAnEmbeddedDocument, $pipeline); + } + + public function testOverwritingAnExistingField(): void + { + $pipeline = new Pipeline( + Stage::addFields( + cats: 20, + ), + ); + + $this->assertSamePipeline(Pipelines::AddFieldsOverwritingAnExistingField, $pipeline); + } + + public function testUsingTwoAddFieldsStages(): void + { + $pipeline = new Pipeline( + Stage::addFields( + totalHomework: Expression::sum(Expression::fieldPath('homework')), + totalQuiz: Expression::sum(Expression::fieldPath('quiz')), + ), + Stage::addFields( + totalScore: Expression::add( + Expression::fieldPath('totalHomework'), + Expression::fieldPath('totalQuiz'), + Expression::fieldPath('extraCredit'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::AddFieldsUsingTwoAddFieldsStages, $pipeline); + } +} diff --git a/tests/Builder/Stage/BucketAutoStageTest.php b/tests/Builder/Stage/BucketAutoStageTest.php new file mode 100644 index 000000000..ecae48f20 --- /dev/null +++ b/tests/Builder/Stage/BucketAutoStageTest.php @@ -0,0 +1,28 @@ +assertSamePipeline(Pipelines::BucketAutoSingleFacetAggregation, $pipeline); + } +} diff --git a/tests/Builder/Stage/BucketStageTest.php b/tests/Builder/Stage/BucketStageTest.php new file mode 100644 index 000000000..95119a5e3 --- /dev/null +++ b/tests/Builder/Stage/BucketStageTest.php @@ -0,0 +1,94 @@ +assertSamePipeline(Pipelines::BucketBucketByYearAndFilterByBucketResults, $pipeline); + } + + public function testUseBucketWithFacetToBucketByMultipleFields(): void + { + $pipeline = new Pipeline( + Stage::facet( + price: new Pipeline( + Stage::bucket( + groupBy: Expression::numberFieldPath('price'), + boundaries: [0, 200, 400], + default: 'Other', + output: object( + count: Accumulator::sum(1), + artwork: Accumulator::push( + object( + title: Expression::stringFieldPath('title'), + price: Expression::stringFieldPath('price'), + ), + ), + averagePrice: Accumulator::avg( + Expression::numberFieldPath('price'), + ), + ), + ), + ), + year: new Pipeline( + Stage::bucket( + groupBy: Expression::stringFieldPath('year'), + boundaries: [1890, 1910, 1920, 1940], + default: 'Unknown', + output: object( + count: Accumulator::sum(1), + artwork: Accumulator::push( + object( + title: Expression::stringFieldPath('title'), + year: Expression::stringFieldPath('year'), + ), + ), + ), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::BucketUseBucketWithFacetToBucketByMultipleFields, $pipeline); + } +} diff --git a/tests/Builder/Stage/ChangeStreamSplitLargeEventStageTest.php b/tests/Builder/Stage/ChangeStreamSplitLargeEventStageTest.php new file mode 100644 index 000000000..c7652e2de --- /dev/null +++ b/tests/Builder/Stage/ChangeStreamSplitLargeEventStageTest.php @@ -0,0 +1,24 @@ +assertSamePipeline(Pipelines::ChangeStreamSplitLargeEventExample, $pipeline); + } +} diff --git a/tests/Builder/Stage/ChangeStreamStageTest.php b/tests/Builder/Stage/ChangeStreamStageTest.php new file mode 100644 index 000000000..03a5bf523 --- /dev/null +++ b/tests/Builder/Stage/ChangeStreamStageTest.php @@ -0,0 +1,24 @@ +assertSamePipeline(Pipelines::ChangeStreamExample, $pipeline); + } +} diff --git a/tests/Builder/Stage/CollStatsStageTest.php b/tests/Builder/Stage/CollStatsStageTest.php new file mode 100644 index 000000000..5b9277d27 --- /dev/null +++ b/tests/Builder/Stage/CollStatsStageTest.php @@ -0,0 +1,63 @@ +assertSamePipeline(Pipelines::CollStatsCountField, $pipeline); + } + + public function testLatencyStatsDocument(): void + { + $pipeline = new Pipeline( + Stage::collStats( + latencyStats: object( + histograms: true, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::CollStatsLatencyStatsDocument, $pipeline); + } + + public function testQueryExecStatsDocument(): void + { + $pipeline = new Pipeline( + Stage::collStats( + queryExecStats: object(), + ), + ); + + $this->assertSamePipeline(Pipelines::CollStatsQueryExecStatsDocument, $pipeline); + } + + public function testStorageStatsDocument(): void + { + $pipeline = new Pipeline( + Stage::collStats( + storageStats: object(), + ), + ); + + $this->assertSamePipeline(Pipelines::CollStatsStorageStatsDocument, $pipeline); + } +} diff --git a/tests/Builder/Stage/CountStageTest.php b/tests/Builder/Stage/CountStageTest.php new file mode 100644 index 000000000..68c45c52e --- /dev/null +++ b/tests/Builder/Stage/CountStageTest.php @@ -0,0 +1,28 @@ +assertSamePipeline(Pipelines::CountExample, $pipeline); + } +} diff --git a/tests/Builder/Stage/CurrentOpStageTest.php b/tests/Builder/Stage/CurrentOpStageTest.php new file mode 100644 index 000000000..6e50cb0b9 --- /dev/null +++ b/tests/Builder/Stage/CurrentOpStageTest.php @@ -0,0 +1,47 @@ +assertSamePipeline(Pipelines::CurrentOpInactiveSessions, $pipeline); + } + + public function testSampledQueries(): void + { + $pipeline = new Pipeline( + Stage::currentOp( + allUsers: true, + localOps: true, + ), + Stage::match( + desc: 'query analyzer', + ), + ); + + $this->assertSamePipeline(Pipelines::CurrentOpSampledQueries, $pipeline); + } +} diff --git a/tests/Builder/Stage/DensifyStageTest.php b/tests/Builder/Stage/DensifyStageTest.php new file mode 100644 index 000000000..142233fcf --- /dev/null +++ b/tests/Builder/Stage/DensifyStageTest.php @@ -0,0 +1,55 @@ +assertSamePipeline(Pipelines::DensifyDensifictionWithPartitions, $pipeline); + } + + public function testDensifyTimeSeriesData(): void + { + $pipeline = new Pipeline( + Stage::densify( + field: 'timestamp', + range: object( + step: 1, + unit: TimeUnit::Hour, + bounds: [ + new UTCDateTime(new DateTimeImmutable('2021-05-18T00:00:00.000Z')), + new UTCDateTime(new DateTimeImmutable('2021-05-18T08:00:00.000Z')), + ], + ), + ), + ); + + $this->assertSamePipeline(Pipelines::DensifyDensifyTimeSeriesData, $pipeline); + } +} diff --git a/tests/Builder/Stage/DocumentsStageTest.php b/tests/Builder/Stage/DocumentsStageTest.php new file mode 100644 index 000000000..e0b2e4ce0 --- /dev/null +++ b/tests/Builder/Stage/DocumentsStageTest.php @@ -0,0 +1,56 @@ +assertSamePipeline(Pipelines::DocumentsTestAPipelineStage, $pipeline); + } + + public function testUseADocumentsStageInALookupStage(): void + { + $pipeline = new Pipeline( + Stage::match(), + Stage::lookup( + localField: 'zip', + foreignField: 'zip_id', + as: 'city_state', + pipeline: new Pipeline( + Stage::documents([ + Document::fromPHP(object(zip_id: 94301, name: 'Palo Alto, CA')), + Document::fromPHP(object(zip_id: 10019, name: 'New York, NY')), + ]), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::DocumentsUseADocumentsStageInALookupStage, $pipeline); + } +} diff --git a/tests/Builder/Stage/FacetStageTest.php b/tests/Builder/Stage/FacetStageTest.php new file mode 100644 index 000000000..121131617 --- /dev/null +++ b/tests/Builder/Stage/FacetStageTest.php @@ -0,0 +1,62 @@ + new Pipeline( + Stage::bucketAuto( + groupBy: Expression::stringFieldPath('year'), + buckets: 4, + ), + ), + ], + categorizedByTags: new Pipeline( + Stage::unwind( + Expression::arrayFieldPath('tags'), + ), + Stage::sortByCount( + Expression::arrayFieldPath('tags'), + ), + ), + categorizedByPrice: new Pipeline( + Stage::match( + price: Query::exists(), + ), + Stage::bucket( + groupBy: Expression::numberFieldPath('price'), + boundaries: [0, 150, 200, 300, 400], + default: 'Other', + output: object( + count: Accumulator::sum(1), + titles: Accumulator::push( + Expression::stringFieldPath('title'), + ), + ), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::FacetExample, $pipeline); + } +} diff --git a/tests/Builder/Stage/FillStageTest.php b/tests/Builder/Stage/FillStageTest.php new file mode 100644 index 000000000..e464cfaef --- /dev/null +++ b/tests/Builder/Stage/FillStageTest.php @@ -0,0 +1,111 @@ +assertSamePipeline(Pipelines::FillFillDataForDistinctPartitions, $pipeline); + } + + public function testFillMissingFieldValuesBasedOnTheLastObservedValue(): void + { + $pipeline = new Pipeline( + Stage::fill( + sortBy: object( + date: Sort::Asc, + ), + output: object( + score: object(method: 'locf'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::FillFillMissingFieldValuesBasedOnTheLastObservedValue, $pipeline); + } + + public function testFillMissingFieldValuesWithAConstantValue(): void + { + $pipeline = new Pipeline( + Stage::fill( + output: object( + bootsSold: object(value: 0), + sandalsSold: object(value: 0), + sneakersSold: object(value: 0), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::FillFillMissingFieldValuesWithAConstantValue, $pipeline); + } + + public function testFillMissingFieldValuesWithLinearInterpolation(): void + { + $pipeline = new Pipeline( + Stage::fill( + sortBy: object( + time: Sort::Asc, + ), + output: object( + price: object(method: 'linear'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::FillFillMissingFieldValuesWithLinearInterpolation, $pipeline); + } + + public function testIndicateIfAFieldWasPopulatedUsingFill(): void + { + $pipeline = new Pipeline( + Stage::set( + valueExisted: Expression::ifNull( + Expression::toBool( + Expression::toString( + Expression::fieldPath('score'), + ), + ), + false, + ), + ), + Stage::fill( + sortBy: object( + date: Sort::Asc, + ), + output: object( + score: object(method: 'locf'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::FillIndicateIfAFieldWasPopulatedUsingFill, $pipeline); + } +} diff --git a/tests/Builder/Stage/GeoNearStageTest.php b/tests/Builder/Stage/GeoNearStageTest.php new file mode 100644 index 000000000..93acfc277 --- /dev/null +++ b/tests/Builder/Stage/GeoNearStageTest.php @@ -0,0 +1,123 @@ +assertSamePipeline(Pipelines::GeoNearMaximumDistance, $pipeline); + } + + public function testMinimumDistance(): void + { + $pipeline = new Pipeline( + Stage::geoNear( + near: object( + type: 'Point', + coordinates: [-73.99279, 40.719296], + ), + distanceField: 'dist.calculated', + minDistance: 2, + query: Query::query( + category: 'Parks', + ), + includeLocs: 'dist.location', + spherical: true, + ), + ); + + $this->assertSamePipeline(Pipelines::GeoNearMinimumDistance, $pipeline); + } + + public function testSpecifyWhichGeospatialIndexToUse(): void + { + $pipeline = new Pipeline( + Stage::geoNear( + near: object( + type: 'Point', + coordinates: [-73.98142, 40.71782], + ), + key: 'location', + distanceField: 'dist.calculated', + query: Query::query( + category: 'Parks', + ), + ), + Stage::limit(5), + ); + + $this->assertSamePipeline(Pipelines::GeoNearSpecifyWhichGeospatialIndexToUse, $pipeline); + } + + public function testWithBoundLetOption(): void + { + $pipeline = new Pipeline( + Stage::lookup( + from: 'places', + let: object( + pt: Expression::stringFieldPath('location'), + ), + pipeline: new Pipeline( + Stage::geoNear( + near: Expression::variable('pt'), + distanceField: 'distance', + ), + ), + as: 'joinedField', + ), + Stage::match( + name: 'Sara D. Roosevelt Park', + ), + ); + + $this->assertSamePipeline(Pipelines::GeoNearWithBoundLetOption, $pipeline); + } + + public function testWithTheLetOption(): void + { + $pipeline = new Pipeline( + Stage::geoNear( + near: Expression::variable('pt'), + distanceField: 'distance', + maxDistance: 2, + query: Query::query( + category: 'Parks', + ), + includeLocs: 'dist.location', + spherical: true, + ), + ); + + $this->assertSamePipeline(Pipelines::GeoNearWithTheLetOption, $pipeline); + } +} diff --git a/tests/Builder/Stage/GraphLookupStageTest.php b/tests/Builder/Stage/GraphLookupStageTest.php new file mode 100644 index 000000000..fd4a97b4c --- /dev/null +++ b/tests/Builder/Stage/GraphLookupStageTest.php @@ -0,0 +1,77 @@ +assertSamePipeline(Pipelines::GraphLookupAcrossMultipleCollections, $pipeline); + } + + public function testWithAQueryFilter(): void + { + $pipeline = new Pipeline( + Stage::match( + name: 'Tanya Jordan', + ), + Stage::graphLookup( + from: 'people', + startWith: Expression::stringFieldPath('friends'), + connectFromField: 'friends', + connectToField: 'name', + as: 'golfers', + restrictSearchWithMatch: Query::query( + hobbies: 'golf', + ), + ), + Stage::project( + ...[ + 'connections who play golf' => Expression::stringFieldPath('golfers.name'), + ], + name: 1, + friends: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::GraphLookupWithAQueryFilter, $pipeline); + } + + public function testWithinASingleCollection(): void + { + $pipeline = new Pipeline( + Stage::graphLookup( + from: 'employees', + startWith: Expression::stringFieldPath('reportsTo'), + connectFromField: 'reportsTo', + connectToField: 'name', + as: 'reportingHierarchy', + ), + ); + + $this->assertSamePipeline(Pipelines::GraphLookupWithinASingleCollection, $pipeline); + } +} diff --git a/tests/Builder/Stage/GroupStageTest.php b/tests/Builder/Stage/GroupStageTest.php new file mode 100644 index 000000000..ca742312f --- /dev/null +++ b/tests/Builder/Stage/GroupStageTest.php @@ -0,0 +1,148 @@ +assertSamePipeline(Pipelines::GroupCalculateCountSumAndAverage, $pipeline); + } + + public function testCountTheNumberOfDocumentsInACollection(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: null, + count: Accumulator::count(), + ), + ); + + $this->assertSamePipeline(Pipelines::GroupCountTheNumberOfDocumentsInACollection, $pipeline); + } + + public function testGroupByItemHaving(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: Expression::fieldPath('item'), + totalSaleAmount: Accumulator::sum( + Expression::multiply( + Expression::numberFieldPath('price'), + Expression::numberFieldPath('quantity'), + ), + ), + ), + Stage::match( + totalSaleAmount: Query::gte(100), + ), + ); + + $this->assertSamePipeline(Pipelines::GroupGroupByItemHaving, $pipeline); + } + + public function testGroupByNull(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: null, + totalSaleAmount: Accumulator::sum( + Expression::multiply( + Expression::numberFieldPath('price'), + Expression::numberFieldPath('quantity'), + ), + ), + averageQuantity: Accumulator::avg( + Expression::numberFieldPath('quantity'), + ), + count: Accumulator::sum(1), + ), + ); + + $this->assertSamePipeline(Pipelines::GroupGroupByNull, $pipeline); + } + + public function testGroupDocumentsByAuthor(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: Expression::fieldPath('author'), + books: Accumulator::push( + Expression::variable('ROOT'), + ), + ), + Stage::addFields( + totalCopies: Expression::sum( + Expression::numberFieldPath('books.copies'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::GroupGroupDocumentsByAuthor, $pipeline); + } + + public function testPivotData(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: Expression::fieldPath('author'), + books: Accumulator::push( + Expression::stringFieldPath('title'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::GroupPivotData, $pipeline); + } + + public function testRetrieveDistinctValues(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: Expression::stringFieldPath('item'), + ), + ); + + $this->assertSamePipeline(Pipelines::GroupRetrieveDistinctValues, $pipeline); + } +} diff --git a/tests/Builder/Stage/IndexStatsStageTest.php b/tests/Builder/Stage/IndexStatsStageTest.php new file mode 100644 index 000000000..9b121417b --- /dev/null +++ b/tests/Builder/Stage/IndexStatsStageTest.php @@ -0,0 +1,24 @@ +assertSamePipeline(Pipelines::IndexStatsExample, $pipeline); + } +} diff --git a/tests/Builder/Stage/LimitStageTest.php b/tests/Builder/Stage/LimitStageTest.php new file mode 100644 index 000000000..04c9c6bbd --- /dev/null +++ b/tests/Builder/Stage/LimitStageTest.php @@ -0,0 +1,24 @@ +assertSamePipeline(Pipelines::LimitExample, $pipeline); + } +} diff --git a/tests/Builder/Stage/ListLocalSessionsStageTest.php b/tests/Builder/Stage/ListLocalSessionsStageTest.php new file mode 100644 index 000000000..57d1bf06d --- /dev/null +++ b/tests/Builder/Stage/ListLocalSessionsStageTest.php @@ -0,0 +1,50 @@ +assertSamePipeline(Pipelines::ListLocalSessionsListAllLocalSessions, $pipeline); + } + + public function testListAllLocalSessionsForTheCurrentUser(): void + { + $pipeline = new Pipeline( + Stage::listLocalSessions(), + ); + + $this->assertSamePipeline(Pipelines::ListLocalSessionsListAllLocalSessionsForTheCurrentUser, $pipeline); + } + + public function testListAllLocalSessionsForTheSpecifiedUsers(): void + { + $pipeline = new Pipeline( + Stage::listLocalSessions( + users: [ + object(user: 'myAppReader', db: 'test'), + ], + ), + ); + + $this->assertSamePipeline(Pipelines::ListLocalSessionsListAllLocalSessionsForTheSpecifiedUsers, $pipeline); + } +} diff --git a/tests/Builder/Stage/ListSampledQueriesStageTest.php b/tests/Builder/Stage/ListSampledQueriesStageTest.php new file mode 100644 index 000000000..3d1fccf29 --- /dev/null +++ b/tests/Builder/Stage/ListSampledQueriesStageTest.php @@ -0,0 +1,35 @@ +assertSamePipeline(Pipelines::ListSampledQueriesListSampledQueriesForASpecificCollection, $pipeline); + } + + public function testListSampledQueriesForAllCollections(): void + { + $pipeline = new Pipeline( + Stage::listSampledQueries(), + ); + + $this->assertSamePipeline(Pipelines::ListSampledQueriesListSampledQueriesForAllCollections, $pipeline); + } +} diff --git a/tests/Builder/Stage/ListSearchIndexesStageTest.php b/tests/Builder/Stage/ListSearchIndexesStageTest.php new file mode 100644 index 000000000..e5bdbfd18 --- /dev/null +++ b/tests/Builder/Stage/ListSearchIndexesStageTest.php @@ -0,0 +1,46 @@ +assertSamePipeline(Pipelines::ListSearchIndexesReturnASingleSearchIndexById, $pipeline); + } + + public function testReturnASingleSearchIndexByName(): void + { + $pipeline = new Pipeline( + Stage::listSearchIndexes( + name: 'synonym-mappings', + ), + ); + + $this->assertSamePipeline(Pipelines::ListSearchIndexesReturnASingleSearchIndexByName, $pipeline); + } + + public function testReturnAllSearchIndexes(): void + { + $pipeline = new Pipeline( + Stage::listSearchIndexes(), + ); + + $this->assertSamePipeline(Pipelines::ListSearchIndexesReturnAllSearchIndexes, $pipeline); + } +} diff --git a/tests/Builder/Stage/ListSessionsStageTest.php b/tests/Builder/Stage/ListSessionsStageTest.php new file mode 100644 index 000000000..a6d68e3b1 --- /dev/null +++ b/tests/Builder/Stage/ListSessionsStageTest.php @@ -0,0 +1,50 @@ +assertSamePipeline(Pipelines::ListSessionsListAllSessions, $pipeline); + } + + public function testListAllSessionsForTheCurrentUser(): void + { + $pipeline = new Pipeline( + Stage::listSessions(), + ); + + $this->assertSamePipeline(Pipelines::ListSessionsListAllSessionsForTheCurrentUser, $pipeline); + } + + public function testListAllSessionsForTheSpecifiedUsers(): void + { + $pipeline = new Pipeline( + Stage::listSessions( + users: [ + object(user: 'myAppReader', db: 'test'), + ], + ), + ); + + $this->assertSamePipeline(Pipelines::ListSessionsListAllSessionsForTheSpecifiedUsers, $pipeline); + } +} diff --git a/tests/Builder/Stage/LookupStageTest.php b/tests/Builder/Stage/LookupStageTest.php new file mode 100644 index 000000000..3b541ebb4 --- /dev/null +++ b/tests/Builder/Stage/LookupStageTest.php @@ -0,0 +1,161 @@ +assertSamePipeline(Pipelines::LookupPerformAConciseCorrelatedSubqueryWithLookup, $pipeline); + } + + public function testPerformASingleEqualityJoinWithLookup(): void + { + $pipeline = new Pipeline( + Stage::lookup( + from: 'inventory', + localField: 'item', + foreignField: 'sku', + as: 'inventory_docs', + ), + ); + + $this->assertSamePipeline(Pipelines::LookupPerformASingleEqualityJoinWithLookup, $pipeline); + } + + public function testPerformAnUncorrelatedSubqueryWithLookup(): void + { + $pipeline = new Pipeline( + Stage::lookup( + from: 'holidays', + pipeline: new Pipeline( + Stage::match( + year: 2018, + ), + Stage::project( + _id: 0, + date: object( + name: Expression::stringFieldPath('name'), + date: Expression::dateFieldPath('date'), + ), + ), + Stage::replaceRoot(Expression::objectFieldPath('date')), + ), + as: 'holidays', + ), + ); + + $this->assertSamePipeline(Pipelines::LookupPerformAnUncorrelatedSubqueryWithLookup, $pipeline); + } + + public function testPerformMultipleJoinsAndACorrelatedSubqueryWithLookup(): void + { + $pipeline = new Pipeline( + Stage::lookup( + from: 'warehouses', + let: object( + order_item: Expression::fieldPath('item'), + order_qty: Expression::intFieldPath('ordered'), + ), + pipeline: new Pipeline( + Stage::match( + Query::expr( + Expression::and( + Expression::eq( + Expression::stringFieldPath('stock_item'), + Expression::variable('order_item'), + ), + Expression::gte( + Expression::intFieldPath('instock'), + Expression::variable('order_qty'), + ), + ), + ), + ), + Stage::project( + stock_item: 0, + _id: 0, + ), + ), + as: 'stockdata', + ), + ); + + $this->assertSamePipeline(Pipelines::LookupPerformMultipleJoinsAndACorrelatedSubqueryWithLookup, $pipeline); + } + + public function testUseLookupWithAnArray(): void + { + $pipeline = new Pipeline( + Stage::lookup( + from: 'members', + localField: 'enrollmentlist', + foreignField: 'name', + as: 'enrollee_info', + ), + ); + + $this->assertSamePipeline(Pipelines::LookupUseLookupWithAnArray, $pipeline); + } + + public function testUseLookupWithMergeObjects(): void + { + $pipeline = new Pipeline( + Stage::lookup( + from: 'items', + localField: 'item', + foreignField: 'item', + as: 'fromItems', + ), + Stage::replaceRoot( + Expression::mergeObjects( + Expression::arrayElemAt( + Expression::arrayFieldPath('fromItems'), + 0, + ), + Expression::variable('ROOT'), + ), + ), + Stage::project( + fromItems: 0, + ), + ); + + $this->assertSamePipeline(Pipelines::LookupUseLookupWithMergeObjects, $pipeline); + } +} diff --git a/tests/Builder/Stage/MatchStageTest.php b/tests/Builder/Stage/MatchStageTest.php new file mode 100644 index 000000000..31c2d9554 --- /dev/null +++ b/tests/Builder/Stage/MatchStageTest.php @@ -0,0 +1,53 @@ +assertSamePipeline(Pipelines::MatchEqualityMatch, $pipeline); + } + + public function testPerformACount(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::or( + Query::query( + score: [ + Query::gt(70), + Query::lt(90), + ], + ), + Query::query( + views: Query::gte(1000), + ), + ), + ), + Stage::group( + _id: null, + count: Accumulator::sum(1), + ), + ); + + $this->assertSamePipeline(Pipelines::MatchPerformACount, $pipeline); + } +} diff --git a/tests/Builder/Stage/MergeStageTest.php b/tests/Builder/Stage/MergeStageTest.php new file mode 100644 index 000000000..7c145fc29 --- /dev/null +++ b/tests/Builder/Stage/MergeStageTest.php @@ -0,0 +1,188 @@ +assertSamePipeline(Pipelines::MergeMergeResultsFromMultipleCollections, $pipeline); + } + + public function testOnDemandMaterializedViewInitialCreation(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: object( + fiscal_year: Expression::stringFieldPath('fiscal_year'), + dept: Expression::stringFieldPath('dept'), + ), + salaries: Accumulator::sum( + Expression::numberFieldPath('salary'), + ), + ), + Stage::merge( + into: object( + db: 'reporting', + coll: 'budgets', + ), + on: '_id', + whenMatched: 'replace', + whenNotMatched: 'insert', + ), + ); + + $this->assertSamePipeline(Pipelines::MergeOnDemandMaterializedViewInitialCreation, $pipeline); + } + + public function testOnDemandMaterializedViewUpdateReplaceData(): void + { + $pipeline = new Pipeline( + Stage::match( + fiscal_year: Query::gte(2019), + ), + Stage::group( + _id: object( + fiscal_year: Expression::stringFieldPath('fiscal_year'), + dept: Expression::stringFieldPath('dept'), + ), + salaries: Accumulator::sum( + Expression::numberFieldPath('salary'), + ), + ), + Stage::merge( + into: object( + db: 'reporting', + coll: 'budgets', + ), + on: '_id', + whenMatched: 'replace', + whenNotMatched: 'insert', + ), + ); + + $this->assertSamePipeline(Pipelines::MergeOnDemandMaterializedViewUpdateReplaceData, $pipeline); + } + + public function testOnlyInsertNewData(): void + { + $pipeline = new Pipeline( + Stage::match( + fiscal_year: 2019, + ), + Stage::group( + _id: object( + fiscal_year: Expression::stringFieldPath('fiscal_year'), + dept: Expression::stringFieldPath('dept'), + ), + employees: Accumulator::push( + Expression::numberFieldPath('employee'), + ), + ), + Stage::project( + _id: 0, + dept: Expression::fieldPath('_id.dept'), + fiscal_year: Expression::fieldPath('_id.fiscal_year'), + employees: 1, + ), + Stage::merge( + into: object( + db: 'reporting', + coll: 'orgArchive', + ), + on: ['dept', 'fiscal_year'], + whenMatched: 'fail', + ), + ); + + $this->assertSamePipeline(Pipelines::MergeOnlyInsertNewData, $pipeline); + } + + public function testUseThePipelineToCustomizeTheMerge(): void + { + $pipeline = new Pipeline( + Stage::match( + date: [ + Query::gte(new UTCDateTime(1557187200000)), + Query::lt(new UTCDateTime(1557273600000)), + ], + ), + Stage::project( + _id: Expression::dateToString( + format: '%Y-%m', + date: Expression::dateFieldPath('date'), + ), + thumbsup: 1, + thumbsdown: 1, + ), + Stage::merge( + into: 'monthlytotals', + on: '_id', + whenMatched: new Pipeline( + Stage::addFields( + thumbsup: Expression::add( + Expression::numberFieldPath('thumbsup'), + Expression::variable('new.thumbsup'), + ), + thumbsdown: Expression::add( + Expression::numberFieldPath('thumbsdown'), + Expression::variable('new.thumbsdown'), + ), + ), + ), + whenNotMatched: 'insert', + ), + ); + + $this->assertSamePipeline(Pipelines::MergeUseThePipelineToCustomizeTheMerge, $pipeline); + } + + public function testUseVariablesToCustomizeTheMerge(): void + { + $pipeline = new Pipeline( + Stage::merge( + into: 'cakeSales', + let: object( + year: '2020', + ), + whenMatched: new Pipeline( + Stage::addFields( + salesYear: Expression::variable('year'), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::MergeUseVariablesToCustomizeTheMerge, $pipeline); + } +} diff --git a/tests/Builder/Stage/OutStageTest.php b/tests/Builder/Stage/OutStageTest.php new file mode 100644 index 000000000..a8ec9fb77 --- /dev/null +++ b/tests/Builder/Stage/OutStageTest.php @@ -0,0 +1,54 @@ +assertSamePipeline(Pipelines::OutOutputToADifferentDatabase, $pipeline); + } + + public function testOutputToSameDatabase(): void + { + $pipeline = new Pipeline( + Stage::group( + _id: Expression::stringFieldPath('author'), + books: Accumulator::push( + Expression::stringFieldPath('title'), + ), + ), + Stage::out('authors'), + ); + + $this->assertSamePipeline(Pipelines::OutOutputToSameDatabase, $pipeline); + } +} diff --git a/tests/Builder/Stage/Pipelines.php b/tests/Builder/Stage/Pipelines.php new file mode 100644 index 000000000..81f5b8fe3 --- /dev/null +++ b/tests/Builder/Stage/Pipelines.php @@ -0,0 +1,4033 @@ +assertSamePipeline(Pipelines::PlanCacheStatsFindCacheEntryDetailsForAQueryHash, $pipeline); + } + + public function testReturnInformationForAllEntriesInTheQueryCache(): void + { + $pipeline = new Pipeline( + Stage::planCacheStats(), + ); + + $this->assertSamePipeline(Pipelines::PlanCacheStatsReturnInformationForAllEntriesInTheQueryCache, $pipeline); + } +} diff --git a/tests/Builder/Stage/ProjectStageTest.php b/tests/Builder/Stage/ProjectStageTest.php new file mode 100644 index 000000000..9e30d731e --- /dev/null +++ b/tests/Builder/Stage/ProjectStageTest.php @@ -0,0 +1,164 @@ + 1, + 'author.last' => 1, + 'author.middle' => Expression::cond( + if: Expression::eq( + '', + Expression::stringFieldPath('author.middle'), + ), + then: Expression::variable('REMOVE'), + else: Expression::stringFieldPath('author.middle'), + ), + ], + title: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::ProjectConditionallyExcludeFields, $pipeline); + } + + public function testExcludeFieldsFromEmbeddedDocuments(): void + { + $pipeline = new Pipeline( + // Both stages are equivalents + Stage::project( + ...['author.first' => 0], + ...['lastModified' => 0], + ), + Stage::project( + author: object(first: 0), + lastModified: 0, + ), + ); + + $this->assertSamePipeline(Pipelines::ProjectExcludeFieldsFromEmbeddedDocuments, $pipeline); + } + + public function testExcludeFieldsFromOutputDocuments(): void + { + $pipeline = new Pipeline( + Stage::project( + lastModified: 0, + ), + ); + + $this->assertSamePipeline(Pipelines::ProjectExcludeFieldsFromOutputDocuments, $pipeline); + } + + public function testIncludeComputedFields(): void + { + $pipeline = new Pipeline( + Stage::project( + title: 1, + isbn: object( + prefix: Expression::substr( + Expression::stringFieldPath('isbn'), + 0, + 3, + ), + group: Expression::substr( + Expression::stringFieldPath('isbn'), + 3, + 2, + ), + publisher: Expression::substr( + Expression::stringFieldPath('isbn'), + 5, + 4, + ), + title: Expression::substr( + Expression::stringFieldPath('isbn'), + 9, + 3, + ), + checkDigit: Expression::substr( + Expression::stringFieldPath('isbn'), + 12, + 1, + ), + ), + lastName: Expression::stringFieldPath('author.last'), + copiesSold: Expression::intFieldPath('copies'), + ), + ); + + $this->assertSamePipeline(Pipelines::ProjectIncludeComputedFields, $pipeline); + } + + public function testIncludeSpecificFieldsFromEmbeddedDocuments(): void + { + $pipeline = new Pipeline( + Stage::project( + ...['stop.title' => 1], + ), + Stage::project( + stop: object(title: 1), + ), + ); + + $this->assertSamePipeline(Pipelines::ProjectIncludeSpecificFieldsFromEmbeddedDocuments, $pipeline); + } + + public function testIncludeSpecificFieldsInOutputDocuments(): void + { + $pipeline = new Pipeline( + Stage::project( + title: 1, + author: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::ProjectIncludeSpecificFieldsInOutputDocuments, $pipeline); + } + + public function testProjectNewArrayFields(): void + { + $pipeline = new Pipeline( + Stage::project( + myArray: [ + Expression::fieldPath('x'), + Expression::fieldPath('y'), + ], + ), + ); + + $this->assertSamePipeline(Pipelines::ProjectProjectNewArrayFields, $pipeline); + } + + public function testSuppressIdFieldInTheOutputDocuments(): void + { + $pipeline = new Pipeline( + Stage::project( + _id: 0, + title: 1, + author: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::ProjectSuppressIdFieldInTheOutputDocuments, $pipeline); + } +} diff --git a/tests/Builder/Stage/RedactStageTest.php b/tests/Builder/Stage/RedactStageTest.php new file mode 100644 index 000000000..867ca5919 --- /dev/null +++ b/tests/Builder/Stage/RedactStageTest.php @@ -0,0 +1,63 @@ +assertSamePipeline(Pipelines::RedactEvaluateAccessAtEveryDocumentLevel, $pipeline); + } + + public function testExcludeAllFieldsAtAGivenLevel(): void + { + $pipeline = new Pipeline( + Stage::match( + status: 'A', + ), + Stage::redact( + Expression::cond( + if: Expression::eq( + Expression::intFieldPath('level'), + 5, + ), + then: Expression::variable('PRUNE'), + else: Expression::variable('DESCEND'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::RedactExcludeAllFieldsAtAGivenLevel, $pipeline); + } +} diff --git a/tests/Builder/Stage/ReplaceRootStageTest.php b/tests/Builder/Stage/ReplaceRootStageTest.php new file mode 100644 index 000000000..436bde704 --- /dev/null +++ b/tests/Builder/Stage/ReplaceRootStageTest.php @@ -0,0 +1,77 @@ + Query::gte(90)], + ), + Stage::replaceRoot(Expression::objectFieldPath('grades')), + ); + + $this->assertSamePipeline(Pipelines::ReplaceRootWithADocumentNestedInAnArray, $pipeline); + } + + public function testWithANewDocumentCreatedFromROOTAndADefaultDocument(): void + { + $pipeline = new Pipeline( + Stage::replaceRoot( + Expression::mergeObjects( + object(_id: '', name: '', email: '', cell: '', home: ''), + Expression::variable('ROOT'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ReplaceRootWithANewDocumentCreatedFromROOTAndADefaultDocument, $pipeline); + } + + public function testWithANewlyCreatedDocument(): void + { + $pipeline = new Pipeline( + Stage::replaceRoot( + object( + full_name: Expression::concat( + Expression::stringFieldPath('first_name'), + ' ', + Expression::stringFieldPath('last_name'), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ReplaceRootWithANewlyCreatedDocument, $pipeline); + } + + public function testWithAnEmbeddedDocumentField(): void + { + $pipeline = new Pipeline( + Stage::replaceRoot( + Expression::mergeObjects( + object(dogs: 0, cats: 0, birds: 0, fish: 0), + Expression::objectFieldPath('pets'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ReplaceRootWithAnEmbeddedDocumentField, $pipeline); + } +} diff --git a/tests/Builder/Stage/ReplaceWithStageTest.php b/tests/Builder/Stage/ReplaceWithStageTest.php new file mode 100644 index 000000000..ad0edfbc5 --- /dev/null +++ b/tests/Builder/Stage/ReplaceWithStageTest.php @@ -0,0 +1,83 @@ + Query::gte(90)], + ), + Stage::replaceWith(Expression::objectFieldPath('grades')), + ); + + $this->assertSamePipeline(Pipelines::ReplaceWithADocumentNestedInAnArray, $pipeline); + } + + public function testANewDocumentCreatedFromROOTAndADefaultDocument(): void + { + $pipeline = new Pipeline( + Stage::replaceWith( + Expression::mergeObjects( + object(_id: '', name: '', email: '', cell: '', home: ''), + Expression::variable('ROOT'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ReplaceWithANewDocumentCreatedFromROOTAndADefaultDocument, $pipeline); + } + + public function testANewlyCreatedDocument(): void + { + $pipeline = new Pipeline( + Stage::match( + status: 'C', + ), + Stage::replaceWith( + object( + _id: Expression::objectFieldPath('_id'), + item: Expression::fieldPath('item'), + amount: Expression::multiply( + Expression::numberFieldPath('price'), + Expression::numberFieldPath('quantity'), + ), + status: 'Complete', + asofDate: Expression::variable('NOW'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ReplaceWithANewlyCreatedDocument, $pipeline); + } + + public function testAnEmbeddedDocumentField(): void + { + $pipeline = new Pipeline( + Stage::replaceWith( + Expression::mergeObjects( + object(dogs: 0, cats: 0, birds: 0, fish: 0), + Expression::objectFieldPath('pets'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::ReplaceWithAnEmbeddedDocumentField, $pipeline); + } +} diff --git a/tests/Builder/Stage/SampleStageTest.php b/tests/Builder/Stage/SampleStageTest.php new file mode 100644 index 000000000..5ac8efd4a --- /dev/null +++ b/tests/Builder/Stage/SampleStageTest.php @@ -0,0 +1,24 @@ +assertSamePipeline(Pipelines::SampleExample, $pipeline); + } +} diff --git a/tests/Builder/Stage/SearchMetaStageTest.php b/tests/Builder/Stage/SearchMetaStageTest.php new file mode 100644 index 000000000..6ded31935 --- /dev/null +++ b/tests/Builder/Stage/SearchMetaStageTest.php @@ -0,0 +1,151 @@ +assertSamePipeline(Pipelines::SearchMetaAutocompleteBucketResultsThroughFacetQueries, $pipeline); + } + + public function testDateFacet(): void + { + $pipeline = new Pipeline( + Stage::searchMeta( + Search::facet( + operator: Search::range( + path: 'released', + gte: new UTCDateTime(new DateTimeImmutable('2000-01-01')), + lte: new UTCDateTime(new DateTimeImmutable('2015-01-31')), + ), + facets: object( + yearFacet: object( + type: 'date', + path: 'released', + boundaries: [ + new UTCDateTime(new DateTimeImmutable('2000-01-01')), + new UTCDateTime(new DateTimeImmutable('2005-01-01')), + new UTCDateTime(new DateTimeImmutable('2010-01-01')), + new UTCDateTime(new DateTimeImmutable('2015-01-01')), + ], + default: 'other', + ), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SearchMetaDateFacet, $pipeline); + } + + public function testExample(): void + { + $pipeline = new Pipeline( + Stage::searchMeta( + Search::range( + path: 'year', + gte: 1998, + lt: 1999, + ), + count: object(type: 'total'), + ), + ); + + $this->assertSamePipeline(Pipelines::SearchMetaExample, $pipeline); + } + + public function testMetadataResults(): void + { + $pipeline = new Pipeline( + Stage::searchMeta( + Search::facet( + operator: Search::range( + path: 'released', + gte: new UTCDateTime(new DateTimeImmutable('2000-01-01')), + lte: new UTCDateTime(new DateTimeImmutable('2015-01-31')), + ), + facets: object( + directorsFacet: object( + type: 'string', + path: 'directors', + numBuckets: 7, + ), + yearFacet: object( + type: 'number', + path: 'year', + boundaries: [ + 2000, + 2005, + 2010, + 2015, + ], + ), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SearchMetaMetadataResults, $pipeline); + } + + public function testYearFacet(): void + { + $pipeline = new Pipeline( + Stage::searchMeta( + Search::facet( + operator: Search::range( + path: 'year', + gte: 1980, + lte: 2000, + ), + facets: object( + yearFacet: object( + type: 'number', + path: 'year', + boundaries: [ + 1980, + 1990, + 2000, + ], + default: 'other', + ), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SearchMetaYearFacet, $pipeline); + } +} diff --git a/tests/Builder/Stage/SearchStageTest.php b/tests/Builder/Stage/SearchStageTest.php new file mode 100644 index 000000000..0af9d7742 --- /dev/null +++ b/tests/Builder/Stage/SearchStageTest.php @@ -0,0 +1,225 @@ +assertSamePipeline(Pipelines::SearchCountResults, $pipeline); + } + + public function testDateSearchAndSort(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::range( + path: 'released', + gt: new UTCDateTime(new DateTime('2010-01-01')), + lt: new UTCDateTime(new DateTime('2015-01-01')), + ), + sort: object( + released: -1, + ), + ), + Stage::limit(5), + Stage::project( + _id: 0, + title: 1, + released: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::SearchDateSearchAndSort, $pipeline); + } + + public function testExample(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::near( + path: 'released', + origin: new UTCDateTime(new DateTime('2011-09-01T00:00:00.000+00:00')), + pivot: 7776000000, + ), + ), + Stage::project(_id: 0, title: 1, released: 1), + Stage::limit(5), + Stage::facet( + docs: [], + meta: new Pipeline( + Stage::replaceWith(Expression::variable('SEARCH_META')), + Stage::limit(1), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SearchExample, $pipeline); + } + + public function testNumberSearchAndSort(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::range( + path: 'awards.wins', + gt: 3, + ), + sort: ['awards.wins' => -1], + ), + Stage::limit(5), + Stage::project(...[ + '_id' => 0, + 'title' => 1, + 'awards.wins' => 1, + ]), + ); + + $this->assertSamePipeline(Pipelines::SearchNumberSearchAndSort, $pipeline); + } + + public function testPaginateResultsAfterAToken(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::text( + path: 'title', + query: 'war', + ), + searchAfter: 'CMtJGgYQuq+ngwgaCSkAjBYH7AAAAA==', + sort: object( + score: ['$meta' => 'searchScore'], + released: 1, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SearchPaginateResultsAfterAToken, $pipeline); + } + + public function testPaginateResultsBeforeAToken(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::text( + path: 'title', + query: 'war', + ), + searchBefore: 'CJ6kARoGELqvp4MIGgkpACDA3U8BAAA=', + sort: object( + score: ['$meta' => 'searchScore'], + released: 1, + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SearchPaginateResultsBeforeAToken, $pipeline); + } + + public function testReturnStoredSourceFields(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::text( + path: 'title', + query: 'baseball', + ), + returnStoredSource: true, + ), + Stage::match( + Query::or( + Query::query(...['imdb.rating' => Query::gt(8.2)]), + Query::query(...['imdb.votes' => Query::gte(4500)]), + ), + ), + Stage::lookup( + as: 'document', + from: 'movies', + localField: '_id', + foreignField: '_id', + ), + ); + + $this->assertSamePipeline(Pipelines::SearchReturnStoredSourceFields, $pipeline); + } + + public function testSortByScore(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::text( + path: 'title', + query: 'story', + ), + sort: object( + score: [ + '$meta' => 'searchScore', + 'order' => 1, + ], + ), + ), + Stage::limit(5), + Stage::project( + _id: 0, + title: 1, + score: ['$meta' => 'searchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::SearchSortByScore, $pipeline); + } + + public function testTrackSearchTerms(): void + { + $pipeline = new Pipeline( + Stage::search( + Search::text( + query: 'summer', + path: 'title', + ), + tracking: object(searchTerms: 'summer'), + ), + Stage::limit(5), + Stage::project( + _id: 0, + title: 1, + ), + ); + + $this->assertSamePipeline(Pipelines::SearchTrackSearchTerms, $pipeline); + } +} diff --git a/tests/Builder/Stage/SetStageTest.php b/tests/Builder/Stage/SetStageTest.php new file mode 100644 index 000000000..64193b8b9 --- /dev/null +++ b/tests/Builder/Stage/SetStageTest.php @@ -0,0 +1,89 @@ +assertSamePipeline(Pipelines::SetAddElementToAnArray, $pipeline); + } + + public function testAddingFieldsToAnEmbeddedDocument(): void + { + $pipeline = new Pipeline( + Stage::set( + ...['specs.fuel_type' => 'unleaded'], + ), + ); + + $this->assertSamePipeline(Pipelines::SetAddingFieldsToAnEmbeddedDocument, $pipeline); + } + + public function testCreatingANewFieldWithExistingFields(): void + { + $pipeline = new Pipeline( + Stage::set( + quizAverage: Expression::avg( + Expression::numberFieldPath('quiz'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SetCreatingANewFieldWithExistingFields, $pipeline); + } + + public function testOverwritingAnExistingField(): void + { + $pipeline = new Pipeline( + Stage::set(cats: 20), + ); + + $this->assertSamePipeline(Pipelines::SetOverwritingAnExistingField, $pipeline); + } + + public function testUsingTwoSetStages(): void + { + $pipeline = new Pipeline( + Stage::set( + totalHomework: Expression::sum( + Expression::arrayFieldPath('homework'), + ), + totalQuiz: Expression::sum( + Expression::arrayFieldPath('quiz'), + ), + ), + Stage::set( + totalScore: Expression::add( + Expression::numberFieldPath('totalHomework'), + Expression::numberFieldPath('totalQuiz'), + Expression::numberFieldPath('extraCredit'), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SetUsingTwoSetStages, $pipeline); + } +} diff --git a/tests/Builder/Stage/SetWindowFieldsStageTest.php b/tests/Builder/Stage/SetWindowFieldsStageTest.php new file mode 100644 index 000000000..442d959bf --- /dev/null +++ b/tests/Builder/Stage/SetWindowFieldsStageTest.php @@ -0,0 +1,175 @@ +assertSamePipeline(Pipelines::SetWindowFieldsRangeWindowExample, $pipeline); + } + + public function testUseATimeRangeWindowWithANegativeUpperBound(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::stringFieldPath('state'), + sortBy: object(orderDate: Sort::Asc), + output: object( + recentOrders: Accumulator::outputWindow( + Accumulator::push( + Expression::dateFieldPath('orderDate'), + ), + range: ['unbounded', -10], + unit: TimeUnit::Month, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SetWindowFieldsUseATimeRangeWindowWithANegativeUpperBound, $pipeline); + } + + public function testUseATimeRangeWindowWithAPositiveUpperBound(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::stringFieldPath('state'), + sortBy: object(orderDate: Sort::Asc), + output: object( + recentOrders: Accumulator::outputWindow( + Accumulator::push( + Expression::dateFieldPath('orderDate'), + ), + range: ['unbounded', 10], + unit: TimeUnit::Month, + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SetWindowFieldsUseATimeRangeWindowWithAPositiveUpperBound, $pipeline); + } + + public function testUseDocumentsWindowToObtainCumulativeAndMaximumQuantityForEachYear(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::year( + Expression::dateFieldPath('orderDate'), + ), + sortBy: object(orderDate: Sort::Asc), + output: object( + cumulativeQuantityForYear: Accumulator::outputWindow( + Accumulator::sum( + Expression::numberFieldPath('quantity'), + ), + documents: ['unbounded', 'current'], + ), + maximumQuantityForYear: Accumulator::outputWindow( + Accumulator::max( + Expression::numberFieldPath('quantity'), + ), + documents: ['unbounded', 'unbounded'], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SetWindowFieldsUseDocumentsWindowToObtainCumulativeAndMaximumQuantityForEachYear, $pipeline); + } + + public function testUseDocumentsWindowToObtainCumulativeQuantityForEachState(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::stringFieldPath('state'), + sortBy: object(orderDate: Sort::Asc), + output: object( + cumulativeQuantityForState: Accumulator::outputWindow( + Accumulator::sum( + Expression::numberFieldPath('quantity'), + ), + documents: ['unbounded', 'current'], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SetWindowFieldsUseDocumentsWindowToObtainCumulativeQuantityForEachState, $pipeline); + } + + public function testUseDocumentsWindowToObtainCumulativeQuantityForEachYear(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::year( + Expression::dateFieldPath('orderDate'), + ), + sortBy: object(orderDate: Sort::Asc), + output: object( + cumulativeQuantityForYear: Accumulator::outputWindow( + Accumulator::sum( + Expression::numberFieldPath('quantity'), + ), + documents: ['unbounded', 'current'], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SetWindowFieldsUseDocumentsWindowToObtainCumulativeQuantityForEachYear, $pipeline); + } + + public function testUseDocumentsWindowToObtainMovingAverageQuantityForEachYear(): void + { + $pipeline = new Pipeline( + Stage::setWindowFields( + partitionBy: Expression::year( + Expression::dateFieldPath('orderDate'), + ), + sortBy: object(orderDate: Sort::Asc), + output: object( + averageQuantity: Accumulator::outputWindow( + Accumulator::avg( + Expression::numberFieldPath('quantity'), + ), + documents: [-1, 0], + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::SetWindowFieldsUseDocumentsWindowToObtainMovingAverageQuantityForEachYear, $pipeline); + } +} diff --git a/tests/Builder/Stage/ShardedDataDistributionStageTest.php b/tests/Builder/Stage/ShardedDataDistributionStageTest.php new file mode 100644 index 000000000..f9c0db9bc --- /dev/null +++ b/tests/Builder/Stage/ShardedDataDistributionStageTest.php @@ -0,0 +1,24 @@ +assertSamePipeline(Pipelines::ShardedDataDistributionExample, $pipeline); + } +} diff --git a/tests/Builder/Stage/SkipStageTest.php b/tests/Builder/Stage/SkipStageTest.php new file mode 100644 index 000000000..4a716bea1 --- /dev/null +++ b/tests/Builder/Stage/SkipStageTest.php @@ -0,0 +1,24 @@ +assertSamePipeline(Pipelines::SkipExample, $pipeline); + } +} diff --git a/tests/Builder/Stage/SortByCountStageTest.php b/tests/Builder/Stage/SortByCountStageTest.php new file mode 100644 index 000000000..d1a0393a9 --- /dev/null +++ b/tests/Builder/Stage/SortByCountStageTest.php @@ -0,0 +1,30 @@ +assertSamePipeline(Pipelines::SortByCountExample, $pipeline); + } +} diff --git a/tests/Builder/Stage/SortStageTest.php b/tests/Builder/Stage/SortStageTest.php new file mode 100644 index 000000000..5590454bc --- /dev/null +++ b/tests/Builder/Stage/SortStageTest.php @@ -0,0 +1,44 @@ +assertSamePipeline(Pipelines::SortAscendingDescendingSort, $pipeline); + } + + public function testTextScoreMetadataSort(): void + { + $pipeline = new Pipeline( + Stage::match( + Query::text('operating'), + ), + Stage::sort( + score: Sort::TextScore, + posts: Sort::Desc, + ), + ); + + $this->assertSamePipeline(Pipelines::SortTextScoreMetadataSort, $pipeline); + } +} diff --git a/tests/Builder/Stage/UnionWithStageTest.php b/tests/Builder/Stage/UnionWithStageTest.php new file mode 100644 index 000000000..fcf2edf90 --- /dev/null +++ b/tests/Builder/Stage/UnionWithStageTest.php @@ -0,0 +1,78 @@ +assertSamePipeline(Pipelines::UnionWithReport1AllSalesByYearAndStoresAndItems, $pipeline); + } + + public function testReport2AggregatedSalesByItems(): void + { + $pipeline = new Pipeline( + Stage::unionWith('sales_2018'), + Stage::unionWith('sales_2019'), + Stage::unionWith('sales_2020'), + Stage::group( + _id: Expression::stringFieldPath('item'), + total: Accumulator::sum( + Expression::numberFieldPath('quantity'), + ), + ), + Stage::sort( + total: Sort::Desc, + ), + ); + + $this->assertSamePipeline(Pipelines::UnionWithReport2AggregatedSalesByItems, $pipeline); + } +} diff --git a/tests/Builder/Stage/UnsetStageTest.php b/tests/Builder/Stage/UnsetStageTest.php new file mode 100644 index 000000000..217172743 --- /dev/null +++ b/tests/Builder/Stage/UnsetStageTest.php @@ -0,0 +1,49 @@ +assertSamePipeline(Pipelines::UnsetRemoveASingleField, $pipeline); + } + + public function testRemoveEmbeddedFields(): void + { + $pipeline = new Pipeline( + Stage::unset( + 'isbn', + 'author.first', + 'copies.warehouse', + ), + ); + + $this->assertSamePipeline(Pipelines::UnsetRemoveEmbeddedFields, $pipeline); + } + + public function testRemoveTopLevelFields(): void + { + $pipeline = new Pipeline( + Stage::unset( + 'isbn', + 'copies', + ), + ); + + $this->assertSamePipeline(Pipelines::UnsetRemoveTopLevelFields, $pipeline); + } +} diff --git a/tests/Builder/Stage/UnwindStageTest.php b/tests/Builder/Stage/UnwindStageTest.php new file mode 100644 index 000000000..26b1d377c --- /dev/null +++ b/tests/Builder/Stage/UnwindStageTest.php @@ -0,0 +1,91 @@ +assertSamePipeline(Pipelines::UnwindGroupByUnwoundValues, $pipeline); + } + + public function testIncludeArrayIndex(): void + { + $pipeline = new Pipeline( + Stage::unwind( + path: Expression::arrayFieldPath('sizes'), + includeArrayIndex: 'arrayIndex', + ), + ); + + $this->assertSamePipeline(Pipelines::UnwindIncludeArrayIndex, $pipeline); + } + + public function testPreserveNullAndEmptyArrays(): void + { + $pipeline = new Pipeline( + Stage::unwind( + path: Expression::arrayFieldPath('sizes'), + preserveNullAndEmptyArrays: true, + ), + ); + + $this->assertSamePipeline(Pipelines::UnwindPreserveNullAndEmptyArrays, $pipeline); + } + + public function testUnwindArray(): void + { + $pipeline = new Pipeline( + Stage::unwind(Expression::arrayFieldPath('sizes')), + ); + + $this->assertSamePipeline(Pipelines::UnwindUnwindArray, $pipeline); + } + + public function testUnwindEmbeddedArrays(): void + { + $pipeline = new Pipeline( + Stage::unwind(Expression::arrayFieldPath('items')), + Stage::unwind(Expression::arrayFieldPath('items.tags')), + Stage::group( + _id: Expression::fieldPath('items.tags'), + totalSalesAmount: Accumulator::sum( + Expression::multiply( + Expression::numberFieldPath('items.price'), + Expression::numberFieldPath('items.quantity'), + ), + ), + ), + ); + + $this->assertSamePipeline(Pipelines::UnwindUnwindEmbeddedArrays, $pipeline); + } +} diff --git a/tests/Builder/Stage/VectorSearchStageTest.php b/tests/Builder/Stage/VectorSearchStageTest.php new file mode 100644 index 000000000..f6259510a --- /dev/null +++ b/tests/Builder/Stage/VectorSearchStageTest.php @@ -0,0 +1,85 @@ + 'vectorSearchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::VectorSearchANNBasic, $pipeline); + } + + public function testANNFilter(): void + { + $pipeline = new Pipeline( + Stage::vectorSearch( + index: 'vector_index', + limit: 10, + path: 'plot_embedding', + queryVector: [0.02421053, -0.022372592, -0.006231137], + filter: Query::and( + Query::query( + year: Query::lt(1975), + ), + ), + numCandidates: 150, + ), + Stage::project( + _id: 0, + title: 1, + plot: 1, + year: 1, + score: ['$meta' => 'vectorSearchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::VectorSearchANNFilter, $pipeline); + } + + public function testENN(): void + { + $pipeline = new Pipeline( + Stage::vectorSearch( + index: 'vector_index', + limit: 10, + path: 'plot_embedding', + queryVector: [-0.006954097, -0.009932499, -0.001311474], + exact: true, + ), + Stage::project( + _id: 0, + title: 1, + plot: 1, + score: ['$meta' => 'vectorSearchScore'], + ), + ); + + $this->assertSamePipeline(Pipelines::VectorSearchENN, $pipeline); + } +} diff --git a/tests/Builder/Type/CombinedFieldQueryTest.php b/tests/Builder/Type/CombinedFieldQueryTest.php new file mode 100644 index 000000000..e37f61630 --- /dev/null +++ b/tests/Builder/Type/CombinedFieldQueryTest.php @@ -0,0 +1,111 @@ +assertSame([], $fieldQueries->fieldQueries); + } + + public function testSupportedTypes(): void + { + $fieldQueries = new CombinedFieldQuery([ + new EqOperator(1), + ['$gt' => 1], + (object) ['$lt' => 1], + ]); + + $this->assertCount(3, $fieldQueries->fieldQueries); + } + + public function testFlattenCombinedFieldQueries(): void + { + $fieldQueries = new CombinedFieldQuery([ + new CombinedFieldQuery([ + new CombinedFieldQuery([ + ['$lt' => 1], + new CombinedFieldQuery([]), + ]), + ['$gt' => 1], + ]), + ['$gte' => 1], + ]); + + $this->assertCount(3, $fieldQueries->fieldQueries); + } + + #[DataProvider('provideInvalidFieldQuery')] + public function testRejectInvalidFieldQueries(mixed $invalidQuery, string $message = '-'): void + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage($message); + + new CombinedFieldQuery([$invalidQuery]); + } + + public static function provideInvalidFieldQuery(): Generator + { + yield 'int' => [1, 'Expected filters to be a list of field query operators, array or stdClass, int given']; + yield 'float' => [1.1, 'Expected filters to be a list of field query operators, array or stdClass, float given']; + yield 'string' => ['foo', 'Expected filters to be a list of field query operators, array or stdClass, string given']; + yield 'bool' => [true, 'Expected filters to be a list of field query operators, array or stdClass, bool given']; + yield 'null' => [null, 'Expected filters to be a list of field query operators, array or stdClass, null given']; + yield 'empty array' => [[], 'Operator must contain exactly one key, 0 given']; + yield 'array with two keys' => [['$eq' => 1, '$ne' => 2], 'Operator must contain exactly one key, 2 given']; + yield 'array key without $' => [['eq' => 1], 'Operator must contain exactly one key starting with $, "eq" given']; + yield 'empty object' => [(object) [], 'Operator must contain exactly one key, 0 given']; + yield 'object with two keys' => [(object) ['$eq' => 1, '$ne' => 2], 'Operator must contain exactly one key, 2 given']; + yield 'object key without $' => [(object) ['eq' => 1], 'Operator must contain exactly one key starting with $, "eq" given']; + } + + /** @param array $fieldQueries */ + #[DataProvider('provideDuplicateOperator')] + public function testRejectDuplicateOperator(array $fieldQueries): void + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Duplicate operator "$eq" detected'); + + new CombinedFieldQuery([ + ['$eq' => 1], + new EqOperator(2), + ]); + } + + public static function provideDuplicateOperator(): Generator + { + yield 'array and FieldQuery' => [ + [ + ['$eq' => 1], + new EqOperator(2), + ], + ]; + + yield 'object and FieldQuery' => [ + [ + (object) ['$gt' => 1], + new GtOperator(2), + ], + ]; + + yield 'object and array' => [ + [ + (object) ['$ne' => 1], + ['$ne' => 2], + ], + ]; + } +} diff --git a/tests/Builder/Type/OutputWindowTest.php b/tests/Builder/Type/OutputWindowTest.php new file mode 100644 index 000000000..0a60f3635 --- /dev/null +++ b/tests/Builder/Type/OutputWindowTest.php @@ -0,0 +1,103 @@ +createMock(WindowInterface::class), + ); + + $this->assertSame($operator, $outputWindow->operator); + $this->assertSame(Optional::Undefined, $outputWindow->window); + } + + public function testWithDocuments(): void + { + $outputWindow = new OutputWindow( + operator: $operator = $this->createMock(WindowInterface::class), + documents: [1, 5], + ); + + $this->assertSame($operator, $outputWindow->operator); + $this->assertEquals((object) ['documents' => [1, 5]], $outputWindow->window); + } + + public function testWithRange(): void + { + $outputWindow = new OutputWindow( + operator: $operator = $this->createMock(WindowInterface::class), + range: [1.2, 5.8], + ); + + $this->assertSame($operator, $outputWindow->operator); + $this->assertEquals((object) ['range' => [1.2, 5.8]], $outputWindow->window); + } + + public function testWithUnit(): void + { + $outputWindow = new OutputWindow( + operator: $operator = $this->createMock(WindowInterface::class), + unit: TimeUnit::Day, + ); + + $this->assertSame($operator, $outputWindow->operator); + $this->assertEquals((object) ['unit' => TimeUnit::Day], $outputWindow->window); + } + + /** @param array $documents */ + #[DataProvider('provideInvalidDocuments')] + public function testRejectInvalidDocuments(array $documents): void + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Expected $documents argument to be a list of 2 string or int'); + + new OutputWindow( + operator: $this->createMock(WindowInterface::class), + documents: $documents, + ); + } + + public static function provideInvalidDocuments(): Generator + { + yield 'too few' => [[1]]; + yield 'too many' => [[1, 2, 3]]; + yield 'invalid boolean' => [[1, true]]; + yield 'invalid float' => [[1, 4.3]]; + yield 'not a list' => [['foo' => 1, 'bar' => 2]]; + } + + /** @param array $range */ + #[DataProvider('provideInvalidRange')] + public function testRejectInvalidRange(array $range): void + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('Expected $range argument to be a list of 2 string or numeric'); + + new OutputWindow( + operator: $this->createMock(WindowInterface::class), + range: $range, + ); + } + + public static function provideInvalidRange(): Generator + { + yield 'too few' => [[1]]; + yield 'too many' => [[1, 2, 3]]; + yield 'invalid boolean' => [[1, true]]; + yield 'not a list' => [['foo' => 1, 'bar' => 2]]; + } +} diff --git a/tests/Builder/Type/QueryObjectTest.php b/tests/Builder/Type/QueryObjectTest.php new file mode 100644 index 000000000..819495805 --- /dev/null +++ b/tests/Builder/Type/QueryObjectTest.php @@ -0,0 +1,91 @@ +assertSame([], $queryObject->queries); + } + + public function testShortCutQueryObject(): void + { + $query = $this->createMock(QueryInterface::class); + $queryObject = QueryObject::create([$query]); + + $this->assertSame($query, $queryObject); + } + + /** @param array $value */ + #[DataProvider('provideQueryObjectValue')] + public function testCreateQueryObject(array $value, int $expectedCount = 1): void + { + $queryObject = QueryObject::create($value); + + $this->assertCount($expectedCount, $queryObject->queries); + } + + /** @param array $value */ + #[DataProvider('provideQueryObjectValue')] + public function testCreateQueryObjectFromArray(array $value, int $expectedCount = 1): void + { + // $value is wrapped in an array as if the user used an array instead of variadic arguments + $queryObject = QueryObject::create([$value]); + + $this->assertCount($expectedCount, $queryObject->queries); + } + + public static function provideQueryObjectValue(): Generator + { + yield 'int' => [['foo' => 1]]; + yield 'float' => [['foo' => 1.1]]; + yield 'string' => [['foo' => 'bar']]; + yield 'bool' => [['foo' => true]]; + yield 'null' => [['foo' => null]]; + yield 'decimal128' => [['foo' => new BSON\Decimal128('1.1')]]; + yield 'int64' => [[1 => new BSON\Int64(1)]]; + yield 'objectId' => [['foo' => new BSON\ObjectId()]]; + yield 'binary' => [['foo' => new BSON\Binary('foo')]]; + yield 'regex' => [['foo' => new BSON\Regex('foo')]]; + yield 'datetime' => [['foo' => new BSON\UTCDateTime()]]; + yield 'timestamp' => [['foo' => new BSON\Timestamp(1234, 5678)]]; + yield 'bson document' => [['foo' => BSON\Document::fromPHP(['bar' => 'baz'])]]; + yield 'bson array' => [['foo' => BSON\PackedArray::fromPHP(['bar', 'baz'])]]; + yield 'object' => [['foo' => (object) ['bar' => 'baz']]]; + yield 'list' => [['foo' => ['bar', 'baz']]]; + yield 'operator as array' => [['foo' => ['$eq' => 1]]]; + yield 'operator as object' => [['foo' => (object) ['$eq' => 1]]]; + yield 'field query operator' => [['foo' => new EqOperator(1)]]; + yield 'query operator' => [[new CommentOperator('foo'), 'foo' => 1], 2]; + yield 'numeric field with array' => [[1 => [2, 3]]]; + yield 'numeric field with operator' => [[1 => ['$eq' => 2]]]; + } + + public function testFieldQueryList(): void + { + $queryObject = QueryObject::create( + ['foo' => [new GtOperator(1), new LtOperator(5)]], + ); + + $this->assertArrayHasKey('foo', $queryObject->queries); + $this->assertInstanceOf(CombinedFieldQuery::class, $queryObject->queries['foo']); + $this->assertCount(2, $queryObject->queries['foo']->fieldQueries); + } +} diff --git a/tests/Builder/VariableTest.php b/tests/Builder/VariableTest.php new file mode 100644 index 000000000..14137b3aa --- /dev/null +++ b/tests/Builder/VariableTest.php @@ -0,0 +1,68 @@ +assertSame('foo', $variable->name); + $this->assertInstanceOf(Expression\ResolvesToAny::class, $variable); + $this->assertInstanceOf(Expression\Variable::class, $variable); + } + + public function testVariableRejectDollarPrefix(): void + { + $this->expectException(InvalidArgumentException::class); + + new Expression\Variable('$$foo'); + } + + #[DataProvider('provideVariableBuilders')] + public function testSystemVariables($factory): void + { + $variable = $factory(); + $this->assertInstanceOf(Expression\Variable::class, $variable); + $this->assertStringStartsNotWith('$$', $variable->name); + } + + public static function provideVariableBuilders(): Generator + { + yield 'now' => [fn () => Variable::now()]; + yield 'clusterTime' => [fn () => Variable::clusterTime()]; + yield 'root' => [fn () => Variable::root()]; + yield 'current' => [fn () => Variable::current()]; + yield 'remove' => [fn () => Variable::remove()]; + yield 'descend' => [fn () => Variable::descend()]; + yield 'prune' => [fn () => Variable::prune()]; + yield 'keep' => [fn () => Variable::keep()]; + yield 'searchMeta' => [fn () => Variable::searchMeta()]; + yield 'userRoles' => [fn () => Variable::userRoles()]; + } + + public function testCurrent(): void + { + $variable = Variable::current(); + $this->assertInstanceOf(Expression\Variable::class, $variable); + $this->assertSame('CURRENT', $variable->name); + + $variable = Variable::current('foo'); + $this->assertInstanceOf(Expression\Variable::class, $variable); + $this->assertSame('CURRENT.foo', $variable->name); + } + + public function testCustomVariable(): void + { + $this->assertInstanceOf(Expression\Variable::class, Variable::variable('foo')); + } +} diff --git a/tests/ClientFunctionalTest.php b/tests/ClientFunctionalTest.php index 3c04ecd67..393f23607 100644 --- a/tests/ClientFunctionalTest.php +++ b/tests/ClientFunctionalTest.php @@ -2,6 +2,10 @@ namespace MongoDB\Tests; +use Iterator; +use MongoDB\Builder\Pipeline; +use MongoDB\Builder\Query; +use MongoDB\Builder\Stage; use MongoDB\Client; use MongoDB\Driver\BulkWrite; use MongoDB\Driver\Command; @@ -9,10 +13,10 @@ use MongoDB\Driver\Monitoring\CommandSubscriber; use MongoDB\Driver\Session; use MongoDB\Model\DatabaseInfo; -use MongoDB\Model\DatabaseInfoIterator; use function call_user_func; use function is_callable; +use function iterator_to_array; use function sprintf; /** @@ -43,8 +47,7 @@ public function testDropDatabase(): void $writeResult = $this->manager->executeBulkWrite($this->getNamespace(), $bulkWrite); $this->assertEquals(1, $writeResult->getInsertedCount()); - $commandResult = $this->client->dropDatabase($this->getDatabaseName()); - $this->assertCommandSucceeded($commandResult); + $this->client->dropDatabase($this->getDatabaseName()); $this->assertCollectionCount($this->getNamespace(), 0); } @@ -58,7 +61,7 @@ public function testListDatabases(): void $databases = $this->client->listDatabases(); - $this->assertInstanceOf(DatabaseInfoIterator::class, $databases); + $this->assertInstanceOf(Iterator::class, $databases); foreach ($databases as $database) { $this->assertInstanceOf(DatabaseInfo::class, $database); @@ -137,4 +140,25 @@ public function testAddAndRemoveSubscriber(): void $client->getManager()->executeCommand('admin', new Command(['ping' => 1])); } + + public function testWatchWithBuilderPipeline(): void + { + $this->skipIfChangeStreamIsNotSupported(); + + if ($this->isShardedCluster()) { + $this->markTestSkipped('Test does not apply on sharded clusters: need more than a single getMore call on the change stream.'); + } + + $pipeline = new Pipeline( + Stage::match(operationType: Query::eq('insert')), + ); + // Extract the list of stages for arg type restriction + $pipeline = iterator_to_array($pipeline); + + $changeStream = $this->client->watch($pipeline); + $this->client->selectCollection($this->getDatabaseName(), $this->getCollectionName())->insertOne(['x' => 3]); + $changeStream->next(); + $this->assertTrue($changeStream->valid()); + $this->assertEquals('insert', $changeStream->current()->operationType); + } } diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 04855d479..45d852dc4 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -3,12 +3,15 @@ namespace MongoDB\Tests; use MongoDB\Client; +use MongoDB\Codec\Encoder; use MongoDB\Driver\ClientEncryption; use MongoDB\Driver\Exception\InvalidArgumentException as DriverInvalidArgumentException; use MongoDB\Driver\ReadConcern; use MongoDB\Driver\ReadPreference; use MongoDB\Driver\WriteConcern; use MongoDB\Exception\InvalidArgumentException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; /** * Unit tests for the Client class. @@ -22,7 +25,7 @@ public function testConstructorDefaultUri(): void $this->assertEquals('mongodb://127.0.0.1/', (string) $client); } - /** @doesNotPerformAssertions */ + #[DoesNotPerformAssertions] public function testConstructorAutoEncryptionOpts(): void { $autoEncryptionOpts = [ @@ -34,32 +37,48 @@ public function testConstructorAutoEncryptionOpts(): void new Client(static::getUri(), [], ['autoEncryption' => $autoEncryptionOpts]); } - /** @dataProvider provideInvalidConstructorDriverOptions */ + #[DoesNotPerformAssertions] + public function testConstructorEmptyKmsProvider(): void + { + $autoEncryptionOpts = [ + 'keyVaultClient' => new Client(static::getUri()), + 'keyVaultNamespace' => 'default.keys', + 'kmsProviders' => ['gcp' => []], + ]; + + new Client(static::getUri(), [], ['autoEncryption' => $autoEncryptionOpts]); + } + + #[DataProvider('provideInvalidConstructorDriverOptions')] public function testConstructorDriverOptionTypeChecks(array $driverOptions, string $exception = InvalidArgumentException::class): void { $this->expectException($exception); new Client(static::getUri(), [], $driverOptions); } - public function provideInvalidConstructorDriverOptions() + public static function provideInvalidConstructorDriverOptions() { $options = []; - foreach ($this->getInvalidArrayValues(true) as $value) { + foreach (self::getInvalidObjectValues() as $value) { + $options[][] = ['builderEncoder' => $value]; + } + + foreach (self::getInvalidArrayValues(true) as $value) { $options[][] = ['typeMap' => $value]; } $options[][] = ['autoEncryption' => ['keyVaultClient' => 'foo']]; - foreach ($this->getInvalidStringValues() as $value) { + foreach (self::getInvalidStringValues() as $value) { $options[][] = ['driver' => ['name' => $value]]; } - foreach ($this->getInvalidStringValues() as $value) { + foreach (self::getInvalidStringValues() as $value) { $options[][] = ['driver' => ['version' => $value]]; } - foreach ($this->getInvalidStringValues() as $value) { + foreach (self::getInvalidStringValues() as $value) { $options[] = [ 'driverOptions' => ['driver' => ['platform' => $value]], 'exception' => DriverInvalidArgumentException::class, @@ -85,6 +104,7 @@ public function testSelectCollectionInheritsOptions(): void ]; $driverOptions = [ + 'builderEncoder' => $builderEncoder = $this->createMock(Encoder::class), 'typeMap' => ['root' => 'array'], ]; @@ -92,6 +112,7 @@ public function testSelectCollectionInheritsOptions(): void $collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName()); $debug = $collection->__debugInfo(); + $this->assertSame($builderEncoder, $debug['builderEncoder']); $this->assertInstanceOf(ReadConcern::class, $debug['readConcern']); $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); $this->assertInstanceOf(ReadPreference::class, $debug['readPreference']); @@ -105,6 +126,7 @@ public function testSelectCollectionInheritsOptions(): void public function testSelectCollectionPassesOptions(): void { $collectionOptions = [ + 'builderEncoder' => $builderEncoder = $this->createMock(Encoder::class), 'readConcern' => new ReadConcern(ReadConcern::LOCAL), 'readPreference' => new ReadPreference(ReadPreference::SECONDARY_PREFERRED), 'typeMap' => ['root' => 'array'], @@ -115,6 +137,7 @@ public function testSelectCollectionPassesOptions(): void $collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName(), $collectionOptions); $debug = $collection->__debugInfo(); + $this->assertSame($builderEncoder, $debug['builderEncoder']); $this->assertInstanceOf(ReadConcern::class, $debug['readConcern']); $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); $this->assertInstanceOf(ReadPreference::class, $debug['readPreference']); @@ -129,11 +152,19 @@ public function testGetSelectsDatabaseAndInheritsOptions(): void { $uriOptions = ['w' => WriteConcern::MAJORITY]; - $client = new Client(static::getUri(), $uriOptions); + $driverOptions = [ + 'builderEncoder' => $builderEncoder = $this->createMock(Encoder::class), + 'typeMap' => ['root' => 'array'], + ]; + + $client = new Client(static::getUri(), $uriOptions, $driverOptions); $database = $client->{$this->getDatabaseName()}; $debug = $database->__debugInfo(); + $this->assertSame($builderEncoder, $debug['builderEncoder']); $this->assertSame($this->getDatabaseName(), $debug['databaseName']); + $this->assertIsArray($debug['typeMap']); + $this->assertSame(['root' => 'array'], $debug['typeMap']); $this->assertInstanceOf(WriteConcern::class, $debug['writeConcern']); $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); } @@ -147,6 +178,7 @@ public function testSelectDatabaseInheritsOptions(): void ]; $driverOptions = [ + 'builderEncoder' => $builderEncoder = $this->createMock(Encoder::class), 'typeMap' => ['root' => 'array'], ]; @@ -154,6 +186,7 @@ public function testSelectDatabaseInheritsOptions(): void $database = $client->selectDatabase($this->getDatabaseName()); $debug = $database->__debugInfo(); + $this->assertSame($builderEncoder, $debug['builderEncoder']); $this->assertInstanceOf(ReadConcern::class, $debug['readConcern']); $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); $this->assertInstanceOf(ReadPreference::class, $debug['readPreference']); @@ -167,6 +200,7 @@ public function testSelectDatabaseInheritsOptions(): void public function testSelectDatabasePassesOptions(): void { $databaseOptions = [ + 'builderEncoder' => $builderEncoder = $this->createMock(Encoder::class), 'readConcern' => new ReadConcern(ReadConcern::LOCAL), 'readPreference' => new ReadPreference(ReadPreference::SECONDARY_PREFERRED), 'typeMap' => ['root' => 'array'], diff --git a/tests/Collection/BuilderCollectionFunctionalTest.php b/tests/Collection/BuilderCollectionFunctionalTest.php new file mode 100644 index 000000000..484ad972d --- /dev/null +++ b/tests/Collection/BuilderCollectionFunctionalTest.php @@ -0,0 +1,301 @@ +collection->insertMany([['x' => 1], ['x' => 2], ['x' => 2]]); + } + + #[TestWith([true])] + #[TestWith([false])] + public function testAggregate(bool $pipelineAsArray): void + { + $this->collection->insertMany([['x' => 10], ['x' => 10], ['x' => 10]]); + $pipeline = [ + Stage::bucketAuto( + groupBy: Expression::intFieldPath('x'), + buckets: 2, + ), + ]; + + if (! $pipelineAsArray) { + $pipeline = new Pipeline(...$pipeline); + } + + $results = $this->collection->aggregate($pipeline)->toArray(); + $this->assertCount(2, $results); + } + + public function testBulkWriteDeleteMany(): void + { + $result = $this->collection->bulkWrite([ + [ + 'deleteMany' => [ + Query::query(x: Query::gt(1)), + ], + ], + ]); + $this->assertEquals(2, $result->getDeletedCount()); + } + + public function testBulkWriteDeleteOne(): void + { + $result = $this->collection->bulkWrite([ + [ + 'deleteOne' => [ + Query::query(x: Query::eq(1)), + ], + ], + ]); + $this->assertEquals(1, $result->getDeletedCount()); + } + + public function testBulkWriteReplaceOne(): void + { + $result = $this->collection->bulkWrite([ + [ + 'replaceOne' => [ + Query::query(x: Query::eq(1)), + ['x' => 3], + ], + ], + ]); + $this->assertEquals(1, $result->getModifiedCount()); + + $result = $this->collection->findOne(Query::query(x: Query::eq(3))); + $this->assertEquals(3, $result->x); + } + + public function testBulkWriteUpdateMany(): void + { + $result = $this->collection->bulkWrite([ + [ + 'updateMany' => [ + Query::query(x: Query::gt(1)), + // @todo Use Builder when update operators are supported by PHPLIB-1507 + ['$set' => ['x' => 3]], + ], + ], + ]); + $this->assertEquals(2, $result->getModifiedCount()); + + $result = $this->collection->find(Query::query(x: Query::eq(3)))->toArray(); + $this->assertCount(2, $result); + $this->assertEquals(3, $result[0]->x); + } + + public function testBulkWriteUpdateOne(): void + { + $result = $this->collection->bulkWrite([ + [ + 'updateOne' => [ + Query::query(x: Query::eq(1)), + // @todo Use Builder when update operators are supported by PHPLIB-1507 + ['$set' => ['x' => 3]], + ], + ], + ]); + + $this->assertEquals(1, $result->getModifiedCount()); + + $result = $this->collection->findOne(Query::query(x: Query::eq(3))); + $this->assertEquals(3, $result->x); + } + + public function testCountDocuments(): void + { + $result = $this->collection->countDocuments(Query::query(x: Query::gt(1))); + $this->assertEquals(2, $result); + } + + public function testDeleteMany(): void + { + $result = $this->collection->deleteMany(Query::query(x: Query::gt(1))); + $this->assertEquals(2, $result->getDeletedCount()); + } + + public function testDeleteOne(): void + { + $result = $this->collection->deleteOne(Query::query(x: Query::gt(1))); + $this->assertEquals(1, $result->getDeletedCount()); + } + + public function testDistinct(): void + { + $result = $this->collection->distinct('x', Query::query(x: Query::gt(1))); + $this->assertEquals([2], $result); + } + + public function testFind(): void + { + $results = $this->collection->find(Query::query(x: Query::gt(1)))->toArray(); + $this->assertCount(2, $results); + $this->assertEquals(2, $results[0]->x); + } + + public function testFindOne(): void + { + $result = $this->collection->findOne(Query::query(x: Query::eq(1))); + $this->assertEquals(1, $result->x); + } + + public function testFindOneAndDelete(): void + { + $result = $this->collection->findOneAndDelete(Query::query(x: Query::eq(1))); + $this->assertEquals(1, $result->x); + + $result = $this->collection->find()->toArray(); + $this->assertCount(2, $result); + } + + public function testFindOneAndReplace(): void + { + $this->collection->insertOne(['x' => 1]); + + $result = $this->collection->findOneAndReplace( + Query::query(x: Query::lt(2)), + ['x' => 3], + ); + $this->assertEquals(1, $result->x); + + $result = $this->collection->findOne(Query::query(x: Query::eq(3))); + $this->assertEquals(3, $result->x); + } + + public function testFindOneAndUpdate(): void + { + $result = $this->collection->findOneAndUpdate( + Query::query(x: Query::lt(2)), + // @todo Use Builder when update operators are supported by PHPLIB-1507 + ['$set' => ['x' => 3]], + ); + $this->assertEquals(1, $result->x); + + $result = $this->collection->findOne(Query::query(x: Query::eq(3))); + $this->assertEquals(3, $result->x); + } + + public function testFindOneAndUpdateWithPipelineUpdate(): void + { + $result = $this->collection->findOneAndUpdate( + Query::query(x: Query::lt(2)), + new Pipeline( + Stage::set(x: 3), + ), + ); + $this->assertEquals(1, $result->x); + + $result = $this->collection->findOne(Query::query(x: Query::eq(3))); + $this->assertEquals(3, $result->x); + } + + public function testReplaceOne(): void + { + $this->collection->insertOne(['x' => 1]); + + $result = $this->collection->replaceOne( + Query::query(x: Query::lt(2)), + ['x' => 3], + ); + $this->assertEquals(1, $result->getModifiedCount()); + + $result = $this->collection->findOne(Query::query(x: Query::eq(3))); + $this->assertEquals(3, $result->x); + } + + public function testUpdateOne(): void + { + $this->collection->insertOne(['x' => 1]); + + $result = $this->collection->updateOne( + Query::query(x: Query::lt(2)), + // @todo Use Builder when update operators are supported by PHPLIB-1507 + ['$set' => ['x' => 3]], + ); + $this->assertEquals(1, $result->getModifiedCount()); + + $result = $this->collection->findOne(Query::query(x: Query::eq(3))); + $this->assertEquals(3, $result->x); + } + + public function testUpdateWithPipeline(): void + { + $this->skipIfServerVersion('<', '4.2.0', 'Pipeline-style updates are not supported'); + + $result = $this->collection->updateOne( + Query::query(x: Query::lt(2)), + new Pipeline( + Stage::set(x: 3), + ), + ); + + $this->assertEquals(1, $result->getModifiedCount()); + } + + public function testUpdateMany(): void + { + $result = $this->collection->updateMany( + Query::query(x: Query::gt(1)), + // @todo Use Builder when update operators are supported by PHPLIB-1507 + ['$set' => ['x' => 3]], + ); + $this->assertEquals(2, $result->getModifiedCount()); + + $result = $this->collection->find(Query::query(x: Query::eq(3)))->toArray(); + $this->assertCount(2, $result); + $this->assertEquals(3, $result[0]->x); + } + + public function testUpdateManyWithPipeline(): void + { + $this->skipIfServerVersion('<', '4.2.0', 'Pipeline-style updates are not supported'); + + $result = $this->collection->updateMany( + Query::query(x: Query::gt(1)), + new Pipeline( + Stage::set(x: 3), + ), + ); + $this->assertEquals(2, $result->getModifiedCount()); + + $result = $this->collection->find(Query::query(x: Query::eq(3)))->toArray(); + $this->assertCount(2, $result); + $this->assertEquals(3, $result[0]->x); + } + + #[TestWith([true])] + #[TestWith([false])] + public function testWatch(bool $pipelineAsArray): void + { + $this->skipIfChangeStreamIsNotSupported(); + + if ($this->isShardedCluster()) { + $this->markTestSkipped('Test does not apply on sharded clusters: need more than a single getMore call on the change stream.'); + } + + $pipeline = [ + Stage::match(operationType: Query::eq('insert')), + ]; + + if (! $pipelineAsArray) { + $pipeline = new Pipeline(...$pipeline); + } + + $changeStream = $this->collection->watch($pipeline); + $this->collection->insertOne(['x' => 3]); + $changeStream->next(); + $this->assertTrue($changeStream->valid()); + $this->assertEquals('insert', $changeStream->current()->operationType); + } +} diff --git a/tests/Collection/CodecCollectionFunctionalTest.php b/tests/Collection/CodecCollectionFunctionalTest.php index 2eb0c09dd..2447243d0 100644 --- a/tests/Collection/CodecCollectionFunctionalTest.php +++ b/tests/Collection/CodecCollectionFunctionalTest.php @@ -12,6 +12,7 @@ use MongoDB\Operation\FindOneAndReplace; use MongoDB\Tests\Fixtures\Codec\TestDocumentCodec; use MongoDB\Tests\Fixtures\Document\TestObject; +use PHPUnit\Framework\Attributes\DataProvider; class CodecCollectionFunctionalTest extends FunctionalTestCase { @@ -54,7 +55,7 @@ public static function provideAggregateOptions(): Generator ]; } - /** @dataProvider provideAggregateOptions */ + #[DataProvider('provideAggregateOptions')] public function testAggregate($expected, $options): void { $this->createFixtures(3); @@ -114,7 +115,7 @@ public static function provideBulkWriteOptions(): Generator ]; } - /** @dataProvider provideBulkWriteOptions */ + #[DataProvider('provideBulkWriteOptions')] public function testBulkWrite($expected, $options): void { $this->createFixtures(3); @@ -151,7 +152,7 @@ public function testBulkWrite($expected, $options): void ); } - public function provideFindOneAndModifyOptions(): Generator + public static function provideFindOneAndModifyOptions(): Generator { yield 'Default codec' => [ 'expected' => TestObject::createDecodedForFixture(1), @@ -169,7 +170,7 @@ public function provideFindOneAndModifyOptions(): Generator ]; } - /** @dataProvider provideFindOneAndModifyOptions */ + #[DataProvider('provideFindOneAndModifyOptions')] public function testFindOneAndDelete($expected, $options): void { $this->createFixtures(1); @@ -190,7 +191,7 @@ public function testFindOneAndDeleteWithCodecAndTypemap(): void $this->collection->findOneAndDelete(['_id' => 1], $options); } - /** @dataProvider provideFindOneAndModifyOptions */ + #[DataProvider('provideFindOneAndModifyOptions')] public function testFindOneAndUpdate($expected, $options): void { $this->createFixtures(1); @@ -235,7 +236,7 @@ public static function provideFindOneAndReplaceOptions(): Generator ]; } - /** @dataProvider provideFindOneAndReplaceOptions */ + #[DataProvider('provideFindOneAndReplaceOptions')] public function testFindOneAndReplace($expected, $options): void { $this->createFixtures(1); @@ -293,7 +294,7 @@ public static function provideFindOptions(): Generator ]; } - /** @dataProvider provideFindOptions */ + #[DataProvider('provideFindOptions')] public function testFind($expected, $options): void { $this->createFixtures(3); @@ -332,7 +333,7 @@ public static function provideFindOneOptions(): Generator ]; } - /** @dataProvider provideFindOneOptions */ + #[DataProvider('provideFindOneOptions')] public function testFindOne($expected, $options): void { $this->createFixtures(1); @@ -383,7 +384,7 @@ public static function provideInsertManyOptions(): Generator ]; } - /** @dataProvider provideInsertManyOptions */ + #[DataProvider('provideInsertManyOptions')] public function testInsertMany($expected, $options): void { $documents = [ @@ -430,7 +431,7 @@ public static function provideInsertOneOptions(): Generator ]; } - /** @dataProvider provideInsertOneOptions */ + #[DataProvider('provideInsertOneOptions')] public function testInsertOne($expected, $options): void { $result = $this->collection->insertOne(TestObject::createForFixture(1), $options); @@ -475,7 +476,7 @@ public static function provideReplaceOneOptions(): Generator ]; } - /** @dataProvider provideReplaceOneOptions */ + #[DataProvider('provideReplaceOneOptions')] public function testReplaceOne($expected, $options): void { $this->createFixtures(1); diff --git a/tests/Collection/CollectionFunctionalTest.php b/tests/Collection/CollectionFunctionalTest.php index d95b07737..95659381c 100644 --- a/tests/Collection/CollectionFunctionalTest.php +++ b/tests/Collection/CollectionFunctionalTest.php @@ -3,27 +3,30 @@ namespace MongoDB\Tests\Collection; use Closure; -use MongoDB\BSON\Javascript; +use MongoDB\Codec\DocumentCodec; +use MongoDB\Codec\Encoder; use MongoDB\Collection; use MongoDB\Database; use MongoDB\Driver\BulkWrite; +use MongoDB\Driver\Exception\CommandException; use MongoDB\Driver\ReadConcern; use MongoDB\Driver\ReadPreference; use MongoDB\Driver\WriteConcern; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Exception\UnsupportedException; -use MongoDB\MapReduceResult; use MongoDB\Operation\Count; use MongoDB\Tests\CommandObserver; +use PHPUnit\Framework\Attributes\DataProvider; +use ReflectionClass; use TypeError; use function array_filter; use function call_user_func; use function is_scalar; +use function iterator_to_array; use function json_encode; use function str_contains; use function usort; -use function version_compare; use const JSON_THROW_ON_ERROR; @@ -32,7 +35,7 @@ */ class CollectionFunctionalTest extends FunctionalTestCase { - /** @dataProvider provideInvalidDatabaseAndCollectionNames */ + #[DataProvider('provideInvalidDatabaseAndCollectionNames')] public function testConstructorDatabaseNameArgument($databaseName, string $expectedExceptionClass): void { $this->expectException($expectedExceptionClass); @@ -40,7 +43,7 @@ public function testConstructorDatabaseNameArgument($databaseName, string $expec new Collection($this->manager, $databaseName, $this->getCollectionName()); } - /** @dataProvider provideInvalidDatabaseAndCollectionNames */ + #[DataProvider('provideInvalidDatabaseAndCollectionNames')] public function testConstructorCollectionNameArgument($collectionName, string $expectedExceptionClass): void { $this->expectException($expectedExceptionClass); @@ -48,7 +51,7 @@ public function testConstructorCollectionNameArgument($collectionName, string $e new Collection($this->manager, $this->getDatabaseName(), $collectionName); } - public function provideInvalidDatabaseAndCollectionNames() + public static function provideInvalidDatabaseAndCollectionNames() { return [ [null, TypeError::class], @@ -56,24 +59,41 @@ public function provideInvalidDatabaseAndCollectionNames() ]; } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName(), $options); } - public function provideInvalidConstructorOptions(): array + public static function provideInvalidConstructorOptions(): array { - return $this->createOptionDataProvider([ - 'codec' => $this->getInvalidDocumentCodecValues(), - 'readConcern' => $this->getInvalidReadConcernValues(), - 'readPreference' => $this->getInvalidReadPreferenceValues(), - 'typeMap' => $this->getInvalidArrayValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'builderEncoder' => self::getInvalidObjectValues(), + 'codec' => self::getInvalidDocumentCodecValues(), + 'readConcern' => self::getInvalidReadConcernValues(), + 'readPreference' => self::getInvalidReadPreferenceValues(), + 'typeMap' => self::getInvalidArrayValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } + public function testGetBuilderEncoder(): void + { + $collectionOptions = ['builderEncoder' => $this->createMock(Encoder::class)]; + $collection = new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName(), $collectionOptions); + + $this->assertSame($collectionOptions['builderEncoder'], $collection->getBuilderEncoder()); + } + + public function testGetCodec(): void + { + $collectionOptions = ['codec' => $this->createMock(DocumentCodec::class)]; + $collection = new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName(), $collectionOptions); + + $this->assertSame($collectionOptions['codec'], $collection->getCodec()); + } + public function testGetManager(): void { $this->assertSame($this->manager, $this->collection->getManager()); @@ -155,18 +175,18 @@ function (): void { }, function (array $event): void { $command = $event['started']->getCommand(); - $this->assertObjectHasAttribute('comment', $command); - $this->assertObjectHasAttribute('commitQuorum', $command); - $this->assertObjectHasAttribute('lsid', $command); - $this->assertObjectHasAttribute('maxTimeMS', $command); - $this->assertObjectHasAttribute('writeConcern', $command); - $this->assertObjectHasAttribute('sparse', $command->indexes[0]); - $this->assertObjectHasAttribute('unique', $command->indexes[0]); + $this->assertObjectHasProperty('comment', $command); + $this->assertObjectHasProperty('commitQuorum', $command); + $this->assertObjectHasProperty('lsid', $command); + $this->assertObjectHasProperty('maxTimeMS', $command); + $this->assertObjectHasProperty('writeConcern', $command); + $this->assertObjectHasProperty('sparse', $command->indexes[0]); + $this->assertObjectHasProperty('unique', $command->indexes[0]); }, ); } - /** @dataProvider provideTypeMapOptionsAndExpectedDocuments */ + #[DataProvider('provideTypeMapOptionsAndExpectedDocuments')] public function testDistinctWithTypeMap(array $typeMap, array $expectedDocuments): void { $bulkWrite = new BulkWrite(['ordered' => true]); @@ -208,7 +228,7 @@ public function testDistinctWithTypeMap(array $typeMap, array $expectedDocuments $this->assertEquals($expectedDocuments, $values); } - public function provideTypeMapOptionsAndExpectedDocuments() + public static function provideTypeMapOptionsAndExpectedDocuments() { return [ 'No type map' => [ @@ -251,8 +271,7 @@ public function testDrop(): void $writeResult = $this->collection->insertOne(['x' => 1]); $this->assertEquals(1, $writeResult->getInsertedCount()); - $commandResult = $this->collection->drop(); - $this->assertCommandSucceeded($commandResult); + $this->collection->drop(); $this->assertCollectionDoesNotExist($this->getCollectionName()); } @@ -328,8 +347,7 @@ public function testRenameToSameDatabase(): void $writeResult = $this->collection->insertOne(['_id' => 1]); $this->assertEquals(1, $writeResult->getInsertedCount()); - $commandResult = $this->collection->rename($toCollectionName, null, ['dropTarget' => true]); - $this->assertCommandSucceeded($commandResult); + $this->collection->rename($toCollectionName, null, ['dropTarget' => true]); $this->assertCollectionDoesNotExist($this->getCollectionName()); $this->assertCollectionExists($toCollectionName); @@ -357,8 +375,7 @@ public function testRenameToDifferentDatabase(): void $writeResult = $this->collection->insertOne(['_id' => 1]); $this->assertEquals(1, $writeResult->getInsertedCount()); - $commandResult = $this->collection->rename($toCollectionName, $toDatabaseName); - $this->assertCommandSucceeded($commandResult); + $this->collection->rename($toCollectionName, $toDatabaseName); $this->assertCollectionDoesNotExist($this->getCollectionName()); $this->assertCollectionExists($toCollectionName, $toDatabaseName); @@ -370,6 +387,8 @@ public function testRenameToDifferentDatabase(): void public function testWithOptionsInheritsOptions(): void { $collectionOptions = [ + 'builderEncoder' => $this->createMock(Encoder::class), + 'codec' => $this->createMock(DocumentCodec::class), 'readConcern' => new ReadConcern(ReadConcern::LOCAL), 'readPreference' => new ReadPreference(ReadPreference::SECONDARY_PREFERRED), 'typeMap' => ['root' => 'array'], @@ -383,19 +402,26 @@ public function testWithOptionsInheritsOptions(): void $this->assertSame($this->manager, $debug['manager']); $this->assertSame($this->getDatabaseName(), $debug['databaseName']); $this->assertSame($this->getCollectionName(), $debug['collectionName']); - $this->assertInstanceOf(ReadConcern::class, $debug['readConcern']); - $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); - $this->assertInstanceOf(ReadPreference::class, $debug['readPreference']); - $this->assertSame(ReadPreference::SECONDARY_PREFERRED, $debug['readPreference']->getModeString()); - $this->assertIsArray($debug['typeMap']); - $this->assertSame(['root' => 'array'], $debug['typeMap']); - $this->assertInstanceOf(WriteConcern::class, $debug['writeConcern']); - $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); + + foreach ($collectionOptions as $key => $value) { + $this->assertSame($value, $debug[$key]); + } + + // autoEncryptionEnabled is an internal option not reported via debug info + $collection = new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName(), ['autoEncryptionEnabled' => true]); + $clone = $collection->withOptions(); + + $rc = new ReflectionClass($clone); + $rp = $rc->getProperty('autoEncryptionEnabled'); + + $this->assertSame(true, $rp->getValue($clone)); } public function testWithOptionsPassesOptions(): void { $collectionOptions = [ + 'builderEncoder' => $this->createMock(Encoder::class), + 'codec' => $this->createMock(DocumentCodec::class), 'readConcern' => new ReadConcern(ReadConcern::LOCAL), 'readPreference' => new ReadPreference(ReadPreference::SECONDARY_PREFERRED), 'typeMap' => ['root' => 'array'], @@ -405,46 +431,20 @@ public function testWithOptionsPassesOptions(): void $clone = $this->collection->withOptions($collectionOptions); $debug = $clone->__debugInfo(); - $this->assertInstanceOf(ReadConcern::class, $debug['readConcern']); - $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); - $this->assertInstanceOf(ReadPreference::class, $debug['readPreference']); - $this->assertSame(ReadPreference::SECONDARY_PREFERRED, $debug['readPreference']->getModeString()); - $this->assertIsArray($debug['typeMap']); - $this->assertSame(['root' => 'array'], $debug['typeMap']); - $this->assertInstanceOf(WriteConcern::class, $debug['writeConcern']); - $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); - } - - /** - * @group matrix-testing-exclude-server-4.4-driver-4.0 - * @group matrix-testing-exclude-server-4.4-driver-4.2 - * @group matrix-testing-exclude-server-5.0-driver-4.0 - * @group matrix-testing-exclude-server-5.0-driver-4.2 - */ - public function testMapReduce(): void - { - $this->createFixtures(3); - - $map = new Javascript('function() { emit(1, this.x); }'); - $reduce = new Javascript('function(key, values) { return Array.sum(values); }'); - $out = ['inline' => 1]; - - $result = $this->collection->mapReduce($map, $reduce, $out); + foreach ($collectionOptions as $key => $value) { + $this->assertSame($value, $debug[$key]); + } - $this->assertInstanceOf(MapReduceResult::class, $result); - $expected = [ - [ '_id' => 1.0, 'value' => 66.0 ], - ]; + // autoEncryptionEnabled is an internal option not reported via debug info + $clone = $this->collection->withOptions(['autoEncryptionEnabled' => true]); - $this->assertSameDocuments($expected, $result); + $rc = new ReflectionClass($clone); + $rp = $rc->getProperty('autoEncryptionEnabled'); - if (version_compare($this->getServerVersion(), '4.3.0', '<')) { - $this->assertGreaterThanOrEqual(0, $result->getExecutionTimeMS()); - $this->assertNotEmpty($result->getCounts()); - } + $this->assertSame(true, $rp->getValue($clone)); } - public function collectionMethodClosures() + public static function collectionMethodClosures() { return [ 'read-only aggregate' => [ @@ -656,19 +656,6 @@ function($collection, $session, $options = []) { ], */ - /* Disabled, as it's illegal to use mapReduce command in transactions - 'mapReduce' => [ - function($collection, $session, $options = []) { - $collection->mapReduce( - new \MongoDB\BSON\Javascript('function() { emit(this.state, this.pop); }'), - new \MongoDB\BSON\Javascript('function(key, values) { return Array.sum(values) }'), - ['inline' => 1], - ['session' => $session] + $options - ); - }, 'rw' - ], - */ - 'replaceOne' => [ function ($collection, $session, $options = []): void { $collection->replaceOne( @@ -712,23 +699,23 @@ function($collection, $session, $options = []) { ]; } - public function collectionReadMethodClosures(): array + public static function collectionReadMethodClosures(): array { return array_filter( - $this->collectionMethodClosures(), + self::collectionMethodClosures(), fn ($rw) => str_contains($rw[1], 'r'), ); } - public function collectionWriteMethodClosures(): array + public static function collectionWriteMethodClosures(): array { return array_filter( - $this->collectionMethodClosures(), + self::collectionMethodClosures(), fn ($rw) => str_contains($rw[1], 'w'), ); } - /** @dataProvider collectionMethodClosures */ + #[DataProvider('collectionMethodClosures')] public function testMethodDoesNotInheritReadWriteConcernInTransaction(Closure $method): void { $this->skipIfTransactionsAreNotSupported(); @@ -748,13 +735,13 @@ function () use ($method, $collection, $session): void { call_user_func($method, $collection, $session); }, function (array $event): void { - $this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand()); - $this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('readConcern', $event['started']->getCommand()); }, ); } - /** @dataProvider collectionWriteMethodClosures */ + #[DataProvider('collectionWriteMethodClosures')] public function testMethodInTransactionWithWriteConcernOption($method): void { $this->skipIfTransactionsAreNotSupported(); @@ -765,7 +752,7 @@ public function testMethodInTransactionWithWriteConcernOption($method): void $session->startTransaction(); $this->expectException(UnsupportedException::class); - $this->expectExceptionMessage('"writeConcern" option cannot be specified within a transaction'); + $this->expectExceptionMessage('Cannot set write concern after starting a transaction'); try { call_user_func($method, $this->collection, $session, ['writeConcern' => new WriteConcern(1)]); @@ -774,7 +761,7 @@ public function testMethodInTransactionWithWriteConcernOption($method): void } } - /** @dataProvider collectionReadMethodClosures */ + #[DataProvider('collectionReadMethodClosures')] public function testMethodInTransactionWithReadConcernOption($method): void { $this->skipIfTransactionsAreNotSupported(); @@ -785,7 +772,7 @@ public function testMethodInTransactionWithReadConcernOption($method): void $session->startTransaction(); $this->expectException(UnsupportedException::class); - $this->expectExceptionMessage('"readConcern" option cannot be specified within a transaction'); + $this->expectExceptionMessage('Cannot set read concern after starting a transaction'); try { call_user_func($method, $this->collection, $session, ['readConcern' => new ReadConcern(ReadConcern::LOCAL)]); @@ -794,6 +781,32 @@ public function testMethodInTransactionWithReadConcernOption($method): void } } + public function testListSearchIndexesInheritTypeMap(): void + { + $this->skipIfAtlasSearchIndexIsNotSupported(); + + $collection = new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName(), ['typeMap' => ['root' => 'array']]); + + // Insert a document to create the collection + $collection->insertOne(['_id' => 1]); + + try { + $collection->createSearchIndex(['mappings' => ['dynamic' => false]], ['name' => 'test-search-index']); + } catch (CommandException $e) { + // Ignore duplicate errors in case this test is re-run too quickly + // Index is asynchronously dropped during tearDown, we only need to + // ensure it exists for this test. + if ($e->getCode() !== 68 /* IndexAlreadyExists */) { + throw $e; + } + } + + $indexes = $collection->listSearchIndexes(); + $indexes = iterator_to_array($indexes); + $this->assertCount(1, $indexes); + $this->assertIsArray($indexes[0]); + } + /** * Create data fixtures. */ @@ -804,7 +817,7 @@ private function createFixtures(int $n, array $executeBulkWriteOptions = []): vo for ($i = 1; $i <= $n; $i++) { $bulkWrite->insert([ '_id' => $i, - 'x' => (integer) ($i . $i), + 'x' => (int) ($i . $i), ]); } diff --git a/tests/Command/ListCollectionsTest.php b/tests/Command/ListCollectionsTest.php index 78c90afa6..54ab1bbe3 100644 --- a/tests/Command/ListCollectionsTest.php +++ b/tests/Command/ListCollectionsTest.php @@ -5,23 +5,24 @@ use MongoDB\Command\ListCollections; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Tests\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class ListCollectionsTest extends TestCase { - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new ListCollections($this->getDatabaseName(), $options); } - public function provideInvalidConstructorOptions(): array + public static function provideInvalidConstructorOptions(): array { - return $this->createOptionDataProvider([ - 'authorizedCollections' => $this->getInvalidBooleanValues(), - 'filter' => $this->getInvalidDocumentValues(), - 'maxTimeMS' => $this->getInvalidIntegerValues(), - 'session' => $this->getInvalidSessionValues(), + return self::createOptionDataProvider([ + 'authorizedCollections' => self::getInvalidBooleanValues(), + 'filter' => self::getInvalidDocumentValues(), + 'maxTimeMS' => self::getInvalidIntegerValues(), + 'session' => self::getInvalidSessionValues(), ]); } } diff --git a/tests/Command/ListDatabasesTest.php b/tests/Command/ListDatabasesTest.php index 92de68afd..f436bdb0d 100644 --- a/tests/Command/ListDatabasesTest.php +++ b/tests/Command/ListDatabasesTest.php @@ -5,24 +5,25 @@ use MongoDB\Command\ListDatabases; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Tests\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class ListDatabasesTest extends TestCase { - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new ListDatabases($options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'authorizedDatabases' => $this->getInvalidBooleanValues(), - 'filter' => $this->getInvalidDocumentValues(), - 'maxTimeMS' => $this->getInvalidIntegerValues(), - 'nameOnly' => $this->getInvalidBooleanValues(), - 'session' => $this->getInvalidSessionValues(), + return self::createOptionDataProvider([ + 'authorizedDatabases' => self::getInvalidBooleanValues(), + 'filter' => self::getInvalidDocumentValues(), + 'maxTimeMS' => self::getInvalidIntegerValues(), + 'nameOnly' => self::getInvalidBooleanValues(), + 'session' => self::getInvalidSessionValues(), ]); } } diff --git a/tests/Comparator/Int64Comparator.php b/tests/Comparator/Int64Comparator.php index c786aa919..83cc6621e 100644 --- a/tests/Comparator/Int64Comparator.php +++ b/tests/Comparator/Int64Comparator.php @@ -5,13 +5,14 @@ use MongoDB\BSON\Int64; use SebastianBergmann\Comparator\Comparator; use SebastianBergmann\Comparator\ComparisonFailure; +use SebastianBergmann\Exporter\Exporter; use function is_numeric; use function sprintf; class Int64Comparator extends Comparator { - public function accepts($expected, $actual) + public function accepts($expected, $actual): bool { // Only compare if either value is an Int64 and the other value is numeric return ($expected instanceof Int64 && $this->isComparable($actual)) @@ -24,16 +25,17 @@ public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = f return; } + $exporter = new Exporter(); + throw new ComparisonFailure( $expected, $actual, '', '', - false, sprintf( 'Failed asserting that %s matches expected %s.', - $this->exporter->export($actual), - $this->exporter->export($expected), + $exporter->export($actual), + $exporter->export($expected), ), ); } diff --git a/tests/Comparator/Int64ComparatorTest.php b/tests/Comparator/Int64ComparatorTest.php index 9e85964c2..308b9cec7 100644 --- a/tests/Comparator/Int64ComparatorTest.php +++ b/tests/Comparator/Int64ComparatorTest.php @@ -4,12 +4,14 @@ use Generator; use MongoDB\BSON\Int64; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; use PHPUnit\Framework\TestCase; use SebastianBergmann\Comparator\ComparisonFailure; class Int64ComparatorTest extends TestCase { - /** @dataProvider provideAcceptsValues */ + #[DataProvider('provideAcceptsValues')] public function testAccepts(bool $expectedResult, $expectedValue, $actualValue): void { $this->assertSame($expectedResult, (new Int64Comparator())->accepts($expectedValue, $actualValue)); @@ -96,10 +98,8 @@ public static function provideAcceptsValues(): Generator ]; } - /** - * @dataProvider provideMatchingAssertions - * @doesNotPerformAssertions - */ + #[DataProvider('provideMatchingAssertions')] + #[DoesNotPerformAssertions] public function testMatchingAssertions($expected, $actual): void { (new Int64Comparator())->assertEquals($expected, $actual); @@ -153,7 +153,7 @@ public static function provideMatchingAssertions(): Generator ]; } - /** @dataProvider provideFailingValues */ + #[DataProvider('provideFailingValues')] public function testFailingAssertions($expected, $actual): void { $this->expectException(ComparisonFailure::class); diff --git a/tests/Comparator/ServerComparator.php b/tests/Comparator/ServerComparator.php index 54b109795..28c958593 100644 --- a/tests/Comparator/ServerComparator.php +++ b/tests/Comparator/ServerComparator.php @@ -10,7 +10,7 @@ class ServerComparator extends Comparator { - public function accepts($expected, $actual) + public function accepts($expected, $actual): bool { return $expected instanceof Server && $actual instanceof Server; } @@ -26,7 +26,6 @@ public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = f $actual, '', '', - false, sprintf( 'Failed asserting that Server("%s:%d") matches expected Server("%s:%d").', $actual->getHost(), diff --git a/tests/Database/BuilderDatabaseFunctionalTest.php b/tests/Database/BuilderDatabaseFunctionalTest.php new file mode 100644 index 000000000..491d2ccc1 --- /dev/null +++ b/tests/Database/BuilderDatabaseFunctionalTest.php @@ -0,0 +1,70 @@ +dropCollection($this->getDatabaseName(), $this->getCollectionName()); + + parent::tearDown(); + } + + #[TestWith([true])] + #[TestWith([false])] + public function testAggregate(bool $pipelineAsArray): void + { + $this->skipIfServerVersion('<', '6.0.0', '$documents stage is not supported'); + + $pipeline = [ + Stage::documents([ + ['x' => 1], + ['x' => 2], + ['x' => 3], + ]), + Stage::bucketAuto( + groupBy: Expression::intFieldPath('x'), + buckets: 2, + ), + ]; + + if (! $pipelineAsArray) { + $pipeline = new Pipeline(...$pipeline); + } + + $results = $this->database->aggregate($pipeline)->toArray(); + $this->assertCount(2, $results); + } + + #[TestWith([true])] + #[TestWith([false])] + public function testWatch(bool $pipelineAsArray): void + { + $this->skipIfChangeStreamIsNotSupported(); + + if ($this->isShardedCluster()) { + $this->markTestSkipped('Test does not apply on sharded clusters: need more than a single getMore call on the change stream.'); + } + + $pipeline = [ + Stage::match(operationType: Query::eq('insert')), + ]; + + if (! $pipelineAsArray) { + $pipeline = new Pipeline(...$pipeline); + } + + $changeStream = $this->database->watch($pipeline); + $this->database->selectCollection($this->getCollectionName())->insertOne(['x' => 3]); + $changeStream->next(); + $this->assertTrue($changeStream->valid()); + $this->assertEquals('insert', $changeStream->current()->operationType); + } +} diff --git a/tests/Database/CollectionManagementFunctionalTest.php b/tests/Database/CollectionManagementFunctionalTest.php index 485bcd8e5..dc5b49974 100644 --- a/tests/Database/CollectionManagementFunctionalTest.php +++ b/tests/Database/CollectionManagementFunctionalTest.php @@ -2,9 +2,9 @@ namespace MongoDB\Tests\Database; +use Iterator; use MongoDB\Driver\BulkWrite; use MongoDB\Model\CollectionInfo; -use MongoDB\Model\CollectionInfoIterator; /** * Functional tests for collection management methods. @@ -16,8 +16,7 @@ public function testCreateCollection(): void $that = $this; $basicCollectionName = $this->getCollectionName() . '.basic'; - $commandResult = $this->database->createCollection($basicCollectionName); - $this->assertCommandSucceeded($commandResult); + $this->database->createCollection($basicCollectionName); $this->assertCollectionExists($basicCollectionName, null, function (CollectionInfo $info) use ($that): void { $that->assertFalse($info->isCapped()); }); @@ -29,8 +28,7 @@ public function testCreateCollection(): void 'size' => 1_048_576, ]; - $commandResult = $this->database->createCollection($cappedCollectionName, $cappedCollectionOptions); - $this->assertCommandSucceeded($commandResult); + $this->database->createCollection($cappedCollectionName, $cappedCollectionOptions); $this->assertCollectionExists($cappedCollectionName, null, function (CollectionInfo $info) use ($that): void { $that->assertTrue($info->isCapped()); $that->assertEquals(100, $info->getCappedMax()); @@ -46,18 +44,16 @@ public function testDropCollection(): void $writeResult = $this->manager->executeBulkWrite($this->getNamespace(), $bulkWrite); $this->assertEquals(1, $writeResult->getInsertedCount()); - $commandResult = $this->database->dropCollection($this->getCollectionName()); - $this->assertCommandSucceeded($commandResult); + $this->database->dropCollection($this->getCollectionName()); $this->assertCollectionCount($this->getNamespace(), 0); } public function testListCollections(): void { - $commandResult = $this->database->createCollection($this->getCollectionName()); - $this->assertCommandSucceeded($commandResult); + $this->database->createCollection($this->getCollectionName()); $collections = $this->database->listCollections(); - $this->assertInstanceOf(CollectionInfoIterator::class, $collections); + $this->assertInstanceOf(Iterator::class, $collections); foreach ($collections as $collection) { $this->assertInstanceOf(CollectionInfo::class, $collection); @@ -66,14 +62,13 @@ public function testListCollections(): void public function testListCollectionsWithFilter(): void { - $commandResult = $this->database->createCollection($this->getCollectionName()); - $this->assertCommandSucceeded($commandResult); + $this->database->createCollection($this->getCollectionName()); $collectionName = $this->getCollectionName(); $options = ['filter' => ['name' => $collectionName]]; $collections = $this->database->listCollections($options); - $this->assertInstanceOf(CollectionInfoIterator::class, $collections); + $this->assertInstanceOf(Iterator::class, $collections); foreach ($collections as $collection) { $this->assertInstanceOf(CollectionInfo::class, $collection); @@ -83,8 +78,7 @@ public function testListCollectionsWithFilter(): void public function testListCollectionNames(): void { - $commandResult = $this->database->createCollection($this->getCollectionName()); - $this->assertCommandSucceeded($commandResult); + $this->database->createCollection($this->getCollectionName()); $collections = $this->database->listCollectionNames(); @@ -95,8 +89,7 @@ public function testListCollectionNames(): void public function testListCollectionNamesWithFilter(): void { - $commandResult = $this->database->createCollection($this->getCollectionName()); - $this->assertCommandSucceeded($commandResult); + $this->database->createCollection($this->getCollectionName()); $collectionName = $this->getCollectionName(); $options = ['filter' => ['name' => $collectionName]]; diff --git a/tests/Database/DatabaseFunctionalTest.php b/tests/Database/DatabaseFunctionalTest.php index c5854e882..7f4e564c2 100644 --- a/tests/Database/DatabaseFunctionalTest.php +++ b/tests/Database/DatabaseFunctionalTest.php @@ -2,6 +2,8 @@ namespace MongoDB\Tests\Database; +use MongoDB\BSON\PackedArray; +use MongoDB\Codec\Encoder; use MongoDB\Collection; use MongoDB\Database; use MongoDB\Driver\BulkWrite; @@ -11,6 +13,9 @@ use MongoDB\Driver\WriteConcern; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\CreateIndexes; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use ReflectionClass; use TypeError; use function array_key_exists; @@ -21,7 +26,7 @@ */ class DatabaseFunctionalTest extends FunctionalTestCase { - /** @dataProvider provideInvalidDatabaseNames */ + #[DataProvider('provideInvalidDatabaseNames')] public function testConstructorDatabaseNameArgument($databaseName, string $expectedExceptionClass): void { $this->expectException($expectedExceptionClass); @@ -29,7 +34,7 @@ public function testConstructorDatabaseNameArgument($databaseName, string $expec new Database($this->manager, $databaseName); } - public function provideInvalidDatabaseNames() + public static function provideInvalidDatabaseNames() { return [ [null, TypeError::class], @@ -37,20 +42,21 @@ public function provideInvalidDatabaseNames() ]; } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new Database($this->manager, $this->getDatabaseName(), $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'readConcern' => $this->getInvalidReadConcernValues(), - 'readPreference' => $this->getInvalidReadPreferenceValues(), - 'typeMap' => $this->getInvalidArrayValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'builderEncoder' => self::getInvalidObjectValues(), + 'readConcern' => self::getInvalidReadConcernValues(), + 'readPreference' => self::getInvalidReadPreferenceValues(), + 'typeMap' => self::getInvalidArrayValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } @@ -82,7 +88,7 @@ public function testCommand(): void $commandResult = current($cursor->toArray()); $this->assertCommandSucceeded($commandResult); - $this->assertObjectHasAttribute('ok', $commandResult); + $this->assertObjectHasProperty('ok', $commandResult); $this->assertSame(1, (int) $commandResult->ok); } @@ -121,10 +127,10 @@ public function testCommandAppliesTypeMapToCursor(): void $this->assertSame(1, (int) $commandResult['ok']); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testCommandCommandArgumentTypeCheck($command): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($command instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); $this->database->command($command); } @@ -136,8 +142,7 @@ public function testDrop(): void $writeResult = $this->manager->executeBulkWrite($this->getNamespace(), $bulkWrite); $this->assertEquals(1, $writeResult->getInsertedCount()); - $commandResult = $this->database->drop(); - $this->assertCommandSucceeded($commandResult); + $this->database->drop(); $this->assertCollectionCount($this->getNamespace(), 0); } @@ -149,8 +154,7 @@ public function testDropCollection(): void $writeResult = $this->manager->executeBulkWrite($this->getNamespace(), $bulkWrite); $this->assertEquals(1, $writeResult->getInsertedCount()); - $commandResult = $this->database->dropCollection($this->getCollectionName()); - $this->assertCommandSucceeded($commandResult); + $this->database->dropCollection($this->getCollectionName()); $this->assertCollectionDoesNotExist($this->getCollectionName()); } @@ -169,11 +173,9 @@ public function testGetSelectsCollectionAndInheritsOptions(): void $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); } - /** - * @group matrix-testing-exclude-server-4.2-driver-4.0-topology-sharded_cluster - * @group matrix-testing-exclude-server-4.4-driver-4.0-topology-sharded_cluster - * @group matrix-testing-exclude-server-5.0-driver-4.0-topology-sharded_cluster - */ + #[Group('matrix-testing-exclude-server-4.2-driver-4.0-topology-sharded_cluster')] + #[Group('matrix-testing-exclude-server-4.4-driver-4.0-topology-sharded_cluster')] + #[Group('matrix-testing-exclude-server-5.0-driver-4.0-topology-sharded_cluster')] public function testModifyCollection(): void { $this->database->createCollection($this->getCollectionName()); @@ -218,13 +220,12 @@ public function testRenameCollectionToSameDatabase(): void $writeResult = $this->manager->executeBulkWrite($this->getNamespace(), $bulkWrite); $this->assertEquals(1, $writeResult->getInsertedCount()); - $commandResult = $this->database->renameCollection( + $this->database->renameCollection( $this->getCollectionName(), $toCollectionName, null, ['dropTarget' => true], ); - $this->assertCommandSucceeded($commandResult); $this->assertCollectionDoesNotExist($this->getCollectionName()); $this->assertCollectionExists($toCollectionName); @@ -255,12 +256,11 @@ public function testRenameCollectionToDifferentDatabase(): void $writeResult = $this->manager->executeBulkWrite($this->getNamespace(), $bulkWrite); $this->assertEquals(1, $writeResult->getInsertedCount()); - $commandResult = $this->database->renameCollection( + $this->database->renameCollection( $this->getCollectionName(), $toCollectionName, $toDatabaseName, ); - $this->assertCommandSucceeded($commandResult); $this->assertCollectionDoesNotExist($this->getCollectionName()); $this->assertCollectionExists($toCollectionName, $toDatabaseName); @@ -369,6 +369,7 @@ public function testSelectGridFSBucketPassesOptions(): void public function testWithOptionsInheritsOptions(): void { $databaseOptions = [ + 'builderEncoder' => $this->createMock(Encoder::class), 'readConcern' => new ReadConcern(ReadConcern::LOCAL), 'readPreference' => new ReadPreference(ReadPreference::SECONDARY_PREFERRED), 'typeMap' => ['root' => 'array'], @@ -381,19 +382,25 @@ public function testWithOptionsInheritsOptions(): void $this->assertSame($this->manager, $debug['manager']); $this->assertSame($this->getDatabaseName(), $debug['databaseName']); - $this->assertInstanceOf(ReadConcern::class, $debug['readConcern']); - $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); - $this->assertInstanceOf(ReadPreference::class, $debug['readPreference']); - $this->assertSame(ReadPreference::SECONDARY_PREFERRED, $debug['readPreference']->getModeString()); - $this->assertIsArray($debug['typeMap']); - $this->assertSame(['root' => 'array'], $debug['typeMap']); - $this->assertInstanceOf(WriteConcern::class, $debug['writeConcern']); - $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); + + foreach ($databaseOptions as $key => $value) { + $this->assertSame($value, $debug[$key]); + } + + // autoEncryptionEnabled is an internal option not reported via debug info + $database = new Database($this->manager, $this->getDatabaseName(), ['autoEncryptionEnabled' => true]); + $clone = $database->withOptions(); + + $rc = new ReflectionClass($clone); + $rp = $rc->getProperty('autoEncryptionEnabled'); + + $this->assertSame(true, $rp->getValue($clone)); } public function testWithOptionsPassesOptions(): void { $databaseOptions = [ + 'builderEncoder' => $this->createMock(Encoder::class), 'readConcern' => new ReadConcern(ReadConcern::LOCAL), 'readPreference' => new ReadPreference(ReadPreference::SECONDARY_PREFERRED), 'typeMap' => ['root' => 'array'], @@ -403,13 +410,16 @@ public function testWithOptionsPassesOptions(): void $clone = $this->database->withOptions($databaseOptions); $debug = $clone->__debugInfo(); - $this->assertInstanceOf(ReadConcern::class, $debug['readConcern']); - $this->assertSame(ReadConcern::LOCAL, $debug['readConcern']->getLevel()); - $this->assertInstanceOf(ReadPreference::class, $debug['readPreference']); - $this->assertSame(ReadPreference::SECONDARY_PREFERRED, $debug['readPreference']->getModeString()); - $this->assertIsArray($debug['typeMap']); - $this->assertSame(['root' => 'array'], $debug['typeMap']); - $this->assertInstanceOf(WriteConcern::class, $debug['writeConcern']); - $this->assertSame(WriteConcern::MAJORITY, $debug['writeConcern']->getW()); + foreach ($databaseOptions as $key => $value) { + $this->assertSame($value, $debug[$key]); + } + + // autoEncryptionEnabled is an internal option not reported via debug info + $clone = $this->database->withOptions(['autoEncryptionEnabled' => true]); + + $rc = new ReflectionClass($clone); + $rp = $rc->getProperty('autoEncryptionEnabled'); + + $this->assertSame(true, $rp->getValue($clone)); } } diff --git a/tests/DocumentationExamplesTest.php b/tests/DocumentationExamplesTest.php index 8d4062c57..c5876bebe 100644 --- a/tests/DocumentationExamplesTest.php +++ b/tests/DocumentationExamplesTest.php @@ -12,6 +12,8 @@ use MongoDB\Driver\Exception\Exception; use MongoDB\Driver\ReadPreference; use MongoDB\Tests\SpecTests\ClientSideEncryptionSpecTest; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; +use PHPUnit\Framework\Attributes\Group; use function base64_decode; use function in_array; @@ -591,7 +593,7 @@ public function testExample_42_50(): void $this->assertCount(3, $documents); foreach ($documents as $document) { foreach (['_id', 'item', 'status', 'size', 'instock'] as $field) { - $this->assertObjectHasAttribute($field, $document); + $this->assertObjectHasProperty($field, $document); } } @@ -606,11 +608,11 @@ public function testExample_42_50(): void $this->assertCount(3, $documents); foreach ($documents as $document) { foreach (['_id', 'item', 'status'] as $field) { - $this->assertObjectHasAttribute($field, $document); + $this->assertObjectHasProperty($field, $document); } foreach (['size', 'instock'] as $field) { - $this->assertObjectNotHasAttribute($field, $document); + $this->assertObjectNotHasProperty($field, $document); } } @@ -625,11 +627,11 @@ public function testExample_42_50(): void $this->assertCount(3, $documents); foreach ($documents as $document) { foreach (['item', 'status'] as $field) { - $this->assertObjectHasAttribute($field, $document); + $this->assertObjectHasProperty($field, $document); } foreach (['_id', 'size', 'instock'] as $field) { - $this->assertObjectNotHasAttribute($field, $document); + $this->assertObjectNotHasProperty($field, $document); } } @@ -644,11 +646,11 @@ public function testExample_42_50(): void $this->assertCount(3, $documents); foreach ($documents as $document) { foreach (['_id', 'item', 'size'] as $field) { - $this->assertObjectHasAttribute($field, $document); + $this->assertObjectHasProperty($field, $document); } foreach (['status', 'instock'] as $field) { - $this->assertObjectNotHasAttribute($field, $document); + $this->assertObjectNotHasProperty($field, $document); } } @@ -663,13 +665,13 @@ public function testExample_42_50(): void $this->assertCount(3, $documents); foreach ($documents as $document) { foreach (['_id', 'item', 'status', 'size'] as $field) { - $this->assertObjectHasAttribute($field, $document); + $this->assertObjectHasProperty($field, $document); } - $this->assertObjectNotHasAttribute('instock', $document); - $this->assertObjectHasAttribute('uom', $document->size); - $this->assertObjectNotHasAttribute('h', $document->size); - $this->assertObjectNotHasAttribute('w', $document->size); + $this->assertObjectNotHasProperty('instock', $document); + $this->assertObjectHasProperty('uom', $document->size); + $this->assertObjectNotHasProperty('h', $document->size); + $this->assertObjectNotHasProperty('w', $document->size); } // Start Example 48 @@ -683,12 +685,12 @@ public function testExample_42_50(): void $this->assertCount(3, $documents); foreach ($documents as $document) { foreach (['_id', 'item', 'status', 'size', 'instock'] as $field) { - $this->assertObjectHasAttribute($field, $document); + $this->assertObjectHasProperty($field, $document); } - $this->assertObjectHasAttribute('h', $document->size); - $this->assertObjectHasAttribute('w', $document->size); - $this->assertObjectNotHasAttribute('uom', $document->size); + $this->assertObjectHasProperty('h', $document->size); + $this->assertObjectHasProperty('w', $document->size); + $this->assertObjectNotHasProperty('uom', $document->size); } // Start Example 49 @@ -702,13 +704,13 @@ public function testExample_42_50(): void $this->assertCount(3, $documents); foreach ($documents as $document) { foreach (['_id', 'item', 'status', 'instock'] as $field) { - $this->assertObjectHasAttribute($field, $document); + $this->assertObjectHasProperty($field, $document); } - $this->assertObjectNotHasAttribute('size', $document); + $this->assertObjectNotHasProperty('size', $document); foreach ($document->instock as $instock) { - $this->assertObjectHasAttribute('qty', $instock); - $this->assertObjectNotHasAttribute('warehouse', $instock); + $this->assertObjectHasProperty('qty', $instock); + $this->assertObjectNotHasProperty('warehouse', $instock); } } @@ -723,10 +725,10 @@ public function testExample_42_50(): void $this->assertCount(3, $documents); foreach ($documents as $document) { foreach (['_id', 'item', 'status', 'instock'] as $field) { - $this->assertObjectHasAttribute($field, $document); + $this->assertObjectHasProperty($field, $document); } - $this->assertObjectNotHasAttribute('size', $document); + $this->assertObjectNotHasProperty('size', $document); $this->assertCount(1, $document->instock); } } @@ -786,10 +788,10 @@ public function testAggregationProjectionExample_1(): void $this->assertCount(3, $documents); foreach ($documents as $document) { foreach (['item', 'status', 'area', 'reportNumber'] as $field) { - $this->assertObjectHasAttribute($field, $document); + $this->assertObjectHasProperty($field, $document); } - $this->assertObjectNotHasAttribute('_id', $document); + $this->assertObjectNotHasProperty('_id', $document); $this->assertIsString($document->status); $this->assertIsString($document->area); $this->assertSame(1, $document->reportNumber); @@ -1009,7 +1011,7 @@ public function testExample_55_58(): void $this->assertInventoryCount(0); } - /** @group matrix-testing-exclude-server-5.0-driver-4.0-topology-sharded_cluster */ + #[Group('matrix-testing-exclude-server-5.0-driver-4.0-topology-sharded_cluster')] public function testChangeStreamExample_1_4(): void { $this->skipIfChangeStreamIsNotSupported(); @@ -1501,7 +1503,7 @@ private function doUpdateEmployeeInfo(\MongoDB\Client $client): void try { $this->runTransactionWithRetry3([$this, 'updateEmployeeInfo3'], $client, $session); - } catch (\MongoDB\Driver\Exception\Exception $error) { + } catch (\MongoDB\Driver\Exception\Exception) { // Do something with error } } @@ -1547,7 +1549,7 @@ public function testCausalConsistency(): void * around this, we run a query on a secondary and rely on an * exception to let us know that no secondary is available. */ $items->countDocuments([], ['readPreference' => new ReadPreference(ReadPreference::SECONDARY)]); - } catch (Exception $e) { + } catch (Exception) { $this->markTestSkipped('Secondary is not available'); } @@ -1715,7 +1717,7 @@ public function testSnapshotQueries(): void $this->assertSame(1, $totalDailySales); } - /** @doesNotPerformAssertions */ + #[DoesNotPerformAssertions] public function testVersionedApi(): void { $uriString = static::getUri(true); @@ -1800,7 +1802,7 @@ public function testVersionedApiMigration(): void // phpcs:enable } - /** @doesNotPerformAssertions */ + #[DoesNotPerformAssertions] public function testWithTransactionExample(): void { $this->skipIfTransactionsAreNotSupported(); diff --git a/tests/ExamplesTest.php b/tests/ExamplesTest.php index aa3e8580e..78ade169c 100644 --- a/tests/ExamplesTest.php +++ b/tests/ExamplesTest.php @@ -3,6 +3,9 @@ namespace MongoDB\Tests; use Generator; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use function bin2hex; use function getenv; @@ -10,7 +13,7 @@ use function random_bytes; use function sprintf; -/** @runTestsInSeparateProcesses */ +#[RunTestsInSeparateProcesses] final class ExamplesTest extends FunctionalTestCase { public function setUp(): void @@ -26,7 +29,7 @@ public function setUp(): void } } - /** @dataProvider provideExamples */ + #[DataProvider('provideExamples')] public function testExamples(string $file, string $expectedOutput): void { $this->assertExampleOutput($file, $expectedOutput); @@ -144,7 +147,6 @@ public static function provideExamples(): Generator [oid] => %s ) - [name] => alcaeus [emails] => Array ( [0] => MongoDB\Examples\Persistable\PersistableEmail Object @@ -161,6 +163,7 @@ public static function provideExamples(): Generator ) + [name] => alcaeus ) OUTPUT; @@ -221,11 +224,10 @@ public static function provideExamples(): Generator } /** - * MongoDB Atlas Search example requires a MongoDB Atlas M10+ cluster with MongoDB 7.0+ + * MongoDB Atlas Search example requires a MongoDB Atlas cluster with MongoDB 7.0+ * Tips for insiders: if using a cloud-dev server, append ".mongodb.net" to the MONGODB_URI. - * - * @group atlas */ + #[Group('atlas')] public function testAtlasSearch(): void { $uri = getenv('MONGODB_URI') ?? ''; diff --git a/tests/Exception/InvalidArgumentExceptionTest.php b/tests/Exception/InvalidArgumentExceptionTest.php index c4ab90a1d..95ce89061 100644 --- a/tests/Exception/InvalidArgumentExceptionTest.php +++ b/tests/Exception/InvalidArgumentExceptionTest.php @@ -5,17 +5,18 @@ use AssertionError; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Tests\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class InvalidArgumentExceptionTest extends TestCase { - /** @dataProvider provideExpectedTypes */ + #[DataProvider('provideExpectedTypes')] public function testExpectedTypeFormatting($expectedType, $typeString): void { $e = InvalidArgumentException::invalidType('$arg', null, $expectedType); $this->assertStringContainsString($typeString, $e->getMessage()); } - public function provideExpectedTypes() + public static function provideExpectedTypes() { yield 'expectedType is a string' => [ 'array', diff --git a/tests/FunctionalTestCase.php b/tests/FunctionalTestCase.php index 53d1c3558..156d80149 100644 --- a/tests/FunctionalTestCase.php +++ b/tests/FunctionalTestCase.php @@ -24,7 +24,6 @@ use function count; use function current; use function explode; -use function filter_var; use function getenv; use function implode; use function in_array; @@ -46,7 +45,6 @@ use function version_compare; use const DIRECTORY_SEPARATOR; -use const FILTER_VALIDATE_BOOLEAN; use const INFO_MODULES; use const PATH_SEPARATOR; @@ -71,7 +69,7 @@ public function setUp(): void public function tearDown(): void { - if (! $this->hasFailed()) { + if ($this->status()->isSuccess()) { $this->cleanupCollections(); } @@ -85,7 +83,7 @@ public static function createTestClient(?string $uri = null, array $options = [] return new Client( $uri ?? static::getUri(), static::appendAuthenticationOptions($options), - static::appendServerApiOption($driverOptions), + static::appendDriverOptions($driverOptions), ); } @@ -94,7 +92,7 @@ public static function createTestManager(?string $uri = null, array $options = [ return new Manager( $uri ?? static::getUri(), static::appendAuthenticationOptions($options), - static::appendServerApiOption($driverOptions), + static::appendDriverOptions($driverOptions), ); } @@ -213,12 +211,8 @@ protected function assertSameObjectId($expectedObjectId, $actualObjectId): void * @param array|stdClass $command configureFailPoint command document * @throws InvalidArgumentException if $command is not a configureFailPoint command */ - public function configureFailPoint($command, ?Server $server = null): void + public function configureFailPoint(array|stdClass $command, ?Server $server = null): void { - if (! $this->isFailCommandSupported()) { - $this->markTestSkipped('failCommand is only supported on mongod >= 4.0.0 and mongos >= 4.1.5.'); - } - if (! $this->isFailCommandEnabled()) { $this->markTestSkipped('The enableTestCommands parameter is not enabled.'); } @@ -238,10 +232,7 @@ public function configureFailPoint($command, ?Server $server = null): void $failPointServer = $server ?: $this->getPrimaryServer(); $operation = new DatabaseCommand('admin', $command); - $cursor = $operation->execute($failPointServer); - $result = $cursor->toArray()[0]; - - $this->assertCommandSucceeded($result); + $operation->execute($failPointServer); // Record the fail point so it can be disabled during tearDown() $this->configuredFailPoints[] = [$command->configureFailPoint, $failPointServer]; @@ -330,7 +321,7 @@ protected function getFeatureCompatibilityVersion(?ReadPreference $readPreferenc $cursor = $this->manager->executeCommand( 'admin', new Command(['getParameter' => 1, 'featureCompatibilityVersion' => 1]), - $readPreference ?: new ReadPreference(ReadPreference::PRIMARY), + ['readPreference' => $readPreference ?: new ReadPreference(ReadPreference::PRIMARY)], ); $cursor->setTypeMap(['root' => 'array', 'document' => 'array']); @@ -353,7 +344,7 @@ protected function getServerVersion(?ReadPreference $readPreference = null) $buildInfo = $this->manager->executeCommand( $this->getDatabaseName(), new Command(['buildInfo' => 1]), - $readPreference ?: new ReadPreference(ReadPreference::PRIMARY), + ['readPreference' => $readPreference ?: new ReadPreference(ReadPreference::PRIMARY)], )->toArray()[0]; if (isset($buildInfo->version) && is_string($buildInfo->version)) { @@ -368,7 +359,7 @@ protected function getServerStorageEngine(?ReadPreference $readPreference = null $cursor = $this->manager->executeCommand( $this->getDatabaseName(), new Command(['serverStatus' => 1]), - $readPreference ?: new ReadPreference(ReadPreference::PRIMARY), + ['readPreference' => $readPreference ?: new ReadPreference(ReadPreference::PRIMARY)], ); $result = current($cursor->toArray()); @@ -393,7 +384,7 @@ protected function isApiVersionRequired(): bool ); $document = current($cursor->toArray()); - } catch (CommandException $e) { + } catch (CommandException) { return false; } @@ -420,16 +411,6 @@ protected function isStandalone() return $this->getPrimaryServer()->getType() == Server::TYPE_STANDALONE; } - /** - * Return whether serverless (i.e. proxy as mongos) is being utilized. - */ - protected static function isServerless(): bool - { - $isServerless = getenv('MONGODB_IS_SERVERLESS'); - - return $isServerless !== false ? filter_var($isServerless, FILTER_VALIDATE_BOOLEAN) : false; - } - protected function isShardedCluster() { $type = $this->getPrimaryServer()->getType(); @@ -453,6 +434,15 @@ protected function skipIfServerVersion(string $operator, string $version, ?strin } } + protected function skipIfAtlasSearchIndexIsNotSupported(): void + { + if (! self::isAtlas()) { + self::markTestSkipped('Search Indexes are only supported on MongoDB Atlas 7.0+'); + } + + $this->skipIfServerVersion('<', '7.0', 'Search Indexes are only supported on MongoDB Atlas 7.0+'); + } + protected function skipIfChangeStreamIsNotSupported(): void { if ($this->isStandalone()) { @@ -506,15 +496,7 @@ protected function skipIfTransactionsAreNotSupported(): void } if ($this->isShardedCluster()) { - if (version_compare($this->getFeatureCompatibilityVersion(), '4.2', '<')) { - $this->markTestSkipped('Transactions are only supported on FCV 4.2 or higher'); - } - - return; - } - - if (version_compare($this->getFeatureCompatibilityVersion(), '4.0', '<')) { - $this->markTestSkipped('Transactions are only supported on FCV 4.0 or higher'); + $this->markTestSkipped('Transactions are only supported on FCV 4.2 or higher'); } if ($this->getServerStorageEngine() !== 'wiredTiger') { @@ -522,16 +504,6 @@ protected function skipIfTransactionsAreNotSupported(): void } } - protected function isAtlasDataLake(): bool - { - $buildInfo = $this->getPrimaryServer()->executeCommand( - $this->getDatabaseName(), - new Command(['buildInfo' => 1]), - )->toArray()[0]; - - return ! empty($buildInfo->dataLake); - } - protected function isEnterprise(): bool { $buildInfo = $this->getPrimaryServer()->executeCommand( @@ -597,8 +569,12 @@ private static function appendAuthenticationOptions(array $options): array return $options; } - private static function appendServerApiOption(array $driverOptions): array + private static function appendDriverOptions(array $driverOptions): array { + if (isset($driverOptions['autoEncryption']) && getenv('CRYPT_SHARED_LIB_PATH')) { + $driverOptions['autoEncryption']['extraOptions']['cryptSharedLibPath'] = getenv('CRYPT_SHARED_LIB_PATH'); + } + if (getenv('API_VERSION') && ! isset($driverOptions['serverApi'])) { $driverOptions['serverApi'] = new ServerApi(getenv('API_VERSION')); } @@ -688,16 +664,6 @@ private static function getUriWithoutMultipleMongoses(): string return $uri; } - /** - * Checks if the failCommand command is supported on this server version - */ - private function isFailCommandSupported(): bool - { - $minVersion = $this->isShardedCluster() ? '4.1.5' : '4.0.0'; - - return version_compare($this->getServerVersion(), $minVersion, '>='); - } - /** * Checks if the failCommand command is enabled by checking the enableTestCommands parameter */ @@ -710,7 +676,7 @@ private function isFailCommandEnabled(): bool ); $document = current($cursor->toArray()); - } catch (CommandException $e) { + } catch (CommandException) { return false; } diff --git a/tests/Functions/GetEncryptedFieldsFromServerFunctionalTest.php b/tests/Functions/GetEncryptedFieldsFromServerFunctionalTest.php new file mode 100644 index 000000000..47849c1ce --- /dev/null +++ b/tests/Functions/GetEncryptedFieldsFromServerFunctionalTest.php @@ -0,0 +1,101 @@ +skipIfClientSideEncryptionIsNotSupported(); + + if ($this->isStandalone()) { + $this->markTestSkipped('Queryable encryption requires replica sets'); + } + + $this->skipIfServerVersion('<', '7.0.0', 'Queryable encryption requires MongoDB 7.0 or later'); + + $encryptionOptions = [ + 'keyVaultNamespace' => 'keyvault.datakeys', + 'kmsProviders' => [ + 'local' => [ + 'key' => new Binary(str_repeat("\0", 96)), // 96-byte local master key + ], + ], + ]; + $client = static::createTestClient(driverOptions: ['autoEncryption' => $encryptionOptions]); + + // Ensure the key vault collection is dropped before each test + $this->keyVaultCollection = $client->getCollection('keyvault', 'datakeys', ['writeConcern' => new WriteConcern(WriteConcern::MAJORITY)]); + $this->keyVaultCollection->drop(); + + $this->clientEncryption = $client->createClientEncryption($encryptionOptions); + + $this->database = $client->getDatabase($this->getDatabaseName()); + } + + public function tearDown(): void + { + $this->keyVaultCollection?->drop(); + } + + /** @see https://jira.mongodb.org/browse/PHPLIB-1702 */ + public function testDatabaseDropCollectionConsultsEncryptedFieldsFromServer(): void + { + $this->database->createEncryptedCollection( + $this->getCollectionName(), + $this->clientEncryption, + 'local', + null, + ['encryptedFields' => ['fields' => []]], + ); + + $this->assertCountCollections(3, $this->getCollectionName(), 'createEncryptedCollection should create three collections'); + + $this->database->dropCollection($this->getCollectionName()); + + $this->assertCountCollections(0, $this->getCollectionName()); + } + + /** @see https://jira.mongodb.org/browse/PHPLIB-1702 */ + public function testCollectionDropConsultsEncryptedFieldsFromServer(): void + { + $this->database->createEncryptedCollection( + $this->getCollectionName(), + $this->clientEncryption, + 'local', + null, + ['encryptedFields' => ['fields' => []]], + ); + + $this->assertCountCollections(3, $this->getCollectionName(), 'createEncryptedCollection should create three collections'); + + $this->database->getCollection($this->getCollectionName())->drop(); + + $this->assertCountCollections(0, $this->getCollectionName()); + } + + private function assertCountCollections(int $expected, $collectionName, string $message = ''): void + { + $collectionNames = $this->database->listCollectionNames([ + 'filter' => ['name' => new Regex(preg_quote($collectionName))], + ]); + $this->assertCount($expected, $collectionNames, $message); + } +} diff --git a/tests/Functions/SelectServerFunctionalTest.php b/tests/Functions/SelectServerFunctionalTest.php index 0a3b82a6d..980541b35 100644 --- a/tests/Functions/SelectServerFunctionalTest.php +++ b/tests/Functions/SelectServerFunctionalTest.php @@ -5,12 +5,13 @@ use MongoDB\Driver\ReadPreference; use MongoDB\Driver\Server; use MongoDB\Tests\FunctionalTestCase; +use PHPUnit\Framework\Attributes\DataProvider; use function MongoDB\select_server; class SelectServerFunctionalTest extends FunctionalTestCase { - /** @dataProvider providePinnedOptions */ + #[DataProvider('providePinnedOptions')] public function testSelectServerPrefersPinnedServer(array $options): void { $this->skipIfTransactionsAreNotSupported(); diff --git a/tests/FunctionsTest.php b/tests/FunctionsTest.php index 428028d0c..bf64b03ee 100644 --- a/tests/FunctionsTest.php +++ b/tests/FunctionsTest.php @@ -4,17 +4,20 @@ use MongoDB\BSON\Document; use MongoDB\BSON\PackedArray; +use MongoDB\Builder\Stage\LimitStage; +use MongoDB\Builder\Stage\MatchStage; use MongoDB\Driver\WriteConcern; -use MongoDB\Exception\InvalidArgumentException; use MongoDB\Model\BSONArray; use MongoDB\Model\BSONDocument; +use PHPUnit\Framework\Attributes\DataProvider; +use TypeError; use function MongoDB\apply_type_map_to_document; use function MongoDB\create_field_path_type_map; use function MongoDB\document_to_array; +use function MongoDB\is_builder_pipeline; use function MongoDB\is_first_key_operator; use function MongoDB\is_last_pipeline_operator_write; -use function MongoDB\is_mapreduce_output_inline; use function MongoDB\is_pipeline; use function MongoDB\is_write_concern_acknowledged; @@ -23,13 +26,13 @@ */ class FunctionsTest extends TestCase { - /** @dataProvider provideDocumentAndTypeMap */ + #[DataProvider('provideDocumentAndTypeMap')] public function testApplyTypeMapToDocument($document, array $typeMap, $expectedDocument): void { $this->assertEquals($expectedDocument, apply_type_map_to_document($document, $typeMap)); } - public function provideDocumentAndTypeMap() + public static function provideDocumentAndTypeMap() { return [ [ @@ -93,13 +96,13 @@ public function provideDocumentAndTypeMap() ]; } - /** @dataProvider provideDocumentsAndExpectedArrays */ + #[DataProvider('provideDocumentsAndExpectedArrays')] public function testDocumentToArray($document, array $expectedArray): void { $this->assertSame($expectedArray, document_to_array($document)); } - public function provideDocumentsAndExpectedArrays(): array + public static function provideDocumentsAndExpectedArrays(): array { return [ 'array' => [['x' => 1], ['x' => 1]], @@ -112,21 +115,20 @@ public function provideDocumentsAndExpectedArrays(): array ]; } - /** @dataProvider provideInvalidDocumentValuesForChecks */ + #[DataProvider('provideInvalidDocumentValuesForChecks')] public function testDocumentToArrayArgumentTypeCheck($document): void { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('Expected $document to have type "document" (array or object)'); + $this->expectException(TypeError::class); document_to_array($document); } - public function provideInvalidDocumentValuesForChecks(): array + public static function provideInvalidDocumentValuesForChecks(): array { // PackedArray is intentionally left out, as document_to_array is used to convert aggregation pipelines - return $this->wrapValuesForDataProvider([123, 3.14, 'foo', true]); + return self::wrapValuesForDataProvider([123, 3.14, 'foo', true]); } - public function provideDocumentCasts(): array + public static function provideDocumentCasts(): array { // phpcs:disable SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing // phpcs:disable Squiz.Functions.MultiLineFunctionDeclaration @@ -140,7 +142,7 @@ public function provideDocumentCasts(): array // phpcs:enable } - /** @dataProvider provideDocumentCasts */ + #[DataProvider('provideDocumentCasts')] public function testIsFirstKeyOperator(callable $cast): void { $this->assertFalse(is_first_key_operator($cast(['y' => 1]))); @@ -151,34 +153,20 @@ public function testIsFirstKeyOperator(callable $cast): void $this->assertFalse(is_first_key_operator($cast(['foo']))); } - /** @dataProvider provideInvalidDocumentValuesForChecks */ + #[DataProvider('provideInvalidDocumentValuesForChecks')] public function testIsFirstKeyOperatorArgumentTypeCheck($document): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException(TypeError::class); is_first_key_operator($document); } - /** @dataProvider provideDocumentCasts */ - public function testIsMapReduceOutputInlineWithDocumentValues(callable $cast): void - { - $this->assertTrue(is_mapreduce_output_inline($cast(['inline' => 1]))); - // Note: only the key is significant - $this->assertTrue(is_mapreduce_output_inline($cast(['inline' => 0]))); - $this->assertFalse(is_mapreduce_output_inline($cast(['replace' => 'collectionName']))); - } - - public function testIsMapReduceOutputInlineWithStringValue(): void - { - $this->assertFalse(is_mapreduce_output_inline('collectionName')); - } - - /** @dataProvider provideTypeMapValues */ + #[DataProvider('provideTypeMapValues')] public function testCreateFieldPathTypeMap(array $expected, array $typeMap, $fieldPath = 'field'): void { $this->assertEquals($expected, create_field_path_type_map($typeMap, $fieldPath)); } - public function provideTypeMapValues() + public static function provideTypeMapValues() { return [ 'No root type' => [ @@ -232,7 +220,7 @@ public function provideTypeMapValues() ]; } - /** @dataProvider provideDocumentCasts */ + #[DataProvider('provideDocumentCasts')] public function testIsLastPipelineOperatorWrite(callable $cast): void { $match = ['$match' => ['x' => 1]]; @@ -248,13 +236,13 @@ public function testIsLastPipelineOperatorWrite(callable $cast): void $this->assertFalse(is_last_pipeline_operator_write([$cast($out), $cast($match)])); } - /** @dataProvider providePipelines */ + #[DataProvider('providePipelines')] public function testIsPipeline($expected, $pipeline, $allowEmpty = false): void { $this->assertSame($expected, is_pipeline($pipeline, $allowEmpty)); } - public function providePipelines(): array + public static function providePipelines(): array { $valid = [ ['$match' => ['foo' => 'bar']], @@ -312,13 +300,28 @@ public function providePipelines(): array ]; } - /** @dataProvider provideWriteConcerns */ + #[DataProvider('provideStagePipelines')] + public function testIsBuilderPipeline($expected, $pipeline): void + { + $this->assertSame($expected, is_builder_pipeline($pipeline)); + } + + public static function provideStagePipelines(): iterable + { + yield 'empty array' => [false, []]; + yield 'array of arrays' => [false, [['$match' => ['x' => 1]]]]; + yield 'map of stages' => [false, [1 => new MatchStage([])]]; + yield 'stages' => [true, [new MatchStage([]), new LimitStage(1)]]; + yield 'stages and operators' => [true, [new MatchStage([]), ['$limit' => 1]]]; + } + + #[DataProvider('provideWriteConcerns')] public function testIsWriteConcernAcknowledged($expected, WriteConcern $writeConcern): void { $this->assertSame($expected, is_write_concern_acknowledged($writeConcern)); } - public function provideWriteConcerns(): array + public static function provideWriteConcerns(): array { // Note: WriteConcern constructor prohibits w=-1 or w=0 and journal=true return [ diff --git a/tests/GridFS/BucketFunctionalTest.php b/tests/GridFS/BucketFunctionalTest.php index 9498e586d..8c347c5cd 100644 --- a/tests/GridFS/BucketFunctionalTest.php +++ b/tests/GridFS/BucketFunctionalTest.php @@ -20,6 +20,8 @@ use MongoDB\Tests\Fixtures\Codec\TestDocumentCodec; use MongoDB\Tests\Fixtures\Codec\TestFileCodec; use MongoDB\Tests\Fixtures\Document\TestFile; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; use ReflectionMethod; use stdClass; @@ -51,7 +53,7 @@ */ class BucketFunctionalTest extends FunctionalTestCase { - /** @doesNotPerformAssertions */ + #[DoesNotPerformAssertions] public function testValidConstructorOptions(): void { new Bucket($this->manager, $this->getDatabaseName(), [ @@ -60,28 +62,26 @@ public function testValidConstructorOptions(): void 'readConcern' => new ReadConcern(ReadConcern::LOCAL), 'readPreference' => new ReadPreference(ReadPreference::PRIMARY), 'writeConcern' => new WriteConcern(WriteConcern::MAJORITY, 1000), - 'disableMD5' => true, ]); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new Bucket($this->manager, $this->getDatabaseName(), $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'bucketName' => $this->getInvalidStringValues(true), - 'chunkSizeBytes' => $this->getInvalidIntegerValues(true), - 'codec' => $this->getInvalidDocumentCodecValues(), - 'disableMD5' => $this->getInvalidBooleanValues(true), - 'readConcern' => $this->getInvalidReadConcernValues(), - 'readPreference' => $this->getInvalidReadPreferenceValues(), - 'typeMap' => $this->getInvalidArrayValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'bucketName' => self::getInvalidStringValues(true), + 'chunkSizeBytes' => self::getInvalidIntegerValues(true), + 'codec' => self::getInvalidDocumentCodecValues(), + 'readConcern' => self::getInvalidReadConcernValues(), + 'readPreference' => self::getInvalidReadPreferenceValues(), + 'typeMap' => self::getInvalidArrayValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } @@ -103,10 +103,10 @@ public function testConstructorWithCodecAndTypeMapOptions(): void new Bucket($this->manager, $this->getDatabaseName(), $options); } - /** @dataProvider provideInputDataAndExpectedChunks */ + #[DataProvider('provideInputDataAndExpectedChunks')] public function testDelete($input, $expectedChunks): void { - $id = $this->bucket->uploadFromStream('filename', $this->createStream($input)); + $id = $this->bucket->uploadFromStream('filename', self::createStream($input)); $this->assertCollectionCount($this->filesCollection, 1); $this->assertCollectionCount($this->chunksCollection, $expectedChunks); @@ -117,7 +117,7 @@ public function testDelete($input, $expectedChunks): void $this->assertCollectionCount($this->chunksCollection, 0); } - public function provideInputDataAndExpectedChunks() + public static function provideInputDataAndExpectedChunks() { return [ ['', 0], @@ -139,10 +139,10 @@ public function testDeleteShouldRequireFileToExist(): void $this->bucket->delete('nonexistent-id'); } - /** @dataProvider provideInputDataAndExpectedChunks */ + #[DataProvider('provideInputDataAndExpectedChunks')] public function testDeleteStillRemovesChunksIfFileDoesNotExist($input, $expectedChunks): void { - $id = $this->bucket->uploadFromStream('filename', $this->createStream($input)); + $id = $this->bucket->uploadFromStream('filename', self::createStream($input)); $this->assertCollectionCount($this->filesCollection, 1); $this->assertCollectionCount($this->chunksCollection, $expectedChunks); @@ -152,15 +152,43 @@ public function testDeleteStillRemovesChunksIfFileDoesNotExist($input, $expected try { $this->bucket->delete($id); $this->fail('FileNotFoundException was not thrown'); - } catch (FileNotFoundException $e) { + } catch (FileNotFoundException) { } $this->assertCollectionCount($this->chunksCollection, 0); } + public function testDeleteByName(): void + { + $this->bucket->uploadFromStream('filename', self::createStream('foobar1')); + $this->bucket->uploadFromStream('filename', self::createStream('foobar2')); + $this->bucket->uploadFromStream('filename', self::createStream('foobar3')); + + $this->bucket->uploadFromStream('other', self::createStream('foobar')); + + $this->assertCollectionCount($this->filesCollection, 4); + $this->assertCollectionCount($this->chunksCollection, 4); + + $this->bucket->deleteByName('filename'); + + $this->assertCollectionCount($this->filesCollection, 1); + $this->assertCollectionCount($this->chunksCollection, 1); + + $this->bucket->deleteByName('other'); + + $this->assertCollectionCount($this->filesCollection, 0); + $this->assertCollectionCount($this->chunksCollection, 0); + } + + public function testDeleteByNameShouldRequireFileToExist(): void + { + $this->expectException(FileNotFoundException::class); + $this->bucket->deleteByName('nonexistent-name'); + } + public function testDownloadingFileWithMissingChunk(): void { - $id = $this->bucket->uploadFromStream('filename', $this->createStream('foobar')); + $id = $this->bucket->uploadFromStream('filename', self::createStream('foobar')); $this->chunksCollection->deleteOne(['files_id' => $id, 'n' => 0]); @@ -171,7 +199,7 @@ public function testDownloadingFileWithMissingChunk(): void public function testDownloadingFileWithUnexpectedChunkIndex(): void { - $id = $this->bucket->uploadFromStream('filename', $this->createStream('foobar')); + $id = $this->bucket->uploadFromStream('filename', self::createStream('foobar')); $this->chunksCollection->updateOne( ['files_id' => $id, 'n' => 0], @@ -185,7 +213,7 @@ public function testDownloadingFileWithUnexpectedChunkIndex(): void public function testDownloadingFileWithUnexpectedChunkSize(): void { - $id = $this->bucket->uploadFromStream('filename', $this->createStream('foobar')); + $id = $this->bucket->uploadFromStream('filename', self::createStream('foobar')); $this->chunksCollection->updateOne( ['files_id' => $id, 'n' => 0], @@ -197,88 +225,88 @@ public function testDownloadingFileWithUnexpectedChunkSize(): void stream_get_contents($this->bucket->openDownloadStream($id)); } - /** @dataProvider provideInputDataAndExpectedChunks */ + #[DataProvider('provideInputDataAndExpectedChunks')] public function testDownloadToStream($input): void { - $id = $this->bucket->uploadFromStream('filename', $this->createStream($input)); - $destination = $this->createStream(); + $id = $this->bucket->uploadFromStream('filename', self::createStream($input)); + $destination = self::createStream(); $this->bucket->downloadToStream($id, $destination); $this->assertStreamContents($input, $destination); } - /** @dataProvider provideInvalidStreamValues */ + #[DataProvider('provideInvalidStreamValues')] public function testDownloadToStreamShouldRequireDestinationStream($destination): void { $this->expectException(InvalidArgumentException::class); $this->bucket->downloadToStream('id', $destination); } - public function provideInvalidStreamValues() + public static function provideInvalidStreamValues(): array { - return $this->wrapValuesForDataProvider($this->getInvalidStreamValues()); + return self::wrapValuesForDataProvider(self::getInvalidStreamValues()); } public function testDownloadToStreamShouldRequireFileToExist(): void { $this->expectException(FileNotFoundException::class); - $this->bucket->downloadToStream('nonexistent-id', $this->createStream()); + $this->bucket->downloadToStream('nonexistent-id', self::createStream()); } public function testDownloadToStreamByName(): void { - $this->bucket->uploadFromStream('filename', $this->createStream('foo')); - $this->bucket->uploadFromStream('filename', $this->createStream('bar')); - $this->bucket->uploadFromStream('filename', $this->createStream('baz')); + $this->bucket->uploadFromStream('filename', self::createStream('foo')); + $this->bucket->uploadFromStream('filename', self::createStream('bar')); + $this->bucket->uploadFromStream('filename', self::createStream('baz')); - $destination = $this->createStream(); + $destination = self::createStream(); $this->bucket->downloadToStreamByName('filename', $destination); $this->assertStreamContents('baz', $destination); - $destination = $this->createStream(); + $destination = self::createStream(); $this->bucket->downloadToStreamByName('filename', $destination, ['revision' => -3]); $this->assertStreamContents('foo', $destination); - $destination = $this->createStream(); + $destination = self::createStream(); $this->bucket->downloadToStreamByName('filename', $destination, ['revision' => -2]); $this->assertStreamContents('bar', $destination); - $destination = $this->createStream(); + $destination = self::createStream(); $this->bucket->downloadToStreamByName('filename', $destination, ['revision' => -1]); $this->assertStreamContents('baz', $destination); - $destination = $this->createStream(); + $destination = self::createStream(); $this->bucket->downloadToStreamByName('filename', $destination, ['revision' => 0]); $this->assertStreamContents('foo', $destination); - $destination = $this->createStream(); + $destination = self::createStream(); $this->bucket->downloadToStreamByName('filename', $destination, ['revision' => 1]); $this->assertStreamContents('bar', $destination); - $destination = $this->createStream(); + $destination = self::createStream(); $this->bucket->downloadToStreamByName('filename', $destination, ['revision' => 2]); $this->assertStreamContents('baz', $destination); } - /** @dataProvider provideInvalidStreamValues */ + #[DataProvider('provideInvalidStreamValues')] public function testDownloadToStreamByNameShouldRequireDestinationStream($destination): void { $this->expectException(InvalidArgumentException::class); $this->bucket->downloadToStreamByName('filename', $destination); } - /** @dataProvider provideNonexistentFilenameAndRevision */ + #[DataProvider('provideNonexistentFilenameAndRevision')] public function testDownloadToStreamByNameShouldRequireFilenameAndRevisionToExist($filename, $revision): void { - $this->bucket->uploadFromStream('filename', $this->createStream('foo')); - $this->bucket->uploadFromStream('filename', $this->createStream('bar')); + $this->bucket->uploadFromStream('filename', self::createStream('foo')); + $this->bucket->uploadFromStream('filename', self::createStream('bar')); - $destination = $this->createStream(); + $destination = self::createStream(); $this->expectException(FileNotFoundException::class); $this->bucket->downloadToStreamByName($filename, $destination, ['revision' => $revision]); } - public function provideNonexistentFilenameAndRevision() + public static function provideNonexistentFilenameAndRevision() { return [ ['filename', 2], @@ -290,7 +318,7 @@ public function provideNonexistentFilenameAndRevision() public function testDrop(): void { - $this->bucket->uploadFromStream('filename', $this->createStream('foobar')); + $this->bucket->uploadFromStream('filename', self::createStream('foobar')); $this->assertCollectionCount($this->filesCollection, 1); $this->assertCollectionCount($this->chunksCollection, 1); @@ -303,9 +331,9 @@ public function testDrop(): void public function testFind(): void { - $this->bucket->uploadFromStream('a', $this->createStream('foo')); - $this->bucket->uploadFromStream('b', $this->createStream('foobar')); - $this->bucket->uploadFromStream('c', $this->createStream('foobarbaz')); + $this->bucket->uploadFromStream('a', self::createStream('foo')); + $this->bucket->uploadFromStream('b', self::createStream('foobar')); + $this->bucket->uploadFromStream('c', self::createStream('foobarbaz')); $cursor = $this->bucket->find( ['length' => ['$lte' => 6]], @@ -329,7 +357,7 @@ public function testFind(): void public function testFindUsesTypeMap(): void { - $this->bucket->uploadFromStream('a', $this->createStream('foo')); + $this->bucket->uploadFromStream('a', self::createStream('foo')); $cursor = $this->bucket->find(); $fileDocument = current($cursor->toArray()); @@ -339,7 +367,7 @@ public function testFindUsesTypeMap(): void public function testFindUsesCodec(): void { - $this->bucket->uploadFromStream('a', $this->createStream('foo')); + $this->bucket->uploadFromStream('a', self::createStream('foo')); $cursor = $this->bucket->find([], ['codec' => new TestFileCodec()]); $fileDocument = current($cursor->toArray()); @@ -351,7 +379,7 @@ public function testFindUsesCodec(): void public function testFindInheritsBucketCodec(): void { $bucket = new Bucket($this->manager, $this->getDatabaseName(), ['codec' => new TestFileCodec()]); - $bucket->uploadFromStream('a', $this->createStream('foo')); + $bucket->uploadFromStream('a', self::createStream('foo')); $cursor = $bucket->find(); $fileDocument = current($cursor->toArray()); @@ -363,7 +391,7 @@ public function testFindInheritsBucketCodec(): void public function testFindResetsInheritedBucketCodec(): void { $bucket = new Bucket($this->manager, $this->getDatabaseName(), ['codec' => new TestFileCodec()]); - $bucket->uploadFromStream('a', $this->createStream('foo')); + $bucket->uploadFromStream('a', self::createStream('foo')); $cursor = $bucket->find([], ['codec' => null]); $fileDocument = current($cursor->toArray()); @@ -374,9 +402,9 @@ public function testFindResetsInheritedBucketCodec(): void public function testFindOne(): void { - $this->bucket->uploadFromStream('a', $this->createStream('foo')); - $this->bucket->uploadFromStream('b', $this->createStream('foobar')); - $this->bucket->uploadFromStream('c', $this->createStream('foobarbaz')); + $this->bucket->uploadFromStream('a', self::createStream('foo')); + $this->bucket->uploadFromStream('b', self::createStream('foobar')); + $this->bucket->uploadFromStream('c', self::createStream('foobarbaz')); $fileDocument = $this->bucket->findOne( ['length' => ['$lte' => 6]], @@ -396,9 +424,9 @@ public function testFindOne(): void public function testFindOneUsesCodec(): void { - $this->bucket->uploadFromStream('a', $this->createStream('foo')); - $this->bucket->uploadFromStream('b', $this->createStream('foobar')); - $this->bucket->uploadFromStream('c', $this->createStream('foobarbaz')); + $this->bucket->uploadFromStream('a', self::createStream('foo')); + $this->bucket->uploadFromStream('b', self::createStream('foobar')); + $this->bucket->uploadFromStream('c', self::createStream('foobarbaz')); $fileDocument = $this->bucket->findOne( ['length' => ['$lte' => 6]], @@ -417,9 +445,9 @@ public function testFindOneInheritsBucketCodec(): void { $bucket = new Bucket($this->manager, $this->getDatabaseName(), ['codec' => new TestFileCodec()]); - $bucket->uploadFromStream('a', $this->createStream('foo')); - $bucket->uploadFromStream('b', $this->createStream('foobar')); - $bucket->uploadFromStream('c', $this->createStream('foobarbaz')); + $bucket->uploadFromStream('a', self::createStream('foo')); + $bucket->uploadFromStream('b', self::createStream('foobar')); + $bucket->uploadFromStream('c', self::createStream('foobarbaz')); $fileDocument = $bucket->findOne( ['length' => ['$lte' => 6]], @@ -435,9 +463,9 @@ public function testFindOneResetsInheritedBucketCodec(): void { $bucket = new Bucket($this->manager, $this->getDatabaseName(), ['codec' => new TestFileCodec()]); - $bucket->uploadFromStream('a', $this->createStream('foo')); - $bucket->uploadFromStream('b', $this->createStream('foobar')); - $bucket->uploadFromStream('c', $this->createStream('foobarbaz')); + $bucket->uploadFromStream('a', self::createStream('foo')); + $bucket->uploadFromStream('b', self::createStream('foobar')); + $bucket->uploadFromStream('c', self::createStream('foobarbaz')); $fileDocument = $bucket->findOne( ['length' => ['$lte' => 6]], @@ -520,7 +548,7 @@ public function testGetFileDocumentForStreamUsesCodec(): void public function testGetFileDocumentForStreamWithReadableStream(): void { $metadata = ['foo' => 'bar']; - $id = $this->bucket->uploadFromStream('filename', $this->createStream('foobar'), ['metadata' => $metadata]); + $id = $this->bucket->uploadFromStream('filename', self::createStream('foobar'), ['metadata' => $metadata]); $stream = $this->bucket->openDownloadStream($id); $fileDocument = $this->bucket->getFileDocumentForStream($stream); @@ -543,16 +571,16 @@ public function testGetFileDocumentForStreamWithWritableStream(): void $this->assertSameDocument($metadata, $fileDocument->metadata); } - /** @dataProvider provideInvalidGridFSStreamValues */ + #[DataProvider('provideInvalidGridFSStreamValues')] public function testGetFileDocumentForStreamShouldRequireGridFSStreamResource($stream): void { $this->expectException(InvalidArgumentException::class); $this->bucket->getFileDocumentForStream($stream); } - public function provideInvalidGridFSStreamValues() + public static function provideInvalidGridFSStreamValues(): array { - return $this->wrapValuesForDataProvider(array_merge($this->getInvalidStreamValues(), [$this->createStream()])); + return self::wrapValuesForDataProvider(array_merge(self::getInvalidStreamValues(), [self::createStream()])); } public function testGetFileIdForStreamUsesTypeMap(): void @@ -567,7 +595,7 @@ public function testGetFileIdForStreamUsesTypeMap(): void public function testGetFileIdForStreamWithReadableStream(): void { - $id = $this->bucket->uploadFromStream('filename', $this->createStream('foobar')); + $id = $this->bucket->uploadFromStream('filename', self::createStream('foobar')); $stream = $this->bucket->openDownloadStream($id); $this->assertSameObjectId($id, $this->bucket->getFileIdForStream($stream)); @@ -580,7 +608,7 @@ public function testGetFileIdForStreamWithWritableStream(): void $this->assertEquals(1, $this->bucket->getFileIdForStream($stream)); } - /** @dataProvider provideInvalidGridFSStreamValues */ + #[DataProvider('provideInvalidGridFSStreamValues')] public function testGetFileIdForStreamShouldRequireGridFSStreamResource($stream): void { $this->expectException(InvalidArgumentException::class); @@ -595,18 +623,18 @@ public function testGetFilesCollection(): void $this->assertEquals('fs.files', $filesCollection->getCollectionName()); } - /** @dataProvider provideInputDataAndExpectedChunks */ + #[DataProvider('provideInputDataAndExpectedChunks')] public function testOpenDownloadStream($input): void { - $id = $this->bucket->uploadFromStream('filename', $this->createStream($input)); + $id = $this->bucket->uploadFromStream('filename', self::createStream($input)); $this->assertStreamContents($input, $this->bucket->openDownloadStream($id)); } - /** @dataProvider provideInputDataAndExpectedChunks */ + #[DataProvider('provideInputDataAndExpectedChunks')] public function testOpenDownloadStreamAndMultipleReadOperations($input): void { - $id = $this->bucket->uploadFromStream('filename', $this->createStream($input)); + $id = $this->bucket->uploadFromStream('filename', self::createStream($input)); $stream = $this->bucket->openDownloadStream($id); $buffer = ''; @@ -636,9 +664,9 @@ public function testOpenDownloadStreamByNameShouldRequireFilenameToExist(): void public function testOpenDownloadStreamByName(): void { - $this->bucket->uploadFromStream('filename', $this->createStream('foo')); - $this->bucket->uploadFromStream('filename', $this->createStream('bar')); - $this->bucket->uploadFromStream('filename', $this->createStream('baz')); + $this->bucket->uploadFromStream('filename', self::createStream('foo')); + $this->bucket->uploadFromStream('filename', self::createStream('bar')); + $this->bucket->uploadFromStream('filename', self::createStream('baz')); $this->assertStreamContents('baz', $this->bucket->openDownloadStreamByName('filename')); $this->assertStreamContents('foo', $this->bucket->openDownloadStreamByName('filename', ['revision' => -3])); @@ -649,11 +677,11 @@ public function testOpenDownloadStreamByName(): void $this->assertStreamContents('baz', $this->bucket->openDownloadStreamByName('filename', ['revision' => 2])); } - /** @dataProvider provideNonexistentFilenameAndRevision */ + #[DataProvider('provideNonexistentFilenameAndRevision')] public function testOpenDownloadStreamByNameShouldRequireFilenameAndRevisionToExist($filename, $revision): void { - $this->bucket->uploadFromStream('filename', $this->createStream('foo')); - $this->bucket->uploadFromStream('filename', $this->createStream('bar')); + $this->bucket->uploadFromStream('filename', self::createStream('foo')); + $this->bucket->uploadFromStream('filename', self::createStream('bar')); $this->expectException(FileNotFoundException::class); $this->bucket->openDownloadStreamByName($filename, ['revision' => $revision]); @@ -669,7 +697,7 @@ public function testOpenUploadStream(): void $this->assertStreamContents('foobar', $this->bucket->openDownloadStreamByName('filename')); } - /** @dataProvider provideInputDataAndExpectedChunks */ + #[DataProvider('provideInputDataAndExpectedChunks')] public function testOpenUploadStreamAndMultipleWriteOperations($input): void { $stream = $this->bucket->openUploadStream('filename'); @@ -689,7 +717,7 @@ public function testOpenUploadStreamAndMultipleWriteOperations($input): void public function testRename(): void { - $id = $this->bucket->uploadFromStream('a', $this->createStream('foo')); + $id = $this->bucket->uploadFromStream('a', self::createStream('foo')); $this->bucket->rename($id, 'b'); $fileDocument = $this->filesCollection->findOne( @@ -703,7 +731,7 @@ public function testRename(): void public function testRenameShouldNotRequireFileToBeModified(): void { - $id = $this->bucket->uploadFromStream('a', $this->createStream('foo')); + $id = $this->bucket->uploadFromStream('a', self::createStream('foo')); $this->bucket->rename($id, 'a'); $fileDocument = $this->filesCollection->findOne( @@ -721,6 +749,24 @@ public function testRenameShouldRequireFileToExist(): void $this->bucket->rename('nonexistent-id', 'b'); } + public function testRenameByName(): void + { + $this->bucket->uploadFromStream('filename', self::createStream('foo')); + $this->bucket->uploadFromStream('filename', self::createStream('foo')); + $this->bucket->uploadFromStream('filename', self::createStream('foo')); + + $this->bucket->renameByName('filename', 'newname'); + + $this->assertNull($this->bucket->findOne(['filename' => 'filename']), 'No file has the old name'); + $this->assertStreamContents('foo', $this->bucket->openDownloadStreamByName('newname')); + } + + public function testRenameByNameShouldRequireFileToExist(): void + { + $this->expectException(FileNotFoundException::class); + $this->bucket->renameByName('nonexistent-name', 'b'); + } + public function testUploadFromStream(): void { $options = [ @@ -729,7 +775,7 @@ public function testUploadFromStream(): void 'metadata' => ['foo' => 'bar'], ]; - $id = $this->bucket->uploadFromStream('filename', $this->createStream('foobar'), $options); + $id = $this->bucket->uploadFromStream('filename', self::createStream('foobar'), $options); $this->assertCollectionCount($this->filesCollection, 1); $this->assertCollectionCount($this->chunksCollection, 3); @@ -740,7 +786,7 @@ public function testUploadFromStream(): void $this->assertSameDocument(['foo' => 'bar'], $fileDocument['metadata']); } - /** @dataProvider provideInvalidStreamValues */ + #[DataProvider('provideInvalidStreamValues')] public function testUploadFromStreamShouldRequireSourceStream($source): void { $this->expectException(InvalidArgumentException::class); @@ -749,8 +795,8 @@ public function testUploadFromStreamShouldRequireSourceStream($source): void public function testUploadingAnEmptyFile(): void { - $id = $this->bucket->uploadFromStream('filename', $this->createStream('')); - $destination = $this->createStream(); + $id = $this->bucket->uploadFromStream('filename', self::createStream('')); + $destination = self::createStream(); $this->bucket->downloadToStream($id, $destination); $this->assertStreamContents('', $destination); @@ -762,49 +808,19 @@ public function testUploadingAnEmptyFile(): void [ 'projection' => [ 'length' => 1, - 'md5' => 1, '_id' => 0, ], ], ); - $expected = [ - 'length' => 0, - 'md5' => 'd41d8cd98f00b204e9800998ecf8427e', - ]; + $expected = ['length' => 0]; $this->assertSameDocument($expected, $fileDocument); } - public function testDisableMD5(): void - { - $options = ['disableMD5' => true]; - $id = $this->bucket->uploadFromStream('filename', $this->createStream('data'), $options); - - $fileDocument = $this->filesCollection->findOne( - ['_id' => $id], - ); - - $this->assertArrayNotHasKey('md5', $fileDocument); - } - - public function testDisableMD5OptionInConstructor(): void - { - $options = ['disableMD5' => true]; - - $this->bucket = new Bucket($this->manager, $this->getDatabaseName(), $options); - $id = $this->bucket->uploadFromStream('filename', $this->createStream('data')); - - $fileDocument = $this->filesCollection->findOne( - ['_id' => $id], - ); - - $this->assertArrayNotHasKey('md5', $fileDocument); - } - public function testUploadingFirstFileCreatesIndexes(): void { - $this->bucket->uploadFromStream('filename', $this->createStream('foo')); + $this->bucket->uploadFromStream('filename', self::createStream('foo')); $this->assertIndexExists($this->filesCollection->getCollectionName(), 'filename_1_uploadDate_1'); $this->assertIndexExists($this->chunksCollection->getCollectionName(), 'files_id_1_n_1', function (IndexInfo $info): void { @@ -814,10 +830,23 @@ public function testUploadingFirstFileCreatesIndexes(): void public function testExistingIndexIsReused(): void { + // The collections may exist from other tests, ensure they are removed + // before and after to avoid potential conflicts. + $this->dropCollection($this->getDatabaseName(), 'fs.chunks'); + $this->dropCollection($this->getDatabaseName(), 'fs.files'); + + // Create indexes with different numeric types before interacting with + // GridFS to assert that the library respects the existing indexes and + // does not attempt to create its own. $this->filesCollection->createIndex(['filename' => 1.0, 'uploadDate' => 1], ['name' => 'test']); $this->chunksCollection->createIndex(['files_id' => 1.0, 'n' => 1], ['name' => 'test', 'unique' => true]); - $this->bucket->uploadFromStream('filename', $this->createStream('foo')); + $this->assertIndexExists('fs.files', 'test'); + $this->assertIndexExists('fs.chunks', 'test', function (IndexInfo $info): void { + $this->assertTrue($info->isUnique()); + }); + + $this->bucket->uploadFromStream('filename', self::createStream('foo')); $this->assertIndexNotExists($this->filesCollection->getCollectionName(), 'filename_1_uploadDate_1'); $this->assertIndexNotExists($this->chunksCollection->getCollectionName(), 'files_id_1_n_1'); @@ -825,7 +854,7 @@ public function testExistingIndexIsReused(): void public function testDownloadToStreamFails(): void { - $this->bucket->uploadFromStream('filename', $this->createStream('foo'), ['_id' => ['foo' => 'bar']]); + $this->bucket->uploadFromStream('filename', self::createStream('foo'), ['_id' => ['foo' => 'bar']]); $this->expectException(StreamException::class); $this->expectExceptionMessageMatches('#^Downloading file from "gridfs://.*/.*/.*" to "php://temp" failed. GridFS identifier: "{ "_id" : { "foo" : "bar" } }"$#'); @@ -834,7 +863,7 @@ public function testDownloadToStreamFails(): void public function testDownloadToStreamByNameFails(): void { - $this->bucket->uploadFromStream('filename', $this->createStream('foo')); + $this->bucket->uploadFromStream('filename', self::createStream('foo')); $this->expectException(StreamException::class); $this->expectExceptionMessageMatches('#^Downloading file from "gridfs://.*/.*/.*" to "php://temp" failed. GridFS filename: "filename"$#'); @@ -858,7 +887,6 @@ public function testDanglingOpenWritableStream(): void } $code = <<<'PHP' - require '%s'; require '%s'; // Don't report deprecations - if the issue exists this code will // result in a fatal error @@ -866,7 +894,7 @@ public function testDanglingOpenWritableStream(): void $client = MongoDB\Tests\FunctionalTestCase::createTestClient(); $database = $client->selectDatabase(getenv('MONGODB_DATABASE') ?: 'phplib_test'); $gridfs = $database->selectGridFSBucket(); - $stream = $gridfs->openUploadStream('hello.txt', ['disableMD5' => true]); + $stream = $gridfs->openUploadStream('hello.txt'); fwrite($stream, 'Hello MongoDB!'); PHP; @@ -878,8 +906,6 @@ public function testDanglingOpenWritableStream(): void sprintf( $code, __DIR__ . '/../../vendor/autoload.php', - // Include the PHPUnit autoload file to ensure PHPUnit classes can be loaded - __DIR__ . '/../../vendor/bin/.phpunit/phpunit/vendor/autoload.php', ), ), '2>&1', @@ -904,7 +930,6 @@ public function testDanglingOpenWritableStreamWithGlobalStreamWrapperAlias(): vo } $code = <<<'PHP' - require '%s'; require '%s'; // Don't report deprecations - if the issue exists this code will // result in a fatal error @@ -924,8 +949,6 @@ public function testDanglingOpenWritableStreamWithGlobalStreamWrapperAlias(): vo sprintf( $code, __DIR__ . '/../../vendor/autoload.php', - // Include the PHPUnit autoload file to ensure PHPUnit classes can be loaded - __DIR__ . '/../../vendor/bin/.phpunit/phpunit/vendor/autoload.php', ), ), '2>&1', @@ -950,8 +973,6 @@ public function testResolveStreamContextForRead(): void fclose($stream); $method = new ReflectionMethod($this->bucket, 'resolveStreamContext'); - $method->setAccessible(true); - $context = $method->invokeArgs($this->bucket, ['gridfs://bucket/filename', 'rb', []]); $this->assertIsArray($context); @@ -966,8 +987,6 @@ public function testResolveStreamContextForRead(): void public function testResolveStreamContextForWrite(): void { $method = new ReflectionMethod($this->bucket, 'resolveStreamContext'); - $method->setAccessible(true); - $context = $method->invokeArgs($this->bucket, ['gridfs://bucket/filename', 'wb', []]); $this->assertIsArray($context); @@ -976,7 +995,7 @@ public function testResolveStreamContextForWrite(): void $this->assertArrayHasKey('filename', $context); $this->assertSame('filename', $context['filename']); $this->assertArrayHasKey('options', $context); - $this->assertSame(['chunkSizeBytes' => 261120, 'disableMD5' => false], $context['options']); + $this->assertSame(['chunkSizeBytes' => 261120], $context['options']); } /** @@ -1035,7 +1054,7 @@ private function assertIndexNotExists(string $collectionName, string $indexName) /** * Return a list of invalid stream values. */ - private function getInvalidStreamValues(): array + private static function getInvalidStreamValues(): array { return [null, 123, 'foo', [], hash_init('md5')]; } diff --git a/tests/GridFS/FunctionalTestCase.php b/tests/GridFS/FunctionalTestCase.php index 1508fef68..ad2ca614a 100644 --- a/tests/GridFS/FunctionalTestCase.php +++ b/tests/GridFS/FunctionalTestCase.php @@ -4,7 +4,10 @@ use MongoDB\Collection; use MongoDB\GridFS\Bucket; +use MongoDB\Operation\DropCollection; use MongoDB\Tests\FunctionalTestCase as BaseFunctionalTestCase; +use PHPUnit\Framework\Attributes\AfterClass; +use PHPUnit\Framework\Attributes\BeforeClass; use function fopen; use function fwrite; @@ -28,10 +31,32 @@ public function setUp(): void parent::setUp(); $this->bucket = new Bucket($this->manager, $this->getDatabaseName()); - $this->bucket->drop(); - $this->chunksCollection = $this->createCollection($this->getDatabaseName(), 'fs.chunks'); - $this->filesCollection = $this->createCollection($this->getDatabaseName(), 'fs.files'); + $this->chunksCollection = new Collection($this->manager, $this->getDatabaseName(), 'fs.chunks'); + $this->filesCollection = new Collection($this->manager, $this->getDatabaseName(), 'fs.files'); + } + + public function tearDown(): void + { + $this->chunksCollection->deleteMany([]); + $this->filesCollection->deleteMany([]); + + parent::tearDown(); + } + + /** + * The bucket's collections are created by the first test that runs and + * kept for all subsequent tests. This is done to avoid creating the + * collections and their indexes for each test, which would be slow. + */ + #[BeforeClass] + #[AfterClass] + public static function dropCollectionsBeforeAfterClass(): void + { + $manager = static::createTestManager(); + + (new DropCollection(self::getDatabaseName(), 'fs.chunks'))->execute($manager->selectServer()); + (new DropCollection(self::getDatabaseName(), 'fs.files'))->execute($manager->selectServer()); } /** @@ -53,7 +78,7 @@ protected function assertStreamContents(string $expectedContents, $stream): void * * @return resource */ - protected function createStream(string $data = '') + protected static function createStream(string $data = '') { $stream = fopen('php://temp', 'w+b'); fwrite($stream, $data); diff --git a/tests/GridFS/ReadableStreamFunctionalTest.php b/tests/GridFS/ReadableStreamFunctionalTest.php index dba7e0016..3a14af698 100644 --- a/tests/GridFS/ReadableStreamFunctionalTest.php +++ b/tests/GridFS/ReadableStreamFunctionalTest.php @@ -8,6 +8,7 @@ use MongoDB\GridFS\Exception\CorruptFileException; use MongoDB\GridFS\ReadableStream; use MongoDB\Tests\CommandObserver; +use PHPUnit\Framework\Attributes\DataProvider; use function array_filter; @@ -50,22 +51,22 @@ public function testGetFile(): void $this->assertSame($fileDocument, $stream->getFile()); } - /** @dataProvider provideInvalidConstructorFileDocuments */ + #[DataProvider('provideInvalidConstructorFileDocuments')] public function testConstructorFileDocumentChecks($file): void { $this->expectException(CorruptFileException::class); new ReadableStream($this->collectionWrapper, $file); } - public function provideInvalidConstructorFileDocuments() + public static function provideInvalidConstructorFileDocuments() { $options = []; - foreach ($this->getInvalidIntegerValues() as $value) { + foreach (self::getInvalidIntegerValues() as $value) { $options[][] = (object) ['_id' => 1, 'chunkSize' => $value, 'length' => 0]; } - foreach ($this->getInvalidIntegerValues() as $value) { + foreach (self::getInvalidIntegerValues() as $value) { $options[][] = (object) ['_id' => 1, 'chunkSize' => 1, 'length' => $value]; } @@ -76,7 +77,7 @@ public function provideInvalidConstructorFileDocuments() return $options; } - /** @dataProvider provideFileIdAndExpectedBytes */ + #[DataProvider('provideFileIdAndExpectedBytes')] public function testReadBytes($fileId, $length, $expectedBytes): void { $fileDocument = $this->collectionWrapper->findFileById($fileId); @@ -85,7 +86,7 @@ public function testReadBytes($fileId, $length, $expectedBytes): void $this->assertSame($expectedBytes, $stream->readBytes($length)); } - public function provideFileIdAndExpectedBytes() + public static function provideFileIdAndExpectedBytes() { return [ ['length-0', 0, ''], @@ -111,15 +112,15 @@ public function provideFileIdAndExpectedBytes() ]; } - public function provideFilteredFileIdAndExpectedBytes() + public static function provideFilteredFileIdAndExpectedBytes() { return array_filter( - $this->provideFileIdAndExpectedBytes(), + self::provideFileIdAndExpectedBytes(), fn (array $args) => $args[1] > 0, ); } - /** @dataProvider provideFilteredFileIdAndExpectedBytes */ + #[DataProvider('provideFilteredFileIdAndExpectedBytes')] public function testReadBytesCalledMultipleTimes($fileId, $length, $expectedBytes): void { $fileDocument = $this->collectionWrapper->findFileById($fileId); @@ -197,7 +198,7 @@ public function testSeekOutOfRange(): void $stream->seek(11); } - /** @dataProvider providePreviousChunkSeekOffsetAndBytes */ + #[DataProvider('providePreviousChunkSeekOffsetAndBytes')] public function testSeekPreviousChunk($offset, $length, $expectedBytes): void { $fileDocument = $this->collectionWrapper->findFileById('length-10'); @@ -221,7 +222,7 @@ function (array $event) use (&$commands): void { $this->assertSame(['find'], $commands); } - public function providePreviousChunkSeekOffsetAndBytes() + public static function providePreviousChunkSeekOffsetAndBytes() { return [ [0, 4, 'abcd'], @@ -231,7 +232,7 @@ public function providePreviousChunkSeekOffsetAndBytes() ]; } - /** @dataProvider provideSameChunkSeekOffsetAndBytes */ + #[DataProvider('provideSameChunkSeekOffsetAndBytes')] public function testSeekSameChunk($offset, $length, $expectedBytes): void { $fileDocument = $this->collectionWrapper->findFileById('length-10'); @@ -255,7 +256,7 @@ function (array $event) use (&$commands): void { $this->assertSame([], $commands); } - public function provideSameChunkSeekOffsetAndBytes() + public static function provideSameChunkSeekOffsetAndBytes() { return [ [4, 4, 'efgh'], @@ -263,7 +264,7 @@ public function provideSameChunkSeekOffsetAndBytes() ]; } - /** @dataProvider provideSubsequentChunkSeekOffsetAndBytes */ + #[DataProvider('provideSubsequentChunkSeekOffsetAndBytes')] public function testSeekSubsequentChunk($offset, $length, $expectedBytes): void { $fileDocument = $this->collectionWrapper->findFileById('length-10'); @@ -287,7 +288,7 @@ function (array $event) use (&$commands): void { $this->assertSame([], $commands); } - public function provideSubsequentChunkSeekOffsetAndBytes() + public static function provideSubsequentChunkSeekOffsetAndBytes() { return [ [4, 4, 'efgh'], diff --git a/tests/GridFS/StreamWrapperFunctionalTest.php b/tests/GridFS/StreamWrapperFunctionalTest.php index fc8c45523..1960e5518 100644 --- a/tests/GridFS/StreamWrapperFunctionalTest.php +++ b/tests/GridFS/StreamWrapperFunctionalTest.php @@ -7,6 +7,7 @@ use MongoDB\GridFS\Exception\FileNotFoundException; use MongoDB\GridFS\Exception\LogicException; use MongoDB\GridFS\StreamWrapper; +use PHPUnit\Framework\Attributes\DataProvider; use function copy; use function fclose; @@ -232,7 +233,7 @@ public function testWritableStreamWrite(): void $this->assertSame(6, fwrite($stream, 'foobar')); } - /** @dataProvider provideUrl */ + #[DataProvider('provideUrl')] public function testStreamWithContextResolver(string $url, string $expectedFilename): void { $this->bucket->registerGlobalStreamWrapperAlias('bucket'); diff --git a/tests/GridFS/WritableStreamFunctionalTest.php b/tests/GridFS/WritableStreamFunctionalTest.php index f87eaf1aa..2b22baa53 100644 --- a/tests/GridFS/WritableStreamFunctionalTest.php +++ b/tests/GridFS/WritableStreamFunctionalTest.php @@ -5,6 +5,8 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\GridFS\CollectionWrapper; use MongoDB\GridFS\WritableStream; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; use function str_repeat; @@ -22,7 +24,7 @@ public function setUp(): void $this->collectionWrapper = new CollectionWrapper($this->manager, $this->getDatabaseName(), 'fs'); } - /** @doesNotPerformAssertions */ + #[DoesNotPerformAssertions] public function testValidConstructorOptions(): void { new WritableStream($this->collectionWrapper, 'filename', [ @@ -32,19 +34,18 @@ public function testValidConstructorOptions(): void ]); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new WritableStream($this->collectionWrapper, 'filename', $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'chunkSizeBytes' => $this->getInvalidIntegerValues(true), - 'disableMD5' => $this->getInvalidBooleanValues(true), - 'metadata' => $this->getInvalidDocumentValues(), + return self::createOptionDataProvider([ + 'chunkSizeBytes' => self::getInvalidIntegerValues(true), + 'metadata' => self::getInvalidDocumentValues(), ]); } @@ -70,31 +71,4 @@ public function testWriteBytesAlwaysUpdatesFileSize(): void $stream->close(); $this->assertSame(1536, $stream->getSize()); } - - /** @dataProvider provideInputDataAndExpectedMD5 */ - public function testWriteBytesCalculatesMD5($input, $expectedMD5): void - { - $stream = new WritableStream($this->collectionWrapper, 'filename'); - $stream->writeBytes($input); - $stream->close(); - - $fileDocument = $this->filesCollection->findOne( - ['_id' => $stream->getFile()->_id], - ['projection' => ['md5' => 1, '_id' => 0]], - ); - - $this->assertSameDocument(['md5' => $expectedMD5], $fileDocument); - } - - public function provideInputDataAndExpectedMD5() - { - return [ - ['', 'd41d8cd98f00b204e9800998ecf8427e'], - ['foobar', '3858f62230ac3c915f300c664312c63f'], - [str_repeat('foobar', 43520), '88ff0e5fcb0acb27947d736b5d69cb73'], - [str_repeat('foobar', 43521), '8ff86511c95a06a611842ceb555d8454'], - [str_repeat('foobar', 87040), '45bfa1a9ec36728ee7338d15c5a30c13'], - [str_repeat('foobar', 87041), '95e78f624f8e745bcfd2d11691fa601e'], - ]; - } } diff --git a/tests/LogNonGenuineHostTest.php b/tests/LogNonGenuineHostTest.php index 4991b2339..2de5e2d95 100644 --- a/tests/LogNonGenuineHostTest.php +++ b/tests/LogNonGenuineHostTest.php @@ -4,6 +4,7 @@ use MongoDB\Client; use MongoDB\Driver\Exception\InvalidArgumentException; +use PHPUnit\Framework\Attributes\DataProvider; use Psr\Log\AbstractLogger; use Psr\Log\LoggerInterface; @@ -28,7 +29,7 @@ public function tearDown(): void remove_logger($this->logger); } - /** @dataProvider provideCosmosUris */ + #[DataProvider('provideCosmosUris')] public function testCosmosUriLogsInfoMessage(string $uri): void { $this->createClientAndIgnoreSrvLookupError($uri); @@ -54,7 +55,7 @@ public static function provideCosmosUris(): array ]; } - /** @dataProvider provideDocumentDbUris */ + #[DataProvider('provideDocumentDbUris')] public function testDocumentDbUriLogsInfoMessage(string $uri): void { $this->createClientAndIgnoreSrvLookupError($uri); @@ -83,7 +84,7 @@ public static function provideDocumentDbUris(): array ]; } - /** @dataProvider provideGenuineUris */ + #[DataProvider('provideGenuineUris')] public function testGenuineUriDoesNotLog(string $uri): void { $this->createClientAndIgnoreSrvLookupError($uri); diff --git a/tests/Model/BSONDocumentTest.php b/tests/Model/BSONDocumentTest.php index 4d832d591..2000aef63 100644 --- a/tests/Model/BSONDocumentTest.php +++ b/tests/Model/BSONDocumentTest.php @@ -23,6 +23,13 @@ public function testConstructorDefaultsToPropertyAccess(): void $this->assertSame('bar', $document->foo); } + public function testConstructorWithStandardObject(): void + { + $object = (object) ['foo' => 'bar']; + $document = new BSONDocument($object); + $this->assertEquals($object, $document->bsonSerialize()); + } + public function testBsonSerializeCastsToObject(): void { $data = [0 => 'foo', 2 => 'bar']; diff --git a/tests/Model/BSONIteratorTest.php b/tests/Model/BSONIteratorTest.php index ff1a8bd1c..bac019156 100644 --- a/tests/Model/BSONIteratorTest.php +++ b/tests/Model/BSONIteratorTest.php @@ -7,6 +7,7 @@ use MongoDB\Exception\UnexpectedValueException; use MongoDB\Model\BSONIterator; use MongoDB\Tests\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; use function array_map; use function implode; @@ -15,10 +16,10 @@ class BSONIteratorTest extends TestCase { - /** @dataProvider provideTypeMapOptionsAndExpectedDocuments */ + #[DataProvider('provideTypeMapOptionsAndExpectedDocuments')] public function testValidValues(?array $typeMap, array $expectedDocuments): void { - $binaryString = implode(array_map( + $binaryString = implode('', array_map( fn ($input) => (string) Document::fromPHP($input), [ ['_id' => 1, 'x' => ['foo' => 'bar']], @@ -33,7 +34,7 @@ public function testValidValues(?array $typeMap, array $expectedDocuments): void $this->assertEquals($expectedDocuments, $results); } - public function provideTypeMapOptionsAndExpectedDocuments(): Generator + public static function provideTypeMapOptionsAndExpectedDocuments(): Generator { yield 'No type map' => [ 'typeMap' => null, diff --git a/tests/Model/CallbackIteratorTest.php b/tests/Model/CallbackIteratorTest.php index 6705e79f5..e38a26c4f 100644 --- a/tests/Model/CallbackIteratorTest.php +++ b/tests/Model/CallbackIteratorTest.php @@ -8,12 +8,13 @@ use IteratorAggregate; use MongoDB\Model\CallbackIterator; use MongoDB\Tests\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; use function iterator_to_array; class CallbackIteratorTest extends TestCase { - /** @dataProvider provideTests */ + #[DataProvider('provideTests')] public function testIteration($expected, $source, $callback): void { $callbackIterator = new CallbackIterator($source, $callback); @@ -28,11 +29,8 @@ public static function provideTests(): Generator $iteratorAggregate = new class ($listIterator) implements IteratorAggregate { - private Iterator $iterator; - - public function __construct(Iterator $iterator) + public function __construct(private Iterator $iterator) { - $this->iterator = $iterator; } public function getIterator(): Iterator diff --git a/tests/Model/ChangeStreamIteratorTest.php b/tests/Model/ChangeStreamIteratorTest.php index bdc062be6..84b4390fb 100644 --- a/tests/Model/ChangeStreamIteratorTest.php +++ b/tests/Model/ChangeStreamIteratorTest.php @@ -7,6 +7,7 @@ namespace MongoDB\Tests\Model; +use MongoDB\BSON\PackedArray; use MongoDB\Collection; use MongoDB\Driver\Exception\LogicException; use MongoDB\Exception\InvalidArgumentException; @@ -14,6 +15,7 @@ use MongoDB\Operation\Find; use MongoDB\Tests\CommandObserver; use MongoDB\Tests\FunctionalTestCase; +use PHPUnit\Framework\Attributes\DataProvider; use TypeError; use function sprintf; @@ -30,7 +32,7 @@ public function setUp(): void $this->collection = $this->createCollection($this->getDatabaseName(), $this->getCollectionName(), ['capped' => true, 'size' => 8192]); } - /** @dataProvider provideInvalidIntegerValues */ + #[DataProvider('provideInvalidIntegerValues')] public function testFirstBatchArgumentTypeCheck($firstBatchSize): void { $this->expectException(TypeError::class); @@ -49,23 +51,23 @@ public function testInitialResumeToken(): void $this->assertSameDocument((object) ['resumeToken' => 2], $iterator->getResumeToken()); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testInitialResumeTokenArgumentTypeCheck($initialResumeToken): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($initialResumeToken instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new ChangeStreamIterator($this->collection->find(), 0, $initialResumeToken, null); } - /** @dataProvider provideInvalidObjectValues */ + #[DataProvider('provideInvalidObjectValues')] public function testPostBatchResumeTokenArgumentTypeCheck($postBatchResumeToken): void { $this->expectException(TypeError::class); new ChangeStreamIterator($this->collection->find(), 0, null, $postBatchResumeToken); } - public function provideInvalidObjectValues() + public static function provideInvalidObjectValues() { - return $this->wrapValuesForDataProvider([123, 3.14, 'foo', true, []]); + return self::wrapValuesForDataProvider([123, 3.14, 'foo', true, []]); } public function testPostBatchResumeTokenIsReturnedForLastElementInFirstBatch(): void diff --git a/tests/Model/CodecCursorFunctionalTest.php b/tests/Model/CodecCursorFunctionalTest.php index 6a6a763e5..64c7268b7 100644 --- a/tests/Model/CodecCursorFunctionalTest.php +++ b/tests/Model/CodecCursorFunctionalTest.php @@ -4,17 +4,10 @@ use MongoDB\BSON\Int64; use MongoDB\Codec\DocumentCodec; -use MongoDB\Driver\CursorId; use MongoDB\Model\CodecCursor; use MongoDB\Tests\FunctionalTestCase; -use function phpversion; -use function restore_error_handler; -use function set_error_handler; -use function version_compare; - -use const E_DEPRECATED; -use const E_USER_DEPRECATED; +use const E_USER_WARNING; class CodecCursorFunctionalTest extends FunctionalTestCase { @@ -26,58 +19,13 @@ public function setUp(): void } public function testSetTypeMap(): void - { - if (version_compare(phpversion(), '8.4', '>=')) { - $this->markTestIncomplete('Test fails on PHP 8.4 due to deprecations'); - } - - $collection = self::createTestClient()->selectCollection($this->getDatabaseName(), $this->getCollectionName()); - $cursor = $collection->find(); - - $codecCursor = CodecCursor::fromCursor($cursor, $this->createMock(DocumentCodec::class)); - - $this->expectWarning(); - $this->expectWarningMessage('Discarding type map for MongoDB\Model\CodecCursor::setTypeMap'); - - $codecCursor->setTypeMap(['root' => 'array']); - } - - public function testGetIdReturnTypeWithoutArgument(): void { $collection = self::createTestClient()->selectCollection($this->getDatabaseName(), $this->getCollectionName()); $cursor = $collection->find(); $codecCursor = CodecCursor::fromCursor($cursor, $this->createMock(DocumentCodec::class)); - $deprecations = []; - - try { - $previousErrorHandler = set_error_handler( - function (...$args) use (&$previousErrorHandler, &$deprecations) { - $deprecations[] = $args; - - return true; - }, - E_USER_DEPRECATED | E_DEPRECATED, - ); - - $cursorId = $codecCursor->getId(); - } finally { - restore_error_handler(); - } - - self::assertInstanceOf(CursorId::class, $cursorId); - - // Expect 2 deprecations: 1 from CodecCursor, one from Cursor - self::assertCount(2, $deprecations); - self::assertSame( - 'The method "MongoDB\Model\CodecCursor::getId" will no longer return a "MongoDB\Driver\CursorId" instance in the future. Pass "true" as argument to change to the new behavior and receive a "MongoDB\BSON\Int64" instance instead.', - $deprecations[0][1], - ); - self::assertSame( - 'MongoDB\Driver\Cursor::getId(): The method "MongoDB\Driver\Cursor::getId" will no longer return a "MongoDB\Driver\CursorId" instance in the future. Pass "true" as argument to change to the new behavior and receive a "MongoDB\BSON\Int64" instance instead.', - $deprecations[1][1], - ); + $this->assertError(E_USER_WARNING, fn () => $codecCursor->setTypeMap(['root' => 'array'])); } public function testGetIdReturnTypeWithArgument(): void @@ -87,24 +35,6 @@ public function testGetIdReturnTypeWithArgument(): void $codecCursor = CodecCursor::fromCursor($cursor, $this->createMock(DocumentCodec::class)); - $deprecations = []; - - try { - $previousErrorHandler = set_error_handler( - function (...$args) use (&$previousErrorHandler, &$deprecations) { - $deprecations[] = $args; - - return true; - }, - E_USER_DEPRECATED | E_DEPRECATED, - ); - - $cursorId = $codecCursor->getId(true); - } finally { - restore_error_handler(); - } - - self::assertInstanceOf(Int64::class, $cursorId); - self::assertCount(0, $deprecations); + self::assertInstanceOf(Int64::class, $codecCursor->getId()); } } diff --git a/tests/Model/CollectionInfoTest.php b/tests/Model/CollectionInfoTest.php index 043023baa..9b926cfad 100644 --- a/tests/Model/CollectionInfoTest.php +++ b/tests/Model/CollectionInfoTest.php @@ -10,7 +10,7 @@ class CollectionInfoTest extends TestCase { public function testGetBasicInformation(): void { - $info = new CollectionInfo([ + $viewInfo = new CollectionInfo([ 'name' => 'foo', 'type' => 'view', 'options' => ['capped' => true, 'size' => 1_048_576], @@ -18,20 +18,27 @@ public function testGetBasicInformation(): void 'idIndex' => ['idIndex' => true], // Dummy option ]); - $this->assertSame('foo', $info->getName()); - $this->assertSame('foo', $info['name']); + $this->assertSame('foo', $viewInfo->getName()); + $this->assertSame('foo', $viewInfo['name']); + + $this->assertTrue($viewInfo->isView()); + $this->assertSame('view', $viewInfo['type']); - $this->assertSame('view', $info->getType()); - $this->assertSame('view', $info['type']); + $this->assertSame(['capped' => true, 'size' => 1_048_576], $viewInfo->getOptions()); + $this->assertSame(['capped' => true, 'size' => 1_048_576], $viewInfo['options']); - $this->assertSame(['capped' => true, 'size' => 1_048_576], $info->getOptions()); - $this->assertSame(['capped' => true, 'size' => 1_048_576], $info['options']); + $this->assertSame(['readOnly' => true], $viewInfo->getInfo()); + $this->assertSame(['readOnly' => true], $viewInfo['info']); - $this->assertSame(['readOnly' => true], $info->getInfo()); - $this->assertSame(['readOnly' => true], $info['info']); + $this->assertSame(['idIndex' => true], $viewInfo->getIdIndex()); + $this->assertSame(['idIndex' => true], $viewInfo['idIndex']); + + $collectionInfo = new CollectionInfo([ + 'name' => 'bar', + 'type' => 'collection', + ]); - $this->assertSame(['idIndex' => true], $info->getIdIndex()); - $this->assertSame(['idIndex' => true], $info['idIndex']); + $this->assertFalse($collectionInfo->isView()); } public function testMissingFields(): void diff --git a/tests/Model/IndexInfoFunctionalTest.php b/tests/Model/IndexInfoFunctionalTest.php index 65d22259a..824507ec6 100644 --- a/tests/Model/IndexInfoFunctionalTest.php +++ b/tests/Model/IndexInfoFunctionalTest.php @@ -32,29 +32,6 @@ public function testIs2dSphere(): void $this->assertEquals(3, $index['2dsphereIndexVersion']); } - /** - * @group matrix-testing-exclude-server-5.0-driver-4.0 - * @group matrix-testing-exclude-server-5.0-driver-4.2 - * @group matrix-testing-exclude-server-5.0-driver-4.4 - */ - public function testIsGeoHaystack(): void - { - $this->skipIfGeoHaystackIndexIsNotSupported(); - - $indexName = $this->collection->createIndex(['pos' => 'geoHaystack', 'x' => 1], ['bucketSize' => 5]); - $result = $this->collection->listIndexes(); - - $result->rewind(); - $result->next(); - $index = $result->current(); - - $this->assertEquals($indexName, $index->getName()); - $this->assertDeprecated(function () use ($index): void { - $this->assertTrue($index->isGeoHaystack()); - }); - $this->assertEquals(5, $index['bucketSize']); - } - public function testIsText(): void { $indexName = $this->collection->createIndex(['x' => 'text']); diff --git a/tests/Model/IndexInfoTest.php b/tests/Model/IndexInfoTest.php index 30cb26aea..189b522bd 100644 --- a/tests/Model/IndexInfoTest.php +++ b/tests/Model/IndexInfoTest.php @@ -14,17 +14,12 @@ public function testBasicIndex(): void 'v' => 1, 'key' => ['x' => 1], 'name' => 'x_1', - 'ns' => 'foo.bar', ]); $this->assertSame(1, $info->getVersion()); $this->assertSame(['x' => 1], $info->getKey()); $this->assertSame('x_1', $info->getName()); - $this->assertSame('foo.bar', $info->getNamespace()); $this->assertFalse($info->is2dSphere()); - $this->assertDeprecated(function () use ($info): void { - $this->assertFalse($info->isGeoHaystack()); - }); $this->assertFalse($info->isSparse()); $this->assertFalse($info->isText()); $this->assertFalse($info->isTtl()); @@ -37,18 +32,13 @@ public function testSparseIndex(): void 'v' => 1, 'key' => ['y' => 1], 'name' => 'y_sparse', - 'ns' => 'foo.bar', 'sparse' => true, ]); $this->assertSame(1, $info->getVersion()); $this->assertSame(['y' => 1], $info->getKey()); $this->assertSame('y_sparse', $info->getName()); - $this->assertSame('foo.bar', $info->getNamespace()); $this->assertFalse($info->is2dSphere()); - $this->assertDeprecated(function () use ($info): void { - $this->assertFalse($info->isGeoHaystack()); - }); $this->assertTrue($info->isSparse()); $this->assertFalse($info->isText()); $this->assertFalse($info->isTtl()); @@ -61,18 +51,13 @@ public function testUniqueIndex(): void 'v' => 1, 'key' => ['z' => 1], 'name' => 'z_unique', - 'ns' => 'foo.bar', 'unique' => true, ]); $this->assertSame(1, $info->getVersion()); $this->assertSame(['z' => 1], $info->getKey()); $this->assertSame('z_unique', $info->getName()); - $this->assertSame('foo.bar', $info->getNamespace()); $this->assertFalse($info->is2dSphere()); - $this->assertDeprecated(function () use ($info): void { - $this->assertFalse($info->isGeoHaystack()); - }); $this->assertFalse($info->isSparse()); $this->assertFalse($info->isText()); $this->assertFalse($info->isTtl()); @@ -85,18 +70,13 @@ public function testTtlIndex(): void 'v' => 1, 'key' => ['z' => 1], 'name' => 'z_unique', - 'ns' => 'foo.bar', 'expireAfterSeconds' => 100, ]); $this->assertSame(1, $info->getVersion()); $this->assertSame(['z' => 1], $info->getKey()); $this->assertSame('z_unique', $info->getName()); - $this->assertSame('foo.bar', $info->getNamespace()); $this->assertFalse($info->is2dSphere()); - $this->assertDeprecated(function () use ($info): void { - $this->assertFalse($info->isGeoHaystack()); - }); $this->assertFalse($info->isSparse()); $this->assertFalse($info->isText()); $this->assertTrue($info->isTtl()); @@ -111,7 +91,6 @@ public function testDebugInfo(): void 'v' => 1, 'key' => ['x' => 1], 'name' => 'x_1', - 'ns' => 'foo.bar', ]; $info = new IndexInfo($expectedInfo); @@ -124,7 +103,6 @@ public function testImplementsArrayAccess(): void 'v' => 1, 'key' => ['x' => 1], 'name' => 'x_1', - 'ns' => 'foo.bar', ]); $this->assertInstanceOf('ArrayAccess', $info); @@ -138,7 +116,6 @@ public function testOffsetSetCannotBeCalled(): void 'v' => 1, 'key' => ['x' => 1], 'name' => 'x_1', - 'ns' => 'foo.bar', ]); $this->expectException(BadMethodCallException::class); @@ -152,7 +129,6 @@ public function testOffsetUnsetCannotBeCalled(): void 'v' => 1, 'key' => ['x' => 1], 'name' => 'x_1', - 'ns' => 'foo.bar', ]); $this->expectException(BadMethodCallException::class); @@ -166,40 +142,12 @@ public function testIs2dSphere(): void 'v' => 2, 'key' => ['pos' => '2dsphere'], 'name' => 'pos_2dsphere', - 'ns' => 'foo.bar', ]); $this->assertSame(2, $info->getVersion()); $this->assertSame(['pos' => '2dsphere'], $info->getKey()); $this->assertSame('pos_2dsphere', $info->getName()); - $this->assertSame('foo.bar', $info->getNamespace()); $this->assertTrue($info->is2dSphere()); - $this->assertDeprecated(function () use ($info): void { - $this->assertFalse($info->isGeoHaystack()); - }); - $this->assertFalse($info->isSparse()); - $this->assertFalse($info->isText()); - $this->assertFalse($info->isTtl()); - $this->assertFalse($info->isUnique()); - } - - public function testIsGeoHaystack(): void - { - $info = new IndexInfo([ - 'v' => 2, - 'key' => ['pos2' => 'geoHaystack', 'x' => 1], - 'name' => 'pos2_geoHaystack_x_1', - 'ns' => 'foo.bar', - ]); - - $this->assertSame(2, $info->getVersion()); - $this->assertSame(['pos2' => 'geoHaystack', 'x' => 1], $info->getKey()); - $this->assertSame('pos2_geoHaystack_x_1', $info->getName()); - $this->assertSame('foo.bar', $info->getNamespace()); - $this->assertFalse($info->is2dSphere()); - $this->assertDeprecated(function () use ($info): void { - $this->assertTrue($info->isGeoHaystack()); - }); $this->assertFalse($info->isSparse()); $this->assertFalse($info->isText()); $this->assertFalse($info->isTtl()); @@ -212,17 +160,12 @@ public function testIsText(): void 'v' => 2, 'key' => ['_fts' => 'text', '_ftsx' => 1], 'name' => 'title_text_description_text', - 'ns' => 'foo.bar', ]); $this->assertSame(2, $info->getVersion()); $this->assertSame(['_fts' => 'text', '_ftsx' => 1], $info->getKey()); $this->assertSame('title_text_description_text', $info->getName()); - $this->assertSame('foo.bar', $info->getNamespace()); $this->assertFalse($info->is2dSphere()); - $this->assertDeprecated(function () use ($info): void { - $this->assertFalse($info->isGeoHaystack()); - }); $this->assertFalse($info->isSparse()); $this->assertTrue($info->isText()); $this->assertFalse($info->isTtl()); diff --git a/tests/Model/IndexInputTest.php b/tests/Model/IndexInputTest.php index 3f5e814e5..a0a44fa1a 100644 --- a/tests/Model/IndexInputTest.php +++ b/tests/Model/IndexInputTest.php @@ -8,6 +8,7 @@ use MongoDB\Model\BSONDocument; use MongoDB\Model\IndexInput; use MongoDB\Tests\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; use stdClass; class IndexInputTest extends TestCase @@ -19,7 +20,7 @@ public function testConstructorShouldRequireKey(): void new IndexInput([]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorShouldRequireKeyToBeArrayOrObject($key): void { $this->expectException(InvalidArgumentException::class); @@ -27,7 +28,7 @@ public function testConstructorShouldRequireKeyToBeArrayOrObject($key): void new IndexInput(['key' => $key]); } - /** @dataProvider provideInvalidFieldOrderValues */ + #[DataProvider('provideInvalidFieldOrderValues')] public function testConstructorShouldRequireKeyFieldOrderToBeNumericOrString($order): void { $this->expectException(InvalidArgumentException::class); @@ -35,12 +36,12 @@ public function testConstructorShouldRequireKeyFieldOrderToBeNumericOrString($or new IndexInput(['key' => ['x' => $order]]); } - public function provideInvalidFieldOrderValues() + public static function provideInvalidFieldOrderValues() { - return $this->wrapValuesForDataProvider([true, [], new stdClass()]); + return self::wrapValuesForDataProvider([true, [], new stdClass()]); } - /** @dataProvider provideInvalidStringValues */ + #[DataProvider('provideInvalidStringValues')] public function testConstructorShouldRequireNameToBeString($name): void { $this->expectException(InvalidArgumentException::class); @@ -48,16 +49,13 @@ public function testConstructorShouldRequireNameToBeString($name): void new IndexInput(['key' => ['x' => 1], 'name' => $name]); } - /** - * @dataProvider provideExpectedNameAndKey - * @param array|object $key - */ - public function testNameGeneration($expectedName, $key): void + #[DataProvider('provideExpectedNameAndKey')] + public function testNameGeneration($expectedName, array|object $key): void { $this->assertSame($expectedName, (string) new IndexInput(['key' => $key])); } - public function provideExpectedNameAndKey(): array + public static function provideExpectedNameAndKey(): array { return [ ['x_1', ['x' => 1]], diff --git a/tests/Model/SearchIndexInputTest.php b/tests/Model/SearchIndexInputTest.php index aef36c8c2..507ced5c9 100644 --- a/tests/Model/SearchIndexInputTest.php +++ b/tests/Model/SearchIndexInputTest.php @@ -6,6 +6,7 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Model\SearchIndexInput; use MongoDB\Tests\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class SearchIndexInputTest extends TestCase { @@ -16,7 +17,7 @@ public function testConstructorIndexDefinitionMustBeDefined(): void new SearchIndexInput([]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorIndexDefinitionMustBeADocument($definition): void { $this->expectException(InvalidArgumentException::class); @@ -24,7 +25,7 @@ public function testConstructorIndexDefinitionMustBeADocument($definition): void new SearchIndexInput(['definition' => $definition]); } - /** @dataProvider provideInvalidStringValues */ + #[DataProvider('provideInvalidStringValues')] public function testConstructorShouldRequireNameToBeString($name): void { $this->expectException(InvalidArgumentException::class); @@ -32,7 +33,7 @@ public function testConstructorShouldRequireNameToBeString($name): void new SearchIndexInput(['definition' => ['mapping' => ['dynamic' => true]], 'name' => $name]); } - /** @dataProvider provideInvalidStringValues */ + #[DataProvider('provideInvalidStringValues')] public function testConstructorShouldRequireTypeToBeString($type): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/Operation/AggregateFunctionalTest.php b/tests/Operation/AggregateFunctionalTest.php index bd5ccee80..2d70ea299 100644 --- a/tests/Operation/AggregateFunctionalTest.php +++ b/tests/Operation/AggregateFunctionalTest.php @@ -11,6 +11,7 @@ use MongoDB\Tests\CommandObserver; use MongoDB\Tests\Fixtures\Codec\TestDocumentCodec; use MongoDB\Tests\Fixtures\Document\TestObject; +use PHPUnit\Framework\Attributes\DataProvider; use stdClass; use function array_key_exists; @@ -33,7 +34,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('allowDiskUse', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('allowDiskUse', $event['started']->getCommand()); }, ); } @@ -92,7 +93,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('readConcern', $event['started']->getCommand()); }, ); } @@ -111,7 +112,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand()); }, ); @@ -156,12 +157,12 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } - /** @dataProvider provideTypeMapOptionsAndExpectedDocuments */ + #[DataProvider('provideTypeMapOptionsAndExpectedDocuments')] public function testTypeMapOption(?array $typeMap, array $expectedDocuments): void { $this->createFixtures(3); @@ -218,14 +219,14 @@ function () use ($pipeline, $options): void { if (isset($result->shards)) { foreach ($result->shards as $shard) { - $this->assertObjectHasAttribute('stages', $shard); + $this->assertObjectHasProperty('stages', $shard); } } else { - $this->assertObjectHasAttribute('stages', $result); + $this->assertObjectHasProperty('stages', $result); } }, function (array $event): void { - $this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand()); }, ); @@ -246,7 +247,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('bypassDocumentValidation', $event['started']->getCommand()); + $this->assertObjectHasProperty('bypassDocumentValidation', $event['started']->getCommand()); $this->assertEquals(true, $event['started']->getCommand()->bypassDocumentValidation); }, ); @@ -266,12 +267,12 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('bypassDocumentValidation', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('bypassDocumentValidation', $event['started']->getCommand()); }, ); } - public function provideTypeMapOptionsAndExpectedDocuments() + public static function provideTypeMapOptionsAndExpectedDocuments() { return [ [ diff --git a/tests/Operation/AggregateTest.php b/tests/Operation/AggregateTest.php index 81128dca4..f9befaf36 100644 --- a/tests/Operation/AggregateTest.php +++ b/tests/Operation/AggregateTest.php @@ -7,6 +7,7 @@ use MongoDB\Driver\WriteConcern; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\Aggregate; +use PHPUnit\Framework\Attributes\DataProvider; class AggregateTest extends TestCase { @@ -17,31 +18,31 @@ public function testConstructorPipelineArgumentMustBeAList(): void new Aggregate($this->getDatabaseName(), $this->getCollectionName(), [1 => ['$match' => ['x' => 1]]]); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new Aggregate($this->getDatabaseName(), $this->getCollectionName(), [['$match' => ['x' => 1]]], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'allowDiskUse' => $this->getInvalidBooleanValues(), - 'batchSize' => $this->getInvalidIntegerValues(), - 'bypassDocumentValidation' => $this->getInvalidBooleanValues(), - 'codec' => $this->getInvalidDocumentCodecValues(), - 'collation' => $this->getInvalidDocumentValues(), - 'hint' => $this->getInvalidHintValues(), - 'let' => $this->getInvalidDocumentValues(), - 'explain' => $this->getInvalidBooleanValues(), - 'maxAwaitTimeMS' => $this->getInvalidIntegerValues(), - 'maxTimeMS' => $this->getInvalidIntegerValues(), - 'readConcern' => $this->getInvalidReadConcernValues(), - 'readPreference' => $this->getInvalidReadPreferenceValues(), - 'session' => $this->getInvalidSessionValues(), - 'typeMap' => $this->getInvalidArrayValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'allowDiskUse' => self::getInvalidBooleanValues(), + 'batchSize' => self::getInvalidIntegerValues(), + 'bypassDocumentValidation' => self::getInvalidBooleanValues(), + 'codec' => self::getInvalidDocumentCodecValues(), + 'collation' => self::getInvalidDocumentValues(), + 'hint' => self::getInvalidHintValues(), + 'let' => self::getInvalidDocumentValues(), + 'explain' => self::getInvalidBooleanValues(), + 'maxAwaitTimeMS' => self::getInvalidIntegerValues(), + 'maxTimeMS' => self::getInvalidIntegerValues(), + 'readConcern' => self::getInvalidReadConcernValues(), + 'readPreference' => self::getInvalidReadPreferenceValues(), + 'session' => self::getInvalidSessionValues(), + 'typeMap' => self::getInvalidArrayValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } diff --git a/tests/Operation/BulkWriteFunctionalTest.php b/tests/Operation/BulkWriteFunctionalTest.php index 46958e324..9fce1c8ac 100644 --- a/tests/Operation/BulkWriteFunctionalTest.php +++ b/tests/Operation/BulkWriteFunctionalTest.php @@ -7,13 +7,15 @@ use MongoDB\BulkWriteResult; use MongoDB\Collection; use MongoDB\Driver\BulkWrite as Bulk; +use MongoDB\Driver\Exception\LogicException; use MongoDB\Driver\WriteConcern; -use MongoDB\Exception\BadMethodCallException; use MongoDB\Model\BSONDocument; use MongoDB\Operation\BulkWrite; use MongoDB\Tests\CommandObserver; use MongoDB\Tests\Fixtures\Codec\TestDocumentCodec; use MongoDB\Tests\Fixtures\Document\TestObject; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Depends; use stdClass; use function is_array; @@ -60,10 +62,8 @@ public function testInserts(): void $this->assertSameDocuments($expected, $this->collection->find()); } - /** - * @dataProvider provideDocumentsWithIds - * @dataProvider provideDocumentsWithoutIds - */ + #[DataProvider('provideDocumentsWithIds')] + #[DataProvider('provideDocumentsWithoutIds')] public function testInsertDocumentEncoding($document, stdClass $expectedDocument): void { (new CommandObserver())->observe( @@ -87,7 +87,7 @@ function (array $event) use ($expectedDocument): void { ); } - public function provideDocumentsWithIds(): array + public static function provideDocumentsWithIds(): array { $expectedDocument = (object) ['_id' => 1]; @@ -99,7 +99,7 @@ public function provideDocumentsWithIds(): array ]; } - public function provideDocumentsWithoutIds(): array + public static function provideDocumentsWithoutIds(): array { /* Note: _id placeholders must be replaced with generated ObjectIds. We * also clone the value for each data set since tests may need to modify @@ -150,7 +150,7 @@ public function testUpdates(): void $this->assertSameDocuments($expected, $this->collection->find()); } - /** @dataProvider provideFilterDocuments */ + #[DataProvider('provideFilterDocuments')] public function testUpdateFilterDocuments($filter, stdClass $expectedFilter): void { (new CommandObserver())->observe( @@ -175,7 +175,7 @@ function (array $event) use ($expectedFilter): void { ); } - /** @dataProvider provideReplacementDocuments */ + #[DataProvider('provideReplacementDocuments')] public function testReplacementDocuments($replacement, stdClass $expectedReplacement): void { (new CommandObserver())->observe( @@ -194,10 +194,8 @@ function (array $event) use ($expectedReplacement): void { ); } - /** - * @dataProvider provideUpdateDocuments - * @dataProvider provideUpdatePipelines - */ + #[DataProvider('provideUpdateDocuments')] + #[DataProvider('provideUpdatePipelines')] public function testUpdateDocuments($update, $expectedUpdate): void { if (is_array($expectedUpdate)) { @@ -246,7 +244,7 @@ public function testDeletes(): void $this->assertSameDocuments($expected, $this->collection->find()); } - /** @dataProvider provideFilterDocuments */ + #[DataProvider('provideFilterDocuments')] public function testDeleteFilterDocuments($filter, stdClass $expectedQuery): void { (new CommandObserver())->observe( @@ -317,51 +315,51 @@ public function testUnacknowledgedWriteConcern() return $result; } - /** @depends testUnacknowledgedWriteConcern */ + #[Depends('testUnacknowledgedWriteConcern')] public function testUnacknowledgedWriteConcernAccessesDeletedCount(BulkWriteResult $result): void { - $this->expectException(BadMethodCallException::class); - $this->expectExceptionMessageMatches('/[\w:\\\\]+ should not be called for an unacknowledged write result/'); + $this->expectException(LogicException::class); + $this->expectExceptionMessageMatches('/[\w:\\\\\(\)]+ should not be called for an unacknowledged write result/'); $result->getDeletedCount(); } - /** @depends testUnacknowledgedWriteConcern */ + #[Depends('testUnacknowledgedWriteConcern')] public function testUnacknowledgedWriteConcernAccessesInsertCount(BulkWriteResult $result): void { - $this->expectException(BadMethodCallException::class); - $this->expectExceptionMessageMatches('/[\w:\\\\]+ should not be called for an unacknowledged write result/'); + $this->expectException(LogicException::class); + $this->expectExceptionMessageMatches('/[\w:\\\\\(\)]+ should not be called for an unacknowledged write result/'); $result->getInsertedCount(); } - /** @depends testUnacknowledgedWriteConcern */ + #[Depends('testUnacknowledgedWriteConcern')] public function testUnacknowledgedWriteConcernAccessesMatchedCount(BulkWriteResult $result): void { - $this->expectException(BadMethodCallException::class); - $this->expectExceptionMessageMatches('/[\w:\\\\]+ should not be called for an unacknowledged write result/'); + $this->expectException(LogicException::class); + $this->expectExceptionMessageMatches('/[\w:\\\\\(\)]+ should not be called for an unacknowledged write result/'); $result->getMatchedCount(); } - /** @depends testUnacknowledgedWriteConcern */ + #[Depends('testUnacknowledgedWriteConcern')] public function testUnacknowledgedWriteConcernAccessesModifiedCount(BulkWriteResult $result): void { - $this->expectException(BadMethodCallException::class); - $this->expectExceptionMessageMatches('/[\w:\\\\]+ should not be called for an unacknowledged write result/'); + $this->expectException(LogicException::class); + $this->expectExceptionMessageMatches('/[\w:\\\\\(\)]+ should not be called for an unacknowledged write result/'); $result->getModifiedCount(); } - /** @depends testUnacknowledgedWriteConcern */ + #[Depends('testUnacknowledgedWriteConcern')] public function testUnacknowledgedWriteConcernAccessesUpsertedCount(BulkWriteResult $result): void { - $this->expectException(BadMethodCallException::class); - $this->expectExceptionMessageMatches('/[\w:\\\\]+ should not be called for an unacknowledged write result/'); + $this->expectException(LogicException::class); + $this->expectExceptionMessageMatches('/[\w:\\\\\(\)]+ should not be called for an unacknowledged write result/'); $result->getUpsertedCount(); } - /** @depends testUnacknowledgedWriteConcern */ + #[Depends('testUnacknowledgedWriteConcern')] public function testUnacknowledgedWriteConcernAccessesUpsertedIds(BulkWriteResult $result): void { - $this->expectException(BadMethodCallException::class); - $this->expectExceptionMessageMatches('/[\w:\\\\]+ should not be called for an unacknowledged write result/'); + $this->expectException(LogicException::class); + $this->expectExceptionMessageMatches('/[\w:\\\\\(\)]+ should not be called for an unacknowledged write result/'); $result->getUpsertedIds(); } @@ -379,7 +377,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } @@ -398,7 +396,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('bypassDocumentValidation', $event['started']->getCommand()); + $this->assertObjectHasProperty('bypassDocumentValidation', $event['started']->getCommand()); $this->assertEquals(true, $event['started']->getCommand()->bypassDocumentValidation); }, ); @@ -418,7 +416,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('bypassDocumentValidation', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('bypassDocumentValidation', $event['started']->getCommand()); }, ); } @@ -502,7 +500,7 @@ private function createFixtures(int $n): void for ($i = 1; $i <= $n; $i++) { $bulkWrite->insert([ '_id' => $i, - 'x' => (integer) ($i . $i), + 'x' => (int) ($i . $i), ]); } diff --git a/tests/Operation/BulkWriteTest.php b/tests/Operation/BulkWriteTest.php index 2c255bec5..30d5c6374 100644 --- a/tests/Operation/BulkWriteTest.php +++ b/tests/Operation/BulkWriteTest.php @@ -2,10 +2,14 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Exception\UnsupportedValueException; use MongoDB\Operation\BulkWrite; use MongoDB\Tests\Fixtures\Codec\TestDocumentCodec; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; +use TypeError; class BulkWriteTest extends TestCase { @@ -55,7 +59,7 @@ public function testInsertOneDocumentArgumentMissing(): void ]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testInsertOneDocumentArgumentTypeCheck($document): void { $this->expectException(InvalidArgumentException::class); @@ -86,7 +90,7 @@ public function testDeleteManyFilterArgumentMissing(): void ]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testDeleteManyFilterArgumentTypeCheck($document): void { $this->expectException(InvalidArgumentException::class); @@ -96,7 +100,7 @@ public function testDeleteManyFilterArgumentTypeCheck($document): void ]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testDeleteManyCollationOptionTypeCheck($collation): void { $this->expectException(InvalidArgumentException::class); @@ -115,7 +119,7 @@ public function testDeleteOneFilterArgumentMissing(): void ]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testDeleteOneFilterArgumentTypeCheck($document): void { $this->expectException(InvalidArgumentException::class); @@ -125,7 +129,7 @@ public function testDeleteOneFilterArgumentTypeCheck($document): void ]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testDeleteOneCollationOptionTypeCheck($collation): void { $this->expectException(InvalidArgumentException::class); @@ -144,7 +148,7 @@ public function testReplaceOneFilterArgumentMissing(): void ]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testReplaceOneFilterArgumentTypeCheck($filter): void { $this->expectException(InvalidArgumentException::class); @@ -154,10 +158,8 @@ public function testReplaceOneFilterArgumentTypeCheck($filter): void ]); } - /** - * @dataProvider provideReplacementDocuments - * @doesNotPerformAssertions - */ + #[DataProvider('provideReplacementDocuments')] + #[DoesNotPerformAssertions] public function testReplaceOneReplacementArgument($replacement): void { new BulkWrite($this->getDatabaseName(), $this->getCollectionName(), [ @@ -174,7 +176,7 @@ public function testReplaceOneReplacementArgumentMissing(): void ]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testReplaceOneReplacementArgumentTypeCheck($replacement): void { $this->expectException(InvalidArgumentException::class); @@ -184,7 +186,7 @@ public function testReplaceOneReplacementArgumentTypeCheck($replacement): void ]); } - /** @dataProvider provideUpdateDocuments */ + #[DataProvider('provideUpdateDocuments')] public function testReplaceOneReplacementArgumentProhibitsUpdateDocument($replacement): void { $this->expectException(InvalidArgumentException::class); @@ -194,10 +196,8 @@ public function testReplaceOneReplacementArgumentProhibitsUpdateDocument($replac ]); } - /** - * @dataProvider provideUpdatePipelines - * @dataProvider provideEmptyUpdatePipelinesExcludingArray - */ + #[DataProvider('provideUpdatePipelines')] + #[DataProvider('provideEmptyUpdatePipelinesExcludingArray')] public function testReplaceOneReplacementArgumentProhibitsUpdatePipeline($replacement): void { $this->expectException(InvalidArgumentException::class); @@ -207,7 +207,7 @@ public function testReplaceOneReplacementArgumentProhibitsUpdatePipeline($replac ]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testReplaceOneCollationOptionTypeCheck($collation): void { $this->expectException(InvalidArgumentException::class); @@ -217,7 +217,17 @@ public function testReplaceOneCollationOptionTypeCheck($collation): void ]); } - /** @dataProvider provideInvalidBooleanValues */ + #[DataProvider('provideInvalidDocumentValues')] + public function testReplaceOneSortOptionTypeCheck($sort): void + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessageMatches('/Expected \$operations\[0\]\["replaceOne"\]\[2\]\["sort"\] to have type "document" \(array or object\) but found ".+"/'); + new BulkWrite($this->getDatabaseName(), $this->getCollectionName(), [ + [BulkWrite::REPLACE_ONE => [['x' => 1], ['y' => 1], ['sort' => $sort]]], + ]); + } + + #[DataProvider('provideInvalidBooleanValues')] public function testReplaceOneUpsertOptionTypeCheck($upsert): void { $this->expectException(InvalidArgumentException::class); @@ -227,9 +237,9 @@ public function testReplaceOneUpsertOptionTypeCheck($upsert): void ]); } - public function provideInvalidBooleanValues() + public static function provideInvalidBooleanValues() { - return $this->wrapValuesForDataProvider($this->getInvalidBooleanValues()); + return self::wrapValuesForDataProvider(self::getInvalidBooleanValues()); } public function testReplaceOneWithCodecRejectsInvalidDocuments(): void @@ -253,7 +263,7 @@ public function testUpdateManyFilterArgumentMissing(): void ]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testUpdateManyFilterArgumentTypeCheck($filter): void { $this->expectException(InvalidArgumentException::class); @@ -263,11 +273,9 @@ public function testUpdateManyFilterArgumentTypeCheck($filter): void ]); } - /** - * @dataProvider provideUpdateDocuments - * @dataProvider provideUpdatePipelines - * @doesNotPerformAssertions - */ + #[DataProvider('provideUpdateDocuments')] + #[DataProvider('provideUpdatePipelines')] + #[DoesNotPerformAssertions] public function testUpdateManyUpdateArgument($update): void { new BulkWrite($this->getDatabaseName(), $this->getCollectionName(), [ @@ -284,20 +292,17 @@ public function testUpdateManyUpdateArgumentMissing(): void ]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testUpdateManyUpdateArgumentTypeCheck($update): void { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('Expected update operator(s) or non-empty pipeline for $operations[0]["updateMany"][1]'); + $this->expectException($update instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new BulkWrite($this->getDatabaseName(), $this->getCollectionName(), [ [BulkWrite::UPDATE_MANY => [['x' => 1], $update]], ]); } - /** - * @dataProvider provideReplacementDocuments - * @dataProvider provideEmptyUpdatePipelines - */ + #[DataProvider('provideReplacementDocuments')] + #[DataProvider('provideEmptyUpdatePipelines')] public function testUpdateManyUpdateArgumentProhibitsReplacementDocumentOrEmptyPipeline($update): void { $this->expectException(InvalidArgumentException::class); @@ -307,7 +312,7 @@ public function testUpdateManyUpdateArgumentProhibitsReplacementDocumentOrEmptyP ]); } - /** @dataProvider provideInvalidArrayValues */ + #[DataProvider('provideInvalidArrayValues')] public function testUpdateManyArrayFiltersOptionTypeCheck($arrayFilters): void { $this->expectException(InvalidArgumentException::class); @@ -317,7 +322,7 @@ public function testUpdateManyArrayFiltersOptionTypeCheck($arrayFilters): void ]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testUpdateManyCollationOptionTypeCheck($collation): void { $this->expectException(InvalidArgumentException::class); @@ -327,7 +332,16 @@ public function testUpdateManyCollationOptionTypeCheck($collation): void ]); } - /** @dataProvider provideInvalidBooleanValues */ + public function testUpdateManyProhibitsSortOption(): void + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('"sort" option cannot be used with $operations[0]["updateMany"]'); + new BulkWrite($this->getDatabaseName(), $this->getCollectionName(), [ + [BulkWrite::UPDATE_MANY => [['x' => 1], ['$set' => ['y' => 1]], ['sort' => ['z' => 1]]]], + ]); + } + + #[DataProvider('provideInvalidBooleanValues')] public function testUpdateManyUpsertOptionTypeCheck($upsert): void { $this->expectException(InvalidArgumentException::class); @@ -337,11 +351,9 @@ public function testUpdateManyUpsertOptionTypeCheck($upsert): void ]); } - /** - * @dataProvider provideUpdateDocuments - * @dataProvider provideUpdatePipelines - * @doesNotPerformAssertions - */ + #[DataProvider('provideUpdateDocuments')] + #[DataProvider('provideUpdatePipelines')] + #[DoesNotPerformAssertions] public function testUpdateOneUpdateArgument($update): void { new BulkWrite($this->getDatabaseName(), $this->getCollectionName(), [ @@ -358,7 +370,7 @@ public function testUpdateOneFilterArgumentMissing(): void ]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testUpdateOneFilterArgumentTypeCheck($filter): void { $this->expectException(InvalidArgumentException::class); @@ -377,20 +389,17 @@ public function testUpdateOneUpdateArgumentMissing(): void ]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testUpdateOneUpdateArgumentTypeCheck($update): void { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('Expected update operator(s) or non-empty pipeline for $operations[0]["updateOne"][1]'); + $this->expectException($update instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new BulkWrite($this->getDatabaseName(), $this->getCollectionName(), [ [BulkWrite::UPDATE_ONE => [['x' => 1], $update]], ]); } - /** - * @dataProvider provideReplacementDocuments - * @dataProvider provideEmptyUpdatePipelines - */ + #[DataProvider('provideReplacementDocuments')] + #[DataProvider('provideEmptyUpdatePipelines')] public function testUpdateOneUpdateArgumentProhibitsReplacementDocumentOrEmptyPipeline($update): void { $this->expectException(InvalidArgumentException::class); @@ -400,7 +409,7 @@ public function testUpdateOneUpdateArgumentProhibitsReplacementDocumentOrEmptyPi ]); } - /** @dataProvider provideInvalidArrayValues */ + #[DataProvider('provideInvalidArrayValues')] public function testUpdateOneArrayFiltersOptionTypeCheck($arrayFilters): void { $this->expectException(InvalidArgumentException::class); @@ -410,7 +419,7 @@ public function testUpdateOneArrayFiltersOptionTypeCheck($arrayFilters): void ]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testUpdateOneCollationOptionTypeCheck($collation): void { $this->expectException(InvalidArgumentException::class); @@ -420,7 +429,17 @@ public function testUpdateOneCollationOptionTypeCheck($collation): void ]); } - /** @dataProvider provideInvalidBooleanValues */ + #[DataProvider('provideInvalidDocumentValues')] + public function testUpdateOneSortOptionTypeCheck($sort): void + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessageMatches('/Expected \$operations\[0\]\["updateOne"\]\[2\]\["sort"\] to have type "document" \(array or object\) but found ".+"/'); + new BulkWrite($this->getDatabaseName(), $this->getCollectionName(), [ + [BulkWrite::UPDATE_ONE => [['x' => 1], ['$set' => ['y' => 1]], ['sort' => $sort]]], + ]); + } + + #[DataProvider('provideInvalidBooleanValues')] public function testUpdateOneUpsertOptionTypeCheck($upsert): void { $this->expectException(InvalidArgumentException::class); @@ -430,7 +449,7 @@ public function testUpdateOneUpsertOptionTypeCheck($upsert): void ]); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); @@ -442,14 +461,14 @@ public function testConstructorOptionTypeChecks(array $options): void ); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'bypassDocumentValidation' => $this->getInvalidBooleanValues(), - 'codec' => $this->getInvalidDocumentCodecValues(), - 'ordered' => $this->getInvalidBooleanValues(true), - 'session' => $this->getInvalidSessionValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'bypassDocumentValidation' => self::getInvalidBooleanValues(), + 'codec' => self::getInvalidDocumentCodecValues(), + 'ordered' => self::getInvalidBooleanValues(true), + 'session' => self::getInvalidSessionValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } } diff --git a/tests/Operation/CountDocumentsFunctionalTest.php b/tests/Operation/CountDocumentsFunctionalTest.php index e3dc36a53..be6c64bbd 100644 --- a/tests/Operation/CountDocumentsFunctionalTest.php +++ b/tests/Operation/CountDocumentsFunctionalTest.php @@ -5,11 +5,12 @@ use MongoDB\Operation\CountDocuments; use MongoDB\Operation\InsertMany; use MongoDB\Tests\CommandObserver; +use PHPUnit\Framework\Attributes\DataProvider; use stdClass; class CountDocumentsFunctionalTest extends FunctionalTestCase { - /** @dataProvider provideFilterDocuments */ + #[DataProvider('provideFilterDocuments')] public function testFilterDocuments($filter, stdClass $expectedMatchStage): void { (new CommandObserver())->observe( diff --git a/tests/Operation/CountDocumentsTest.php b/tests/Operation/CountDocumentsTest.php index a7a048be1..44ee49825 100644 --- a/tests/Operation/CountDocumentsTest.php +++ b/tests/Operation/CountDocumentsTest.php @@ -2,36 +2,39 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\CountDocuments; +use PHPUnit\Framework\Attributes\DataProvider; +use TypeError; class CountDocumentsTest extends TestCase { - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorFilterArgumentTypeCheck($filter): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($filter instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new CountDocuments($this->getDatabaseName(), $this->getCollectionName(), $filter); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new CountDocuments($this->getDatabaseName(), $this->getCollectionName(), [], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'collation' => $this->getInvalidDocumentValues(), - 'hint' => $this->getInvalidHintValues(), - 'limit' => $this->getInvalidIntegerValues(), - 'maxTimeMS' => $this->getInvalidIntegerValues(), - 'readConcern' => $this->getInvalidReadConcernValues(), - 'readPreference' => $this->getInvalidReadPreferenceValues(), - 'session' => $this->getInvalidSessionValues(), - 'skip' => $this->getInvalidIntegerValues(), + return self::createOptionDataProvider([ + 'collation' => self::getInvalidDocumentValues(), + 'hint' => self::getInvalidHintValues(), + 'limit' => self::getInvalidIntegerValues(), + 'maxTimeMS' => self::getInvalidIntegerValues(), + 'readConcern' => self::getInvalidReadConcernValues(), + 'readPreference' => self::getInvalidReadPreferenceValues(), + 'session' => self::getInvalidSessionValues(), + 'skip' => self::getInvalidIntegerValues(), ]); } } diff --git a/tests/Operation/CountFunctionalTest.php b/tests/Operation/CountFunctionalTest.php index 47e9bea07..58326a01a 100644 --- a/tests/Operation/CountFunctionalTest.php +++ b/tests/Operation/CountFunctionalTest.php @@ -6,11 +6,12 @@ use MongoDB\Operation\CreateIndexes; use MongoDB\Operation\InsertMany; use MongoDB\Tests\CommandObserver; +use PHPUnit\Framework\Attributes\DataProvider; use stdClass; class CountFunctionalTest extends FunctionalTestCase { - /** @dataProvider provideFilterDocuments */ + #[DataProvider('provideFilterDocuments')] public function testFilterDocuments($filter, stdClass $expectedQuery): void { (new CommandObserver())->observe( @@ -43,7 +44,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('readConcern', $event['started']->getCommand()); }, ); } @@ -99,7 +100,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } diff --git a/tests/Operation/CountTest.php b/tests/Operation/CountTest.php index 7a26341f6..b8a5d357e 100644 --- a/tests/Operation/CountTest.php +++ b/tests/Operation/CountTest.php @@ -2,37 +2,40 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Driver\ReadConcern; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\Count; +use PHPUnit\Framework\Attributes\DataProvider; +use TypeError; class CountTest extends TestCase { - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorFilterArgumentTypeCheck($filter): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($filter instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new Count($this->getDatabaseName(), $this->getCollectionName(), $filter); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new Count($this->getDatabaseName(), $this->getCollectionName(), [], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'collation' => $this->getInvalidDocumentValues(), - 'hint' => $this->getInvalidHintValues(), - 'limit' => $this->getInvalidIntegerValues(), - 'maxTimeMS' => $this->getInvalidIntegerValues(), - 'readConcern' => $this->getInvalidReadConcernValues(), - 'readPreference' => $this->getInvalidReadPreferenceValues(), - 'session' => $this->getInvalidSessionValues(), - 'skip' => $this->getInvalidIntegerValues(), + return self::createOptionDataProvider([ + 'collation' => self::getInvalidDocumentValues(), + 'hint' => self::getInvalidHintValues(), + 'limit' => self::getInvalidIntegerValues(), + 'maxTimeMS' => self::getInvalidIntegerValues(), + 'readConcern' => self::getInvalidReadConcernValues(), + 'readPreference' => self::getInvalidReadPreferenceValues(), + 'session' => self::getInvalidSessionValues(), + 'skip' => self::getInvalidIntegerValues(), ]); } diff --git a/tests/Operation/CreateCollectionFunctionalTest.php b/tests/Operation/CreateCollectionFunctionalTest.php index aa383f091..023a67e60 100644 --- a/tests/Operation/CreateCollectionFunctionalTest.php +++ b/tests/Operation/CreateCollectionFunctionalTest.php @@ -20,7 +20,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand()); }, ); } @@ -38,7 +38,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } diff --git a/tests/Operation/CreateCollectionTest.php b/tests/Operation/CreateCollectionTest.php index 956fa6ed7..4ec92b32f 100644 --- a/tests/Operation/CreateCollectionTest.php +++ b/tests/Operation/CreateCollectionTest.php @@ -4,6 +4,7 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\CreateCollection; +use PHPUnit\Framework\Attributes\DataProvider; class CreateCollectionTest extends TestCase { @@ -14,49 +15,35 @@ public function testConstructorPipelineOptionMustBeAList(): void new CreateCollection($this->getDatabaseName(), $this->getCollectionName(), ['pipeline' => [1 => ['$match' => ['x' => 1]]]]); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new CreateCollection($this->getDatabaseName(), $this->getCollectionName(), $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'autoIndexId' => $this->getInvalidBooleanValues(), - 'capped' => $this->getInvalidBooleanValues(), - 'changeStreamPreAndPostImages' => $this->getInvalidDocumentValues(), - 'clusteredIndex' => $this->getInvalidDocumentValues(), - 'collation' => $this->getInvalidDocumentValues(), - 'encryptedFields' => $this->getInvalidDocumentValues(), - 'expireAfterSeconds' => $this->getInvalidIntegerValues(), - 'flags' => $this->getInvalidIntegerValues(), - 'indexOptionDefaults' => $this->getInvalidDocumentValues(), - 'max' => $this->getInvalidIntegerValues(), - 'maxTimeMS' => $this->getInvalidIntegerValues(), - 'pipeline' => $this->getInvalidArrayValues(), - 'session' => $this->getInvalidSessionValues(), - 'size' => $this->getInvalidIntegerValues(), - 'storageEngine' => $this->getInvalidDocumentValues(), - 'timeseries' => $this->getInvalidDocumentValues(), - 'typeMap' => $this->getInvalidArrayValues(), - 'validationAction' => $this->getInvalidStringValues(), - 'validationLevel' => $this->getInvalidStringValues(), - 'validator' => $this->getInvalidDocumentValues(), - 'viewOn' => $this->getInvalidStringValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'capped' => self::getInvalidBooleanValues(), + 'changeStreamPreAndPostImages' => self::getInvalidDocumentValues(), + 'clusteredIndex' => self::getInvalidDocumentValues(), + 'collation' => self::getInvalidDocumentValues(), + 'encryptedFields' => self::getInvalidDocumentValues(), + 'expireAfterSeconds' => self::getInvalidIntegerValues(), + 'indexOptionDefaults' => self::getInvalidDocumentValues(), + 'max' => self::getInvalidIntegerValues(), + 'maxTimeMS' => self::getInvalidIntegerValues(), + 'pipeline' => self::getInvalidArrayValues(), + 'session' => self::getInvalidSessionValues(), + 'size' => self::getInvalidIntegerValues(), + 'storageEngine' => self::getInvalidDocumentValues(), + 'timeseries' => self::getInvalidDocumentValues(), + 'validationAction' => self::getInvalidStringValues(), + 'validationLevel' => self::getInvalidStringValues(), + 'validator' => self::getInvalidDocumentValues(), + 'viewOn' => self::getInvalidStringValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } - - public function testAutoIndexIdOptionIsDeprecated(): void - { - $this->assertDeprecated(function (): void { - new CreateCollection($this->getDatabaseName(), $this->getCollectionName(), ['autoIndexId' => true]); - }); - - $this->assertDeprecated(function (): void { - new CreateCollection($this->getDatabaseName(), $this->getCollectionName(), ['autoIndexId' => false]); - }); - } } diff --git a/tests/Operation/CreateEncryptedCollectionFunctionalTest.php b/tests/Operation/CreateEncryptedCollectionFunctionalTest.php index dde1f7d4e..7c0cb644f 100644 --- a/tests/Operation/CreateEncryptedCollectionFunctionalTest.php +++ b/tests/Operation/CreateEncryptedCollectionFunctionalTest.php @@ -10,6 +10,7 @@ use MongoDB\Model\BSONArray; use MongoDB\Model\BSONDocument; use MongoDB\Operation\CreateEncryptedCollection; +use PHPUnit\Framework\Attributes\DataProvider; use function base64_decode; use function getenv; @@ -26,10 +27,6 @@ public function setUp(): void $this->skipIfClientSideEncryptionIsNotSupported(); - if (! static::isCryptSharedLibAvailable() && ! static::isMongocryptdAvailable()) { - $this->markTestSkipped('Neither crypt_shared nor mongocryptd are available'); - } - if ($this->isStandalone()) { $this->markTestSkipped('Queryable Encryption requires replica sets'); } @@ -54,7 +51,7 @@ public function setUp(): void ]); } - /** @dataProvider provideEncryptedFieldsAndFieldsIsMissing */ + #[DataProvider('provideEncryptedFieldsAndFieldsIsMissing')] public function testCreateDataKeysNopIfFieldsIsMissing($input, array $expectedOutput): void { $operation = new CreateEncryptedCollection( @@ -63,17 +60,16 @@ public function testCreateDataKeysNopIfFieldsIsMissing($input, array $expectedOu ['encryptedFields' => $input], ); - $operation->createDataKeys( + $encryptedFieldsOutput = $operation->createDataKeys( $this->clientEncryption, 'local', null, - $encryptedFieldsOutput, ); $this->assertSame($expectedOutput, $encryptedFieldsOutput); } - public function provideEncryptedFieldsAndFieldsIsMissing(): array + public static function provideEncryptedFieldsAndFieldsIsMissing(): array { $ef = []; @@ -85,7 +81,7 @@ public function provideEncryptedFieldsAndFieldsIsMissing(): array ]; } - /** @dataProvider provideEncryptedFieldsAndFieldsHasInvalidType */ + #[DataProvider('provideEncryptedFieldsAndFieldsHasInvalidType')] public function testCreateDataKeysNopIfFieldsHasInvalidType($input, array $expectedOutput): void { $operation = new CreateEncryptedCollection( @@ -94,17 +90,16 @@ public function testCreateDataKeysNopIfFieldsHasInvalidType($input, array $expec ['encryptedFields' => $input], ); - $operation->createDataKeys( + $encryptedFieldsOutput = $operation->createDataKeys( $this->clientEncryption, 'local', null, - $encryptedFieldsOutput, ); $this->assertSame($expectedOutput, $encryptedFieldsOutput); } - public function provideEncryptedFieldsAndFieldsHasInvalidType(): array + public static function provideEncryptedFieldsAndFieldsHasInvalidType(): array { $ef = ['fields' => 'not-an-array']; @@ -116,7 +111,7 @@ public function provideEncryptedFieldsAndFieldsHasInvalidType(): array ]; } - /** @dataProvider provideEncryptedFieldsElementHasInvalidType */ + #[DataProvider('provideEncryptedFieldsElementHasInvalidType')] public function testCreateDataKeysSkipsNonDocumentFields($input, array $expectedOutput): void { $operation = new CreateEncryptedCollection( @@ -125,17 +120,16 @@ public function testCreateDataKeysSkipsNonDocumentFields($input, array $expected ['encryptedFields' => $input], ); - $operation->createDataKeys( + $encryptedFieldsOutput = $operation->createDataKeys( $this->clientEncryption, 'local', null, - $encryptedFieldsOutput, ); $this->assertSame($expectedOutput, $encryptedFieldsOutput); } - public function provideEncryptedFieldsElementHasInvalidType(): array + public static function provideEncryptedFieldsElementHasInvalidType(): array { $ef = ['fields' => ['not-an-array-or-object']]; @@ -158,11 +152,10 @@ public function testCreateDataKeysDoesNotModifyOriginalEncryptedFieldsOption(): ['encryptedFields' => $originalEncryptedFields], ); - $operation->createDataKeys( + $modifiedEncryptedFields = $operation->createDataKeys( $this->clientEncryption, 'local', null, - $modifiedEncryptedFields, ); $this->assertSame($originalField, $originalEncryptedFields->fields[0]); @@ -171,7 +164,7 @@ public function testCreateDataKeysDoesNotModifyOriginalEncryptedFieldsOption(): $this->assertInstanceOf(Binary::class, $modifiedEncryptedFields['fields'][0]['keyId'] ?? null); } - /** @dataProvider provideEncryptedFields */ + #[DataProvider('provideEncryptedFields')] public function testEncryptedFieldsDocuments($input): void { $operation = new CreateEncryptedCollection( @@ -180,17 +173,16 @@ public function testEncryptedFieldsDocuments($input): void ['encryptedFields' => $input], ); - $operation->createDataKeys( + $modifiedEncryptedFields = $operation->createDataKeys( $this->clientEncryption, 'local', null, - $modifiedEncryptedFields, ); $this->assertInstanceOf(Binary::class, $modifiedEncryptedFields['fields'][0]['keyId'] ?? null); } - public function provideEncryptedFields(): array + public static function provideEncryptedFields(): array { $ef = ['fields' => [['path' => 'ssn', 'bsonType' => 'string', 'keyId' => null]]]; diff --git a/tests/Operation/CreateEncryptedCollectionTest.php b/tests/Operation/CreateEncryptedCollectionTest.php index c3c22f5e3..b5c8bf4ea 100644 --- a/tests/Operation/CreateEncryptedCollectionTest.php +++ b/tests/Operation/CreateEncryptedCollectionTest.php @@ -5,24 +5,25 @@ use Generator; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\CreateEncryptedCollection; +use PHPUnit\Framework\Attributes\DataProvider; class CreateEncryptedCollectionTest extends TestCase { - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new CreateEncryptedCollection($this->getDatabaseName(), $this->getCollectionName(), $options); } - public function provideInvalidConstructorOptions(): Generator + public static function provideInvalidConstructorOptions(): Generator { yield 'encryptedFields is required' => [ [], ]; - yield from $this->createOptionDataProvider([ - 'encryptedFields' => $this->getInvalidDocumentValues(), + yield from self::createOptionDataProvider([ + 'encryptedFields' => self::getInvalidDocumentValues(), ]); } } diff --git a/tests/Operation/CreateIndexesFunctionalTest.php b/tests/Operation/CreateIndexesFunctionalTest.php index 4204465d7..a90eaec75 100644 --- a/tests/Operation/CreateIndexesFunctionalTest.php +++ b/tests/Operation/CreateIndexesFunctionalTest.php @@ -12,6 +12,7 @@ use MongoDB\Operation\CreateIndexes; use MongoDB\Operation\ListIndexes; use MongoDB\Tests\CommandObserver; +use PHPUnit\Framework\Attributes\DataProvider; use function call_user_func; use function is_callable; @@ -79,7 +80,7 @@ public function testCreateTTLIndex(): void }); } - /** @dataProvider provideKeyCasts */ + #[DataProvider('provideKeyCasts')] public function testCreateIndexes(callable $cast): void { $expectedNames = ['x_1', 'y_-1_z_1', 'g_2dsphere_z_1', 'my_ttl']; @@ -121,7 +122,7 @@ public function testCreateIndexes(callable $cast): void }); } - public function provideKeyCasts(): array + public static function provideKeyCasts(): array { // phpcs:disable SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing // phpcs:disable Squiz.Functions.MultiLineFunctionDeclaration @@ -162,7 +163,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand()); }, ); } @@ -181,7 +182,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } @@ -206,7 +207,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('commitQuorum', $event['started']->getCommand()); + $this->assertObjectHasProperty('commitQuorum', $event['started']->getCommand()); }, ); } diff --git a/tests/Operation/CreateIndexesTest.php b/tests/Operation/CreateIndexesTest.php index 04e0e86ba..5db02f67f 100644 --- a/tests/Operation/CreateIndexesTest.php +++ b/tests/Operation/CreateIndexesTest.php @@ -7,6 +7,7 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Model\BSONDocument; use MongoDB\Operation\CreateIndexes; +use PHPUnit\Framework\Attributes\DataProvider; use stdClass; class CreateIndexesTest extends TestCase @@ -18,21 +19,21 @@ public function testConstructorIndexesArgumentMustBeAList(): void new CreateIndexes($this->getDatabaseName(), $this->getCollectionName(), [1 => ['key' => ['x' => 1]]]); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new CreateIndexes($this->getDatabaseName(), $this->getCollectionName(), [['key' => ['x' => 1]]], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ + return self::createOptionDataProvider([ // commitQuorum is int|string, for which no helper exists 'commitQuorum' => ['float' => 3.14, 'bool' => true, 'array' => [], 'object' => new stdClass()], - 'maxTimeMS' => $this->getInvalidIntegerValues(), - 'session' => $this->getInvalidSessionValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + 'maxTimeMS' => self::getInvalidIntegerValues(), + 'session' => self::getInvalidSessionValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } @@ -43,7 +44,7 @@ public function testConstructorRequiresAtLeastOneIndex(): void new CreateIndexes($this->getDatabaseName(), $this->getCollectionName(), []); } - /** @dataProvider provideInvalidIndexSpecificationTypes */ + #[DataProvider('provideInvalidIndexSpecificationTypes')] public function testConstructorRequiresIndexSpecificationsToBeAnArray($index): void { $this->expectException(InvalidArgumentException::class); @@ -51,9 +52,9 @@ public function testConstructorRequiresIndexSpecificationsToBeAnArray($index): v new CreateIndexes($this->getDatabaseName(), $this->getCollectionName(), [$index]); } - public function provideInvalidIndexSpecificationTypes() + public static function provideInvalidIndexSpecificationTypes() { - return $this->wrapValuesForDataProvider($this->getInvalidArrayValues()); + return self::wrapValuesForDataProvider(self::getInvalidArrayValues()); } public function testConstructorRequiresIndexSpecificationKey(): void @@ -63,7 +64,7 @@ public function testConstructorRequiresIndexSpecificationKey(): void new CreateIndexes($this->getDatabaseName(), $this->getCollectionName(), [[]]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorRequiresIndexSpecificationKeyToBeADocument($key): void { $this->expectException(InvalidArgumentException::class); @@ -71,7 +72,7 @@ public function testConstructorRequiresIndexSpecificationKeyToBeADocument($key): new CreateIndexes($this->getDatabaseName(), $this->getCollectionName(), [['key' => $key]]); } - /** @dataProvider provideKeyDocumentsWithInvalidOrder */ + #[DataProvider('provideKeyDocumentsWithInvalidOrder')] public function testConstructorValidatesIndexSpecificationKeyOrder($key): void { $this->expectException(InvalidArgumentException::class); @@ -79,7 +80,7 @@ public function testConstructorValidatesIndexSpecificationKeyOrder($key): void new CreateIndexes($this->getDatabaseName(), $this->getCollectionName(), [['key' => $key]]); } - public function provideKeyDocumentsWithInvalidOrder(): Generator + public static function provideKeyDocumentsWithInvalidOrder(): Generator { $invalidOrderValues = [true, [], new stdClass(), null]; @@ -91,7 +92,7 @@ public function provideKeyDocumentsWithInvalidOrder(): Generator } } - /** @dataProvider provideInvalidStringValues */ + #[DataProvider('provideInvalidStringValues')] public function testConstructorRequiresIndexSpecificationNameToBeString($name): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/Operation/CreateSearchIndexesTest.php b/tests/Operation/CreateSearchIndexesTest.php index 27246873b..d55915048 100644 --- a/tests/Operation/CreateSearchIndexesTest.php +++ b/tests/Operation/CreateSearchIndexesTest.php @@ -4,6 +4,7 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\CreateSearchIndexes; +use PHPUnit\Framework\Attributes\DataProvider; class CreateSearchIndexesTest extends TestCase { @@ -14,7 +15,7 @@ public function testConstructorIndexesArgumentMustBeAList(): void new CreateSearchIndexes($this->getDatabaseName(), $this->getCollectionName(), [1 => ['name' => 'index name', 'definition' => ['mappings' => ['dynamic' => true]]]], []); } - /** @dataProvider provideInvalidArrayValues */ + #[DataProvider('provideInvalidArrayValues')] public function testConstructorIndexDefinitionMustBeADocument($index): void { $this->expectException(InvalidArgumentException::class); @@ -22,7 +23,7 @@ public function testConstructorIndexDefinitionMustBeADocument($index): void new CreateSearchIndexes($this->getDatabaseName(), $this->getCollectionName(), [$index], []); } - /** @dataProvider provideInvalidStringValues */ + #[DataProvider('provideInvalidStringValues')] public function testConstructorIndexNameMustBeAString($name): void { $this->expectException(InvalidArgumentException::class); @@ -30,7 +31,7 @@ public function testConstructorIndexNameMustBeAString($name): void new CreateSearchIndexes($this->getDatabaseName(), $this->getCollectionName(), [['name' => $name, 'definition' => ['mappings' => ['dynamic' => true]]]], []); } - /** @dataProvider provideInvalidStringValues */ + #[DataProvider('provideInvalidStringValues')] public function testConstructorIndexTypeMustBeAString($type): void { $this->expectException(InvalidArgumentException::class); @@ -45,7 +46,7 @@ public function testConstructorIndexDefinitionMustBeDefined(): void new CreateSearchIndexes($this->getDatabaseName(), $this->getCollectionName(), [['name' => 'index name']], []); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorIndexDefinitionMustBeAnArray($definition): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/Operation/DatabaseCommandFunctionalTest.php b/tests/Operation/DatabaseCommandFunctionalTest.php index 4381718e8..abed3b2c1 100644 --- a/tests/Operation/DatabaseCommandFunctionalTest.php +++ b/tests/Operation/DatabaseCommandFunctionalTest.php @@ -7,10 +7,11 @@ use MongoDB\Model\BSONDocument; use MongoDB\Operation\DatabaseCommand; use MongoDB\Tests\CommandObserver; +use PHPUnit\Framework\Attributes\DataProvider; class DatabaseCommandFunctionalTest extends FunctionalTestCase { - /** @dataProvider provideCommandDocuments */ + #[DataProvider('provideCommandDocuments')] public function testCommandDocuments($command): void { (new CommandObserver())->observe( @@ -28,7 +29,7 @@ function (array $event): void { ); } - public function provideCommandDocuments(): array + public static function provideCommandDocuments(): array { return [ 'array' => [['ping' => 1]], @@ -55,7 +56,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } diff --git a/tests/Operation/DatabaseCommandTest.php b/tests/Operation/DatabaseCommandTest.php index c592aa5e4..c579ea5b2 100644 --- a/tests/Operation/DatabaseCommandTest.php +++ b/tests/Operation/DatabaseCommandTest.php @@ -2,31 +2,34 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\DatabaseCommand; +use PHPUnit\Framework\Attributes\DataProvider; +use TypeError; class DatabaseCommandTest extends TestCase { - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorCommandArgumentTypeCheck($command): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($command instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new DatabaseCommand($this->getDatabaseName(), $command); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new DatabaseCommand($this->getDatabaseName(), ['ping' => 1], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'readPreference' => $this->getInvalidReadPreferenceValues(), - 'session' => $this->getInvalidSessionValues(), - 'typeMap' => $this->getInvalidArrayValues(), + return self::createOptionDataProvider([ + 'readPreference' => self::getInvalidReadPreferenceValues(), + 'session' => self::getInvalidSessionValues(), + 'typeMap' => self::getInvalidArrayValues(), ]); } } diff --git a/tests/Operation/DeleteFunctionalTest.php b/tests/Operation/DeleteFunctionalTest.php index 44d96bda7..2aceafa1b 100644 --- a/tests/Operation/DeleteFunctionalTest.php +++ b/tests/Operation/DeleteFunctionalTest.php @@ -5,11 +5,13 @@ use MongoDB\Collection; use MongoDB\DeleteResult; use MongoDB\Driver\BulkWrite; +use MongoDB\Driver\Exception\LogicException; use MongoDB\Driver\WriteConcern; -use MongoDB\Exception\BadMethodCallException; use MongoDB\Exception\UnsupportedException; use MongoDB\Operation\Delete; use MongoDB\Tests\CommandObserver; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Depends; use stdClass; class DeleteFunctionalTest extends FunctionalTestCase @@ -23,7 +25,7 @@ public function setUp(): void $this->collection = new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName()); } - /** @dataProvider provideFilterDocuments */ + #[DataProvider('provideFilterDocuments')] public function testFilterDocuments($filter, stdClass $expectedQuery): void { (new CommandObserver())->observe( @@ -115,7 +117,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } @@ -133,11 +135,11 @@ public function testUnacknowledgedWriteConcern() return $result; } - /** @depends testUnacknowledgedWriteConcern */ + #[Depends('testUnacknowledgedWriteConcern')] public function testUnacknowledgedWriteConcernAccessesDeletedCount(DeleteResult $result): void { - $this->expectException(BadMethodCallException::class); - $this->expectExceptionMessageMatches('/[\w:\\\\]+ should not be called for an unacknowledged write result/'); + $this->expectException(LogicException::class); + $this->expectExceptionMessageMatches('/[\w:\\\\\(\)]+ should not be called for an unacknowledged write result/'); $result->getDeletedCount(); } @@ -151,7 +153,7 @@ private function createFixtures(int $n): void for ($i = 1; $i <= $n; $i++) { $bulkWrite->insert([ '_id' => $i, - 'x' => (integer) ($i . $i), + 'x' => (int) ($i . $i), ]); } diff --git a/tests/Operation/DeleteTest.php b/tests/Operation/DeleteTest.php index 143e7bb16..e1cd5bd74 100644 --- a/tests/Operation/DeleteTest.php +++ b/tests/Operation/DeleteTest.php @@ -7,28 +7,30 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Driver\WriteConcern; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\Delete; +use PHPUnit\Framework\Attributes\DataProvider; use TypeError; class DeleteTest extends TestCase { - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorFilterArgumentTypeCheck($filter): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($filter instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new Delete($this->getDatabaseName(), $this->getCollectionName(), $filter, 0); } - /** @dataProvider provideInvalidIntegerValues */ + #[DataProvider('provideInvalidIntegerValues')] public function testConstructorLimitArgumentMustBeInt($limit): void { $this->expectException(TypeError::class); new Delete($this->getDatabaseName(), $this->getCollectionName(), [], $limit); } - /** @dataProvider provideInvalidLimitValues */ + #[DataProvider('provideInvalidLimitValues')] public function testConstructorLimitArgumentMustBeOneOrZero($limit): void { $this->expectException(InvalidArgumentException::class); @@ -36,26 +38,26 @@ public function testConstructorLimitArgumentMustBeOneOrZero($limit): void new Delete($this->getDatabaseName(), $this->getCollectionName(), [], $limit); } - public function provideInvalidLimitValues() + public static function provideInvalidLimitValues() { - return $this->wrapValuesForDataProvider([-1, 2]); + return self::wrapValuesForDataProvider([-1, 2]); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new Delete($this->getDatabaseName(), $this->getCollectionName(), [], 1, $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'collation' => $this->getInvalidDocumentValues(), - 'hint' => $this->getInvalidHintValues(), - 'let' => $this->getInvalidDocumentValues(), - 'session' => $this->getInvalidSessionValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'collation' => self::getInvalidDocumentValues(), + 'hint' => self::getInvalidHintValues(), + 'let' => self::getInvalidDocumentValues(), + 'session' => self::getInvalidSessionValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } diff --git a/tests/Operation/DistinctFunctionalTest.php b/tests/Operation/DistinctFunctionalTest.php index 625053bd9..5106f881d 100644 --- a/tests/Operation/DistinctFunctionalTest.php +++ b/tests/Operation/DistinctFunctionalTest.php @@ -3,19 +3,23 @@ namespace MongoDB\Tests\Operation; use MongoDB\Driver\BulkWrite; +use MongoDB\Operation\CreateIndexes; use MongoDB\Operation\Distinct; +use MongoDB\Operation\InsertMany; use MongoDB\Tests\CommandObserver; +use PHPUnit\Framework\Attributes\DataProvider; use stdClass; use function is_scalar; use function json_encode; +use function sort; use function usort; use const JSON_THROW_ON_ERROR; class DistinctFunctionalTest extends FunctionalTestCase { - /** @dataProvider provideFilterDocuments */ + #[DataProvider('provideFilterDocuments')] public function testFilterDocuments($filter, stdClass $expectedQuery): void { (new CommandObserver())->observe( @@ -50,11 +54,52 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('readConcern', $event['started']->getCommand()); }, ); } + public function testHintOption(): void + { + $this->skipIfServerVersion('<', '7.1.0', 'hint is not supported'); + + $insertMany = new InsertMany($this->getDatabaseName(), $this->getCollectionName(), [ + ['x' => 1], + ['x' => 2, 'y' => 2], + ['y' => 3], + ]); + $insertMany->execute($this->getPrimaryServer()); + + $createIndexes = new CreateIndexes($this->getDatabaseName(), $this->getCollectionName(), [ + ['key' => ['x' => 1], 'sparse' => true, 'name' => 'sparse_x'], + ['key' => ['y' => 1]], + ]); + $createIndexes->execute($this->getPrimaryServer()); + + $hintsUsingSparseIndex = [ + ['x' => 1], + 'sparse_x', + ]; + + foreach ($hintsUsingSparseIndex as $hint) { + $operation = new Distinct($this->getDatabaseName(), $this->getCollectionName(), 'y', [], ['hint' => $hint]); + $this->assertSame([2], $operation->execute($this->getPrimaryServer())); + } + + $hintsNotUsingSparseIndex = [ + ['_id' => 1], + ['y' => 1], + 'y_1', + ]; + + foreach ($hintsNotUsingSparseIndex as $hint) { + $operation = new Distinct($this->getDatabaseName(), $this->getCollectionName(), 'x', [], ['hint' => $hint]); + $values = $operation->execute($this->getPrimaryServer()); + sort($values); + $this->assertSame([1, 2], $values); + } + } + public function testSessionOption(): void { (new CommandObserver())->observe( @@ -70,12 +115,12 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } - /** @dataProvider provideTypeMapOptionsAndExpectedDocuments */ + #[DataProvider('provideTypeMapOptionsAndExpectedDocuments')] public function testTypeMapOption(array $typeMap, array $expectedDocuments): void { $bulkWrite = new BulkWrite(['ordered' => true]); @@ -118,7 +163,7 @@ public function testTypeMapOption(array $typeMap, array $expectedDocuments): voi $this->assertEquals($expectedDocuments, $values); } - public function provideTypeMapOptionsAndExpectedDocuments() + public static function provideTypeMapOptionsAndExpectedDocuments() { return [ 'No type map' => [ diff --git a/tests/Operation/DistinctTest.php b/tests/Operation/DistinctTest.php index f04d244ca..c8cffc337 100644 --- a/tests/Operation/DistinctTest.php +++ b/tests/Operation/DistinctTest.php @@ -2,36 +2,40 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Driver\ReadConcern; use MongoDB\Driver\ReadPreference; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\Distinct; +use PHPUnit\Framework\Attributes\DataProvider; +use TypeError; class DistinctTest extends TestCase { - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorFilterArgumentTypeCheck($filter): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($filter instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new Distinct($this->getDatabaseName(), $this->getCollectionName(), 'x', $filter); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new Distinct($this->getDatabaseName(), $this->getCollectionName(), 'x', [], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'collation' => $this->getInvalidDocumentValues(), - 'maxTimeMS' => $this->getInvalidIntegerValues(), - 'readConcern' => $this->getInvalidReadConcernValues(), - 'readPreference' => $this->getInvalidReadPreferenceValues(), - 'session' => $this->getInvalidSessionValues(), - 'typeMap' => $this->getInvalidArrayValues(), + return self::createOptionDataProvider([ + 'collation' => self::getInvalidDocumentValues(), + 'hint' => self::getInvalidHintValues(), + 'maxTimeMS' => self::getInvalidIntegerValues(), + 'readConcern' => self::getInvalidReadConcernValues(), + 'readPreference' => self::getInvalidReadPreferenceValues(), + 'session' => self::getInvalidSessionValues(), + 'typeMap' => self::getInvalidArrayValues(), ]); } @@ -39,6 +43,7 @@ public function testExplainableCommandDocument(): void { $options = [ 'collation' => ['locale' => 'fr'], + 'hint' => '_id_', 'maxTimeMS' => 100, 'readConcern' => new ReadConcern(ReadConcern::LOCAL), 'comment' => 'explain me', @@ -53,6 +58,7 @@ public function testExplainableCommandDocument(): void 'key' => 'f', 'query' => (object) ['x' => 1], 'collation' => (object) ['locale' => 'fr'], + 'hint' => '_id_', 'comment' => 'explain me', 'maxTimeMS' => 100, 'readConcern' => new ReadConcern(ReadConcern::LOCAL), diff --git a/tests/Operation/DropCollectionFunctionalTest.php b/tests/Operation/DropCollectionFunctionalTest.php index 39b82a69f..3d2015521 100644 --- a/tests/Operation/DropCollectionFunctionalTest.php +++ b/tests/Operation/DropCollectionFunctionalTest.php @@ -5,6 +5,7 @@ use MongoDB\Operation\DropCollection; use MongoDB\Operation\InsertOne; use MongoDB\Tests\CommandObserver; +use PHPUnit\Framework\Attributes\Depends; class DropCollectionFunctionalTest extends FunctionalTestCase { @@ -21,7 +22,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand()); }, ); } @@ -35,23 +36,18 @@ public function testDropExistingCollection(): void $this->assertEquals(1, $writeResult->getInsertedCount()); $operation = new DropCollection($this->getDatabaseName(), $this->getCollectionName()); - $commandResult = $operation->execute($server); + $operation->execute($server); - $this->assertCommandSucceeded($commandResult); $this->assertCollectionDoesNotExist($this->getCollectionName()); } - /** @depends testDropExistingCollection */ + #[Depends('testDropExistingCollection')] public function testDropNonexistentCollection(): void { $this->assertCollectionDoesNotExist($this->getCollectionName()); $operation = new DropCollection($this->getDatabaseName(), $this->getCollectionName()); - $commandResult = $operation->execute($this->getPrimaryServer()); - - /* Avoid inspecting the result document as mongos returns {ok:1.0}, - * which is inconsistent from the expected mongod response of {ok:0}. */ - $this->assertIsObject($commandResult); + $operation->execute($this->getPrimaryServer()); } public function testSessionOption(): void @@ -67,7 +63,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } diff --git a/tests/Operation/DropCollectionTest.php b/tests/Operation/DropCollectionTest.php index eb3ddf76d..5aa580520 100644 --- a/tests/Operation/DropCollectionTest.php +++ b/tests/Operation/DropCollectionTest.php @@ -4,22 +4,22 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\DropCollection; +use PHPUnit\Framework\Attributes\DataProvider; class DropCollectionTest extends TestCase { - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new DropCollection($this->getDatabaseName(), $this->getCollectionName(), $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'session' => $this->getInvalidSessionValues(), - 'typeMap' => $this->getInvalidArrayValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'session' => self::getInvalidSessionValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } } diff --git a/tests/Operation/DropDatabaseFunctionalTest.php b/tests/Operation/DropDatabaseFunctionalTest.php index 6dd101a5d..0ef812a10 100644 --- a/tests/Operation/DropDatabaseFunctionalTest.php +++ b/tests/Operation/DropDatabaseFunctionalTest.php @@ -7,6 +7,7 @@ use MongoDB\Operation\InsertOne; use MongoDB\Operation\ListDatabases; use MongoDB\Tests\CommandObserver; +use PHPUnit\Framework\Attributes\Depends; use function sprintf; @@ -24,7 +25,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand()); }, ); } @@ -43,7 +44,7 @@ public function testDropExistingDatabase(): void $this->assertDatabaseDoesNotExist($server, $this->getDatabaseName()); } - /** @depends testDropExistingDatabase */ + #[Depends('testDropExistingDatabase')] public function testDropNonexistentDatabase(): void { $server = $this->getPrimaryServer(); @@ -69,7 +70,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } diff --git a/tests/Operation/DropDatabaseTest.php b/tests/Operation/DropDatabaseTest.php index 04a5c763f..c2d950223 100644 --- a/tests/Operation/DropDatabaseTest.php +++ b/tests/Operation/DropDatabaseTest.php @@ -4,22 +4,22 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\DropDatabase; +use PHPUnit\Framework\Attributes\DataProvider; class DropDatabaseTest extends TestCase { - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new DropDatabase($this->getDatabaseName(), $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'session' => $this->getInvalidSessionValues(), - 'typeMap' => $this->getInvalidArrayValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'session' => self::getInvalidSessionValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } } diff --git a/tests/Operation/DropEncryptedCollectionTest.php b/tests/Operation/DropEncryptedCollectionTest.php index 4cb0a2401..a0055104c 100644 --- a/tests/Operation/DropEncryptedCollectionTest.php +++ b/tests/Operation/DropEncryptedCollectionTest.php @@ -5,24 +5,25 @@ use Generator; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\DropEncryptedCollection; +use PHPUnit\Framework\Attributes\DataProvider; class DropEncryptedCollectionTest extends TestCase { - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new DropEncryptedCollection($this->getDatabaseName(), $this->getCollectionName(), $options); } - public function provideInvalidConstructorOptions(): Generator + public static function provideInvalidConstructorOptions(): Generator { yield 'encryptedFields is required' => [ [], ]; - yield from $this->createOptionDataProvider([ - 'encryptedFields' => $this->getInvalidDocumentValues(), + yield from self::createOptionDataProvider([ + 'encryptedFields' => self::getInvalidDocumentValues(), ]); } } diff --git a/tests/Operation/DropIndexesFunctionalTest.php b/tests/Operation/DropIndexesFunctionalTest.php index 1c3604159..f273cb216 100644 --- a/tests/Operation/DropIndexesFunctionalTest.php +++ b/tests/Operation/DropIndexesFunctionalTest.php @@ -32,7 +32,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand()); }, ); } @@ -48,7 +48,7 @@ public function testDropOneIndexByName(): void $this->assertIndexExists('x_1'); $operation = new DropIndexes($this->getDatabaseName(), $this->getCollectionName(), 'x_1'); - $this->assertCommandSucceeded($operation->execute($this->getPrimaryServer())); + $operation->execute($this->getPrimaryServer()); $operation = new ListIndexes($this->getDatabaseName(), $this->getCollectionName()); $indexes = $operation->execute($this->getPrimaryServer()); @@ -76,7 +76,7 @@ public function testDropAllIndexesByWildcard(): void $this->assertIndexExists('y_1'); $operation = new DropIndexes($this->getDatabaseName(), $this->getCollectionName(), '*'); - $this->assertCommandSucceeded($operation->execute($this->getPrimaryServer())); + $operation->execute($this->getPrimaryServer()); $operation = new ListIndexes($this->getDatabaseName(), $this->getCollectionName()); $indexes = $operation->execute($this->getPrimaryServer()); @@ -108,7 +108,7 @@ public function testDropByIndexInfo(): void $this->assertIndexExists('x_1'); $operation = new DropIndexes($this->getDatabaseName(), $this->getCollectionName(), $info); - $this->assertCommandSucceeded($operation->execute($this->getPrimaryServer())); + $operation->execute($this->getPrimaryServer()); $operation = new ListIndexes($this->getDatabaseName(), $this->getCollectionName()); $indexes = $operation->execute($this->getPrimaryServer()); @@ -137,7 +137,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } diff --git a/tests/Operation/DropIndexesTest.php b/tests/Operation/DropIndexesTest.php index 5fc021071..214330512 100644 --- a/tests/Operation/DropIndexesTest.php +++ b/tests/Operation/DropIndexesTest.php @@ -4,6 +4,7 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\DropIndexes; +use PHPUnit\Framework\Attributes\DataProvider; class DropIndexesTest extends TestCase { @@ -13,20 +14,19 @@ public function testDropIndexShouldNotAllowEmptyIndexName(): void new DropIndexes($this->getDatabaseName(), $this->getCollectionName(), ''); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new DropIndexes($this->getDatabaseName(), $this->getCollectionName(), '*', $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'maxTimeMS' => $this->getInvalidIntegerValues(), - 'session' => $this->getInvalidSessionValues(), - 'typeMap' => $this->getInvalidArrayValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'maxTimeMS' => self::getInvalidIntegerValues(), + 'session' => self::getInvalidSessionValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } } diff --git a/tests/Operation/EstimatedDocumentCountTest.php b/tests/Operation/EstimatedDocumentCountTest.php index bf090c50d..c530d0e2d 100644 --- a/tests/Operation/EstimatedDocumentCountTest.php +++ b/tests/Operation/EstimatedDocumentCountTest.php @@ -4,23 +4,24 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\EstimatedDocumentCount; +use PHPUnit\Framework\Attributes\DataProvider; class EstimatedDocumentCountTest extends TestCase { - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new EstimatedDocumentCount($this->getDatabaseName(), $this->getCollectionName(), $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'maxTimeMS' => $this->getInvalidIntegerValues(), - 'readConcern' => $this->getInvalidReadConcernValues(), - 'readPreference' => $this->getInvalidReadPreferenceValues(), - 'session' => $this->getInvalidSessionValues(), + return self::createOptionDataProvider([ + 'maxTimeMS' => self::getInvalidIntegerValues(), + 'readConcern' => self::getInvalidReadConcernValues(), + 'readPreference' => self::getInvalidReadPreferenceValues(), + 'session' => self::getInvalidSessionValues(), ]); } } diff --git a/tests/Operation/ExplainFunctionalTest.php b/tests/Operation/ExplainFunctionalTest.php index 19b59dc5f..772479deb 100644 --- a/tests/Operation/ExplainFunctionalTest.php +++ b/tests/Operation/ExplainFunctionalTest.php @@ -20,13 +20,14 @@ use MongoDB\Operation\UpdateMany; use MongoDB\Operation\UpdateOne; use MongoDB\Tests\CommandObserver; +use PHPUnit\Framework\Attributes\DataProvider; use function array_key_exists; use function array_key_first; class ExplainFunctionalTest extends FunctionalTestCase { - /** @dataProvider provideVerbosityInformation */ + #[DataProvider('provideVerbosityInformation')] public function testCount($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void { $this->createFixtures(3); @@ -39,7 +40,7 @@ public function testCount($verbosity, $executionStatsExpected, $allPlansExecutio $this->assertExplainResult($result, $executionStatsExpected, $allPlansExecutionExpected); } - /** @dataProvider provideVerbosityInformation */ + #[DataProvider('provideVerbosityInformation')] public function testDelete($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void { $this->createFixtures(3); @@ -54,7 +55,7 @@ public function testDelete($verbosity, $executionStatsExpected, $allPlansExecuti $this->assertExplainResult($result, $executionStatsExpected, $allPlansExecutionExpected); } - /** @dataProvider provideVerbosityInformation */ + #[DataProvider('provideVerbosityInformation')] public function testDeleteMany($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void { $this->createFixtures(3); @@ -69,7 +70,7 @@ public function testDeleteMany($verbosity, $executionStatsExpected, $allPlansExe $this->assertExplainResult($result, $executionStatsExpected, $allPlansExecutionExpected); } - /** @dataProvider provideVerbosityInformation */ + #[DataProvider('provideVerbosityInformation')] public function testDeleteOne($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void { $this->createFixtures(3); @@ -84,7 +85,7 @@ public function testDeleteOne($verbosity, $executionStatsExpected, $allPlansExec $this->assertExplainResult($result, $executionStatsExpected, $allPlansExecutionExpected); } - /** @dataProvider provideVerbosityInformation */ + #[DataProvider('provideVerbosityInformation')] public function testDistinct($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void { $operation = new Distinct($this->getDatabaseName(), $this->getCollectionName(), 'x', []); @@ -95,7 +96,7 @@ public function testDistinct($verbosity, $executionStatsExpected, $allPlansExecu $this->assertExplainResult($result, $executionStatsExpected, $allPlansExecutionExpected); } - /** @dataProvider provideVerbosityInformation */ + #[DataProvider('provideVerbosityInformation')] public function testFindAndModify($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void { $operation = new FindAndModify($this->getDatabaseName(), $this->getCollectionName(), ['remove' => true]); @@ -106,7 +107,7 @@ public function testFindAndModify($verbosity, $executionStatsExpected, $allPlans $this->assertExplainResult($result, $executionStatsExpected, $allPlansExecutionExpected); } - /** @dataProvider provideVerbosityInformation */ + #[DataProvider('provideVerbosityInformation')] public function testFind($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void { $this->createFixtures(3); @@ -150,38 +151,14 @@ function () use ($operation): void { }, function (array $event): void { $command = $event['started']->getCommand(); - $this->assertObjectNotHasAttribute('maxAwaitTimeMS', $command->explain); - $this->assertObjectHasAttribute('tailable', $command->explain); - $this->assertObjectHasAttribute('awaitData', $command->explain); + $this->assertObjectNotHasProperty('maxAwaitTimeMS', $command->explain); + $this->assertObjectHasProperty('tailable', $command->explain); + $this->assertObjectHasProperty('awaitData', $command->explain); }, ); } - public function testFindModifiers(): void - { - $this->createFixtures(3); - - $operation = new Find( - $this->getDatabaseName(), - $this->getCollectionName(), - [], - ['modifiers' => ['$orderby' => ['_id' => 1]]], - ); - - (new CommandObserver())->observe( - function () use ($operation): void { - $explainOperation = new Explain($this->getDatabaseName(), $operation, ['typeMap' => ['root' => 'array', 'document' => 'array']]); - $explainOperation->execute($this->getPrimaryServer()); - }, - function (array $event): void { - $command = $event['started']->getCommand(); - $this->assertObjectHasAttribute('sort', $command->explain); - $this->assertObjectNotHasAttribute('modifiers', $command->explain); - }, - ); - } - - /** @dataProvider provideVerbosityInformation */ + #[DataProvider('provideVerbosityInformation')] public function testFindOne($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void { $this->createFixtures(1); @@ -194,7 +171,7 @@ public function testFindOne($verbosity, $executionStatsExpected, $allPlansExecut $this->assertExplainResult($result, $executionStatsExpected, $allPlansExecutionExpected); } - /** @dataProvider provideVerbosityInformation */ + #[DataProvider('provideVerbosityInformation')] public function testFindOneAndDelete($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void { $operation = new FindOneAndDelete($this->getDatabaseName(), $this->getCollectionName(), []); @@ -205,7 +182,7 @@ public function testFindOneAndDelete($verbosity, $executionStatsExpected, $allPl $this->assertExplainResult($result, $executionStatsExpected, $allPlansExecutionExpected); } - /** @dataProvider provideVerbosityInformation */ + #[DataProvider('provideVerbosityInformation')] public function testFindOneAndReplace($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void { $operation = new FindOneAndReplace($this->getDatabaseName(), $this->getCollectionName(), ['x' => 1.1], ['x' => 5]); @@ -216,7 +193,7 @@ public function testFindOneAndReplace($verbosity, $executionStatsExpected, $allP $this->assertExplainResult($result, $executionStatsExpected, $allPlansExecutionExpected); } - /** @dataProvider provideVerbosityInformation */ + #[DataProvider('provideVerbosityInformation')] public function testFindOneAndUpdate($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void { $operation = new FindOneAndUpdate($this->getDatabaseName(), $this->getCollectionName(), [], ['$rename' => ['x' => 'y']]); @@ -227,7 +204,7 @@ public function testFindOneAndUpdate($verbosity, $executionStatsExpected, $allPl $this->assertExplainResult($result, $executionStatsExpected, $allPlansExecutionExpected); } - /** @dataProvider provideVerbosityInformation */ + #[DataProvider('provideVerbosityInformation')] public function testUpdate($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void { $this->createFixtures(3); @@ -261,7 +238,7 @@ function (): void { $result = $explainOperation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute( + $this->assertObjectHasProperty( 'bypassDocumentValidation', $event['started']->getCommand()->explain, ); @@ -288,7 +265,7 @@ function (): void { $result = $explainOperation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute( + $this->assertObjectNotHasProperty( 'bypassDocumentValidation', $event['started']->getCommand()->explain, ); @@ -296,7 +273,7 @@ function (array $event): void { ); } - /** @dataProvider provideVerbosityInformation */ + #[DataProvider('provideVerbosityInformation')] public function testUpdateMany($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void { $this->createFixtures(3); @@ -312,7 +289,7 @@ public function testUpdateMany($verbosity, $executionStatsExpected, $allPlansExe $this->assertExplainResult($result, $executionStatsExpected, $allPlansExecutionExpected); } - /** @dataProvider provideVerbosityInformation */ + #[DataProvider('provideVerbosityInformation')] public function testUpdateOne($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void { $this->createFixtures(3); @@ -330,8 +307,6 @@ public function testUpdateOne($verbosity, $executionStatsExpected, $allPlansExec public function testAggregate(): void { - $this->skipIfServerVersion('<', '4.0.0', 'Explaining aggregate command requires server version >= 4.0'); - $this->createFixtures(3); // Use a $sort stage to ensure the aggregate does not get optimised to a query @@ -344,7 +319,7 @@ public function testAggregate(): void $this->assertExplainResult($result, false, false); } - /** @dataProvider provideVerbosityInformation */ + #[DataProvider('provideVerbosityInformation')] public function testAggregateOptimizedToQuery($verbosity, $executionStatsExpected, $allPlansExecutionExpected): void { $this->skipIfServerVersion('<', '4.2.0', 'MongoDB < 4.2 does not optimize simple aggregation pipelines'); @@ -360,7 +335,7 @@ public function testAggregateOptimizedToQuery($verbosity, $executionStatsExpecte $this->assertExplainResult($result, $executionStatsExpected, $allPlansExecutionExpected); } - public function provideVerbosityInformation() + public static function provideVerbosityInformation() { return [ [Explain::VERBOSITY_ALL_PLANS, true, true], @@ -405,7 +380,7 @@ private function createFixtures(int $n): void for ($i = 1; $i <= $n; $i++) { $bulkWrite->insert([ '_id' => $i, - 'x' => (integer) ($i . $i), + 'x' => (int) ($i . $i), ]); } diff --git a/tests/Operation/ExplainTest.php b/tests/Operation/ExplainTest.php index 3b202de03..1255d787c 100644 --- a/tests/Operation/ExplainTest.php +++ b/tests/Operation/ExplainTest.php @@ -5,10 +5,11 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\Explain; use MongoDB\Operation\Explainable; +use PHPUnit\Framework\Attributes\DataProvider; class ExplainTest extends TestCase { - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $explainable = $this->getMockBuilder(Explainable::class)->getMock(); @@ -16,13 +17,13 @@ public function testConstructorOptionTypeChecks(array $options): void new Explain($this->getDatabaseName(), $explainable, $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'readPreference' => $this->getInvalidReadPreferenceValues(), - 'session' => $this->getInvalidSessionValues(), - 'typeMap' => $this->getInvalidArrayValues(), - 'verbosity' => $this->getInvalidStringValues(), + return self::createOptionDataProvider([ + 'readPreference' => self::getInvalidReadPreferenceValues(), + 'session' => self::getInvalidSessionValues(), + 'typeMap' => self::getInvalidArrayValues(), + 'verbosity' => self::getInvalidStringValues(), ]); } } diff --git a/tests/Operation/FindAndModifyFunctionalTest.php b/tests/Operation/FindAndModifyFunctionalTest.php index 05e819132..576b0474c 100644 --- a/tests/Operation/FindAndModifyFunctionalTest.php +++ b/tests/Operation/FindAndModifyFunctionalTest.php @@ -12,11 +12,12 @@ use MongoDB\Tests\CommandObserver; use MongoDB\Tests\Fixtures\Codec\TestDocumentCodec; use MongoDB\Tests\Fixtures\Document\TestObject; +use PHPUnit\Framework\Attributes\DataProvider; use stdClass; class FindAndModifyFunctionalTest extends FunctionalTestCase { - /** @dataProvider provideQueryDocuments */ + #[DataProvider('provideQueryDocuments')] public function testQueryDocuments($query, stdClass $expectedQuery): void { (new CommandObserver())->observe( @@ -35,7 +36,7 @@ function (array $event) use ($expectedQuery): void { ); } - public function provideQueryDocuments(): array + public static function provideQueryDocuments(): array { $expected = (object) ['x' => 1]; @@ -47,12 +48,10 @@ public function provideQueryDocuments(): array ]; } - /** - * @dataProvider provideReplacementDocuments - * @dataProvider provideUpdateDocuments - * @dataProvider provideUpdatePipelines - * @dataProvider provideReplacementDocumentLikePipeline - */ + #[DataProvider('provideReplacementDocuments')] + #[DataProvider('provideUpdateDocuments')] + #[DataProvider('provideUpdatePipelines')] + #[DataProvider('provideReplacementDocumentLikePipeline')] public function testUpdateDocuments($update, $expectedUpdate): void { (new CommandObserver())->observe( @@ -74,7 +73,7 @@ function (array $event) use ($expectedUpdate): void { ); } - public function provideReplacementDocumentLikePipeline(): array + public static function provideReplacementDocumentLikePipeline(): array { /* Note: this expected value differs from UpdateFunctionalTest because * FindAndModify is not affected by libmongoc's pipeline detection for @@ -104,7 +103,7 @@ function () use ($server): void { $operation->execute($server); }, function (array $event): void { - $this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('readConcern', $event['started']->getCommand()); }, ); } @@ -122,7 +121,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand()); }, ); } @@ -191,7 +190,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } @@ -209,7 +208,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('bypassDocumentValidation', $event['started']->getCommand()); + $this->assertObjectHasProperty('bypassDocumentValidation', $event['started']->getCommand()); $this->assertEquals(true, $event['started']->getCommand()->bypassDocumentValidation); }, ); @@ -228,12 +227,12 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('bypassDocumentValidation', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('bypassDocumentValidation', $event['started']->getCommand()); }, ); } - /** @dataProvider provideTypeMapOptionsAndExpectedDocument */ + #[DataProvider('provideTypeMapOptionsAndExpectedDocument')] public function testTypeMapOption(?array $typeMap, $expectedDocument): void { $this->createFixtures(1); @@ -251,7 +250,7 @@ public function testTypeMapOption(?array $typeMap, $expectedDocument): void $this->assertEquals($expectedDocument, $document); } - public function provideTypeMapOptionsAndExpectedDocument() + public static function provideTypeMapOptionsAndExpectedDocument() { return [ [ diff --git a/tests/Operation/FindAndModifyTest.php b/tests/Operation/FindAndModifyTest.php index 65676d289..7abc5bfb9 100644 --- a/tests/Operation/FindAndModifyTest.php +++ b/tests/Operation/FindAndModifyTest.php @@ -5,34 +5,35 @@ use MongoDB\Driver\WriteConcern; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\FindAndModify; +use PHPUnit\Framework\Attributes\DataProvider; class FindAndModifyTest extends TestCase { - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new FindAndModify($this->getDatabaseName(), $this->getCollectionName(), $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'arrayFilters' => $this->getInvalidArrayValues(), - 'bypassDocumentValidation' => $this->getInvalidBooleanValues(), - 'codec' => $this->getInvalidDocumentCodecValues(), - 'collation' => $this->getInvalidDocumentValues(), - 'fields' => $this->getInvalidDocumentValues(), - 'maxTimeMS' => $this->getInvalidIntegerValues(), - 'new' => $this->getInvalidBooleanValues(), - 'query' => $this->getInvalidDocumentValues(), - 'remove' => $this->getInvalidBooleanValues(), - 'session' => $this->getInvalidSessionValues(), - 'sort' => $this->getInvalidDocumentValues(), - 'typeMap' => $this->getInvalidArrayValues(), - 'update' => $this->getInvalidUpdateValues(), - 'upsert' => $this->getInvalidBooleanValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'arrayFilters' => self::getInvalidArrayValues(), + 'bypassDocumentValidation' => self::getInvalidBooleanValues(), + 'codec' => self::getInvalidDocumentCodecValues(), + 'collation' => self::getInvalidDocumentValues(), + 'fields' => self::getInvalidDocumentValues(), + 'maxTimeMS' => self::getInvalidIntegerValues(), + 'new' => self::getInvalidBooleanValues(), + 'query' => self::getInvalidDocumentValues(), + 'remove' => self::getInvalidBooleanValues(), + 'session' => self::getInvalidSessionValues(), + 'sort' => self::getInvalidDocumentValues(), + 'typeMap' => self::getInvalidArrayValues(), + 'update' => self::getInvalidUpdateValues(), + 'upsert' => self::getInvalidBooleanValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } diff --git a/tests/Operation/FindFunctionalTest.php b/tests/Operation/FindFunctionalTest.php index cc9720403..0927b29fb 100644 --- a/tests/Operation/FindFunctionalTest.php +++ b/tests/Operation/FindFunctionalTest.php @@ -2,22 +2,21 @@ namespace MongoDB\Tests\Operation; -use MongoDB\BSON\Document; use MongoDB\Driver\BulkWrite; use MongoDB\Driver\ReadPreference; -use MongoDB\Model\BSONDocument; use MongoDB\Operation\CreateIndexes; use MongoDB\Operation\Find; use MongoDB\Tests\CommandObserver; use MongoDB\Tests\Fixtures\Codec\TestDocumentCodec; use MongoDB\Tests\Fixtures\Document\TestObject; +use PHPUnit\Framework\Attributes\DataProvider; use stdClass; use function microtime; class FindFunctionalTest extends FunctionalTestCase { - /** @dataProvider provideFilterDocuments */ + #[DataProvider('provideFilterDocuments')] public function testFilterDocuments($filter, stdClass $expectedQuery): void { (new CommandObserver())->observe( @@ -36,40 +35,6 @@ function (array $event) use ($expectedQuery): void { ); } - /** @dataProvider provideModifierDocuments */ - public function testModifierDocuments($modifiers, stdClass $expectedSort): void - { - (new CommandObserver())->observe( - function () use ($modifiers): void { - $operation = new Find( - $this->getDatabaseName(), - $this->getCollectionName(), - [], - ['modifiers' => $modifiers], - ); - - $this->assertDeprecated( - fn () => $operation->execute($this->getPrimaryServer()), - ); - }, - function (array $event) use ($expectedSort): void { - $this->assertEquals($expectedSort, $event['started']->getCommand()->sort ?? null); - }, - ); - } - - public function provideModifierDocuments(): array - { - $expectedSort = (object) ['x' => 1]; - - return [ - 'array' => [['$orderby' => ['x' => 1]], $expectedSort], - 'object' => [(object) ['$orderby' => ['x' => 1]], $expectedSort], - 'Serializable' => [new BSONDocument(['$orderby' => ['x' => 1]]), $expectedSort], - 'Document' => [Document::fromPHP(['$orderby' => ['x' => 1]]), $expectedSort], - ]; - } - public function testDefaultReadConcernIsOmitted(): void { (new CommandObserver())->observe( @@ -84,7 +49,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('readConcern', $event['started']->getCommand()); }, ); } @@ -154,12 +119,12 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } - /** @dataProvider provideTypeMapOptionsAndExpectedDocuments */ + #[DataProvider('provideTypeMapOptionsAndExpectedDocuments')] public function testTypeMapOption(array $typeMap, array $expectedDocuments): void { $this->createFixtures(3); @@ -170,7 +135,7 @@ public function testTypeMapOption(array $typeMap, array $expectedDocuments): voi $this->assertEquals($expectedDocuments, $cursor->toArray()); } - public function provideTypeMapOptionsAndExpectedDocuments() + public static function provideTypeMapOptionsAndExpectedDocuments() { return [ [ diff --git a/tests/Operation/FindOneAndDeleteTest.php b/tests/Operation/FindOneAndDeleteTest.php index 042c3a279..9f4cefd1f 100644 --- a/tests/Operation/FindOneAndDeleteTest.php +++ b/tests/Operation/FindOneAndDeleteTest.php @@ -2,30 +2,33 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Driver\WriteConcern; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\FindOneAndDelete; +use PHPUnit\Framework\Attributes\DataProvider; +use TypeError; class FindOneAndDeleteTest extends TestCase { - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorFilterArgumentTypeCheck($filter): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($filter instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new FindOneAndDelete($this->getDatabaseName(), $this->getCollectionName(), $filter); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new FindOneAndDelete($this->getDatabaseName(), $this->getCollectionName(), [], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'projection' => $this->getInvalidDocumentValues(), + return self::createOptionDataProvider([ + 'projection' => self::getInvalidDocumentValues(), ]); } diff --git a/tests/Operation/FindOneAndReplaceTest.php b/tests/Operation/FindOneAndReplaceTest.php index 94075b89d..dd273a46d 100644 --- a/tests/Operation/FindOneAndReplaceTest.php +++ b/tests/Operation/FindOneAndReplaceTest.php @@ -2,36 +2,38 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Driver\WriteConcern; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\FindOneAndReplace; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; +use TypeError; class FindOneAndReplaceTest extends TestCase { - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorFilterArgumentTypeCheck($filter): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($filter instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new FindOneAndReplace($this->getDatabaseName(), $this->getCollectionName(), $filter, []); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorReplacementArgumentTypeCheck($replacement): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($replacement instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new FindOneAndReplace($this->getDatabaseName(), $this->getCollectionName(), [], $replacement); } - /** - * @dataProvider provideReplacementDocuments - * @doesNotPerformAssertions - */ + #[DataProvider('provideReplacementDocuments')] + #[DoesNotPerformAssertions] public function testConstructorReplacementArgument($replacement): void { new FindOneAndReplace($this->getDatabaseName(), $this->getCollectionName(), [], $replacement); } - /** @dataProvider provideUpdateDocuments */ + #[DataProvider('provideUpdateDocuments')] public function testConstructorReplacementArgumentProhibitsUpdateDocument($replacement): void { $this->expectException(InvalidArgumentException::class); @@ -39,10 +41,8 @@ public function testConstructorReplacementArgumentProhibitsUpdateDocument($repla new FindOneAndReplace($this->getDatabaseName(), $this->getCollectionName(), [], $replacement); } - /** - * @dataProvider provideUpdatePipelines - * @dataProvider provideEmptyUpdatePipelinesExcludingArray - */ + #[DataProvider('provideUpdatePipelines')] + #[DataProvider('provideEmptyUpdatePipelinesExcludingArray')] public function testConstructorReplacementArgumentProhibitsUpdatePipeline($replacement): void { $this->expectException(InvalidArgumentException::class); @@ -50,32 +50,32 @@ public function testConstructorReplacementArgumentProhibitsUpdatePipeline($repla new FindOneAndReplace($this->getDatabaseName(), $this->getCollectionName(), [], $replacement); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new FindOneAndReplace($this->getDatabaseName(), $this->getCollectionName(), [], [], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'codec' => $this->getInvalidDocumentCodecValues(), - 'projection' => $this->getInvalidDocumentValues(), - 'returnDocument' => $this->getInvalidIntegerValues(true), + return self::createOptionDataProvider([ + 'codec' => self::getInvalidDocumentCodecValues(), + 'projection' => self::getInvalidDocumentValues(), + 'returnDocument' => self::getInvalidIntegerValues(true), ]); } - /** @dataProvider provideInvalidConstructorReturnDocumentOptions */ + #[DataProvider('provideInvalidConstructorReturnDocumentOptions')] public function testConstructorReturnDocumentOption($returnDocument): void { $this->expectException(InvalidArgumentException::class); new FindOneAndReplace($this->getDatabaseName(), $this->getCollectionName(), [], [], ['returnDocument' => $returnDocument]); } - public function provideInvalidConstructorReturnDocumentOptions() + public static function provideInvalidConstructorReturnDocumentOptions() { - return $this->wrapValuesForDataProvider([-1, 0, 3]); + return self::wrapValuesForDataProvider([-1, 0, 3]); } public function testExplainableCommandDocument(): void diff --git a/tests/Operation/FindOneAndUpdateTest.php b/tests/Operation/FindOneAndUpdateTest.php index 99d49128a..b20ab59ac 100644 --- a/tests/Operation/FindOneAndUpdateTest.php +++ b/tests/Operation/FindOneAndUpdateTest.php @@ -2,30 +2,31 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Driver\WriteConcern; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\FindOneAndUpdate; +use PHPUnit\Framework\Attributes\DataProvider; +use TypeError; class FindOneAndUpdateTest extends TestCase { - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorFilterArgumentTypeCheck($filter): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($filter instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new FindOneAndUpdate($this->getDatabaseName(), $this->getCollectionName(), $filter, []); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorUpdateArgumentTypeCheck($update): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($update instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new FindOneAndUpdate($this->getDatabaseName(), $this->getCollectionName(), [], $update); } - /** - * @dataProvider provideReplacementDocuments - * @dataProvider provideEmptyUpdatePipelines - */ + #[DataProvider('provideReplacementDocuments')] + #[DataProvider('provideEmptyUpdatePipelines')] public function testConstructorUpdateArgumentProhibitsReplacementDocumentOrEmptyPipeline($update): void { $this->expectException(InvalidArgumentException::class); @@ -33,31 +34,31 @@ public function testConstructorUpdateArgumentProhibitsReplacementDocumentOrEmpty new FindOneAndUpdate($this->getDatabaseName(), $this->getCollectionName(), [], $update); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new FindOneAndUpdate($this->getDatabaseName(), $this->getCollectionName(), [], ['$set' => ['x' => 1]], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'projection' => $this->getInvalidDocumentValues(), - 'returnDocument' => $this->getInvalidIntegerValues(), + return self::createOptionDataProvider([ + 'projection' => self::getInvalidDocumentValues(), + 'returnDocument' => self::getInvalidIntegerValues(), ]); } - /** @dataProvider provideInvalidConstructorReturnDocumentOptions */ + #[DataProvider('provideInvalidConstructorReturnDocumentOptions')] public function testConstructorReturnDocumentOption($returnDocument): void { $this->expectException(InvalidArgumentException::class); new FindOneAndUpdate($this->getDatabaseName(), $this->getCollectionName(), [], [], ['returnDocument' => $returnDocument]); } - public function provideInvalidConstructorReturnDocumentOptions() + public static function provideInvalidConstructorReturnDocumentOptions() { - return $this->wrapValuesForDataProvider([-1, 0, 3]); + return self::wrapValuesForDataProvider([-1, 0, 3]); } public function testExplainableCommandDocument(): void diff --git a/tests/Operation/FindOneFunctionalTest.php b/tests/Operation/FindOneFunctionalTest.php index 57e01f442..de9058b7c 100644 --- a/tests/Operation/FindOneFunctionalTest.php +++ b/tests/Operation/FindOneFunctionalTest.php @@ -6,10 +6,11 @@ use MongoDB\Operation\FindOne; use MongoDB\Tests\Fixtures\Codec\TestDocumentCodec; use MongoDB\Tests\Fixtures\Document\TestObject; +use PHPUnit\Framework\Attributes\DataProvider; class FindOneFunctionalTest extends FunctionalTestCase { - /** @dataProvider provideTypeMapOptionsAndExpectedDocument */ + #[DataProvider('provideTypeMapOptionsAndExpectedDocument')] public function testTypeMapOption(array $typeMap, $expectedDocument): void { $this->createFixtures(1); @@ -20,7 +21,7 @@ public function testTypeMapOption(array $typeMap, $expectedDocument): void $this->assertEquals($expectedDocument, $document); } - public function provideTypeMapOptionsAndExpectedDocument() + public static function provideTypeMapOptionsAndExpectedDocument() { return [ [ diff --git a/tests/Operation/FindTest.php b/tests/Operation/FindTest.php index 68341d2ac..97cc1d388 100644 --- a/tests/Operation/FindTest.php +++ b/tests/Operation/FindTest.php @@ -2,90 +2,70 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Driver\ReadConcern; use MongoDB\Driver\ReadPreference; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\Find; +use PHPUnit\Framework\Attributes\DataProvider; +use TypeError; class FindTest extends TestCase { - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorFilterArgumentTypeCheck($filter): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($filter instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new Find($this->getDatabaseName(), $this->getCollectionName(), $filter); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new Find($this->getDatabaseName(), $this->getCollectionName(), [], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'allowPartialResults' => $this->getInvalidBooleanValues(), - 'batchSize' => $this->getInvalidIntegerValues(), - 'codec' => $this->getInvalidDocumentCodecValues(), - 'collation' => $this->getInvalidDocumentValues(), - 'cursorType' => $this->getInvalidIntegerValues(), - 'hint' => $this->getInvalidHintValues(), - 'limit' => $this->getInvalidIntegerValues(), - 'max' => $this->getInvalidDocumentValues(), - 'maxAwaitTimeMS' => $this->getInvalidIntegerValues(), - 'maxScan' => $this->getInvalidIntegerValues(), - 'maxTimeMS' => $this->getInvalidIntegerValues(), - 'min' => $this->getInvalidDocumentValues(), - 'modifiers' => $this->getInvalidDocumentValues(), - 'oplogReplay' => $this->getInvalidBooleanValues(), - 'projection' => $this->getInvalidDocumentValues(), - 'readConcern' => $this->getInvalidReadConcernValues(), - 'readPreference' => $this->getInvalidReadPreferenceValues(), - 'returnKey' => $this->getInvalidBooleanValues(), - 'session' => $this->getInvalidSessionValues(), - 'showRecordId' => $this->getInvalidBooleanValues(), - 'skip' => $this->getInvalidIntegerValues(), - 'snapshot' => $this->getInvalidBooleanValues(), - 'sort' => $this->getInvalidDocumentValues(), - 'typeMap' => $this->getInvalidArrayValues(), + return self::createOptionDataProvider([ + 'allowPartialResults' => self::getInvalidBooleanValues(), + 'batchSize' => self::getInvalidIntegerValues(), + 'codec' => self::getInvalidDocumentCodecValues(), + 'collation' => self::getInvalidDocumentValues(), + 'cursorType' => self::getInvalidIntegerValues(), + 'hint' => self::getInvalidHintValues(), + 'limit' => self::getInvalidIntegerValues(), + 'max' => self::getInvalidDocumentValues(), + 'maxAwaitTimeMS' => self::getInvalidIntegerValues(), + 'maxTimeMS' => self::getInvalidIntegerValues(), + 'min' => self::getInvalidDocumentValues(), + 'projection' => self::getInvalidDocumentValues(), + 'readConcern' => self::getInvalidReadConcernValues(), + 'readPreference' => self::getInvalidReadPreferenceValues(), + 'returnKey' => self::getInvalidBooleanValues(), + 'session' => self::getInvalidSessionValues(), + 'showRecordId' => self::getInvalidBooleanValues(), + 'skip' => self::getInvalidIntegerValues(), + 'sort' => self::getInvalidDocumentValues(), + 'typeMap' => self::getInvalidArrayValues(), ]); } - public function testSnapshotOptionIsDeprecated(): void - { - $this->assertDeprecated(function (): void { - new Find($this->getDatabaseName(), $this->getCollectionName(), [], ['snapshot' => true]); - }); - - $this->assertDeprecated(function (): void { - new Find($this->getDatabaseName(), $this->getCollectionName(), [], ['snapshot' => false]); - }); - } - - public function testMaxScanOptionIsDeprecated(): void - { - $this->assertDeprecated(function (): void { - new Find($this->getDatabaseName(), $this->getCollectionName(), [], ['maxScan' => 1]); - }); - } - - /** @dataProvider provideInvalidConstructorCursorTypeOptions */ + #[DataProvider('provideInvalidConstructorCursorTypeOptions')] public function testConstructorCursorTypeOption($cursorType): void { $this->expectException(InvalidArgumentException::class); new Find($this->getDatabaseName(), $this->getCollectionName(), [], ['cursorType' => $cursorType]); } - public function provideInvalidConstructorCursorTypeOptions() + public static function provideInvalidConstructorCursorTypeOptions() { - return $this->wrapValuesForDataProvider([-1, 0, 4]); + return self::wrapValuesForDataProvider([-1, 0, 4]); } public function testExplainableCommandDocument(): void { - // all options except deprecated "snapshot" and "maxScan" $options = [ 'allowDiskUse' => true, 'allowPartialResults' => true, @@ -98,7 +78,6 @@ public function testExplainableCommandDocument(): void 'maxTimeMS' => 100, 'min' => ['x' => 10], 'noCursorTimeout' => true, - 'oplogReplay' => true, 'projection' => ['_id' => 0], 'readConcern' => new ReadConcern(ReadConcern::LOCAL), 'returnKey' => true, @@ -109,7 +88,6 @@ public function testExplainableCommandDocument(): void // Intentionally omitted options 'cursorType' => Find::NON_TAILABLE, 'maxAwaitTimeMS' => 500, - 'modifiers' => ['foo' => 'bar'], 'readPreference' => new ReadPreference(ReadPreference::SECONDARY_PREFERRED), 'typeMap' => ['root' => 'array'], ]; @@ -126,7 +104,6 @@ public function testExplainableCommandDocument(): void 'limit' => 15, 'maxTimeMS' => 100, 'noCursorTimeout' => true, - 'oplogReplay' => true, 'projection' => ['_id' => 0], 'readConcern' => new ReadConcern(ReadConcern::LOCAL), 'returnKey' => true, diff --git a/tests/Operation/FunctionalTestCase.php b/tests/Operation/FunctionalTestCase.php index c07a35712..98e05c3cb 100644 --- a/tests/Operation/FunctionalTestCase.php +++ b/tests/Operation/FunctionalTestCase.php @@ -22,7 +22,7 @@ public function setUp(): void $this->dropCollection($this->getDatabaseName(), $this->getCollectionName()); } - public function provideFilterDocuments(): array + public static function provideFilterDocuments(): array { $expected = (object) ['x' => 1]; @@ -34,7 +34,7 @@ public function provideFilterDocuments(): array ]; } - public function provideReplacementDocuments(): array + public static function provideReplacementDocuments(): array { $expected = (object) ['x' => 1]; $expectedEmpty = (object) []; @@ -53,7 +53,7 @@ public function provideReplacementDocuments(): array ]; } - public function provideUpdateDocuments(): array + public static function provideUpdateDocuments(): array { $expected = (object) ['$set' => (object) ['x' => 1]]; @@ -65,7 +65,7 @@ public function provideUpdateDocuments(): array ]; } - public function provideUpdatePipelines(): array + public static function provideUpdatePipelines(): array { $expected = [(object) ['$set' => (object) ['x' => 1]]]; diff --git a/tests/Operation/InsertManyFunctionalTest.php b/tests/Operation/InsertManyFunctionalTest.php index ae17f7342..d8e520c98 100644 --- a/tests/Operation/InsertManyFunctionalTest.php +++ b/tests/Operation/InsertManyFunctionalTest.php @@ -5,14 +5,15 @@ use MongoDB\BSON\Document; use MongoDB\BSON\ObjectId; use MongoDB\Collection; +use MongoDB\Driver\Exception\LogicException; use MongoDB\Driver\WriteConcern; -use MongoDB\Exception\BadMethodCallException; use MongoDB\InsertManyResult; use MongoDB\Model\BSONDocument; use MongoDB\Operation\InsertMany; use MongoDB\Tests\CommandObserver; use MongoDB\Tests\Fixtures\Codec\TestDocumentCodec; use MongoDB\Tests\Fixtures\Document\TestObject; +use PHPUnit\Framework\Attributes\Depends; class InsertManyFunctionalTest extends FunctionalTestCase { @@ -132,7 +133,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } @@ -151,7 +152,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('bypassDocumentValidation', $event['started']->getCommand()); + $this->assertObjectHasProperty('bypassDocumentValidation', $event['started']->getCommand()); $this->assertEquals(true, $event['started']->getCommand()->bypassDocumentValidation); }, ); @@ -171,7 +172,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('bypassDocumentValidation', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('bypassDocumentValidation', $event['started']->getCommand()); }, ); } @@ -189,15 +190,15 @@ public function testUnacknowledgedWriteConcern() return $result; } - /** @depends testUnacknowledgedWriteConcern */ + #[Depends('testUnacknowledgedWriteConcern')] public function testUnacknowledgedWriteConcernAccessesInsertedCount(InsertManyResult $result): void { - $this->expectException(BadMethodCallException::class); - $this->expectExceptionMessageMatches('/[\w:\\\\]+ should not be called for an unacknowledged write result/'); + $this->expectException(LogicException::class); + $this->expectExceptionMessageMatches('/[\w:\\\\\(\)]+ should not be called for an unacknowledged write result/'); $result->getInsertedCount(); } - /** @depends testUnacknowledgedWriteConcern */ + #[Depends('testUnacknowledgedWriteConcern')] public function testUnacknowledgedWriteConcernAccessesInsertedId(InsertManyResult $result): void { $this->assertInstanceOf(ObjectId::class, $result->getInsertedIds()[0]); diff --git a/tests/Operation/InsertManyTest.php b/tests/Operation/InsertManyTest.php index ece556cae..8ee11ff5d 100644 --- a/tests/Operation/InsertManyTest.php +++ b/tests/Operation/InsertManyTest.php @@ -6,6 +6,7 @@ use MongoDB\Exception\UnsupportedValueException; use MongoDB\Operation\InsertMany; use MongoDB\Tests\Fixtures\Codec\TestDocumentCodec; +use PHPUnit\Framework\Attributes\DataProvider; class InsertManyTest extends TestCase { @@ -23,7 +24,7 @@ public function testConstructorDocumentsMustBeAList(): void new InsertMany($this->getDatabaseName(), $this->getCollectionName(), [1 => ['x' => 1]]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorDocumentsArgumentElementTypeChecks($document): void { $this->expectException(InvalidArgumentException::class); @@ -31,21 +32,21 @@ public function testConstructorDocumentsArgumentElementTypeChecks($document): vo new InsertMany($this->getDatabaseName(), $this->getCollectionName(), [$document]); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new InsertMany($this->getDatabaseName(), $this->getCollectionName(), [['x' => 1]], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'bypassDocumentValidation' => $this->getInvalidBooleanValues(), - 'codec' => $this->getInvalidDocumentCodecValues(), - 'ordered' => $this->getInvalidBooleanValues(true), - 'session' => $this->getInvalidSessionValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'bypassDocumentValidation' => self::getInvalidBooleanValues(), + 'codec' => self::getInvalidDocumentCodecValues(), + 'ordered' => self::getInvalidBooleanValues(true), + 'session' => self::getInvalidSessionValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } diff --git a/tests/Operation/InsertOneFunctionalTest.php b/tests/Operation/InsertOneFunctionalTest.php index 2075f0fc0..204d8bacc 100644 --- a/tests/Operation/InsertOneFunctionalTest.php +++ b/tests/Operation/InsertOneFunctionalTest.php @@ -5,14 +5,16 @@ use MongoDB\BSON\Document; use MongoDB\BSON\ObjectId; use MongoDB\Collection; +use MongoDB\Driver\Exception\LogicException; use MongoDB\Driver\WriteConcern; -use MongoDB\Exception\BadMethodCallException; use MongoDB\InsertOneResult; use MongoDB\Model\BSONDocument; use MongoDB\Operation\InsertOne; use MongoDB\Tests\CommandObserver; use MongoDB\Tests\Fixtures\Codec\TestDocumentCodec; use MongoDB\Tests\Fixtures\Document\TestObject; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Depends; use stdClass; class InsertOneFunctionalTest extends FunctionalTestCase @@ -26,10 +28,8 @@ public function setUp(): void $this->collection = new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName()); } - /** - * @dataProvider provideDocumentsWithIds - * @dataProvider provideDocumentsWithoutIds - */ + #[DataProvider('provideDocumentsWithIds')] + #[DataProvider('provideDocumentsWithoutIds')] public function testDocumentEncoding($document, stdClass $expectedDocument): void { (new CommandObserver())->observe( @@ -53,7 +53,7 @@ function (array $event) use ($expectedDocument): void { ); } - public function provideDocumentsWithIds(): array + public static function provideDocumentsWithIds(): array { $expectedDocument = (object) ['_id' => 1]; @@ -65,7 +65,7 @@ public function provideDocumentsWithIds(): array ]; } - public function provideDocumentsWithoutIds(): array + public static function provideDocumentsWithoutIds(): array { /* Note: _id placeholders must be replaced with generated ObjectIds. We * also clone the value for each data set since tests may need to modify @@ -80,7 +80,7 @@ public function provideDocumentsWithoutIds(): array ]; } - /** @dataProvider provideDocumentsWithIds */ + #[DataProvider('provideDocumentsWithIds')] public function testInsertOneWithExistingId($document, stdClass $expectedDocument): void { $operation = new InsertOne($this->getDatabaseName(), $this->getCollectionName(), $document); @@ -93,7 +93,7 @@ public function testInsertOneWithExistingId($document, stdClass $expectedDocumen $this->assertSameDocuments([$expectedDocument], $this->collection->find()); } - /** @dataProvider provideDocumentsWithoutIds */ + #[DataProvider('provideDocumentsWithoutIds')] public function testInsertOneWithGeneratedId($document, stdClass $expectedDocument): void { $operation = new InsertOne($this->getDatabaseName(), $this->getCollectionName(), $document); @@ -123,7 +123,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } @@ -142,7 +142,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('bypassDocumentValidation', $event['started']->getCommand()); + $this->assertObjectHasProperty('bypassDocumentValidation', $event['started']->getCommand()); $this->assertEquals(true, $event['started']->getCommand()->bypassDocumentValidation); }, ); @@ -162,7 +162,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('bypassDocumentValidation', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('bypassDocumentValidation', $event['started']->getCommand()); }, ); } @@ -180,15 +180,15 @@ public function testUnacknowledgedWriteConcern() return $result; } - /** @depends testUnacknowledgedWriteConcern */ + #[Depends('testUnacknowledgedWriteConcern')] public function testUnacknowledgedWriteConcernAccessesInsertedCount(InsertOneResult $result): void { - $this->expectException(BadMethodCallException::class); - $this->expectExceptionMessageMatches('/[\w:\\\\]+ should not be called for an unacknowledged write result/'); + $this->expectException(LogicException::class); + $this->expectExceptionMessageMatches('/[\w:\\\\\(\)]+ should not be called for an unacknowledged write result/'); $result->getInsertedCount(); } - /** @depends testUnacknowledgedWriteConcern */ + #[Depends('testUnacknowledgedWriteConcern')] public function testUnacknowledgedWriteConcernAccessesInsertedId(InsertOneResult $result): void { $this->assertInstanceOf(ObjectId::class, $result->getInsertedId()); diff --git a/tests/Operation/InsertOneTest.php b/tests/Operation/InsertOneTest.php index ad7212c7c..1f641ea88 100644 --- a/tests/Operation/InsertOneTest.php +++ b/tests/Operation/InsertOneTest.php @@ -2,34 +2,37 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Exception\UnsupportedValueException; use MongoDB\Operation\InsertOne; use MongoDB\Tests\Fixtures\Codec\TestDocumentCodec; +use PHPUnit\Framework\Attributes\DataProvider; +use TypeError; class InsertOneTest extends TestCase { - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorDocumentArgumentTypeCheck($document): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($document instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new InsertOne($this->getDatabaseName(), $this->getCollectionName(), $document); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new InsertOne($this->getDatabaseName(), $this->getCollectionName(), ['x' => 1], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'bypassDocumentValidation' => $this->getInvalidBooleanValues(), - 'codec' => $this->getInvalidDocumentCodecValues(), - 'session' => $this->getInvalidSessionValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'bypassDocumentValidation' => self::getInvalidBooleanValues(), + 'codec' => self::getInvalidDocumentCodecValues(), + 'session' => self::getInvalidSessionValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } diff --git a/tests/Operation/ListCollectionNamesFunctionalTest.php b/tests/Operation/ListCollectionNamesFunctionalTest.php index 91f8b2fb7..74e188627 100644 --- a/tests/Operation/ListCollectionNamesFunctionalTest.php +++ b/tests/Operation/ListCollectionNamesFunctionalTest.php @@ -41,7 +41,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('authorizedCollections', $event['started']->getCommand()); + $this->assertObjectHasProperty('authorizedCollections', $event['started']->getCommand()); $this->assertSame(true, $event['started']->getCommand()->authorizedCollections); }, ); @@ -59,7 +59,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } diff --git a/tests/Operation/ListCollectionsFunctionalTest.php b/tests/Operation/ListCollectionsFunctionalTest.php index ffdc3748c..ed8cb9b14 100644 --- a/tests/Operation/ListCollectionsFunctionalTest.php +++ b/tests/Operation/ListCollectionsFunctionalTest.php @@ -2,12 +2,13 @@ namespace MongoDB\Tests\Operation; +use Iterator; use MongoDB\Model\CollectionInfo; -use MongoDB\Model\CollectionInfoIterator; use MongoDB\Operation\DropDatabase; use MongoDB\Operation\InsertOne; use MongoDB\Operation\ListCollections; use MongoDB\Tests\CommandObserver; +use PHPUnit\Framework\Attributes\Group; class ListCollectionsFunctionalTest extends FunctionalTestCase { @@ -25,7 +26,7 @@ public function testListCollectionsForNewlyCreatedDatabase(): void $operation = new ListCollections($this->getDatabaseName(), ['filter' => ['name' => $this->getCollectionName()]]); $collections = $operation->execute($server); - $this->assertInstanceOf(CollectionInfoIterator::class, $collections); + $this->assertInstanceOf(Iterator::class, $collections); $this->assertCount(1, $collections); @@ -35,12 +36,10 @@ public function testListCollectionsForNewlyCreatedDatabase(): void } } - /** - * @group matrix-testing-exclude-server-4.4-driver-4.0 - * @group matrix-testing-exclude-server-4.4-driver-4.2 - * @group matrix-testing-exclude-server-5.0-driver-4.0 - * @group matrix-testing-exclude-server-5.0-driver-4.2 - */ + #[Group('matrix-testing-exclude-server-4.4-driver-4.0')] + #[Group('matrix-testing-exclude-server-4.4-driver-4.2')] + #[Group('matrix-testing-exclude-server-5.0-driver-4.0')] + #[Group('matrix-testing-exclude-server-5.0-driver-4.2')] public function testIdIndexAndInfo(): void { $server = $this->getPrimaryServer(); @@ -52,12 +51,14 @@ public function testIdIndexAndInfo(): void $operation = new ListCollections($this->getDatabaseName(), ['filter' => ['name' => $this->getCollectionName()]]); $collections = $operation->execute($server); - $this->assertInstanceOf(CollectionInfoIterator::class, $collections); + $this->assertInstanceOf(Iterator::class, $collections); foreach ($collections as $collection) { $this->assertInstanceOf(CollectionInfo::class, $collection); $this->assertArrayHasKey('readOnly', $collection['info']); - $this->assertEquals(['v' => 2, 'key' => ['_id' => 1], 'name' => '_id_', 'ns' => $this->getNamespace()], $collection['idIndex']); + // Use assertMatchesDocument as MongoDB 4.0 and 4.2 include a ns field + // TODO: change to assertEquals when dropping support for MongoDB 4.2 + $this->assertMatchesDocument(['v' => 2, 'key' => ['_id' => 1], 'name' => '_id_'], $collection['idIndex']); } } @@ -86,7 +87,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('authorizedCollections', $event['started']->getCommand()); + $this->assertObjectHasProperty('authorizedCollections', $event['started']->getCommand()); $this->assertSame(true, $event['started']->getCommand()->authorizedCollections); }, ); @@ -104,7 +105,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } diff --git a/tests/Operation/ListDatabaseNamesFunctionalTest.php b/tests/Operation/ListDatabaseNamesFunctionalTest.php index 651112afd..b9bbcc9a7 100644 --- a/tests/Operation/ListDatabaseNamesFunctionalTest.php +++ b/tests/Operation/ListDatabaseNamesFunctionalTest.php @@ -24,7 +24,7 @@ function () use (&$databases, $server): void { $databases = $operation->execute($server); }, function (array $event): void { - $this->assertObjectNotHasAttribute('authorizedDatabases', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('authorizedDatabases', $event['started']->getCommand()); $this->assertSame(true, $event['started']->getCommand()->nameOnly); }, ); @@ -45,7 +45,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('authorizedDatabases', $event['started']->getCommand()); + $this->assertObjectHasProperty('authorizedDatabases', $event['started']->getCommand()); $this->assertSame(true, $event['started']->getCommand()->authorizedDatabases); }, ); @@ -79,7 +79,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } diff --git a/tests/Operation/ListDatabasesFunctionalTest.php b/tests/Operation/ListDatabasesFunctionalTest.php index 525b3d94e..f881b34dd 100644 --- a/tests/Operation/ListDatabasesFunctionalTest.php +++ b/tests/Operation/ListDatabasesFunctionalTest.php @@ -2,8 +2,8 @@ namespace MongoDB\Tests\Operation; +use Iterator; use MongoDB\Model\DatabaseInfo; -use MongoDB\Model\DatabaseInfoIterator; use MongoDB\Operation\InsertOne; use MongoDB\Operation\ListDatabases; use MongoDB\Tests\CommandObserver; @@ -26,11 +26,11 @@ function () use (&$databases, $server): void { $databases = $operation->execute($server); }, function (array $event): void { - $this->assertObjectNotHasAttribute('authorizedDatabases', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('authorizedDatabases', $event['started']->getCommand()); }, ); - $this->assertInstanceOf(DatabaseInfoIterator::class, $databases); + $this->assertInstanceOf(Iterator::class, $databases); foreach ($databases as $database) { $this->assertInstanceOf(DatabaseInfo::class, $database); @@ -48,7 +48,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('authorizedDatabases', $event['started']->getCommand()); + $this->assertObjectHasProperty('authorizedDatabases', $event['started']->getCommand()); $this->assertSame(true, $event['started']->getCommand()->authorizedDatabases); }, ); @@ -65,7 +65,7 @@ public function testFilterOption(): void $operation = new ListDatabases(['filter' => ['name' => $this->getDatabaseName()]]); $databases = $operation->execute($server); - $this->assertInstanceOf(DatabaseInfoIterator::class, $databases); + $this->assertInstanceOf(Iterator::class, $databases); $this->assertCount(1, $databases); @@ -86,7 +86,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } diff --git a/tests/Operation/ListIndexesFunctionalTest.php b/tests/Operation/ListIndexesFunctionalTest.php index 553615e4d..f5a2f6bc2 100644 --- a/tests/Operation/ListIndexesFunctionalTest.php +++ b/tests/Operation/ListIndexesFunctionalTest.php @@ -2,8 +2,8 @@ namespace MongoDB\Tests\Operation; +use Iterator; use MongoDB\Model\IndexInfo; -use MongoDB\Model\IndexInfoIterator; use MongoDB\Operation\InsertOne; use MongoDB\Operation\ListIndexes; use MongoDB\Tests\CommandObserver; @@ -21,14 +21,13 @@ public function testListIndexesForNewlyCreatedCollection(): void $operation = new ListIndexes($this->getDatabaseName(), $this->getCollectionName()); $indexes = $operation->execute($this->getPrimaryServer()); - $this->assertInstanceOf(IndexInfoIterator::class, $indexes); + $this->assertInstanceOf(Iterator::class, $indexes); $this->assertCount(1, $indexes); foreach ($indexes as $index) { $this->assertInstanceOf(IndexInfo::class, $index); $this->assertEquals(['_id' => 1], $index->getKey()); - $this->assertSame($this->getNamespace(), $index->getNamespace()); } } @@ -55,7 +54,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } diff --git a/tests/Operation/ListIndexesTest.php b/tests/Operation/ListIndexesTest.php index 7edda8ef3..f6c7a095b 100644 --- a/tests/Operation/ListIndexesTest.php +++ b/tests/Operation/ListIndexesTest.php @@ -4,21 +4,22 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\ListIndexes; +use PHPUnit\Framework\Attributes\DataProvider; class ListIndexesTest extends TestCase { - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new ListIndexes($this->getDatabaseName(), $this->getCollectionName(), $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'maxTimeMS' => $this->getInvalidIntegerValues(), - 'session' => $this->getInvalidSessionValues(), + return self::createOptionDataProvider([ + 'maxTimeMS' => self::getInvalidIntegerValues(), + 'session' => self::getInvalidSessionValues(), ]); } } diff --git a/tests/Operation/ListSearchIndexesTest.php b/tests/Operation/ListSearchIndexesTest.php index 23bc770ef..d47e5e893 100644 --- a/tests/Operation/ListSearchIndexesTest.php +++ b/tests/Operation/ListSearchIndexesTest.php @@ -4,6 +4,7 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\ListSearchIndexes; +use PHPUnit\Framework\Attributes\DataProvider; class ListSearchIndexesTest extends TestCase { @@ -13,18 +14,18 @@ public function testConstructorIndexNameMustNotBeEmpty(): void new ListSearchIndexes($this->getDatabaseName(), $this->getCollectionName(), ['name' => '']); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new ListSearchIndexes($this->getDatabaseName(), $this->getCollectionName(), $options); } - public function provideInvalidConstructorOptions(): array + public static function provideInvalidConstructorOptions(): array { $options = []; - foreach ($this->getInvalidIntegerValues() as $value) { + foreach (self::getInvalidIntegerValues() as $value) { $options[][] = ['batchSize' => $value]; } diff --git a/tests/Operation/MapReduceFunctionalTest.php b/tests/Operation/MapReduceFunctionalTest.php deleted file mode 100644 index cc4084c71..000000000 --- a/tests/Operation/MapReduceFunctionalTest.php +++ /dev/null @@ -1,314 +0,0 @@ -createCollection($this->getDatabaseName(), $this->getCollectionName()); - - (new CommandObserver())->observe( - function (): void { - $operation = new MapReduce( - $this->getDatabaseName(), - $this->getCollectionName(), - new Javascript('function() { emit(this.x, this.y); }'), - new Javascript('function(key, values) { return Array.sum(values); }'), - ['inline' => 1], - ['readConcern' => $this->createDefaultReadConcern()], - ); - - $operation->execute($this->getPrimaryServer()); - }, - function (array $event): void { - $this->assertObjectNotHasAttribute('readConcern', $event['started']->getCommand()); - }, - ); - } - - public function testDefaultWriteConcernIsOmitted(): void - { - // Collection must exist for mapReduce command - $this->createCollection($this->getDatabaseName(), $this->getCollectionName()); - $this->dropCollection($this->getDatabaseName(), $this->getCollectionName() . '.output'); - - (new CommandObserver())->observe( - function (): void { - $operation = new MapReduce( - $this->getDatabaseName(), - $this->getCollectionName(), - new Javascript('function() { emit(this.x, this.y); }'), - new Javascript('function(key, values) { return Array.sum(values); }'), - $this->getCollectionName() . '.output', - ['writeConcern' => $this->createDefaultWriteConcern()], - ); - - $operation->execute($this->getPrimaryServer()); - }, - function (array $event): void { - $this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand()); - }, - ); - } - - public function testFinalize(): void - { - $this->createFixtures(3); - - $map = new Javascript('function() { emit(this.x, this.y); }'); - $reduce = new Javascript('function(key, values) { return Array.sum(values); }'); - $out = ['inline' => 1]; - $finalize = new Javascript('function(key, reducedValue) { return reducedValue; }'); - - $operation = new MapReduce($this->getDatabaseName(), $this->getCollectionName(), $map, $reduce, $out, ['finalize' => $finalize]); - $result = $operation->execute($this->getPrimaryServer()); - - $this->assertNotNull($result); - } - - public function testResult(): void - { - $this->createFixtures(3); - - $map = new Javascript('function() { emit(this.x, this.y); }'); - $reduce = new Javascript('function(key, values) { return Array.sum(values); }'); - $out = ['inline' => 1]; - - $operation = new MapReduce($this->getDatabaseName(), $this->getCollectionName(), $map, $reduce, $out); - $result = $operation->execute($this->getPrimaryServer()); - - $this->assertInstanceOf(MapReduceResult::class, $result); - - if (version_compare($this->getServerVersion(), '4.3.0', '<')) { - $this->assertGreaterThanOrEqual(0, $result->getExecutionTimeMS()); - $this->assertNotEmpty($result->getCounts()); - } - } - - public function testResultIncludesTimingWithVerboseOption(): void - { - $this->skipIfServerVersion('>=', '4.3.0', 'mapReduce statistics are no longer exposed'); - - $this->createFixtures(3); - - $map = new Javascript('function() { emit(this.x, this.y); }'); - $reduce = new Javascript('function(key, values) { return Array.sum(values); }'); - $out = ['inline' => 1]; - - $operation = new MapReduce($this->getDatabaseName(), $this->getCollectionName(), $map, $reduce, $out, ['verbose' => true]); - $result = $operation->execute($this->getPrimaryServer()); - - $this->assertInstanceOf(MapReduceResult::class, $result); - $this->assertGreaterThanOrEqual(0, $result->getExecutionTimeMS()); - $this->assertNotEmpty($result->getCounts()); - $this->assertNotEmpty($result->getTiming()); - } - - public function testResultDoesNotIncludeTimingWithoutVerboseOption(): void - { - $this->skipIfServerVersion('>=', '4.3.0', 'mapReduce statistics are no longer exposed'); - - $this->createFixtures(3); - - $map = new Javascript('function() { emit(this.x, this.y); }'); - $reduce = new Javascript('function(key, values) { return Array.sum(values); }'); - $out = ['inline' => 1]; - - $operation = new MapReduce($this->getDatabaseName(), $this->getCollectionName(), $map, $reduce, $out, ['verbose' => false]); - $result = $operation->execute($this->getPrimaryServer()); - - $this->assertInstanceOf(MapReduceResult::class, $result); - $this->assertGreaterThanOrEqual(0, $result->getExecutionTimeMS()); - $this->assertNotEmpty($result->getCounts()); - $this->assertEmpty($result->getTiming()); - } - - public function testSessionOption(): void - { - $this->createFixtures(3); - - (new CommandObserver())->observe( - function (): void { - $operation = new MapReduce( - $this->getDatabaseName(), - $this->getCollectionName(), - new Javascript('function() { emit(this.x, this.y); }'), - new Javascript('function(key, values) { return Array.sum(values); }'), - ['inline' => 1], - ['session' => $this->createSession()], - ); - - $operation->execute($this->getPrimaryServer()); - }, - function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); - }, - ); - } - - public function testBypassDocumentValidationSetWhenTrue(): void - { - $this->createFixtures(1); - - (new CommandObserver())->observe( - function (): void { - $operation = new MapReduce( - $this->getDatabaseName(), - $this->getCollectionName(), - new Javascript('function() { emit(this.x, this.y); }'), - new Javascript('function(key, values) { return Array.sum(values); }'), - ['inline' => 1], - ['bypassDocumentValidation' => true], - ); - - $operation->execute($this->getPrimaryServer()); - }, - function (array $event): void { - $this->assertObjectHasAttribute('bypassDocumentValidation', $event['started']->getCommand()); - $this->assertEquals(true, $event['started']->getCommand()->bypassDocumentValidation); - }, - ); - } - - public function testBypassDocumentValidationUnsetWhenFalse(): void - { - $this->createFixtures(1); - - (new CommandObserver())->observe( - function (): void { - $operation = new MapReduce( - $this->getDatabaseName(), - $this->getCollectionName(), - new Javascript('function() { emit(this.x, this.y); }'), - new Javascript('function(key, values) { return Array.sum(values); }'), - ['inline' => 1], - ['bypassDocumentValidation' => false], - ); - - $operation->execute($this->getPrimaryServer()); - }, - function (array $event): void { - $this->assertObjectNotHasAttribute('bypassDocumentValidation', $event['started']->getCommand()); - }, - ); - } - - /** @dataProvider provideTypeMapOptionsAndExpectedDocuments */ - public function testTypeMapOptionWithInlineResults(?array $typeMap, array $expectedDocuments): void - { - $this->createFixtures(3); - - $map = new Javascript('function() { emit(this.x, this.y); }'); - $reduce = new Javascript('function(key, values) { return Array.sum(values); }'); - $out = ['inline' => 1]; - - $operation = new MapReduce($this->getDatabaseName(), $this->getCollectionName(), $map, $reduce, $out, ['typeMap' => $typeMap]); - $results = iterator_to_array($operation->execute($this->getPrimaryServer())); - - $this->assertEquals($this->sortResults($expectedDocuments), $this->sortResults($results)); - } - - public function provideTypeMapOptionsAndExpectedDocuments() - { - return [ - [ - null, - [ - (object) ['_id' => 1, 'value' => 3], - (object) ['_id' => 2, 'value' => 6], - (object) ['_id' => 3, 'value' => 9], - ], - ], - [ - ['root' => 'array'], - [ - ['_id' => 1, 'value' => 3], - ['_id' => 2, 'value' => 6], - ['_id' => 3, 'value' => 9], - ], - ], - [ - ['root' => 'object'], - [ - (object) ['_id' => 1, 'value' => 3], - (object) ['_id' => 2, 'value' => 6], - (object) ['_id' => 3, 'value' => 9], - ], - ], - ]; - } - - /** @dataProvider provideTypeMapOptionsAndExpectedDocuments */ - public function testTypeMapOptionWithOutputCollection(?array $typeMap, array $expectedDocuments): void - { - $this->createFixtures(3); - - $map = new Javascript('function() { emit(this.x, this.y); }'); - $reduce = new Javascript('function(key, values) { return Array.sum(values); }'); - $out = $this->getCollectionName() . '.output'; - $this->dropCollection($this->getDatabaseName(), $out); - - $operation = new MapReduce($this->getDatabaseName(), $this->getCollectionName(), $map, $reduce, $out, ['typeMap' => $typeMap]); - $results = iterator_to_array($operation->execute($this->getPrimaryServer())); - - $this->assertEquals($this->sortResults($expectedDocuments), $this->sortResults($results)); - - $operation = new Find($this->getDatabaseName(), $out, [], ['typeMap' => $typeMap]); - $cursor = $operation->execute($this->getPrimaryServer()); - - $this->assertEquals($this->sortResults($expectedDocuments), $this->sortResults(iterator_to_array($cursor))); - } - - /** - * Create data fixtures. - */ - private function createFixtures(int $n): void - { - $this->dropCollection($this->getDatabaseName(), $this->getCollectionName()); - $bulkWrite = new BulkWrite(['ordered' => true]); - - for ($i = 1; $i <= $n; $i++) { - $bulkWrite->insert(['x' => $i, 'y' => $i]); - $bulkWrite->insert(['x' => $i, 'y' => $i * 2]); - } - - $result = $this->manager->executeBulkWrite($this->getNamespace(), $bulkWrite); - - $this->assertEquals($n * 2, $result->getInsertedCount()); - } - - private function sortResults(array $results): array - { - $sortFunction = static function ($resultA, $resultB): int { - $idA = is_object($resultA) ? $resultA->_id : $resultA['_id']; - $idB = is_object($resultB) ? $resultB->_id : $resultB['_id']; - - return $idA <=> $idB; - }; - - $sortedResults = $results; - usort($sortedResults, $sortFunction); - - return $sortedResults; - } -} diff --git a/tests/Operation/MapReduceTest.php b/tests/Operation/MapReduceTest.php deleted file mode 100644 index 04b7a58d0..000000000 --- a/tests/Operation/MapReduceTest.php +++ /dev/null @@ -1,91 +0,0 @@ -expectException(InvalidArgumentException::class); - new MapReduce($this->getDatabaseName(), $this->getCollectionName(), $map, $reduce, $out); - } - - public function provideInvalidOutValues() - { - return $this->wrapValuesForDataProvider([123, 3.14, true]); - } - - /** @dataProvider provideDeprecatedOutValues */ - public function testConstructorOutArgumentDeprecations($out): void - { - $map = new Javascript('function() { emit(this.x, this.y); }'); - $reduce = new Javascript('function(key, values) { return Array.sum(values); }'); - - $this->assertDeprecated(function () use ($map, $reduce, $out): void { - new MapReduce($this->getDatabaseName(), $this->getCollectionName(), $map, $reduce, $out); - }); - } - - public function provideDeprecatedOutValues(): array - { - return [ - 'nonAtomic:array' => [['nonAtomic' => false]], - 'nonAtomic:object' => [(object) ['nonAtomic' => false]], - 'nonAtomic:Serializable' => [new BSONDocument(['nonAtomic' => false])], - 'nonAtomic:Document' => [Document::fromPHP(['nonAtomic' => false])], - 'sharded:array' => [['sharded' => false]], - 'sharded:object' => [(object) ['sharded' => false]], - 'sharded:Serializable' => [new BSONDocument(['sharded' => false])], - 'sharded:Document' => [Document::fromPHP(['sharded' => false])], - ]; - } - - /** @dataProvider provideInvalidConstructorOptions */ - public function testConstructorOptionTypeChecks(array $options): void - { - $map = new Javascript('function() { emit(this.x, this.y); }'); - $reduce = new Javascript('function(key, values) { return Array.sum(values); }'); - $out = ['inline' => 1]; - - $this->expectException(InvalidArgumentException::class); - new MapReduce($this->getDatabaseName(), $this->getCollectionName(), $map, $reduce, $out, $options); - } - - public function provideInvalidConstructorOptions() - { - return $this->createOptionDataProvider([ - 'bypassDocumentValidation' => $this->getInvalidBooleanValues(), - 'collation' => $this->getInvalidDocumentValues(), - 'finalize' => $this->getInvalidJavascriptValues(), - 'jsMode' => $this->getInvalidBooleanValues(), - 'limit' => $this->getInvalidIntegerValues(), - 'maxTimeMS' => $this->getInvalidIntegerValues(), - 'query' => $this->getInvalidDocumentValues(), - 'readConcern' => $this->getInvalidReadConcernValues(), - 'readPreference' => $this->getInvalidReadPreferenceValues(), - 'scope' => $this->getInvalidDocumentValues(), - 'session' => $this->getInvalidSessionValues(), - 'sort' => $this->getInvalidDocumentValues(), - 'typeMap' => $this->getInvalidArrayValues(), - 'verbose' => $this->getInvalidBooleanValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), - ]); - } - - private function getInvalidJavascriptValues() - { - return [123, 3.14, 'foo', true, [], new stdClass(), new ObjectId()]; - } -} diff --git a/tests/Operation/ModifyCollectionFunctionalTest.php b/tests/Operation/ModifyCollectionFunctionalTest.php index c92cdb0e8..9c6e3a42d 100644 --- a/tests/Operation/ModifyCollectionFunctionalTest.php +++ b/tests/Operation/ModifyCollectionFunctionalTest.php @@ -4,14 +4,13 @@ use MongoDB\Operation\CreateIndexes; use MongoDB\Operation\ModifyCollection; +use PHPUnit\Framework\Attributes\Group; class ModifyCollectionFunctionalTest extends FunctionalTestCase { - /** - * @group matrix-testing-exclude-server-4.2-driver-4.0-topology-sharded_cluster - * @group matrix-testing-exclude-server-4.4-driver-4.0-topology-sharded_cluster - * @group matrix-testing-exclude-server-5.0-driver-4.0-topology-sharded_cluster - */ + #[Group('matrix-testing-exclude-server-4.2-driver-4.0-topology-sharded_cluster')] + #[Group('matrix-testing-exclude-server-4.4-driver-4.0-topology-sharded_cluster')] + #[Group('matrix-testing-exclude-server-5.0-driver-4.0-topology-sharded_cluster')] public function testCollMod(): void { if ($this->isShardedCluster()) { diff --git a/tests/Operation/ModifyCollectionTest.php b/tests/Operation/ModifyCollectionTest.php index dfa8d2584..c835d6a6d 100644 --- a/tests/Operation/ModifyCollectionTest.php +++ b/tests/Operation/ModifyCollectionTest.php @@ -4,6 +4,7 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\ModifyCollection; +use PHPUnit\Framework\Attributes\DataProvider; class ModifyCollectionTest extends TestCase { @@ -14,19 +15,19 @@ public function testConstructorEmptyCollectionOptions(): void new ModifyCollection($this->getDatabaseName(), $this->getCollectionName(), []); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new ModifyCollection($this->getDatabaseName(), $this->getCollectionName(), [], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'session' => $this->getInvalidSessionValues(), - 'typeMap' => $this->getInvalidArrayValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'session' => self::getInvalidSessionValues(), + 'typeMap' => self::getInvalidArrayValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } } diff --git a/tests/Operation/RenameCollectionFunctionalTest.php b/tests/Operation/RenameCollectionFunctionalTest.php index 05be70da7..37fb23d4d 100644 --- a/tests/Operation/RenameCollectionFunctionalTest.php +++ b/tests/Operation/RenameCollectionFunctionalTest.php @@ -46,7 +46,7 @@ function (): void { $operation->execute($server); }, function (array $event): void { - $this->assertObjectNotHasAttribute('writeConcern', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('writeConcern', $event['started']->getCommand()); }, ); } @@ -65,9 +65,8 @@ public function testRenameCollectionToNonexistentTarget(): void $this->getDatabaseName(), $this->toCollectionName, ); - $commandResult = $operation->execute($server); + $operation->execute($server); - $this->assertCommandSucceeded($commandResult); $this->assertCollectionDoesNotExist($this->getCollectionName()); $this->assertCollectionExists($this->toCollectionName); @@ -138,7 +137,7 @@ function (): void { $operation->execute($server); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } diff --git a/tests/Operation/RenameCollectionTest.php b/tests/Operation/RenameCollectionTest.php index f1d0e15d5..e0a438329 100644 --- a/tests/Operation/RenameCollectionTest.php +++ b/tests/Operation/RenameCollectionTest.php @@ -4,10 +4,11 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\RenameCollection; +use PHPUnit\Framework\Attributes\DataProvider; class RenameCollectionTest extends TestCase { - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); @@ -20,13 +21,12 @@ public function testConstructorOptionTypeChecks(array $options): void ); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'dropTarget' => $this->getInvalidBooleanValues(), - 'session' => $this->getInvalidSessionValues(), - 'typeMap' => $this->getInvalidArrayValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'dropTarget' => self::getInvalidBooleanValues(), + 'session' => self::getInvalidSessionValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } } diff --git a/tests/Operation/ReplaceOneTest.php b/tests/Operation/ReplaceOneTest.php index 404cdae78..d74cd7566 100644 --- a/tests/Operation/ReplaceOneTest.php +++ b/tests/Operation/ReplaceOneTest.php @@ -2,37 +2,39 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Exception\UnsupportedValueException; use MongoDB\Operation\ReplaceOne; use MongoDB\Tests\Fixtures\Codec\TestDocumentCodec; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; +use TypeError; class ReplaceOneTest extends TestCase { - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorFilterArgumentTypeCheck($filter): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($filter instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new ReplaceOne($this->getDatabaseName(), $this->getCollectionName(), $filter, ['y' => 1]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorReplacementArgumentTypeCheck($replacement): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($replacement instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new ReplaceOne($this->getDatabaseName(), $this->getCollectionName(), ['x' => 1], $replacement); } - /** - * @dataProvider provideReplacementDocuments - * @doesNotPerformAssertions - */ + #[DataProvider('provideReplacementDocuments')] + #[DoesNotPerformAssertions] public function testConstructorReplacementArgument($replacement): void { new ReplaceOne($this->getDatabaseName(), $this->getCollectionName(), ['x' => 1], $replacement); } - /** @dataProvider provideUpdateDocuments */ + #[DataProvider('provideUpdateDocuments')] public function testConstructorReplacementArgumentProhibitsUpdateDocument($replacement): void { $this->expectException(InvalidArgumentException::class); @@ -40,10 +42,8 @@ public function testConstructorReplacementArgumentProhibitsUpdateDocument($repla new ReplaceOne($this->getDatabaseName(), $this->getCollectionName(), ['x' => 1], $replacement); } - /** - * @dataProvider provideUpdatePipelines - * @dataProvider provideEmptyUpdatePipelinesExcludingArray - */ + #[DataProvider('provideUpdatePipelines')] + #[DataProvider('provideEmptyUpdatePipelinesExcludingArray')] public function testConstructorReplacementArgumentProhibitsUpdatePipeline($replacement): void { $this->expectException(InvalidArgumentException::class); @@ -51,17 +51,17 @@ public function testConstructorReplacementArgumentProhibitsUpdatePipeline($repla new ReplaceOne($this->getDatabaseName(), $this->getCollectionName(), ['x' => 1], $replacement); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionsTypeCheck($options): void { $this->expectException(InvalidArgumentException::class); new ReplaceOne($this->getDatabaseName(), $this->getCollectionName(), ['x' => 1], ['y' => 1], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'codec' => $this->getInvalidDocumentCodecValues(), + return self::createOptionDataProvider([ + 'codec' => self::getInvalidDocumentCodecValues(), ]); } diff --git a/tests/Operation/TestCase.php b/tests/Operation/TestCase.php index 386468ce2..4bb5c5cec 100644 --- a/tests/Operation/TestCase.php +++ b/tests/Operation/TestCase.php @@ -13,7 +13,7 @@ */ abstract class TestCase extends BaseTestCase { - public function provideReplacementDocuments(): array + public static function provideReplacementDocuments(): array { return [ 'replacement:array' => [['x' => 1]], @@ -29,7 +29,7 @@ public function provideReplacementDocuments(): array ]; } - public function provideUpdateDocuments(): array + public static function provideUpdateDocuments(): array { return [ 'update:array' => [['$set' => ['x' => 1]]], @@ -39,7 +39,7 @@ public function provideUpdateDocuments(): array ]; } - public function provideUpdatePipelines(): array + public static function provideUpdatePipelines(): array { return [ 'pipeline:array' => [[['$set' => ['x' => 1]]]], @@ -48,7 +48,7 @@ public function provideUpdatePipelines(): array ]; } - public function provideEmptyUpdatePipelines(): array + public static function provideEmptyUpdatePipelines(): array { /* Empty update pipelines are accepted by the update and findAndModify * commands (as NOPs); however, they are not supported for updates in @@ -65,7 +65,7 @@ public function provideEmptyUpdatePipelines(): array ]; } - public function provideEmptyUpdatePipelinesExcludingArray(): array + public static function provideEmptyUpdatePipelinesExcludingArray(): array { /* This data provider is used for replace operations, which accept empty * arrays as replacement documents for BC. */ @@ -75,12 +75,12 @@ public function provideEmptyUpdatePipelinesExcludingArray(): array ]; } - public function provideInvalidUpdateValues(): array + public static function provideInvalidUpdateValues(): array { - return $this->wrapValuesForDataProvider($this->getInvalidUpdateValues()); + return self::wrapValuesForDataProvider(self::getInvalidUpdateValues()); } - protected function getInvalidUpdateValues(): array + protected static function getInvalidUpdateValues(): array { return [123, 3.14, 'foo', true]; } diff --git a/tests/Operation/UpdateFunctionalTest.php b/tests/Operation/UpdateFunctionalTest.php index e70331433..b9424975b 100644 --- a/tests/Operation/UpdateFunctionalTest.php +++ b/tests/Operation/UpdateFunctionalTest.php @@ -5,12 +5,14 @@ use MongoDB\BSON\ObjectId; use MongoDB\Collection; use MongoDB\Driver\BulkWrite; +use MongoDB\Driver\Exception\LogicException; use MongoDB\Driver\WriteConcern; -use MongoDB\Exception\BadMethodCallException; use MongoDB\Exception\UnsupportedException; use MongoDB\Operation\Update; use MongoDB\Tests\CommandObserver; use MongoDB\UpdateResult; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Depends; use stdClass; use function is_array; @@ -26,7 +28,7 @@ public function setUp(): void $this->collection = new Collection($this->manager, $this->getDatabaseName(), $this->getCollectionName()); } - /** @dataProvider provideFilterDocuments */ + #[DataProvider('provideFilterDocuments')] public function testFilterDocuments($filter, stdClass $expectedFilter): void { (new CommandObserver())->observe( @@ -46,12 +48,10 @@ function (array $event) use ($expectedFilter): void { ); } - /** - * @dataProvider provideReplacementDocuments - * @dataProvider provideUpdateDocuments - * @dataProvider provideUpdatePipelines - * @dataProvider provideReplacementDocumentLikePipeline - */ + #[DataProvider('provideReplacementDocuments')] + #[DataProvider('provideUpdateDocuments')] + #[DataProvider('provideUpdatePipelines')] + #[DataProvider('provideReplacementDocumentLikePipeline')] public function testUpdateDocuments($update, $expectedUpdate): void { if (is_array($expectedUpdate)) { @@ -75,7 +75,7 @@ function (array $event) use ($expectedUpdate): void { ); } - public function provideReplacementDocumentLikePipeline(): array + public static function provideReplacementDocumentLikePipeline(): array { /* Note: libmongoc encodes this replacement document as a BSON array * because it resembles an update pipeline (see: CDRIVER-4658). */ @@ -102,7 +102,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('lsid', $event['started']->getCommand()); + $this->assertObjectHasProperty('lsid', $event['started']->getCommand()); }, ); } @@ -122,7 +122,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectHasAttribute('bypassDocumentValidation', $event['started']->getCommand()); + $this->assertObjectHasProperty('bypassDocumentValidation', $event['started']->getCommand()); $this->assertEquals(true, $event['started']->getCommand()->bypassDocumentValidation); }, ); @@ -143,7 +143,7 @@ function (): void { $operation->execute($this->getPrimaryServer()); }, function (array $event): void { - $this->assertObjectNotHasAttribute('bypassDocumentValidation', $event['started']->getCommand()); + $this->assertObjectNotHasProperty('bypassDocumentValidation', $event['started']->getCommand()); }, ); } @@ -284,35 +284,35 @@ public function testUnacknowledgedWriteConcern() return $result; } - /** @depends testUnacknowledgedWriteConcern */ + #[Depends('testUnacknowledgedWriteConcern')] public function testUnacknowledgedWriteConcernAccessesMatchedCount(UpdateResult $result): void { - $this->expectException(BadMethodCallException::class); - $this->expectExceptionMessageMatches('/[\w:\\\\]+ should not be called for an unacknowledged write result/'); + $this->expectException(LogicException::class); + $this->expectExceptionMessageMatches('/[\w:\\\\\(\)]+ should not be called for an unacknowledged write result/'); $result->getMatchedCount(); } - /** @depends testUnacknowledgedWriteConcern */ + #[Depends('testUnacknowledgedWriteConcern')] public function testUnacknowledgedWriteConcernAccessesModifiedCount(UpdateResult $result): void { - $this->expectException(BadMethodCallException::class); - $this->expectExceptionMessageMatches('/[\w:\\\\]+ should not be called for an unacknowledged write result/'); + $this->expectException(LogicException::class); + $this->expectExceptionMessageMatches('/[\w:\\\\\(\)]+ should not be called for an unacknowledged write result/'); $result->getModifiedCount(); } - /** @depends testUnacknowledgedWriteConcern */ + #[Depends('testUnacknowledgedWriteConcern')] public function testUnacknowledgedWriteConcernAccessesUpsertedCount(UpdateResult $result): void { - $this->expectException(BadMethodCallException::class); - $this->expectExceptionMessageMatches('/[\w:\\\\]+ should not be called for an unacknowledged write result/'); + $this->expectException(LogicException::class); + $this->expectExceptionMessageMatches('/[\w:\\\\\(\)]+ should not be called for an unacknowledged write result/'); $result->getUpsertedCount(); } - /** @depends testUnacknowledgedWriteConcern */ + #[Depends('testUnacknowledgedWriteConcern')] public function testUnacknowledgedWriteConcernAccessesUpsertedId(UpdateResult $result): void { - $this->expectException(BadMethodCallException::class); - $this->expectExceptionMessageMatches('/[\w:\\\\]+ should not be called for an unacknowledged write result/'); + $this->expectException(LogicException::class); + $this->expectExceptionMessageMatches('/[\w:\\\\\(\)]+ should not be called for an unacknowledged write result/'); $result->getUpsertedId(); } @@ -326,7 +326,7 @@ private function createFixtures(int $n): void for ($i = 1; $i <= $n; $i++) { $bulkWrite->insert([ '_id' => $i, - 'x' => (integer) ($i . $i), + 'x' => (int) ($i . $i), ]); } diff --git a/tests/Operation/UpdateManyTest.php b/tests/Operation/UpdateManyTest.php index 7f12207c8..30c0a0836 100644 --- a/tests/Operation/UpdateManyTest.php +++ b/tests/Operation/UpdateManyTest.php @@ -2,39 +2,39 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\UpdateMany; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; +use TypeError; class UpdateManyTest extends TestCase { - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorFilterArgumentTypeCheck($filter): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($filter instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new UpdateMany($this->getDatabaseName(), $this->getCollectionName(), $filter, ['$set' => ['x' => 1]]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorUpdateArgumentTypeCheck($update): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($update instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new UpdateMany($this->getDatabaseName(), $this->getCollectionName(), ['x' => 1], $update); } - /** - * @dataProvider provideUpdateDocuments - * @dataProvider provideUpdatePipelines - * @doesNotPerformAssertions - */ + #[DataProvider('provideUpdateDocuments')] + #[DataProvider('provideUpdatePipelines')] + #[DoesNotPerformAssertions] public function testConstructorUpdateArgument($update): void { new UpdateMany($this->getDatabaseName(), $this->getCollectionName(), ['x' => 1], $update); } - /** - * @dataProvider provideReplacementDocuments - * @dataProvider provideEmptyUpdatePipelines - */ + #[DataProvider('provideReplacementDocuments')] + #[DataProvider('provideEmptyUpdatePipelines')] public function testConstructorUpdateArgumentProhibitsReplacementDocumentOrEmptyPipeline($update): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/Operation/UpdateOneTest.php b/tests/Operation/UpdateOneTest.php index 657f3d650..25d67f45c 100644 --- a/tests/Operation/UpdateOneTest.php +++ b/tests/Operation/UpdateOneTest.php @@ -2,39 +2,39 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\UpdateOne; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; +use TypeError; class UpdateOneTest extends TestCase { - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorFilterArgumentTypeCheck($filter): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($filter instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new UpdateOne($this->getDatabaseName(), $this->getCollectionName(), $filter, ['$set' => ['x' => 1]]); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorUpdateArgumentTypeCheck($update): void { - $this->expectException(InvalidArgumentException::class); + $this->expectException($update instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new UpdateOne($this->getDatabaseName(), $this->getCollectionName(), ['x' => 1], $update); } - /** - * @dataProvider provideUpdateDocuments - * @dataProvider provideUpdatePipelines - * @doesNotPerformAssertions - */ + #[DataProvider('provideUpdateDocuments')] + #[DataProvider('provideUpdatePipelines')] + #[DoesNotPerformAssertions] public function testConstructorUpdateArgument($update): void { new UpdateOne($this->getDatabaseName(), $this->getCollectionName(), ['x' => 1], $update); } - /** - * @dataProvider provideReplacementDocuments - * @dataProvider provideEmptyUpdatePipelines - */ + #[DataProvider('provideReplacementDocuments')] + #[DataProvider('provideEmptyUpdatePipelines')] public function testConstructorUpdateArgumentProhibitsReplacementDocumentOrEmptyPipeline($update): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/Operation/UpdateSearchIndexTest.php b/tests/Operation/UpdateSearchIndexTest.php index 90c623fc3..f61db793e 100644 --- a/tests/Operation/UpdateSearchIndexTest.php +++ b/tests/Operation/UpdateSearchIndexTest.php @@ -2,8 +2,11 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\UpdateSearchIndex; +use PHPUnit\Framework\Attributes\DataProvider; +use TypeError; class UpdateSearchIndexTest extends TestCase { @@ -13,11 +16,10 @@ public function testConstructorIndexNameMustNotBeEmpty(): void new UpdateSearchIndex($this->getDatabaseName(), $this->getCollectionName(), '', []); } - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorIndexDefinitionMustBeADocument($definition): void { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('Expected $definition to have type "document"'); + $this->expectException($definition instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new UpdateSearchIndex($this->getDatabaseName(), $this->getCollectionName(), 'index name', $definition); } } diff --git a/tests/Operation/UpdateTest.php b/tests/Operation/UpdateTest.php index 85d00ef88..9617c77e8 100644 --- a/tests/Operation/UpdateTest.php +++ b/tests/Operation/UpdateTest.php @@ -2,53 +2,53 @@ namespace MongoDB\Tests\Operation; +use MongoDB\BSON\PackedArray; use MongoDB\Driver\WriteConcern; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\Update; +use PHPUnit\Framework\Attributes\DataProvider; +use TypeError; class UpdateTest extends TestCase { - /** @dataProvider provideInvalidDocumentValues */ + #[DataProvider('provideInvalidDocumentValues')] public function testConstructorFilterArgumentTypeCheck($filter): void { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessageMatches('/Expected \$filter to have type "document" \(array or object\) but found ".+"/'); + $this->expectException($filter instanceof PackedArray ? InvalidArgumentException::class : TypeError::class); new Update($this->getDatabaseName(), $this->getCollectionName(), $filter, ['$set' => ['x' => 1]]); } - /** @dataProvider provideInvalidUpdateValues */ + #[DataProvider('provideInvalidUpdateValues')] public function testConstructorUpdateArgumentTypeCheck($update): void { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessageMatches('/Expected \$update to have type "array or object" but found "[\w ]+"/'); + $this->expectException(TypeError::class); new Update($this->getDatabaseName(), $this->getCollectionName(), ['x' => 1], $update); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new Update($this->getDatabaseName(), $this->getCollectionName(), ['x' => 1], ['y' => 1], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'arrayFilters' => $this->getInvalidArrayValues(), - 'bypassDocumentValidation' => $this->getInvalidBooleanValues(), - 'collation' => $this->getInvalidDocumentValues(), - 'hint' => $this->getInvalidHintValues(), - 'multi' => $this->getInvalidBooleanValues(), - 'session' => $this->getInvalidSessionValues(), - 'upsert' => $this->getInvalidBooleanValues(), - 'writeConcern' => $this->getInvalidWriteConcernValues(), + return self::createOptionDataProvider([ + 'arrayFilters' => self::getInvalidArrayValues(), + 'bypassDocumentValidation' => self::getInvalidBooleanValues(), + 'collation' => self::getInvalidDocumentValues(), + 'hint' => self::getInvalidHintValues(), + 'multi' => self::getInvalidBooleanValues(), + 'sort' => self::getInvalidDocumentValues(), + 'session' => self::getInvalidSessionValues(), + 'upsert' => self::getInvalidBooleanValues(), + 'writeConcern' => self::getInvalidWriteConcernValues(), ]); } - /** - * @dataProvider provideReplacementDocuments - * @dataProvider provideEmptyUpdatePipelines - */ + #[DataProvider('provideReplacementDocuments')] + #[DataProvider('provideEmptyUpdatePipelines')] public function testConstructorMultiOptionProhibitsReplacementDocumentOrEmptyPipeline($update): void { $this->expectException(InvalidArgumentException::class); @@ -56,6 +56,13 @@ public function testConstructorMultiOptionProhibitsReplacementDocumentOrEmptyPip new Update($this->getDatabaseName(), $this->getCollectionName(), ['x' => 1], $update, ['multi' => true]); } + public function testConstructorMultiOptionProhibitsSortOption(): void + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('"sort" option cannot be used with multi-document updates'); + new Update($this->getDatabaseName(), $this->getCollectionName(), ['x' => 1], ['$set' => ['x' => 2]], ['multi' => true, 'sort' => ['x' => 1]]); + } + public function testExplainableCommandDocument(): void { $options = [ diff --git a/tests/Operation/WatchFunctionalTest.php b/tests/Operation/WatchFunctionalTest.php index 9dc0acff1..522b01ba4 100644 --- a/tests/Operation/WatchFunctionalTest.php +++ b/tests/Operation/WatchFunctionalTest.php @@ -6,7 +6,6 @@ use Generator; use Iterator; use MongoDB\BSON\Document; -use MongoDB\BSON\TimestampInterface; use MongoDB\ChangeStream; use MongoDB\Codec\DecodeIfSupported; use MongoDB\Codec\DocumentCodec; @@ -25,6 +24,9 @@ use MongoDB\Operation\InsertOne; use MongoDB\Operation\Watch; use MongoDB\Tests\CommandObserver; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Constraint\ObjectHasProperty; use PHPUnit\Framework\ExpectationFailedException; use ReflectionClass; use stdClass; @@ -36,11 +38,9 @@ use function microtime; use function sprintf; -/** - * @group matrix-testing-exclude-server-4.2-driver-4.0-topology-sharded_cluster - * @group matrix-testing-exclude-server-4.4-driver-4.0-topology-sharded_cluster - * @group matrix-testing-exclude-server-5.0-driver-4.0-topology-sharded_cluster - */ +#[Group('matrix-testing-exclude-server-4.2-driver-4.0-topology-sharded_cluster')] +#[Group('matrix-testing-exclude-server-4.4-driver-4.0-topology-sharded_cluster')] +#[Group('matrix-testing-exclude-server-5.0-driver-4.0-topology-sharded_cluster')] class WatchFunctionalTest extends FunctionalTestCase { public const INTERRUPTED = 11601; @@ -98,52 +98,13 @@ public function encode($value): Document yield 'Codec' => [ 'options' => ['codec' => $codec], 'getIdentifier' => static function (object $document): object { - self::assertObjectHasAttribute('id', $document); + self::assertObjectHasProperty('id', $document); return $document->id; }, ]; } - /** - * Prose test 1: "ChangeStream must continuously track the last seen - * resumeToken" - * - * @dataProvider provideCodecOptions - */ - public function testGetResumeToken(array $options, Closure $getIdentifier): void - { - $this->skipIfServerVersion('>=', '4.0.7', 'postBatchResumeToken is supported'); - - $operation = new Watch( - $this->manager, - $this->getDatabaseName(), - $this->getCollectionName(), - [], - $options + $this->defaultOptions, - ); - $changeStream = $operation->execute($this->getPrimaryServer()); - - $changeStream->rewind(); - $this->assertFalse($changeStream->valid()); - $this->assertNull($changeStream->getResumeToken()); - - $this->insertDocument(['x' => 1]); - $this->insertDocument(['x' => 2]); - - $this->advanceCursorUntilValid($changeStream); - $this->assertSameDocument($getIdentifier($changeStream->current()), $changeStream->getResumeToken()); - - $changeStream->next(); - $this->assertTrue($changeStream->valid()); - $this->assertSameDocument($getIdentifier($changeStream->current()), $changeStream->getResumeToken()); - - $this->insertDocument(['x' => 3]); - - $this->advanceCursorUntilValid($changeStream); - $this->assertSameDocument($getIdentifier($changeStream->current()), $changeStream->getResumeToken()); - } - /** * Prose test 1: "ChangeStream must continuously track the last seen * resumeToken" @@ -161,13 +122,10 @@ public function testGetResumeToken(array $options, Closure $getIdentifier): void * - The batch has been iterated up to but not including the last element. * Expected result: getResumeToken must return the _id of the previous * document returned. - * - * @dataProvider provideCodecOptions */ + #[DataProvider('provideCodecOptions')] public function testGetResumeTokenWithPostBatchResumeToken(array $options, Closure $getIdentifier): void { - $this->skipIfServerVersion('<', '4.0.7', 'postBatchResumeToken is not supported'); - $operation = new Watch( $this->manager, $this->getDatabaseName(), @@ -268,8 +226,6 @@ function (array $event) use (&$commands): void { public function testResumeBeforeReceivingAnyResultsIncludesPostBatchResumeToken(): void { - $this->skipIfServerVersion('<', '4.0.7', 'postBatchResumeToken is not supported'); - $operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), [], $this->defaultOptions); $events = []; @@ -308,102 +264,29 @@ function (array $event) use (&$events): void { $this->assertCount(3, $events); $this->assertSame('getMore', $events[0]['started']->getCommandName()); - $this->arrayHasKey('failed', $events[0]); + $this->assertArrayHasKey('failed', $events[0]); $this->assertSame('aggregate', $events[1]['started']->getCommandName()); $this->assertResumeAfter($postBatchResumeToken, $events[1]['started']->getCommand()); - $this->arrayHasKey('succeeded', $events[1]); + $this->assertArrayHasKey('succeeded', $events[1]); // Original cursor is freed immediately after the change stream resumes $this->assertSame('killCursors', $events[2]['started']->getCommandName()); - $this->arrayHasKey('succeeded', $events[2]); + $this->assertArrayHasKey('succeeded', $events[2]); $this->assertFalse($changeStream->valid()); } private function assertResumeAfter($expectedResumeToken, stdClass $command): void { - $this->assertObjectHasAttribute('pipeline', $command); + $this->assertObjectHasProperty('pipeline', $command); $this->assertIsArray($command->pipeline); $this->assertArrayHasKey(0, $command->pipeline); - $this->assertObjectHasAttribute('$changeStream', $command->pipeline[0]); - $this->assertObjectHasAttribute('resumeAfter', $command->pipeline[0]->{'$changeStream'}); + $this->assertObjectHasProperty('$changeStream', $command->pipeline[0]); + $this->assertObjectHasProperty('resumeAfter', $command->pipeline[0]->{'$changeStream'}); $this->assertEquals($expectedResumeToken, $command->pipeline[0]->{'$changeStream'}->resumeAfter); } - /** - * Prose test 9: "$changeStream stage for ChangeStream against a server - * >=4.0 and <4.0.7 that has not received any results yet MUST include a - * startAtOperationTime option when resuming a changestream." - */ - public function testResumeBeforeReceivingAnyResultsIncludesStartAtOperationTime(): void - { - $this->skipIfServerVersion('>=', '4.0.7', 'postBatchResumeToken takes precedence over startAtOperationTime'); - - $operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), [], $this->defaultOptions); - - $events = []; - - (new CommandObserver())->observe( - function () use ($operation, &$changeStream): void { - $changeStream = $operation->execute($this->getPrimaryServer()); - }, - function (array $event) use (&$events): void { - $events[] = $event; - }, - ); - - $this->assertCount(1, $events); - $this->assertSame('aggregate', $events[0]['started']->getCommandName()); - $reply = $events[0]['succeeded']->getReply(); - $this->assertObjectHasAttribute('operationTime', $reply); - $operationTime = $reply->operationTime; - $this->assertInstanceOf(TimestampInterface::class, $operationTime); - - $this->assertFalse($changeStream->valid()); - $this->forceChangeStreamResume(); - - $this->assertNoCommandExecuted(function () use ($changeStream): void { - $changeStream->rewind(); - }); - - $events = []; - - (new CommandObserver())->observe( - function () use ($changeStream): void { - $changeStream->next(); - }, - function (array $event) use (&$events): void { - $events[] = $event; - }, - ); - - $this->assertCount(3, $events); - - $this->assertSame('getMore', $events[0]['started']->getCommandName()); - $this->arrayHasKey('failed', $events[0]); - - $this->assertSame('aggregate', $events[1]['started']->getCommandName()); - $this->assertStartAtOperationTime($operationTime, $events[1]['started']->getCommand()); - $this->arrayHasKey('succeeded', $events[1]); - - // Original cursor is freed immediately after the change stream resumes - $this->assertSame('killCursors', $events[2]['started']->getCommandName()); - $this->arrayHasKey('succeeded', $events[2]); - - $this->assertFalse($changeStream->valid()); - } - - private function assertStartAtOperationTime(TimestampInterface $expectedOperationTime, stdClass $command): void - { - $this->assertObjectHasAttribute('pipeline', $command); - $this->assertIsArray($command->pipeline); - $this->assertArrayHasKey(0, $command->pipeline); - $this->assertObjectHasAttribute('$changeStream', $command->pipeline[0]); - $this->assertObjectHasAttribute('startAtOperationTime', $command->pipeline[0]->{'$changeStream'}); - $this->assertEquals($expectedOperationTime, $command->pipeline[0]->{'$changeStream'}->startAtOperationTime); - } - public function testRewindMultipleTimesWithResults(): void { $this->skipIfIsShardedCluster('Cursor needs to be advanced multiple times and can\'t be rewound afterwards.'); @@ -488,8 +371,8 @@ public function testRewindMultipleTimesWithNoResults(): void $this->assertNull($changeStream->current()); } - /** @dataProvider provideCodecOptions */ - public function testNoChangeAfterResumeBeforeInsert(array $options): void + #[DataProvider('provideCodecOptions')] + public function testNoChangeAfterResumeBeforeInsert(array $options, Closure $getIdentifier): void { $operation = new Watch( $this->manager, @@ -721,13 +604,10 @@ public function testInitialCursorIsNotClosed(): void * reports the cursor as alive. While the cursor ID is accessed through * ChangeStream, we'll need to use reflection to access the internal * Cursor and call isDead(). */ - $this->assertNotEquals('0', (string) $changeStream->getCursorId(true)); + $this->assertNotEquals(0, $changeStream->getCursorId()); $rc = new ReflectionClass(ChangeStream::class); - $rp = $rc->getProperty('iterator'); - $rp->setAccessible(true); - - $iterator = $rp->getValue($changeStream); + $iterator = $rc->getProperty('iterator')->getValue($changeStream); $this->assertInstanceOf('IteratorIterator', $iterator); @@ -897,7 +777,7 @@ public function testMaxAwaitTimeMS(): void } } - /** @dataProvider provideCodecOptions */ + #[DataProvider('provideCodecOptions')] public function testRewindExtractsResumeTokenAndNextResumes(array $options, Closure $getIdentifier): void { $operation = new Watch( @@ -955,7 +835,7 @@ public function testRewindExtractsResumeTokenAndNextResumes(array $options, Clos $this->assertMatchesDocument(['_id' => 3, 'x' => 'baz'], $changeStream->current()->fullDocument); } - /** @dataProvider provideCodecOptions */ + #[DataProvider('provideCodecOptions')] public function testResumeAfterOption(array $options, Closure $getIdentifier): void { $operation = new Watch( @@ -1001,7 +881,7 @@ public function testResumeAfterOption(array $options, Closure $getIdentifier): v $this->assertMatchesDocument(['_id' => 2, 'x' => 'bar'], $changeStream->current()->fullDocument); } - /** @dataProvider provideCodecOptions */ + #[DataProvider('provideCodecOptions')] public function testStartAfterOption(array $options, Closure $getIdentifier): void { $this->skipIfServerVersion('<', '4.1.1', 'startAfter is not supported'); @@ -1049,7 +929,7 @@ public function testStartAfterOption(array $options, Closure $getIdentifier): vo $this->assertMatchesDocument(['_id' => 2, 'x' => 'bar'], $changeStream->current()->fullDocument); } - /** @dataProvider provideTypeMapOptionsAndExpectedChangeDocument */ + #[DataProvider('provideTypeMapOptionsAndExpectedChangeDocument')] public function testTypeMapOption(array $typeMap, $expectedChangeDocument): void { $operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), [], ['typeMap' => $typeMap] + $this->defaultOptions); @@ -1065,7 +945,7 @@ public function testTypeMapOption(array $typeMap, $expectedChangeDocument): void $this->assertMatchesDocument($expectedChangeDocument, $changeStream->current()); } - public function provideTypeMapOptionsAndExpectedChangeDocument() + public static function provideTypeMapOptionsAndExpectedChangeDocument() { /* Note: the "_id" and "ns" fields are purposefully omitted because the * resume token's value cannot be anticipated and the collection name, @@ -1136,9 +1016,9 @@ public function testResumeTokenNotFoundDoesNotAdvanceKey(): void try { $this->advanceCursorUntilValid($changeStream); $this->fail('Exception for missing resume token was not thrown'); - } catch (ResumeTokenException $e) { + } catch (ResumeTokenException) { /* On server versions < 4.1.8, a client-side error is thrown. */ - } catch (ServerException $e) { + } catch (ServerException) { /* On server versions >= 4.1.8, the error is thrown server-side. */ } @@ -1148,7 +1028,7 @@ public function testResumeTokenNotFoundDoesNotAdvanceKey(): void try { $changeStream->next(); $this->fail('Exception for missing resume token was not thrown'); - } catch (ResumeTokenException | ServerException $e) { + } catch (ResumeTokenException | ServerException) { } $this->assertFalse($changeStream->valid()); @@ -1225,7 +1105,6 @@ public function testSessionFreed(): void $rc = new ReflectionClass($changeStream); $rp = $rc->getProperty('resumeCallable'); - $rp->setAccessible(true); $this->assertIsCallable($rp->getValue($changeStream)); @@ -1282,9 +1161,9 @@ function (array $event) use (&$aggregateCommands): void { $aggregateCommands[0]['pipeline'][0]->{'$changeStream'}, $this->logicalNot( $this->logicalOr( - $this->objectHasAttribute('resumeAfter'), - $this->objectHasAttribute('startAfter'), - $this->objectHasAttribute('startAtOperationTime'), + new ObjectHasProperty('resumeAfter'), + new ObjectHasProperty('startAfter'), + new ObjectHasProperty('startAtOperationTime'), ), ), ); @@ -1292,9 +1171,9 @@ function (array $event) use (&$aggregateCommands): void { $this->assertThat( $aggregateCommands[1]['pipeline'][0]->{'$changeStream'}, $this->logicalOr( - $this->objectHasAttribute('resumeAfter'), - $this->objectHasAttribute('startAfter'), - $this->objectHasAttribute('startAtOperationTime'), + new ObjectHasProperty('resumeAfter'), + new ObjectHasProperty('startAfter'), + new ObjectHasProperty('startAtOperationTime'), ), ); @@ -1324,8 +1203,6 @@ function (array $aggregateCommand) { */ public function testErrorDuringAggregateCommandDoesNotCauseResume(): void { - $this->skipIfServerVersion('<', '4.0.0', 'failCommand is not supported'); - $operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), [], $this->defaultOptions); $commandCount = 0; @@ -1366,16 +1243,16 @@ public function testOriginalReadPreferenceIsPreservedOnResume(): void try { $secondary = $this->manager->selectServer($readPreference); - } catch (ConnectionTimeoutException $e) { + } catch (ConnectionTimeoutException) { $this->markTestSkipped('Secondary is not available'); } $changeStream = $operation->execute($secondary); - $previousCursorId = $changeStream->getCursorId(true); + $previousCursorId = $changeStream->getCursorId(); $this->forceChangeStreamResume($secondary); $changeStream->next(); - $this->assertNotEquals($previousCursorId, $changeStream->getCursorId(true)); + $this->assertNotEquals($previousCursorId, $changeStream->getCursorId()); $getCursor = Closure::bind( fn () => $this->iterator->getInnerIterator(), @@ -1387,39 +1264,6 @@ public function testOriginalReadPreferenceIsPreservedOnResume(): void self::assertTrue($cursor->getServer()->isSecondary()); } - /** - * Prose test 12 - * For a ChangeStream under these conditions: - * - Running against a server <4.0.7. - * - The batch is empty or has been iterated to the last document. - * Expected result: - * - getResumeToken must return the _id of the last document returned if one exists. - * - getResumeToken must return resumeAfter from the initial aggregate if the option was specified. - * - If resumeAfter was not specified, the getResumeToken result must be empty. - */ - public function testGetResumeTokenReturnsOriginalResumeTokenOnEmptyBatch(): void - { - $this->skipIfServerVersion('>=', '4.0.7', 'postBatchResumeToken is supported'); - - $operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), [], $this->defaultOptions); - $changeStream = $operation->execute($this->getPrimaryServer()); - - $this->assertNull($changeStream->getResumeToken()); - - $this->insertDocument(['x' => 1]); - - $changeStream->next(); - $this->assertTrue($changeStream->valid()); - $resumeToken = $changeStream->getResumeToken(); - $this->assertSame($resumeToken, $changeStream->current()->_id); - - $options = ['resumeAfter' => $resumeToken] + $this->defaultOptions; - $operation = new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), [], $options); - $changeStream = $operation->execute($this->getPrimaryServer()); - - $this->assertSame($resumeToken, $changeStream->getResumeToken()); - } - /** * Prose test 14 * For a ChangeStream under these conditions: @@ -1430,12 +1274,10 @@ public function testGetResumeTokenReturnsOriginalResumeTokenOnEmptyBatch(): void * - getResumeToken must return startAfter from the initial aggregate if the option was specified. * - getResumeToken must return resumeAfter from the initial aggregate if the option was specified. * - If neither the startAfter nor resumeAfter options were specified, the getResumeToken result must be empty. - * - * @dataProvider provideCodecOptions */ - public function testResumeTokenBehaviour(array $options): void + #[DataProvider('provideCodecOptions')] + public function testResumeTokenBehaviour(array $options, Closure $getIdentifier): void { - $this->skipIfServerVersion('<', '4.1.1', 'Testing resumeAfter and startAfter can only be tested on servers >= 4.1.1'); $this->skipIfIsShardedCluster('Resume token behaviour can\'t be reliably tested on sharded clusters.'); $operation = new Watch( @@ -1455,7 +1297,7 @@ public function testResumeTokenBehaviour(array $options): void $this->assertInstanceOf(CommandSucceededEvent::class, $event['succeeded']); $reply = $event['succeeded']->getReply(); - $this->assertObjectHasAttribute('operationTime', $reply); + $this->assertObjectHasProperty('operationTime', $reply); $lastOpTime = $reply->operationTime; }); @@ -1545,8 +1387,8 @@ function (array $event) use (&$aggregateCommand): void { ); $this->assertNotNull($aggregateCommand); - $this->assertObjectNotHasAttribute('resumeAfter', $aggregateCommand->pipeline[0]->{'$changeStream'}); - $this->assertObjectHasAttribute('startAfter', $aggregateCommand->pipeline[0]->{'$changeStream'}); + $this->assertObjectNotHasProperty('resumeAfter', $aggregateCommand->pipeline[0]->{'$changeStream'}); + $this->assertObjectHasProperty('startAfter', $aggregateCommand->pipeline[0]->{'$changeStream'}); } /** @@ -1594,8 +1436,8 @@ function (array $event) use (&$aggregateCommand): void { ); $this->assertNotNull($aggregateCommand); - $this->assertObjectNotHasAttribute('startAfter', $aggregateCommand->pipeline[0]->{'$changeStream'}); - $this->assertObjectHasAttribute('resumeAfter', $aggregateCommand->pipeline[0]->{'$changeStream'}); + $this->assertObjectNotHasProperty('startAfter', $aggregateCommand->pipeline[0]->{'$changeStream'}); + $this->assertObjectHasProperty('resumeAfter', $aggregateCommand->pipeline[0]->{'$changeStream'}); } private function assertNoCommandExecuted(callable $callable): void @@ -1630,9 +1472,9 @@ private function forceChangeStreamResume(?Server $server = null): void private function getPostBatchResumeTokenFromReply(stdClass $reply) { - $this->assertObjectHasAttribute('cursor', $reply); + $this->assertObjectHasProperty('cursor', $reply); $this->assertIsObject($reply->cursor); - $this->assertObjectHasAttribute('postBatchResumeToken', $reply->cursor); + $this->assertObjectHasProperty('postBatchResumeToken', $reply->cursor); $this->assertIsObject($reply->cursor->postBatchResumeToken); return $reply->cursor->postBatchResumeToken; diff --git a/tests/Operation/WatchTest.php b/tests/Operation/WatchTest.php index fd97a1c5e..9e874c484 100644 --- a/tests/Operation/WatchTest.php +++ b/tests/Operation/WatchTest.php @@ -5,6 +5,7 @@ use MongoDB\Exception\InvalidArgumentException; use MongoDB\Operation\Watch; use MongoDB\Tests\Fixtures\Codec\TestDocumentCodec; +use PHPUnit\Framework\Attributes\DataProvider; use stdClass; /** @@ -32,29 +33,29 @@ public function testConstructorPipelineArgumentMustBeAList(): void new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), ['foo' => ['$match' => ['x' => 1]]]); } - /** @dataProvider provideInvalidConstructorOptions */ + #[DataProvider('provideInvalidConstructorOptions')] public function testConstructorOptionTypeChecks(array $options): void { $this->expectException(InvalidArgumentException::class); new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), [], $options); } - public function provideInvalidConstructorOptions() + public static function provideInvalidConstructorOptions() { - return $this->createOptionDataProvider([ - 'batchSize' => $this->getInvalidIntegerValues(), - 'codec' => $this->getInvalidDocumentCodecValues(), - 'collation' => $this->getInvalidDocumentValues(), - 'fullDocument' => $this->getInvalidStringValues(true), - 'fullDocumentBeforeChange' => $this->getInvalidStringValues(), - 'maxAwaitTimeMS' => $this->getInvalidIntegerValues(), - 'readConcern' => $this->getInvalidReadConcernValues(), - 'readPreference' => $this->getInvalidReadPreferenceValues(true), - 'resumeAfter' => $this->getInvalidDocumentValues(), - 'session' => $this->getInvalidSessionValues(), - 'startAfter' => $this->getInvalidDocumentValues(), - 'startAtOperationTime' => $this->getInvalidTimestampValues(), - 'typeMap' => $this->getInvalidArrayValues(), + return self::createOptionDataProvider([ + 'batchSize' => self::getInvalidIntegerValues(), + 'codec' => self::getInvalidDocumentCodecValues(), + 'collation' => self::getInvalidDocumentValues(), + 'fullDocument' => self::getInvalidStringValues(true), + 'fullDocumentBeforeChange' => self::getInvalidStringValues(), + 'maxAwaitTimeMS' => self::getInvalidIntegerValues(), + 'readConcern' => self::getInvalidReadConcernValues(), + 'readPreference' => self::getInvalidReadPreferenceValues(true), + 'resumeAfter' => self::getInvalidDocumentValues(), + 'session' => self::getInvalidSessionValues(), + 'startAfter' => self::getInvalidDocumentValues(), + 'startAtOperationTime' => self::getInvalidTimestampValues(), + 'typeMap' => self::getInvalidArrayValues(), ]); } @@ -66,7 +67,7 @@ public function testConstructorRejectsCodecAndTypemap(): void new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), [], $options); } - private function getInvalidTimestampValues() + private static function getInvalidTimestampValues() { return [123, 3.14, 'foo', true, [], new stdClass()]; } diff --git a/tests/PHPUnit/Functions.php b/tests/PHPUnit/Functions.php deleted file mode 100644 index 64a4eee19..000000000 --- a/tests/PHPUnit/Functions.php +++ /dev/null @@ -1,2729 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace PHPUnit\Framework; - -use ArrayAccess; -use Countable; -use DOMDocument; -use DOMElement; -use PHPUnit\Framework\Constraint\ArrayHasKey; -use PHPUnit\Framework\Constraint\Callback; -use PHPUnit\Framework\Constraint\ClassHasAttribute; -use PHPUnit\Framework\Constraint\ClassHasStaticAttribute; -use PHPUnit\Framework\Constraint\Constraint; -use PHPUnit\Framework\Constraint\Count; -use PHPUnit\Framework\Constraint\DirectoryExists; -use PHPUnit\Framework\Constraint\FileExists; -use PHPUnit\Framework\Constraint\GreaterThan; -use PHPUnit\Framework\Constraint\IsAnything; -use PHPUnit\Framework\Constraint\IsEmpty; -use PHPUnit\Framework\Constraint\IsEqual; -use PHPUnit\Framework\Constraint\IsEqualCanonicalizing; -use PHPUnit\Framework\Constraint\IsEqualIgnoringCase; -use PHPUnit\Framework\Constraint\IsEqualWithDelta; -use PHPUnit\Framework\Constraint\IsFalse; -use PHPUnit\Framework\Constraint\IsFinite; -use PHPUnit\Framework\Constraint\IsIdentical; -use PHPUnit\Framework\Constraint\IsInfinite; -use PHPUnit\Framework\Constraint\IsInstanceOf; -use PHPUnit\Framework\Constraint\IsJson; -use PHPUnit\Framework\Constraint\IsNan; -use PHPUnit\Framework\Constraint\IsNull; -use PHPUnit\Framework\Constraint\IsReadable; -use PHPUnit\Framework\Constraint\IsTrue; -use PHPUnit\Framework\Constraint\IsType; -use PHPUnit\Framework\Constraint\IsWritable; -use PHPUnit\Framework\Constraint\LessThan; -use PHPUnit\Framework\Constraint\LogicalAnd; -use PHPUnit\Framework\Constraint\LogicalNot; -use PHPUnit\Framework\Constraint\LogicalOr; -use PHPUnit\Framework\Constraint\LogicalXor; -use PHPUnit\Framework\Constraint\ObjectHasAttribute; -use PHPUnit\Framework\Constraint\RegularExpression; -use PHPUnit\Framework\Constraint\StringContains; -use PHPUnit\Framework\Constraint\StringEndsWith; -use PHPUnit\Framework\Constraint\StringMatchesFormatDescription; -use PHPUnit\Framework\Constraint\StringStartsWith; -use PHPUnit\Framework\Constraint\TraversableContainsEqual; -use PHPUnit\Framework\Constraint\TraversableContainsIdentical; -use PHPUnit\Framework\Constraint\TraversableContainsOnly; -use PHPUnit\Framework\MockObject\Rule\AnyInvokedCount as AnyInvokedCountMatcher; -use PHPUnit\Framework\MockObject\Rule\InvokedAtIndex as InvokedAtIndexMatcher; -use PHPUnit\Framework\MockObject\Rule\InvokedAtLeastCount as InvokedAtLeastCountMatcher; -use PHPUnit\Framework\MockObject\Rule\InvokedAtLeastOnce as InvokedAtLeastOnceMatcher; -use PHPUnit\Framework\MockObject\Rule\InvokedAtMostCount as InvokedAtMostCountMatcher; -use PHPUnit\Framework\MockObject\Rule\InvokedCount as InvokedCountMatcher; -use PHPUnit\Framework\MockObject\Stub\ConsecutiveCalls as ConsecutiveCallsStub; -use PHPUnit\Framework\MockObject\Stub\Exception as ExceptionStub; -use PHPUnit\Framework\MockObject\Stub\ReturnArgument as ReturnArgumentStub; -use PHPUnit\Framework\MockObject\Stub\ReturnCallback as ReturnCallbackStub; -use PHPUnit\Framework\MockObject\Stub\ReturnSelf as ReturnSelfStub; -use PHPUnit\Framework\MockObject\Stub\ReturnStub; -use PHPUnit\Framework\MockObject\Stub\ReturnValueMap as ReturnValueMapStub; -use PHPUnit\Util\Exception; -use PHPUnit\Util\Xml\Exception as XmlException; -use SebastianBergmann\RecursionContext\InvalidArgumentException; -use Throwable; - -use function func_get_args; -use function function_exists; - -if (! function_exists('PHPUnit\Framework\assertArrayHasKey')) { - /** - * Asserts that an array has a specified key. - * - * @see Assert::assertArrayHasKey - * - * @param int|string $key - * @param array|ArrayAccess $array - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertArrayHasKey($key, $array, string $message = ''): void - { - Assert::assertArrayHasKey(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertArrayNotHasKey')) { - /** - * Asserts that an array does not have a specified key. - * - * @see Assert::assertArrayNotHasKey - * - * @param int|string $key - * @param array|ArrayAccess $array - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertArrayNotHasKey($key, $array, string $message = ''): void - { - Assert::assertArrayNotHasKey(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertContains')) { - /** - * Asserts that a haystack contains a needle. - * - * @see Assert::assertContains - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertContains($needle, $haystack, string $message = ''): void - { - Assert::assertContains(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertContainsEquals')) { - function assertContainsEquals($needle, $haystack, string $message = ''): void - { - Assert::assertContainsEquals(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotContains')) { - /** - * Asserts that a haystack does not contain a needle. - * - * @see Assert::assertNotContains - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertNotContains($needle, $haystack, string $message = ''): void - { - Assert::assertNotContains(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotContainsEquals')) { - function assertNotContainsEquals($needle, $haystack, string $message = ''): void - { - Assert::assertNotContainsEquals(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertContainsOnly')) { - /** - * Asserts that a haystack contains only values of a given type. - * - * @see Assert::assertContainsOnly - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertContainsOnly(string $type, $haystack, ?bool $isNativeType = null, string $message = ''): void - { - Assert::assertContainsOnly(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertContainsOnlyInstancesOf')) { - /** - * Asserts that a haystack contains only instances of a given class name. - * - * @see Assert::assertContainsOnlyInstancesOf - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertContainsOnlyInstancesOf(string $className, $haystack, string $message = ''): void - { - Assert::assertContainsOnlyInstancesOf(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotContainsOnly')) { - /** - * Asserts that a haystack does not contain only values of a given type. - * - * @see Assert::assertNotContainsOnly - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertNotContainsOnly(string $type, $haystack, ?bool $isNativeType = null, string $message = ''): void - { - Assert::assertNotContainsOnly(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertCount')) { - /** - * Asserts the number of elements of an array, Countable or Traversable. - * - * @see Assert::assertCount - * - * @param Countable|iterable $haystack - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertCount(int $expectedCount, $haystack, string $message = ''): void - { - Assert::assertCount(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotCount')) { - /** - * Asserts the number of elements of an array, Countable or Traversable. - * - * @see Assert::assertNotCount - * - * @param Countable|iterable $haystack - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertNotCount(int $expectedCount, $haystack, string $message = ''): void - { - Assert::assertNotCount(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertEquals')) { - /** - * Asserts that two variables are equal. - * - * @see Assert::assertEquals - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertEquals($expected, $actual, string $message = ''): void - { - Assert::assertEquals(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertEqualsCanonicalizing')) { - /** - * Asserts that two variables are equal (canonicalizing). - * - * @see Assert::assertEqualsCanonicalizing - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertEqualsCanonicalizing($expected, $actual, string $message = ''): void - { - Assert::assertEqualsCanonicalizing(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertEqualsIgnoringCase')) { - /** - * Asserts that two variables are equal (ignoring case). - * - * @see Assert::assertEqualsIgnoringCase - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertEqualsIgnoringCase($expected, $actual, string $message = ''): void - { - Assert::assertEqualsIgnoringCase(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertEqualsWithDelta')) { - /** - * Asserts that two variables are equal (with delta). - * - * @see Assert::assertEqualsWithDelta - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertEqualsWithDelta($expected, $actual, float $delta, string $message = ''): void - { - Assert::assertEqualsWithDelta(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotEquals')) { - /** - * Asserts that two variables are not equal. - * - * @see Assert::assertNotEquals - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertNotEquals($expected, $actual, string $message = ''): void - { - Assert::assertNotEquals(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotEqualsCanonicalizing')) { - /** - * Asserts that two variables are not equal (canonicalizing). - * - * @see Assert::assertNotEqualsCanonicalizing - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertNotEqualsCanonicalizing($expected, $actual, string $message = ''): void - { - Assert::assertNotEqualsCanonicalizing(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotEqualsIgnoringCase')) { - /** - * Asserts that two variables are not equal (ignoring case). - * - * @see Assert::assertNotEqualsIgnoringCase - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertNotEqualsIgnoringCase($expected, $actual, string $message = ''): void - { - Assert::assertNotEqualsIgnoringCase(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotEqualsWithDelta')) { - /** - * Asserts that two variables are not equal (with delta). - * - * @see Assert::assertNotEqualsWithDelta - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertNotEqualsWithDelta($expected, $actual, float $delta, string $message = ''): void - { - Assert::assertNotEqualsWithDelta(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertEmpty')) { - /** - * Asserts that a variable is empty. - * - * @see Assert::assertEmpty - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert empty $actual - */ - function assertEmpty($actual, string $message = ''): void - { - Assert::assertEmpty(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotEmpty')) { - /** - * Asserts that a variable is not empty. - * - * @see Assert::assertNotEmpty - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !empty $actual - */ - function assertNotEmpty($actual, string $message = ''): void - { - Assert::assertNotEmpty(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertGreaterThan')) { - /** - * Asserts that a value is greater than another value. - * - * @see Assert::assertGreaterThan - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertGreaterThan($expected, $actual, string $message = ''): void - { - Assert::assertGreaterThan(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertGreaterThanOrEqual')) { - /** - * Asserts that a value is greater than or equal to another value. - * - * @see Assert::assertGreaterThanOrEqual - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertGreaterThanOrEqual($expected, $actual, string $message = ''): void - { - Assert::assertGreaterThanOrEqual(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertLessThan')) { - /** - * Asserts that a value is smaller than another value. - * - * @see Assert::assertLessThan - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertLessThan($expected, $actual, string $message = ''): void - { - Assert::assertLessThan(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertLessThanOrEqual')) { - /** - * Asserts that a value is smaller than or equal to another value. - * - * @see Assert::assertLessThanOrEqual - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertLessThanOrEqual($expected, $actual, string $message = ''): void - { - Assert::assertLessThanOrEqual(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFileEquals')) { - /** - * Asserts that the contents of one file is equal to the contents of another - * file. - * - * @see Assert::assertFileEquals - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertFileEquals(string $expected, string $actual, string $message = ''): void - { - Assert::assertFileEquals(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFileEqualsCanonicalizing')) { - /** - * Asserts that the contents of one file is equal to the contents of another - * file (canonicalizing). - * - * @see Assert::assertFileEqualsCanonicalizing - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertFileEqualsCanonicalizing(string $expected, string $actual, string $message = ''): void - { - Assert::assertFileEqualsCanonicalizing(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFileEqualsIgnoringCase')) { - /** - * Asserts that the contents of one file is equal to the contents of another - * file (ignoring case). - * - * @see Assert::assertFileEqualsIgnoringCase - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertFileEqualsIgnoringCase(string $expected, string $actual, string $message = ''): void - { - Assert::assertFileEqualsIgnoringCase(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFileNotEquals')) { - /** - * Asserts that the contents of one file is not equal to the contents of - * another file. - * - * @see Assert::assertFileNotEquals - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertFileNotEquals(string $expected, string $actual, string $message = ''): void - { - Assert::assertFileNotEquals(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFileNotEqualsCanonicalizing')) { - /** - * Asserts that the contents of one file is not equal to the contents of another - * file (canonicalizing). - * - * @see Assert::assertFileNotEqualsCanonicalizing - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertFileNotEqualsCanonicalizing(string $expected, string $actual, string $message = ''): void - { - Assert::assertFileNotEqualsCanonicalizing(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFileNotEqualsIgnoringCase')) { - /** - * Asserts that the contents of one file is not equal to the contents of another - * file (ignoring case). - * - * @see Assert::assertFileNotEqualsIgnoringCase - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertFileNotEqualsIgnoringCase(string $expected, string $actual, string $message = ''): void - { - Assert::assertFileNotEqualsIgnoringCase(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringEqualsFile')) { - /** - * Asserts that the contents of a string is equal - * to the contents of a file. - * - * @see Assert::assertStringEqualsFile - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringEqualsFile(string $expectedFile, string $actualString, string $message = ''): void - { - Assert::assertStringEqualsFile(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringEqualsFileCanonicalizing')) { - /** - * Asserts that the contents of a string is equal - * to the contents of a file (canonicalizing). - * - * @see Assert::assertStringEqualsFileCanonicalizing - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message = ''): void - { - Assert::assertStringEqualsFileCanonicalizing(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringEqualsFileIgnoringCase')) { - /** - * Asserts that the contents of a string is equal - * to the contents of a file (ignoring case). - * - * @see Assert::assertStringEqualsFileIgnoringCase - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message = ''): void - { - Assert::assertStringEqualsFileIgnoringCase(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringNotEqualsFile')) { - /** - * Asserts that the contents of a string is not equal - * to the contents of a file. - * - * @see Assert::assertStringNotEqualsFile - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = ''): void - { - Assert::assertStringNotEqualsFile(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringNotEqualsFileCanonicalizing')) { - /** - * Asserts that the contents of a string is not equal - * to the contents of a file (canonicalizing). - * - * @see Assert::assertStringNotEqualsFileCanonicalizing - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringNotEqualsFileCanonicalizing(string $expectedFile, string $actualString, string $message = ''): void - { - Assert::assertStringNotEqualsFileCanonicalizing(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringNotEqualsFileIgnoringCase')) { - /** - * Asserts that the contents of a string is not equal - * to the contents of a file (ignoring case). - * - * @see Assert::assertStringNotEqualsFileIgnoringCase - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringNotEqualsFileIgnoringCase(string $expectedFile, string $actualString, string $message = ''): void - { - Assert::assertStringNotEqualsFileIgnoringCase(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsReadable')) { - /** - * Asserts that a file/dir is readable. - * - * @see Assert::assertIsReadable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertIsReadable(string $filename, string $message = ''): void - { - Assert::assertIsReadable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsNotReadable')) { - /** - * Asserts that a file/dir exists and is not readable. - * - * @see Assert::assertIsNotReadable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertIsNotReadable(string $filename, string $message = ''): void - { - Assert::assertIsNotReadable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotIsReadable')) { - /** - * Asserts that a file/dir exists and is not readable. - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4062 - * @see Assert::assertNotIsReadable - */ - function assertNotIsReadable(string $filename, string $message = ''): void - { - Assert::assertNotIsReadable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsWritable')) { - /** - * Asserts that a file/dir exists and is writable. - * - * @see Assert::assertIsWritable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertIsWritable(string $filename, string $message = ''): void - { - Assert::assertIsWritable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsNotWritable')) { - /** - * Asserts that a file/dir exists and is not writable. - * - * @see Assert::assertIsNotWritable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertIsNotWritable(string $filename, string $message = ''): void - { - Assert::assertIsNotWritable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotIsWritable')) { - /** - * Asserts that a file/dir exists and is not writable. - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4065 - * @see Assert::assertNotIsWritable - */ - function assertNotIsWritable(string $filename, string $message = ''): void - { - Assert::assertNotIsWritable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertDirectoryExists')) { - /** - * Asserts that a directory exists. - * - * @see Assert::assertDirectoryExists - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertDirectoryExists(string $directory, string $message = ''): void - { - Assert::assertDirectoryExists(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertDirectoryDoesNotExist')) { - /** - * Asserts that a directory does not exist. - * - * @see Assert::assertDirectoryDoesNotExist - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertDirectoryDoesNotExist(string $directory, string $message = ''): void - { - Assert::assertDirectoryDoesNotExist(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertDirectoryNotExists')) { - /** - * Asserts that a directory does not exist. - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4068 - * @see Assert::assertDirectoryNotExists - */ - function assertDirectoryNotExists(string $directory, string $message = ''): void - { - Assert::assertDirectoryNotExists(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertDirectoryIsReadable')) { - /** - * Asserts that a directory exists and is readable. - * - * @see Assert::assertDirectoryIsReadable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertDirectoryIsReadable(string $directory, string $message = ''): void - { - Assert::assertDirectoryIsReadable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertDirectoryIsNotReadable')) { - /** - * Asserts that a directory exists and is not readable. - * - * @see Assert::assertDirectoryIsNotReadable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertDirectoryIsNotReadable(string $directory, string $message = ''): void - { - Assert::assertDirectoryIsNotReadable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertDirectoryNotIsReadable')) { - /** - * Asserts that a directory exists and is not readable. - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4071 - * @see Assert::assertDirectoryNotIsReadable - */ - function assertDirectoryNotIsReadable(string $directory, string $message = ''): void - { - Assert::assertDirectoryNotIsReadable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertDirectoryIsWritable')) { - /** - * Asserts that a directory exists and is writable. - * - * @see Assert::assertDirectoryIsWritable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertDirectoryIsWritable(string $directory, string $message = ''): void - { - Assert::assertDirectoryIsWritable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertDirectoryIsNotWritable')) { - /** - * Asserts that a directory exists and is not writable. - * - * @see Assert::assertDirectoryIsNotWritable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertDirectoryIsNotWritable(string $directory, string $message = ''): void - { - Assert::assertDirectoryIsNotWritable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertDirectoryNotIsWritable')) { - /** - * Asserts that a directory exists and is not writable. - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4074 - * @see Assert::assertDirectoryNotIsWritable - */ - function assertDirectoryNotIsWritable(string $directory, string $message = ''): void - { - Assert::assertDirectoryNotIsWritable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFileExists')) { - /** - * Asserts that a file exists. - * - * @see Assert::assertFileExists - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertFileExists(string $filename, string $message = ''): void - { - Assert::assertFileExists(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFileDoesNotExist')) { - /** - * Asserts that a file does not exist. - * - * @see Assert::assertFileDoesNotExist - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertFileDoesNotExist(string $filename, string $message = ''): void - { - Assert::assertFileDoesNotExist(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFileNotExists')) { - /** - * Asserts that a file does not exist. - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4077 - * @see Assert::assertFileNotExists - */ - function assertFileNotExists(string $filename, string $message = ''): void - { - Assert::assertFileNotExists(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFileIsReadable')) { - /** - * Asserts that a file exists and is readable. - * - * @see Assert::assertFileIsReadable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertFileIsReadable(string $file, string $message = ''): void - { - Assert::assertFileIsReadable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFileIsNotReadable')) { - /** - * Asserts that a file exists and is not readable. - * - * @see Assert::assertFileIsNotReadable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertFileIsNotReadable(string $file, string $message = ''): void - { - Assert::assertFileIsNotReadable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFileNotIsReadable')) { - /** - * Asserts that a file exists and is not readable. - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4080 - * @see Assert::assertFileNotIsReadable - */ - function assertFileNotIsReadable(string $file, string $message = ''): void - { - Assert::assertFileNotIsReadable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFileIsWritable')) { - /** - * Asserts that a file exists and is writable. - * - * @see Assert::assertFileIsWritable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertFileIsWritable(string $file, string $message = ''): void - { - Assert::assertFileIsWritable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFileIsNotWritable')) { - /** - * Asserts that a file exists and is not writable. - * - * @see Assert::assertFileIsNotWritable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertFileIsNotWritable(string $file, string $message = ''): void - { - Assert::assertFileIsNotWritable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFileNotIsWritable')) { - /** - * Asserts that a file exists and is not writable. - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4083 - * @see Assert::assertFileNotIsWritable - */ - function assertFileNotIsWritable(string $file, string $message = ''): void - { - Assert::assertFileNotIsWritable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertTrue')) { - /** - * Asserts that a condition is true. - * - * @see Assert::assertTrue - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert true $condition - */ - function assertTrue($condition, string $message = ''): void - { - Assert::assertTrue(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotTrue')) { - /** - * Asserts that a condition is not true. - * - * @see Assert::assertNotTrue - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !true $condition - */ - function assertNotTrue($condition, string $message = ''): void - { - Assert::assertNotTrue(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFalse')) { - /** - * Asserts that a condition is false. - * - * @see Assert::assertFalse - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert false $condition - */ - function assertFalse($condition, string $message = ''): void - { - Assert::assertFalse(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotFalse')) { - /** - * Asserts that a condition is not false. - * - * @see Assert::assertNotFalse - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !false $condition - */ - function assertNotFalse($condition, string $message = ''): void - { - Assert::assertNotFalse(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNull')) { - /** - * Asserts that a variable is null. - * - * @see Assert::assertNull - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert null $actual - */ - function assertNull($actual, string $message = ''): void - { - Assert::assertNull(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotNull')) { - /** - * Asserts that a variable is not null. - * - * @see Assert::assertNotNull - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !null $actual - */ - function assertNotNull($actual, string $message = ''): void - { - Assert::assertNotNull(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertFinite')) { - /** - * Asserts that a variable is finite. - * - * @see Assert::assertFinite - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertFinite($actual, string $message = ''): void - { - Assert::assertFinite(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertInfinite')) { - /** - * Asserts that a variable is infinite. - * - * @see Assert::assertInfinite - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertInfinite($actual, string $message = ''): void - { - Assert::assertInfinite(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNan')) { - /** - * Asserts that a variable is nan. - * - * @see Assert::assertNan - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertNan($actual, string $message = ''): void - { - Assert::assertNan(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertClassHasAttribute')) { - /** - * Asserts that a class has a specified attribute. - * - * @see Assert::assertClassHasAttribute - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertClassHasAttribute(string $attributeName, string $className, string $message = ''): void - { - Assert::assertClassHasAttribute(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertClassNotHasAttribute')) { - /** - * Asserts that a class does not have a specified attribute. - * - * @see Assert::assertClassNotHasAttribute - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertClassNotHasAttribute(string $attributeName, string $className, string $message = ''): void - { - Assert::assertClassNotHasAttribute(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertClassHasStaticAttribute')) { - /** - * Asserts that a class has a specified static attribute. - * - * @see Assert::assertClassHasStaticAttribute - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertClassHasStaticAttribute(string $attributeName, string $className, string $message = ''): void - { - Assert::assertClassHasStaticAttribute(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertClassNotHasStaticAttribute')) { - /** - * Asserts that a class does not have a specified static attribute. - * - * @see Assert::assertClassNotHasStaticAttribute - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = ''): void - { - Assert::assertClassNotHasStaticAttribute(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertObjectHasAttribute')) { - /** - * Asserts that an object has a specified attribute. - * - * @see Assert::assertObjectHasAttribute - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertObjectHasAttribute(string $attributeName, object $object, string $message = ''): void - { - Assert::assertObjectHasAttribute(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertObjectNotHasAttribute')) { - /** - * Asserts that an object does not have a specified attribute. - * - * @see Assert::assertObjectNotHasAttribute - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertObjectNotHasAttribute(string $attributeName, object $object, string $message = ''): void - { - Assert::assertObjectNotHasAttribute(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertSame')) { - /** - * Asserts that two variables have the same type and value. - * Used on objects, it asserts that two variables reference - * the same object. - * - * @see Assert::assertSame - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-template ExpectedType - * @psalm-param ExpectedType $expected - * @psalm-assert =ExpectedType $actual - */ - function assertSame($expected, $actual, string $message = ''): void - { - Assert::assertSame(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotSame')) { - /** - * Asserts that two variables do not have the same type and value. - * Used on objects, it asserts that two variables do not reference - * the same object. - * - * @see Assert::assertNotSame - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertNotSame($expected, $actual, string $message = ''): void - { - Assert::assertNotSame(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertInstanceOf')) { - /** - * Asserts that a variable is of a given type. - * - * @see Assert::assertInstanceOf - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - * - * @psalm-template ExpectedType of object - * @psalm-param class-string $expected - * @psalm-assert ExpectedType $actual - */ - function assertInstanceOf(string $expected, $actual, string $message = ''): void - { - Assert::assertInstanceOf(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotInstanceOf')) { - /** - * Asserts that a variable is not of a given type. - * - * @see Assert::assertNotInstanceOf - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - * - * @psalm-template ExpectedType of object - * @psalm-param class-string $expected - * @psalm-assert !ExpectedType $actual - */ - function assertNotInstanceOf(string $expected, $actual, string $message = ''): void - { - Assert::assertNotInstanceOf(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsArray')) { - /** - * Asserts that a variable is of type array. - * - * @see Assert::assertIsArray - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert array $actual - */ - function assertIsArray($actual, string $message = ''): void - { - Assert::assertIsArray(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsBool')) { - /** - * Asserts that a variable is of type bool. - * - * @see Assert::assertIsBool - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert bool $actual - */ - function assertIsBool($actual, string $message = ''): void - { - Assert::assertIsBool(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsFloat')) { - /** - * Asserts that a variable is of type float. - * - * @see Assert::assertIsFloat - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert float $actual - */ - function assertIsFloat($actual, string $message = ''): void - { - Assert::assertIsFloat(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsInt')) { - /** - * Asserts that a variable is of type int. - * - * @see Assert::assertIsInt - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert int $actual - */ - function assertIsInt($actual, string $message = ''): void - { - Assert::assertIsInt(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsNumeric')) { - /** - * Asserts that a variable is of type numeric. - * - * @see Assert::assertIsNumeric - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert numeric $actual - */ - function assertIsNumeric($actual, string $message = ''): void - { - Assert::assertIsNumeric(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsObject')) { - /** - * Asserts that a variable is of type object. - * - * @see Assert::assertIsObject - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert object $actual - */ - function assertIsObject($actual, string $message = ''): void - { - Assert::assertIsObject(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsResource')) { - /** - * Asserts that a variable is of type resource. - * - * @see Assert::assertIsResource - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert resource $actual - */ - function assertIsResource($actual, string $message = ''): void - { - Assert::assertIsResource(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsClosedResource')) { - /** - * Asserts that a variable is of type resource and is closed. - * - * @see Assert::assertIsClosedResource - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert resource $actual - */ - function assertIsClosedResource($actual, string $message = ''): void - { - Assert::assertIsClosedResource(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsString')) { - /** - * Asserts that a variable is of type string. - * - * @see Assert::assertIsString - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert string $actual - */ - function assertIsString($actual, string $message = ''): void - { - Assert::assertIsString(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsScalar')) { - /** - * Asserts that a variable is of type scalar. - * - * @see Assert::assertIsScalar - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert scalar $actual - */ - function assertIsScalar($actual, string $message = ''): void - { - Assert::assertIsScalar(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsCallable')) { - /** - * Asserts that a variable is of type callable. - * - * @see Assert::assertIsCallable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert callable $actual - */ - function assertIsCallable($actual, string $message = ''): void - { - Assert::assertIsCallable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsIterable')) { - /** - * Asserts that a variable is of type iterable. - * - * @see Assert::assertIsIterable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert iterable $actual - */ - function assertIsIterable($actual, string $message = ''): void - { - Assert::assertIsIterable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsNotArray')) { - /** - * Asserts that a variable is not of type array. - * - * @see Assert::assertIsNotArray - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !array $actual - */ - function assertIsNotArray($actual, string $message = ''): void - { - Assert::assertIsNotArray(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsNotBool')) { - /** - * Asserts that a variable is not of type bool. - * - * @see Assert::assertIsNotBool - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !bool $actual - */ - function assertIsNotBool($actual, string $message = ''): void - { - Assert::assertIsNotBool(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsNotFloat')) { - /** - * Asserts that a variable is not of type float. - * - * @see Assert::assertIsNotFloat - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !float $actual - */ - function assertIsNotFloat($actual, string $message = ''): void - { - Assert::assertIsNotFloat(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsNotInt')) { - /** - * Asserts that a variable is not of type int. - * - * @see Assert::assertIsNotInt - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !int $actual - */ - function assertIsNotInt($actual, string $message = ''): void - { - Assert::assertIsNotInt(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsNotNumeric')) { - /** - * Asserts that a variable is not of type numeric. - * - * @see Assert::assertIsNotNumeric - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !numeric $actual - */ - function assertIsNotNumeric($actual, string $message = ''): void - { - Assert::assertIsNotNumeric(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsNotObject')) { - /** - * Asserts that a variable is not of type object. - * - * @see Assert::assertIsNotObject - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !object $actual - */ - function assertIsNotObject($actual, string $message = ''): void - { - Assert::assertIsNotObject(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsNotResource')) { - /** - * Asserts that a variable is not of type resource. - * - * @see Assert::assertIsNotResource - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !resource $actual - */ - function assertIsNotResource($actual, string $message = ''): void - { - Assert::assertIsNotResource(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsNotClosedResource')) { - /** - * Asserts that a variable is not of type resource. - * - * @see Assert::assertIsNotClosedResource - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !resource $actual - */ - function assertIsNotClosedResource($actual, string $message = ''): void - { - Assert::assertIsNotClosedResource(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsNotString')) { - /** - * Asserts that a variable is not of type string. - * - * @see Assert::assertIsNotString - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !string $actual - */ - function assertIsNotString($actual, string $message = ''): void - { - Assert::assertIsNotString(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsNotScalar')) { - /** - * Asserts that a variable is not of type scalar. - * - * @see Assert::assertIsNotScalar - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !scalar $actual - */ - function assertIsNotScalar($actual, string $message = ''): void - { - Assert::assertIsNotScalar(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsNotCallable')) { - /** - * Asserts that a variable is not of type callable. - * - * @see Assert::assertIsNotCallable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !callable $actual - */ - function assertIsNotCallable($actual, string $message = ''): void - { - Assert::assertIsNotCallable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertIsNotIterable')) { - /** - * Asserts that a variable is not of type iterable. - * - * @see Assert::assertIsNotIterable - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @psalm-assert !iterable $actual - */ - function assertIsNotIterable($actual, string $message = ''): void - { - Assert::assertIsNotIterable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertMatchesRegularExpression')) { - /** - * Asserts that a string matches a given regular expression. - * - * @see Assert::assertMatchesRegularExpression - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void - { - Assert::assertMatchesRegularExpression(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertRegExp')) { - /** - * Asserts that a string matches a given regular expression. - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4086 - * @see Assert::assertRegExp - */ - function assertRegExp(string $pattern, string $string, string $message = ''): void - { - Assert::assertRegExp(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertDoesNotMatchRegularExpression')) { - /** - * Asserts that a string does not match a given regular expression. - * - * @see Assert::assertDoesNotMatchRegularExpression - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertDoesNotMatchRegularExpression(string $pattern, string $string, string $message = ''): void - { - Assert::assertDoesNotMatchRegularExpression(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotRegExp')) { - /** - * Asserts that a string does not match a given regular expression. - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4089 - * @see Assert::assertNotRegExp - */ - function assertNotRegExp(string $pattern, string $string, string $message = ''): void - { - Assert::assertNotRegExp(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertSameSize')) { - /** - * Assert that the size of two arrays (or `Countable` or `Traversable` objects) - * is the same. - * - * @see Assert::assertSameSize - * - * @param Countable|iterable $expected - * @param Countable|iterable $actual - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertSameSize($expected, $actual, string $message = ''): void - { - Assert::assertSameSize(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertNotSameSize')) { - /** - * Assert that the size of two arrays (or `Countable` or `Traversable` objects) - * is not the same. - * - * @see Assert::assertNotSameSize - * - * @param Countable|iterable $expected - * @param Countable|iterable $actual - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertNotSameSize($expected, $actual, string $message = ''): void - { - Assert::assertNotSameSize(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringMatchesFormat')) { - /** - * Asserts that a string matches a given format string. - * - * @see Assert::assertStringMatchesFormat - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringMatchesFormat(string $format, string $string, string $message = ''): void - { - Assert::assertStringMatchesFormat(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringNotMatchesFormat')) { - /** - * Asserts that a string does not match a given format string. - * - * @see Assert::assertStringNotMatchesFormat - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringNotMatchesFormat(string $format, string $string, string $message = ''): void - { - Assert::assertStringNotMatchesFormat(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringMatchesFormatFile')) { - /** - * Asserts that a string matches a given format file. - * - * @see Assert::assertStringMatchesFormatFile - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringMatchesFormatFile(string $formatFile, string $string, string $message = ''): void - { - Assert::assertStringMatchesFormatFile(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringNotMatchesFormatFile')) { - /** - * Asserts that a string does not match a given format string. - * - * @see Assert::assertStringNotMatchesFormatFile - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = ''): void - { - Assert::assertStringNotMatchesFormatFile(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringStartsWith')) { - /** - * Asserts that a string starts with a given prefix. - * - * @see Assert::assertStringStartsWith - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringStartsWith(string $prefix, string $string, string $message = ''): void - { - Assert::assertStringStartsWith(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringStartsNotWith')) { - /** - * Asserts that a string starts not with a given prefix. - * - * @see Assert::assertStringStartsNotWith - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringStartsNotWith(string $prefix, string $string, string $message = ''): void - { - Assert::assertStringStartsNotWith(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringContainsString')) { - /** - * @see Assert::assertStringContainsString - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringContainsString(string $needle, string $haystack, string $message = ''): void - { - Assert::assertStringContainsString(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringContainsStringIgnoringCase')) { - /** - * @see Assert::assertStringContainsStringIgnoringCase - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringContainsStringIgnoringCase(string $needle, string $haystack, string $message = ''): void - { - Assert::assertStringContainsStringIgnoringCase(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringNotContainsString')) { - /** - * @see Assert::assertStringNotContainsString - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringNotContainsString(string $needle, string $haystack, string $message = ''): void - { - Assert::assertStringNotContainsString(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringNotContainsStringIgnoringCase')) { - /** - * @see Assert::assertStringNotContainsStringIgnoringCase - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringNotContainsStringIgnoringCase(string $needle, string $haystack, string $message = ''): void - { - Assert::assertStringNotContainsStringIgnoringCase(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringEndsWith')) { - /** - * Asserts that a string ends with a given suffix. - * - * @see Assert::assertStringEndsWith - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringEndsWith(string $suffix, string $string, string $message = ''): void - { - Assert::assertStringEndsWith(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertStringEndsNotWith')) { - /** - * Asserts that a string ends not with a given suffix. - * - * @see Assert::assertStringEndsNotWith - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertStringEndsNotWith(string $suffix, string $string, string $message = ''): void - { - Assert::assertStringEndsNotWith(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertXmlFileEqualsXmlFile')) { - /** - * Asserts that two XML files are equal. - * - * @see Assert::assertXmlFileEqualsXmlFile - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile, string $message = ''): void - { - Assert::assertXmlFileEqualsXmlFile(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertXmlFileNotEqualsXmlFile')) { - /** - * Asserts that two XML files are not equal. - * - * @see Assert::assertXmlFileNotEqualsXmlFile - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws Exception - */ - function assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile, string $message = ''): void - { - Assert::assertXmlFileNotEqualsXmlFile(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertXmlStringEqualsXmlFile')) { - /** - * Asserts that two XML documents are equal. - * - * @see Assert::assertXmlStringEqualsXmlFile - * - * @param DOMDocument|string $actualXml - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws XmlException - */ - function assertXmlStringEqualsXmlFile(string $expectedFile, $actualXml, string $message = ''): void - { - Assert::assertXmlStringEqualsXmlFile(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertXmlStringNotEqualsXmlFile')) { - /** - * Asserts that two XML documents are not equal. - * - * @see Assert::assertXmlStringNotEqualsXmlFile - * - * @param DOMDocument|string $actualXml - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws XmlException - */ - function assertXmlStringNotEqualsXmlFile(string $expectedFile, $actualXml, string $message = ''): void - { - Assert::assertXmlStringNotEqualsXmlFile(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertXmlStringEqualsXmlString')) { - /** - * Asserts that two XML documents are equal. - * - * @see Assert::assertXmlStringEqualsXmlString - * - * @param DOMDocument|string $expectedXml - * @param DOMDocument|string $actualXml - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws XmlException - */ - function assertXmlStringEqualsXmlString($expectedXml, $actualXml, string $message = ''): void - { - Assert::assertXmlStringEqualsXmlString(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertXmlStringNotEqualsXmlString')) { - /** - * Asserts that two XML documents are not equal. - * - * @see Assert::assertXmlStringNotEqualsXmlString - * - * @param DOMDocument|string $expectedXml - * @param DOMDocument|string $actualXml - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * @throws XmlException - */ - function assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, string $message = ''): void - { - Assert::assertXmlStringNotEqualsXmlString(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertEqualXMLStructure')) { - /** - * Asserts that a hierarchy of DOMElements matches. - * - * @throws AssertionFailedError - * @throws ExpectationFailedException - * @throws InvalidArgumentException - * - * @codeCoverageIgnore - * - * @deprecated https://github.com/sebastianbergmann/phpunit/issues/4091 - * @see Assert::assertEqualXMLStructure - */ - function assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, bool $checkAttributes = false, string $message = ''): void - { - Assert::assertEqualXMLStructure(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertThat')) { - /** - * Evaluates a PHPUnit\Framework\Constraint matcher object. - * - * @see Assert::assertThat - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertThat($value, Constraint $constraint, string $message = ''): void - { - Assert::assertThat(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertJson')) { - /** - * Asserts that a string is a valid JSON string. - * - * @see Assert::assertJson - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertJson(string $actualJson, string $message = ''): void - { - Assert::assertJson(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertJsonStringEqualsJsonString')) { - /** - * Asserts that two given JSON encoded objects or arrays are equal. - * - * @see Assert::assertJsonStringEqualsJsonString - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson, string $message = ''): void - { - Assert::assertJsonStringEqualsJsonString(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertJsonStringNotEqualsJsonString')) { - /** - * Asserts that two given JSON encoded objects or arrays are not equal. - * - * @see Assert::assertJsonStringNotEqualsJsonString - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertJsonStringNotEqualsJsonString(string $expectedJson, string $actualJson, string $message = ''): void - { - Assert::assertJsonStringNotEqualsJsonString(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertJsonStringEqualsJsonFile')) { - /** - * Asserts that the generated JSON encoded object and the content of the given file are equal. - * - * @see Assert::assertJsonStringEqualsJsonFile - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson, string $message = ''): void - { - Assert::assertJsonStringEqualsJsonFile(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertJsonStringNotEqualsJsonFile')) { - /** - * Asserts that the generated JSON encoded object and the content of the given file are not equal. - * - * @see Assert::assertJsonStringNotEqualsJsonFile - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson, string $message = ''): void - { - Assert::assertJsonStringNotEqualsJsonFile(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertJsonFileEqualsJsonFile')) { - /** - * Asserts that two JSON files are equal. - * - * @see Assert::assertJsonFileEqualsJsonFile - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile, string $message = ''): void - { - Assert::assertJsonFileEqualsJsonFile(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\assertJsonFileNotEqualsJsonFile')) { - /** - * Asserts that two JSON files are not equal. - * - * @see Assert::assertJsonFileNotEqualsJsonFile - * - * @throws ExpectationFailedException - * @throws InvalidArgumentException - */ - function assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile, string $message = ''): void - { - Assert::assertJsonFileNotEqualsJsonFile(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\logicalAnd')) { - function logicalAnd(): LogicalAnd - { - return Assert::logicalAnd(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\logicalOr')) { - function logicalOr(): LogicalOr - { - return Assert::logicalOr(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\logicalNot')) { - function logicalNot(Constraint $constraint): LogicalNot - { - return Assert::logicalNot(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\logicalXor')) { - function logicalXor(): LogicalXor - { - return Assert::logicalXor(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\anything')) { - function anything(): IsAnything - { - return Assert::anything(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\isTrue')) { - function isTrue(): IsTrue - { - return Assert::isTrue(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\callback')) { - function callback(callable $callback): Callback - { - return Assert::callback(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\isFalse')) { - function isFalse(): IsFalse - { - return Assert::isFalse(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\isJson')) { - function isJson(): IsJson - { - return Assert::isJson(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\isNull')) { - function isNull(): IsNull - { - return Assert::isNull(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\isFinite')) { - function isFinite(): IsFinite - { - return Assert::isFinite(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\isInfinite')) { - function isInfinite(): IsInfinite - { - return Assert::isInfinite(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\isNan')) { - function isNan(): IsNan - { - return Assert::isNan(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\containsEqual')) { - function containsEqual($value): TraversableContainsEqual - { - return Assert::containsEqual(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\containsIdentical')) { - function containsIdentical($value): TraversableContainsIdentical - { - return Assert::containsIdentical(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\containsOnly')) { - function containsOnly(string $type): TraversableContainsOnly - { - return Assert::containsOnly(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\containsOnlyInstancesOf')) { - function containsOnlyInstancesOf(string $className): TraversableContainsOnly - { - return Assert::containsOnlyInstancesOf(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\arrayHasKey')) { - function arrayHasKey($key): ArrayHasKey - { - return Assert::arrayHasKey(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\equalTo')) { - function equalTo($value): IsEqual - { - return Assert::equalTo(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\equalToCanonicalizing')) { - function equalToCanonicalizing($value): IsEqualCanonicalizing - { - return Assert::equalToCanonicalizing(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\equalToIgnoringCase')) { - function equalToIgnoringCase($value): IsEqualIgnoringCase - { - return Assert::equalToIgnoringCase(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\equalToWithDelta')) { - function equalToWithDelta($value, float $delta): IsEqualWithDelta - { - return Assert::equalToWithDelta(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\isEmpty')) { - function isEmpty(): IsEmpty - { - return Assert::isEmpty(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\isWritable')) { - function isWritable(): IsWritable - { - return Assert::isWritable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\isReadable')) { - function isReadable(): IsReadable - { - return Assert::isReadable(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\directoryExists')) { - function directoryExists(): DirectoryExists - { - return Assert::directoryExists(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\fileExists')) { - function fileExists(): FileExists - { - return Assert::fileExists(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\greaterThan')) { - function greaterThan($value): GreaterThan - { - return Assert::greaterThan(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\greaterThanOrEqual')) { - function greaterThanOrEqual($value): LogicalOr - { - return Assert::greaterThanOrEqual(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\classHasAttribute')) { - function classHasAttribute(string $attributeName): ClassHasAttribute - { - return Assert::classHasAttribute(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\classHasStaticAttribute')) { - function classHasStaticAttribute(string $attributeName): ClassHasStaticAttribute - { - return Assert::classHasStaticAttribute(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\objectHasAttribute')) { - function objectHasAttribute($attributeName): ObjectHasAttribute - { - return Assert::objectHasAttribute(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\identicalTo')) { - function identicalTo($value): IsIdentical - { - return Assert::identicalTo(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\isInstanceOf')) { - function isInstanceOf(string $className): IsInstanceOf - { - return Assert::isInstanceOf(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\isType')) { - function isType(string $type): IsType - { - return Assert::isType(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\lessThan')) { - function lessThan($value): LessThan - { - return Assert::lessThan(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\lessThanOrEqual')) { - function lessThanOrEqual($value): LogicalOr - { - return Assert::lessThanOrEqual(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\matchesRegularExpression')) { - function matchesRegularExpression(string $pattern): RegularExpression - { - return Assert::matchesRegularExpression(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\matches')) { - function matches(string $string): StringMatchesFormatDescription - { - return Assert::matches(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\stringStartsWith')) { - function stringStartsWith($prefix): StringStartsWith - { - return Assert::stringStartsWith(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\stringContains')) { - function stringContains(string $string, bool $case = true): StringContains - { - return Assert::stringContains(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\stringEndsWith')) { - function stringEndsWith(string $suffix): StringEndsWith - { - return Assert::stringEndsWith(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\countOf')) { - function countOf(int $count): Count - { - return Assert::countOf(...func_get_args()); - } -} - -if (! function_exists('PHPUnit\Framework\any')) { - /** - * Returns a matcher that matches when the method is executed - * zero or more times. - */ - function any(): AnyInvokedCountMatcher - { - return new AnyInvokedCountMatcher(); - } -} - -if (! function_exists('PHPUnit\Framework\never')) { - /** - * Returns a matcher that matches when the method is never executed. - */ - function never(): InvokedCountMatcher - { - return new InvokedCountMatcher(0); - } -} - -if (! function_exists('PHPUnit\Framework\atLeast')) { - /** - * Returns a matcher that matches when the method is executed - * at least N times. - */ - function atLeast(int $requiredInvocations): InvokedAtLeastCountMatcher - { - return new InvokedAtLeastCountMatcher( - $requiredInvocations, - ); - } -} - -if (! function_exists('PHPUnit\Framework\atLeastOnce')) { - /** - * Returns a matcher that matches when the method is executed at least once. - */ - function atLeastOnce(): InvokedAtLeastOnceMatcher - { - return new InvokedAtLeastOnceMatcher(); - } -} - -if (! function_exists('PHPUnit\Framework\once')) { - /** - * Returns a matcher that matches when the method is executed exactly once. - */ - function once(): InvokedCountMatcher - { - return new InvokedCountMatcher(1); - } -} - -if (! function_exists('PHPUnit\Framework\exactly')) { - /** - * Returns a matcher that matches when the method is executed - * exactly $count times. - */ - function exactly(int $count): InvokedCountMatcher - { - return new InvokedCountMatcher($count); - } -} - -if (! function_exists('PHPUnit\Framework\atMost')) { - /** - * Returns a matcher that matches when the method is executed - * at most N times. - */ - function atMost(int $allowedInvocations): InvokedAtMostCountMatcher - { - return new InvokedAtMostCountMatcher($allowedInvocations); - } -} - -if (! function_exists('PHPUnit\Framework\at')) { - /** - * Returns a matcher that matches when the method is executed - * at the given index. - */ - function at(int $index): InvokedAtIndexMatcher - { - return new InvokedAtIndexMatcher($index); - } -} - -if (! function_exists('PHPUnit\Framework\returnValue')) { - function returnValue($value): ReturnStub - { - return new ReturnStub($value); - } -} - -if (! function_exists('PHPUnit\Framework\returnValueMap')) { - function returnValueMap(array $valueMap): ReturnValueMapStub - { - return new ReturnValueMapStub($valueMap); - } -} - -if (! function_exists('PHPUnit\Framework\returnArgument')) { - function returnArgument(int $argumentIndex): ReturnArgumentStub - { - return new ReturnArgumentStub($argumentIndex); - } -} - -if (! function_exists('PHPUnit\Framework\returnCallback')) { - function returnCallback($callback): ReturnCallbackStub - { - return new ReturnCallbackStub($callback); - } -} - -if (! function_exists('PHPUnit\Framework\returnSelf')) { - /** - * Returns the current object. - * - * This method is useful when mocking a fluent interface. - */ - function returnSelf(): ReturnSelfStub - { - return new ReturnSelfStub(); - } -} - -if (! function_exists('PHPUnit\Framework\throwException')) { - function throwException(Throwable $exception): ExceptionStub - { - return new ExceptionStub($exception); - } -} - -if (! function_exists('PHPUnit\Framework\onConsecutiveCalls')) { - function onConsecutiveCalls(): ConsecutiveCallsStub - { - $args = func_get_args(); - - return new ConsecutiveCallsStub($args); - } -} diff --git a/tests/PedantryTest.php b/tests/PedantryTest.php index 29df17a19..4a5cd7096 100644 --- a/tests/PedantryTest.php +++ b/tests/PedantryTest.php @@ -2,6 +2,8 @@ namespace MongoDB\Tests; +use MongoDB; +use PHPUnit\Framework\Attributes\DataProvider; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; use ReflectionClass; @@ -10,6 +12,8 @@ use function array_filter; use function array_map; +use function array_values; +use function in_array; use function realpath; use function str_contains; use function str_replace; @@ -25,17 +29,23 @@ */ class PedantryTest extends TestCase { - /** @dataProvider provideProjectClassNames */ + private const SKIPPED_CLASSES = [ + // Generated + MongoDB\Builder\Stage\FluentFactoryTrait::class, + ]; + + #[DataProvider('provideProjectClassNames')] public function testMethodsAreOrderedAlphabeticallyByVisibility($className): void { $class = new ReflectionClass($className); $methods = $class->getMethods(); - $methods = array_filter( + $methods = array_values(array_filter( $methods, fn (ReflectionMethod $method) => $method->getDeclaringClass() == $class // Exclude inherited methods - && $method->getFileName() === $class->getFileName(), // Exclude methods inherited from traits - ); + && $method->getFileName() === $class->getFileName() // Exclude methods inherited from traits + && ! ($method->isConstructor() && ! $method->isPublic()), // Exclude non-public constructors + )); $getSortValue = function (ReflectionMethod $method) { $prefix = $method->isPrivate() ? '2' : ($method->isProtected() ? '1' : '0'); @@ -56,7 +66,7 @@ public function testMethodsAreOrderedAlphabeticallyByVisibility($className): voi $this->assertEquals($sortedMethods, $methods); } - public function provideProjectClassNames() + public static function provideProjectClassNames() { $classNames = []; $srcDir = realpath(__DIR__ . '/../src/'); @@ -74,6 +84,10 @@ public function provideProjectClassNames() } $className = 'MongoDB\\' . str_replace(DIRECTORY_SEPARATOR, '\\', substr($file->getRealPath(), strlen($srcDir) + 1, -4)); + if (in_array($className, self::SKIPPED_CLASSES)) { + continue; + } + $classNames[$className][] = $className; } diff --git a/tests/PsrLogAdapterTest.php b/tests/PsrLogAdapterTest.php index 5e945dd62..1907b8532 100644 --- a/tests/PsrLogAdapterTest.php +++ b/tests/PsrLogAdapterTest.php @@ -5,6 +5,7 @@ use MongoDB\Driver\Monitoring\LogSubscriber; use MongoDB\Exception\UnexpectedValueException; use MongoDB\PsrLogAdapter; +use PHPUnit\Framework\Attributes\TestWith; use PHPUnit\Framework\TestCase as BaseTestCase; use Psr\Log\AbstractLogger; use Psr\Log\LoggerInterface; @@ -84,10 +85,8 @@ public function testLog(): void $this->assertSame($expectedLogs, $this->logger->logs); } - /** - * @testWith [-1] - * [9] - */ + #[TestWith([-1])] + #[TestWith([9])] public function testWriteLogWithInvalidLevel(int $level): void { $this->expectException(UnexpectedValueException::class); diff --git a/tests/SpecTests/AtlasDataLakeSpecTest.php b/tests/SpecTests/AtlasDataLakeSpecTest.php deleted file mode 100644 index 15f45434c..000000000 --- a/tests/SpecTests/AtlasDataLakeSpecTest.php +++ /dev/null @@ -1,139 +0,0 @@ -isAtlasDataLake()) { - $this->markTestSkipped('Server is not Atlas Data Lake'); - } - } - - /** - * Prose test 1: killCursors command - */ - public function testKillCursors(): void - { - $cursorId = null; - $cursorNamespace = null; - - (new CommandObserver())->observe( - function (): void { - $client = static::createTestClient(); - $client->test->driverdata->find([], ['batchSize' => 2, 'limit' => 3]); - }, - function (array $event) use (&$cursorId, &$cursorNamespace): void { - if ($event['started']->getCommandName() === 'find') { - $this->assertArrayHasKey('succeeded', $event); - - $reply = $event['succeeded']->getReply(); - $this->assertObjectHasAttribute('cursor', $reply); - $this->assertIsObject($reply->cursor); - $this->assertObjectHasAttribute('id', $reply->cursor); - $this->assertIsInt($reply->cursor->id); - $this->assertObjectHasAttribute('ns', $reply->cursor); - $this->assertIsString($reply->cursor->ns); - - /* Note: MongoDB\Driver\CursorId is not used here; however, - * we shouldn't have to worry about encoutnering a 64-bit - * cursor IDs on a 32-bit platform mongohoused allocates IDs - * sequentially (starting from 1). */ - $cursorId = $reply->cursor->id; - $cursorNamespace = $reply->cursor->ns; - - return; - } - - /* After the initial find command, expect that killCursors is - * next and that a cursor ID and namespace were collected. */ - $this->assertSame('killCursors', $event['started']->getCommandName()); - $this->assertIsInt($cursorId); - $this->assertIsString($cursorNamespace); - - [$databaseName, $collectionName] = explode('.', $cursorNamespace, 2); - $command = $event['started']->getCommand(); - - /* Assert that the killCursors command uses the namespace and - * cursor ID from the find command reply. */ - $this->assertSame($databaseName, $event['started']->getDatabaseName()); - $this->assertSame($databaseName, $command->{'$db'}); - $this->assertObjectHasAttribute('killCursors', $command); - $this->assertSame($collectionName, $command->killCursors); - $this->assertObjectHasAttribute('cursors', $command); - $this->assertIsArray($command->cursors); - $this->assertArrayHasKey(0, $command->cursors); - $this->assertSame($cursorId, $command->cursors[0]); - - /* Assert that the killCursors command reply indicates that the - * expected cursor ID was killed. */ - $reply = $event['succeeded']->getReply(); - $this->assertObjectHasAttribute('cursorsKilled', $reply); - $this->assertIsArray($reply->cursorsKilled); - $this->assertArrayHasKey(0, $reply->cursorsKilled); - $this->assertSame($cursorId, $reply->cursorsKilled[0]); - }, - ); - } - - /** - * Prose test 2: Connect without authentication - */ - public function testConnectWithoutAuth(): void - { - /* Parse URI to remove userinfo component. The query string is left - * as-is and must not include authMechanism or credentials. */ - $parts = parse_url(static::getUri()); - $port = isset($parts['port']) ? ':' . $parts['port'] : ''; - $path = $parts['path'] ?? '/'; - $query = isset($parts['query']) ? '?' . $parts['query'] : ''; - - $uri = $parts['scheme'] . '://' . $parts['host'] . $port . $path . $query; - - $client = static::createTestClient($uri); - $cursor = $client->selectDatabase($this->getDatabaseName())->command(['ping' => 1]); - - $this->assertInstanceOf(Cursor::class, $cursor); - $this->assertCommandSucceeded(current($cursor->toArray())); - } - - /** - * Prose test 3: Connect with SCRAM-SHA-1 authentication - */ - public function testConnectwithSCRAMSHA1(): void - { - $client = static::createTestClient(null, ['authMechanism' => 'SCRAM-SHA-1']); - $cursor = $client->selectDatabase($this->getDatabaseName())->command(['ping' => 1]); - - $this->assertInstanceOf(Cursor::class, $cursor); - $this->assertCommandSucceeded(current($cursor->toArray())); - } - - /** - * Prose test 4: Connect with SCRAM-SHA-256 authentication - */ - public function testConnectwithSCRAMSHA256(): void - { - $client = static::createTestClient(null, ['authMechanism' => 'SCRAM-SHA-256']); - $cursor = $client->selectDatabase($this->getDatabaseName())->command(['ping' => 1]); - - $this->assertInstanceOf(Cursor::class, $cursor); - $this->assertCommandSucceeded(current($cursor->toArray())); - } -} diff --git a/tests/SpecTests/ClientSideEncryption/FunctionalTestCase.php b/tests/SpecTests/ClientSideEncryption/FunctionalTestCase.php index 8290e8e8b..58c2aa24d 100644 --- a/tests/SpecTests/ClientSideEncryption/FunctionalTestCase.php +++ b/tests/SpecTests/ClientSideEncryption/FunctionalTestCase.php @@ -25,19 +25,6 @@ public function setUp(): void parent::setUp(); $this->skipIfClientSideEncryptionIsNotSupported(); - - if (! static::isCryptSharedLibAvailable() && ! static::isMongocryptdAvailable()) { - $this->markTestSkipped('Neither crypt_shared nor mongocryptd are available'); - } - } - - public static function createTestClient(?string $uri = null, array $options = [], array $driverOptions = []): Client - { - if (isset($driverOptions['autoEncryption']) && getenv('CRYPT_SHARED_LIB_PATH')) { - $driverOptions['autoEncryption']['extraOptions']['cryptSharedLibPath'] = getenv('CRYPT_SHARED_LIB_PATH'); - } - - return parent::createTestClient($uri, $options, $driverOptions); } protected static function getAWSCredentials(): array diff --git a/tests/SpecTests/ClientSideEncryption/Prose21_AutomaticDataEncryptionKeysTest.php b/tests/SpecTests/ClientSideEncryption/Prose21_AutomaticDataEncryptionKeysTest.php index ddea08972..ee4d61b1a 100644 --- a/tests/SpecTests/ClientSideEncryption/Prose21_AutomaticDataEncryptionKeysTest.php +++ b/tests/SpecTests/ClientSideEncryption/Prose21_AutomaticDataEncryptionKeysTest.php @@ -10,6 +10,8 @@ use MongoDB\Driver\Exception\CommandException; use MongoDB\Exception\CreateEncryptedCollectionException; use MongoDB\Exception\InvalidArgumentException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use function base64_decode; @@ -17,9 +19,8 @@ * Prose test 21: Automatic Data Encryption Keys * * @see https://github.com/mongodb/specifications/tree/master/source/client-side-encryption/tests#automatic-data-encryption-keys - * @group csfle - * @group serverless */ +#[Group('csfle')] class Prose21_AutomaticDataEncryptionKeysTest extends FunctionalTestCase { public const SERVER_ERROR_TYPEMISMATCH = 14; @@ -63,13 +64,11 @@ public function tearDown(): void $this->database = null; } - /** - * @see https://github.com/mongodb/specifications/blob/bc37892f360cab9df4082922384e0f4d4233f6d3/source/client-side-encryption/tests/README.rst#case-1-simple-creation-and-validation - * @dataProvider provideKmsProviderAndMasterKey - */ + /** @see https://github.com/mongodb/specifications/blob/bc37892f360cab9df4082922384e0f4d4233f6d3/source/client-side-encryption/tests/README.rst#case-1-simple-creation-and-validation */ + #[DataProvider('provideKmsProviderAndMasterKey')] public function testCase1_SimpleCreationAndValidation(string $kmsProvider, ?array $masterKey): void { - [$result, $encryptedFields] = $this->database->createEncryptedCollection( + $encryptedFields = $this->database->createEncryptedCollection( $this->getCollectionName(), $this->clientEncryption, $kmsProvider, @@ -77,7 +76,6 @@ public function testCase1_SimpleCreationAndValidation(string $kmsProvider, ?arra ['encryptedFields' => ['fields' => [['path' => 'ssn', 'bsonType' => 'string', 'keyId' => null]]]], ); - $this->assertCommandSucceeded($result); $this->assertInstanceOf(Binary::class, $encryptedFields['fields'][0]['keyId'] ?? null); $this->expectException(BulkWriteException::class); @@ -98,10 +96,8 @@ public static function provideKmsProviderAndMasterKey(): Generator ]; } - /** - * @see https://github.com/mongodb/specifications/blob/bc37892f360cab9df4082922384e0f4d4233f6d3/source/client-side-encryption/tests/README.rst#case-2-missing-encryptedfields - * @dataProvider provideKmsProviderAndMasterKey - */ + /** @see https://github.com/mongodb/specifications/blob/bc37892f360cab9df4082922384e0f4d4233f6d3/source/client-side-encryption/tests/README.rst#case-2-missing-encryptedfields */ + #[DataProvider('provideKmsProviderAndMasterKey')] public function testCase2_MissingEncryptedFields(string $kmsProvider, ?array $masterKey): void { $this->expectException(InvalidArgumentException::class); @@ -115,10 +111,8 @@ public function testCase2_MissingEncryptedFields(string $kmsProvider, ?array $ma ); } - /** - * @see https://github.com/mongodb/specifications/blob/bc37892f360cab9df4082922384e0f4d4233f6d3/source/client-side-encryption/tests/README.rst#case-3-invalid-keyid - * @dataProvider provideKmsProviderAndMasterKey - */ + /** @see https://github.com/mongodb/specifications/blob/bc37892f360cab9df4082922384e0f4d4233f6d3/source/client-side-encryption/tests/README.rst#case-3-invalid-keyid */ + #[DataProvider('provideKmsProviderAndMasterKey')] public function testCase3_InvalidKeyId(string $kmsProvider, ?array $masterKey): void { try { @@ -140,13 +134,11 @@ public function testCase3_InvalidKeyId(string $kmsProvider, ?array $masterKey): } } - /** - * @see https://github.com/mongodb/specifications/blob/bc37892f360cab9df4082922384e0f4d4233f6d3/source/client-side-encryption/tests/README.rst#case-4-insert-encrypted-value - * @dataProvider provideKmsProviderAndMasterKey - */ + /** @see https://github.com/mongodb/specifications/blob/bc37892f360cab9df4082922384e0f4d4233f6d3/source/client-side-encryption/tests/README.rst#case-4-insert-encrypted-value */ + #[DataProvider('provideKmsProviderAndMasterKey')] public function testCase4_InsertEncryptedValue(string $kmsProvider, ?array $masterKey): void { - [$result, $encryptedFields] = $this->database->createEncryptedCollection( + $encryptedFields = $this->database->createEncryptedCollection( $this->getCollectionName(), $this->clientEncryption, $kmsProvider, @@ -154,7 +146,6 @@ public function testCase4_InsertEncryptedValue(string $kmsProvider, ?array $mast ['encryptedFields' => ['fields' => [['path' => 'ssn', 'bsonType' => 'string', 'keyId' => null]]]], ); - $this->assertCommandSucceeded($result); $this->assertInstanceOf(Binary::class, $encryptedFields['fields'][0]['keyId'] ?? null); $encrypted = $this->clientEncryption->encrypt('123-45-6789', [ diff --git a/tests/SpecTests/ClientSideEncryption/Prose22_RangeExplicitEncryptionTest.php b/tests/SpecTests/ClientSideEncryption/Prose22_RangeExplicitEncryptionTest.php index aebfa6303..fc8da6446 100644 --- a/tests/SpecTests/ClientSideEncryption/Prose22_RangeExplicitEncryptionTest.php +++ b/tests/SpecTests/ClientSideEncryption/Prose22_RangeExplicitEncryptionTest.php @@ -5,6 +5,7 @@ use ArrayIterator; use Generator; use Iterator; +use LogicException; use MongoDB\BSON\Binary; use MongoDB\BSON\Decimal128; use MongoDB\BSON\Document; @@ -15,21 +16,20 @@ use MongoDB\Driver\ClientEncryption; use MongoDB\Driver\Exception\EncryptionException; use MultipleIterator; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use function base64_decode; use function file_get_contents; use function get_debug_type; use function is_int; -use function phpversion; -use function version_compare; /** * Prose test 22: Range Explicit Encryption * * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#22-range-explicit-encryption - * @group csfle - * @group serverless */ +#[Group('csfle')] class Prose22_RangeExplicitEncryptionTest extends FunctionalTestCase { private ?ClientEncryption $clientEncryption = null; @@ -37,14 +37,12 @@ class Prose22_RangeExplicitEncryptionTest extends FunctionalTestCase private ?Client $encryptedClient = null; private $key1Id; + private static string $specDir = __DIR__ . '/../../specifications/source/client-side-encryption'; + public function setUp(): void { parent::setUp(); - if (version_compare(phpversion('mongodb'), '1.20.0dev', '>=')) { - $this->markTestIncomplete('Range protocol V1 is not supported by ext-mongodb 1.20+'); - } - if ($this->isStandalone()) { $this->markTestSkipped('Range explicit encryption tests require replica sets'); } @@ -53,7 +51,7 @@ public function setUp(): void $client = static::createTestClient(); - $key1Document = $this->decodeJson(file_get_contents(__DIR__ . '/../client-side-encryption/etc/data/keys/key1-document.json')); + $key1Document = $this->decodeJson(file_get_contents(self::$specDir . '/etc/data/keys/key1-document.json')); $this->key1Id = $key1Document->_id; // Drop the key vault collection and insert key1Document with a majority write concern @@ -88,7 +86,7 @@ public function setUpWithTypeAndRangeOpts(string $type, array $rangeOpts): void * for 64-bit integers. This means that DropEncryptedCollection and * CreateEncryptedCollection will be unable to inspect the option for * metadata collection names, but that's not necessary for the test. */ - $encryptedFields = Document::fromJSON(file_get_contents(__DIR__ . '/../client-side-encryption/etc/data/range-encryptedFields-' . $type . '.json')); + $encryptedFields = Document::fromJSON(file_get_contents(self::$specDir . '/etc/data/range-encryptedFields-' . $type . '.json')); $database = $this->encryptedClient->selectDatabase($this->getDatabaseName()); $database->dropCollection('explicit_encryption', ['encryptedFields' => $encryptedFields]); @@ -102,14 +100,13 @@ public function setUpWithTypeAndRangeOpts(string $type, array $rangeOpts): void 'rangeOpts' => $rangeOpts, ]; - $cast = self::getCastCallableForType($type); $fieldName = 'encrypted' . $type; $this->collection->insertMany([ - ['_id' => 0, $fieldName => $this->clientEncryption->encrypt($cast(0), $encryptOpts)], - ['_id' => 1, $fieldName => $this->clientEncryption->encrypt($cast(6), $encryptOpts)], - ['_id' => 2, $fieldName => $this->clientEncryption->encrypt($cast(30), $encryptOpts)], - ['_id' => 3, $fieldName => $this->clientEncryption->encrypt($cast(200), $encryptOpts)], + ['_id' => 0, $fieldName => $this->clientEncryption->encrypt(self::cast($type, 0), $encryptOpts)], + ['_id' => 1, $fieldName => $this->clientEncryption->encrypt(self::cast($type, 6), $encryptOpts)], + ['_id' => 2, $fieldName => $this->clientEncryption->encrypt(self::cast($type, 30), $encryptOpts)], + ['_id' => 3, $fieldName => $this->clientEncryption->encrypt(self::cast($type, 200), $encryptOpts)], ]); } @@ -184,10 +181,8 @@ public static function provideTypeAndRangeOpts(): Generator ]; } - /** - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-1-can-decrypt-a-payload - * @dataProvider provideTypeAndRangeOpts - */ + /** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-1-can-decrypt-a-payload */ + #[DataProvider('provideTypeAndRangeOpts')] public function testCase1_CanDecryptAPayload(string $type, array $rangeOpts): void { $this->setUpWithTypeAndRangeOpts($type, $rangeOpts); @@ -199,8 +194,7 @@ public function testCase1_CanDecryptAPayload(string $type, array $rangeOpts): vo 'rangeOpts' => $rangeOpts, ]; - $cast = self::getCastCallableForType($type); - $originalValue = $cast(6); + $originalValue = self::cast($type, 6); $insertPayload = $this->clientEncryption->encrypt($originalValue, $encryptOpts); $decryptedValue = $this->clientEncryption->decrypt($insertPayload); @@ -208,7 +202,7 @@ public function testCase1_CanDecryptAPayload(string $type, array $rangeOpts): vo /* Decryption of a 64-bit integer will likely result in a scalar int, so * cast it back to an Int64 before comparing to the original value. */ if ($type === 'Long' && is_int($decryptedValue)) { - $decryptedValue = $cast($decryptedValue); + $decryptedValue = self::cast($type, $decryptedValue); } /* Use separate assertions for type and equality as assertSame isn't @@ -218,10 +212,8 @@ public function testCase1_CanDecryptAPayload(string $type, array $rangeOpts): vo $this->assertEquals($originalValue, $decryptedValue); } - /** - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-2-can-find-encrypted-range-and-return-the-maximum - * @dataProvider provideTypeAndRangeOpts - */ + /** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-2-can-find-encrypted-range-and-return-the-maximum */ + #[DataProvider('provideTypeAndRangeOpts')] public function testCase2_CanFindEncryptedRangeAndReturnTheMaximum(string $type, array $rangeOpts): void { $this->setUpWithTypeAndRangeOpts($type, $rangeOpts); @@ -234,13 +226,12 @@ public function testCase2_CanFindEncryptedRangeAndReturnTheMaximum(string $type, 'rangeOpts' => $rangeOpts, ]; - $cast = self::getCastCallableForType($type); $fieldName = 'encrypted' . $type; $expr = [ '$and' => [ - [$fieldName => ['$gte' => $cast(6)]], - [$fieldName => ['$lte' => $cast(200)]], + [$fieldName => ['$gte' => self::cast($type, 6)]], + [$fieldName => ['$lte' => self::cast($type, 200)]], ], ]; @@ -248,18 +239,16 @@ public function testCase2_CanFindEncryptedRangeAndReturnTheMaximum(string $type, $cursor = $this->collection->find($encryptedExpr, ['sort' => ['_id' => 1]]); $expectedDocuments = [ - ['_id' => 1, $fieldName => $cast(6)], - ['_id' => 2, $fieldName => $cast(30)], - ['_id' => 3, $fieldName => $cast(200)], + ['_id' => 1, $fieldName => self::cast($type, 6)], + ['_id' => 2, $fieldName => self::cast($type, 30)], + ['_id' => 3, $fieldName => self::cast($type, 200)], ]; $this->assertMultipleDocumentsMatch($expectedDocuments, $cursor); } - /** - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-3-can-find-encrypted-range-and-return-the-minimum - * @dataProvider provideTypeAndRangeOpts - */ + /** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-3-can-find-encrypted-range-and-return-the-minimum */ + #[DataProvider('provideTypeAndRangeOpts')] public function testCase3_CanFindEncryptedRangeAndReturnTheMinimum(string $type, array $rangeOpts): void { $this->setUpWithTypeAndRangeOpts($type, $rangeOpts); @@ -272,13 +261,12 @@ public function testCase3_CanFindEncryptedRangeAndReturnTheMinimum(string $type, 'rangeOpts' => $rangeOpts, ]; - $cast = self::getCastCallableForType($type); $fieldName = 'encrypted' . $type; $expr = [ '$and' => [ - [$fieldName => ['$gte' => $cast(0)]], - [$fieldName => ['$lte' => $cast(6)]], + [$fieldName => ['$gte' => self::cast($type, 0)]], + [$fieldName => ['$lte' => self::cast($type, 6)]], ], ]; @@ -286,17 +274,15 @@ public function testCase3_CanFindEncryptedRangeAndReturnTheMinimum(string $type, $cursor = $this->collection->find($encryptedExpr, ['sort' => ['_id' => 1]]); $expectedDocuments = [ - ['_id' => 0, $fieldName => $cast(0)], - ['_id' => 1, $fieldName => $cast(6)], + ['_id' => 0, $fieldName => self::cast($type, 0)], + ['_id' => 1, $fieldName => self::cast($type, 6)], ]; $this->assertMultipleDocumentsMatch($expectedDocuments, $cursor); } - /** - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-4-can-find-encrypted-range-with-an-open-range-query - * @dataProvider provideTypeAndRangeOpts - */ + /** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-4-can-find-encrypted-range-with-an-open-range-query */ + #[DataProvider('provideTypeAndRangeOpts')] public function testCase4_CanFindEncryptedRangeWithAnOpenRangeQuery(string $type, array $rangeOpts): void { $this->setUpWithTypeAndRangeOpts($type, $rangeOpts); @@ -309,22 +295,19 @@ public function testCase4_CanFindEncryptedRangeWithAnOpenRangeQuery(string $type 'rangeOpts' => $rangeOpts, ]; - $cast = self::getCastCallableForType($type); $fieldName = 'encrypted' . $type; - $expr = ['$and' => [[$fieldName => ['$gt' => $cast(30)]]]]; + $expr = ['$and' => [[$fieldName => ['$gt' => self::cast($type, 30)]]]]; $encryptedExpr = $this->clientEncryption->encryptExpression($expr, $encryptOpts); $cursor = $this->collection->find($encryptedExpr, ['sort' => ['_id' => 1]]); - $expectedDocuments = [['_id' => 3, $fieldName => $cast(200)]]; + $expectedDocuments = [['_id' => 3, $fieldName => self::cast($type, 200)]]; $this->assertMultipleDocumentsMatch($expectedDocuments, $cursor); } - /** - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-5-can-run-an-aggregation-expression-inside-expr - * @dataProvider provideTypeAndRangeOpts - */ + /** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-5-can-run-an-aggregation-expression-inside-expr */ + #[DataProvider('provideTypeAndRangeOpts')] public function testCase5_CanRunAnAggregationExpressionInsideExpr(string $type, array $rangeOpts): void { $this->setUpWithTypeAndRangeOpts($type, $rangeOpts); @@ -337,27 +320,24 @@ public function testCase5_CanRunAnAggregationExpressionInsideExpr(string $type, 'rangeOpts' => $rangeOpts, ]; - $cast = self::getCastCallableForType($type); $fieldName = 'encrypted' . $type; $fieldPath = '$' . $fieldName; - $expr = ['$and' => [['$lt' => [$fieldPath, $cast(30)]]]]; + $expr = ['$and' => [['$lt' => [$fieldPath, self::cast($type, 30)]]]]; $encryptedExpr = $this->clientEncryption->encryptExpression($expr, $encryptOpts); $cursor = $this->collection->find(['$expr' => $encryptedExpr], ['sort' => ['_id' => 1]]); $expectedDocuments = [ - ['_id' => 0, $fieldName => $cast(0)], - ['_id' => 1, $fieldName => $cast(6)], + ['_id' => 0, $fieldName => self::cast($type, 0)], + ['_id' => 1, $fieldName => self::cast($type, 6)], ]; $this->assertMultipleDocumentsMatch($expectedDocuments, $cursor); } - /** - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-6-encrypting-a-document-greater-than-the-maximum-errors - * @dataProvider provideTypeAndRangeOpts - */ + /** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-6-encrypting-a-document-greater-than-the-maximum-errors */ + #[DataProvider('provideTypeAndRangeOpts')] public function testCase6_EncryptingADocumentGreaterThanTheMaximumErrors(string $type, array $rangeOpts): void { if ($type === 'DecimalNoPrecision' || $type === 'DoubleNoPrecision') { @@ -373,17 +353,13 @@ public function testCase6_EncryptingADocumentGreaterThanTheMaximumErrors(string 'rangeOpts' => $rangeOpts, ]; - $cast = self::getCastCallableForType($type); - $this->expectException(EncryptionException::class); $this->expectExceptionMessage('Value must be greater than or equal to the minimum value and less than or equal to the maximum value'); - $this->clientEncryption->encrypt($cast(201), $encryptOpts); + $this->clientEncryption->encrypt(self::cast($type, 201), $encryptOpts); } - /** - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-7-encrypting-a-value-of-a-different-type-errors - * @dataProvider provideTypeAndRangeOpts - */ + /** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-7-encrypting-a-value-of-a-different-type-errors */ + #[DataProvider('provideTypeAndRangeOpts')] public function testCase7_EncryptingAValueOfADifferentTypeErrors(string $type, array $rangeOpts): void { if ($type === 'DecimalNoPrecision' || $type === 'DoubleNoPrecision') { @@ -408,10 +384,8 @@ public function testCase7_EncryptingAValueOfADifferentTypeErrors(string $type, a $this->clientEncryption->encrypt($value, $encryptOpts); } - /** - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-8-setting-precision-errors-if-the-type-is-not-double-or-decimal128 - * @dataProvider provideTypeAndRangeOpts - */ + /** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-8-setting-precision-errors-if-the-type-is-not-double-or-decimal128 */ + #[DataProvider('provideTypeAndRangeOpts')] public function testCase8_SettingPrecisionErrorsIfTheTypeIsNotDoubleOrDecimal128(string $type, array $rangeOpts): void { if ($type === 'DecimalNoPrecision' || $type === 'DecimalPrecision' || $type === 'DoubleNoPrecision' || $type === 'DoublePrecision') { @@ -427,11 +401,9 @@ public function testCase8_SettingPrecisionErrorsIfTheTypeIsNotDoubleOrDecimal128 'rangeOpts' => $rangeOpts + ['precision' => 2], ]; - $cast = self::getCastCallableForType($type); - $this->expectException(EncryptionException::class); $this->expectExceptionMessage('expected \'precision\' to be set with double or decimal128 index'); - $this->clientEncryption->encrypt($cast(6), $encryptOpts); + $this->clientEncryption->encrypt(self::cast($type, 6), $encryptOpts); } private function assertMultipleDocumentsMatch(array $expectedDocuments, Iterator $actualDocuments): void @@ -449,28 +421,15 @@ private function assertMultipleDocumentsMatch(array $expectedDocuments, Iterator } } - private static function getCastCallableForType(string $type): callable + private static function cast(string $type, int $value): mixed { - switch ($type) { - case 'DecimalNoPrecision': - case 'DecimalPrecision': - return fn (int $value) => new Decimal128((string) $value); - - case 'DoubleNoPrecision': - case 'DoublePrecision': - return fn (int $value) => (double) $value; - - case 'Date': - return fn (int $value) => new UTCDateTime($value); - - case 'Int': - return fn (int $value) => $value; - - case 'Long': - return fn (int $value) => new Int64($value); - - default: - throw new LogicException('Unsupported type: ' . $type); - } + return match ($type) { + 'DecimalNoPrecision', 'DecimalPrecision' => new Decimal128((string) $value), + 'DoubleNoPrecision', 'DoublePrecision' => (float) $value, + 'Date' => new UTCDateTime($value), + 'Int' => $value, + 'Long' => new Int64($value), + default => throw new LogicException('Unsupported type: ' . $type), + }; } } diff --git a/tests/SpecTests/ClientSideEncryption/Prose25_LookupTest.php b/tests/SpecTests/ClientSideEncryption/Prose25_LookupTest.php new file mode 100644 index 000000000..6abfbda13 --- /dev/null +++ b/tests/SpecTests/ClientSideEncryption/Prose25_LookupTest.php @@ -0,0 +1,372 @@ +isStandalone()) { + $this->markTestSkipped('Lookup tests require replica sets'); + } + + $this->skipIfServerVersion('<', '7.0.0', 'Lookup encryption tests require MongoDB 7.0 or later'); + + $key1Document = $this->decodeJson(file_get_contents(self::$dataDir . '/key-doc.json')); + $this->key1Id = $key1Document->_id; + + $encryptedClient = $this->getEncryptedClient(); + + // Drop the key vault collection and insert key1Document with a majority write concern + self::insertKeyVaultData($encryptedClient, [$key1Document]); + + $this->refreshCollections($encryptedClient); + } + + private function getEncryptedClient(): Client + { + $autoEncryptionOpts = [ + 'keyVaultNamespace' => 'keyvault.datakeys', + 'kmsProviders' => ['local' => ['key' => new Binary(base64_decode(self::LOCAL_MASTERKEY))]], + ]; + + return self::createTestClient(null, [], [ + 'autoEncryption' => $autoEncryptionOpts, + /* libmongocrypt caches results from listCollections. Use a new + * client in each test to ensure its encryptedFields is applied. */ + 'disableClientPersistence' => true, + ]); + } + + private function refreshCollections(Client $client): void + { + $encryptedDb = $client->getDatabase(self::getDatabaseName()); + $unencryptedDb = self::createTestClient()->getDatabase(self::getDatabaseName()); + + $optionsMap = [ + self::COLL_CSFLE => [ + 'validator' => [ + '$jsonSchema' => $this->decodeJson(file_get_contents(self::$dataDir . '/schema-csfle.json')), + ], + ], + self::COLL_CSFLE2 => [ + 'validator' => [ + '$jsonSchema' => $this->decodeJson(file_get_contents(self::$dataDir . '/schema-csfle2.json')), + ], + ], + self::COLL_QE => [ + 'encryptedFields' => $this->decodeJson(file_get_contents(self::$dataDir . '/schema-qe.json')), + ], + self::COLL_QE2 => [ + 'encryptedFields' => $this->decodeJson(file_get_contents(self::$dataDir . '/schema-qe2.json')), + ], + self::COLL_NO_SCHEMA => [], + self::COLL_NO_SCHEMA2 => [], + ]; + + foreach ($optionsMap as $collectionName => $options) { + $encryptedDb->dropCollection($collectionName); + $encryptedDb->createCollection($collectionName, $options); + + $collection = $unencryptedDb->getCollection($collectionName); + + $result = $encryptedDb->getCollection($collectionName)->insertOne([$collectionName => $collectionName]); + + if ($options) { + $document = $collection->findOne(['_id' => $result->getInsertedId()]); + $this->assertInstanceOf(Binary::class, $document->{$collectionName}); + } + } + } + + private function assertPipelineReturnsSingleDocument(string $collection, array $pipeline, array $expected): void + { + $this->skipIfServerVersion('<', '8.1.0', 'Lookup test case requires server version 8.1.0 or later'); + $this->skipIfClientSideEncryptionIsNotSupported(); + + $cursor = $this + ->getEncryptedClient() + ->getCollection(self::getDatabaseName(), $collection) + ->aggregate($pipeline); + + $cursor->rewind(); + $this->assertMatchesDocument( + $expected, + $cursor->current(), + ); + $this->assertNull($cursor->next()); + } + + public function testCase1_CsfleJoinsNoSchema(): void + { + $pipeline = [ + [ + '$match' => ['csfle' => 'csfle'], + ], + [ + '$lookup' => [ + 'from' => 'no_schema', + 'as' => 'matched', + 'pipeline' => [ + [ + '$match' => ['no_schema' => 'no_schema'], + ], + [ + '$project' => ['_id' => 0], + ], + ], + ], + ], + [ + '$project' => ['_id' => 0], + ], + ]; + $expected = [ + 'csfle' => 'csfle', + 'matched' => [ + ['no_schema' => 'no_schema'], + ], + ]; + + $this->assertPipelineReturnsSingleDocument(self::COLL_CSFLE, $pipeline, $expected); + } + + public function testCase2_QeJoinsNoSchema(): void + { + $pipeline = [ + [ + '$match' => ['qe' => 'qe'], + ], + [ + '$lookup' => [ + 'from' => 'no_schema', + 'as' => 'matched', + 'pipeline' => [ + [ + '$match' => ['no_schema' => 'no_schema'], + ], + [ + '$project' => [ + '_id' => 0, + '__safeContent__' => 0, + ], + ], + ], + ], + ], + [ + '$project' => [ + '_id' => 0, + '__safeContent__' => 0, + ], + ], + ]; + $expected = [ + 'qe' => 'qe', + 'matched' => [ + ['no_schema' => 'no_schema'], + ], + ]; + + $this->assertPipelineReturnsSingleDocument(self::COLL_QE, $pipeline, $expected); + } + + public function testCase3_NoSchemaJoinsCsfle(): void + { + $pipeline = [['$match' => ['no_schema' => 'no_schema']], + [ + '$lookup' => [ + 'from' => 'csfle', + 'as' => 'matched', + 'pipeline' => [ + [ + '$match' => ['csfle' => 'csfle'], + ], + [ + '$project' => ['_id' => 0], + ], + ], + ], + ], + ['$project' => ['_id' => 0]], + ]; + $expected = ['no_schema' => 'no_schema', 'matched' => [['csfle' => 'csfle']]]; + + $this->assertPipelineReturnsSingleDocument(self::COLL_NO_SCHEMA, $pipeline, $expected); + } + + public function testCase4_NoSchemaJoinsQe(): void + { + $pipeline = [ + [ + '$match' => ['no_schema' => 'no_schema'], + ], + [ + '$lookup' => [ + 'from' => 'qe', + 'as' => 'matched', + 'pipeline' => [ + [ + '$match' => ['qe' => 'qe'], + ], + [ + '$project' => [ + '_id' => 0, + '__safeContent__' => 0, + ], + ], + ], + ], + ], + [ + '$project' => ['_id' => 0], + ], + ]; + $expected = [ + 'no_schema' => 'no_schema', + 'matched' => [ + ['qe' => 'qe'], + ], + ]; + + $this->assertPipelineReturnsSingleDocument(self::COLL_NO_SCHEMA, $pipeline, $expected); + } + + public function testCase5_CsfleJoinsCsfle2(): void + { + $pipeline = [ + ['$match' => ['csfle' => 'csfle']], + [ + '$lookup' => [ + 'from' => 'csfle2', + 'as' => 'matched', + 'pipeline' => [ + [ + '$match' => ['csfle2' => 'csfle2'], + ], + [ + '$project' => ['_id' => 0], + ], + ], + ], + ], + ['$project' => ['_id' => 0]], + ]; + $expected = ['csfle' => 'csfle', 'matched' => [['csfle2' => 'csfle2']]]; + + $this->assertPipelineReturnsSingleDocument(self::COLL_CSFLE, $pipeline, $expected); + } + + public function testCase6_QeJoinsQe2(): void + { + $pipeline = [ + ['$match' => ['qe' => 'qe']], + [ + '$lookup' => [ + 'from' => 'qe2', + 'as' => 'matched', + 'pipeline' => [ + [ + '$match' => ['qe2' => 'qe2'], + ], + [ + '$project' => [ + '_id' => 0, + '__safeContent__' => 0, + ], + ], + ], + ], + ], + ['$project' => ['_id' => 0, '__safeContent__' => 0]], + ]; + $expected = ['qe' => 'qe', 'matched' => [['qe2' => 'qe2']]]; + + $this->assertPipelineReturnsSingleDocument(self::COLL_QE, $pipeline, $expected); + } + + public function testCase7_NoSchemaJoinsNoSchema2(): void + { + $pipeline = [ + ['$match' => ['no_schema' => 'no_schema']], + [ + '$lookup' => [ + 'from' => 'no_schema2', + 'as' => 'matched', + 'pipeline' => [ + ['$match' => ['no_schema2' => 'no_schema2']], + ['$project' => ['_id' => 0]], + ], + ], + ], + ['$project' => ['_id' => 0]], + ]; + $expected = ['no_schema' => 'no_schema', 'matched' => [['no_schema2' => 'no_schema2']]]; + + $this->assertPipelineReturnsSingleDocument(self::COLL_NO_SCHEMA, $pipeline, $expected); + } + + public function testCase8_CsfleJoinsQeFails(): void + { + $this->skipIfServerVersion('<', '8.1.0', 'Lookup test case requires server version 8.1.0 or later'); + $this->skipIfClientSideEncryptionIsNotSupported(); + + $this->expectExceptionMessage('not supported'); + + $this->getEncryptedClient() + ->getCollection(self::getDatabaseName(), self::COLL_CSFLE) + ->aggregate([ + [ + '$match' => ['csfle' => 'qe'], + ], + [ + '$lookup' => [ + 'from' => 'qe', + 'as' => 'matched', + 'pipeline' => [ + [ + '$match' => ['qe' => 'qe'], + ], + [ + '$project' => ['_id' => 0], + ], + ], + ], + ], + [ + '$project' => ['_id' => 0], + ], + ]); + } + + public function testCase9_TestErrorWithLessThan8_1(): void + { + $this->markTestSkipped('Depends on PHPC-2616 to determine crypt shared version.'); + } +} diff --git a/tests/SpecTests/ClientSideEncryptionSpecTest.php b/tests/SpecTests/ClientSideEncryptionSpecTest.php index 5f00cb553..585883ae0 100644 --- a/tests/SpecTests/ClientSideEncryptionSpecTest.php +++ b/tests/SpecTests/ClientSideEncryptionSpecTest.php @@ -24,6 +24,9 @@ use MongoDB\Driver\WriteConcern; use MongoDB\Tests\CommandObserver; use PHPUnit\Framework\Assert; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\TestWith; use PHPUnit\Framework\SkippedTestError; use stdClass; use Throwable; @@ -38,12 +41,9 @@ use function in_array; use function iterator_to_array; use function json_decode; -use function phpversion; use function sprintf; use function str_repeat; -use function str_starts_with; use function substr; -use function version_compare; use const JSON_THROW_ON_ERROR; @@ -51,9 +51,8 @@ * Client-side encryption spec tests. * * @see https://github.com/mongodb/specifications/tree/master/source/client-side-encryption - * @group csfle - * @group serverless */ +#[Group('csfle')] class ClientSideEncryptionSpecTest extends FunctionalTestCase { public const LOCAL_MASTERKEY = 'Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk'; @@ -116,8 +115,11 @@ class ClientSideEncryptionSpecTest extends FunctionalTestCase 'timeoutMS: remaining timeoutMS applied to find to get keyvault data' => 'Not yet implemented (PHPC-1760)', 'namedKMS: Automatically encrypt and decrypt with a named KMS provider' => 'Not yet implemented (PHPLIB-1328)', 'fle2v2-Compact: Compact works' => 'Failing due to bug in libmongocrypt (LIBMONGOCRYPT-699)', + 'keyCache: Insert with deterministic encryption, then find it' => 'Wait operation not supported (PHPLIB-1496)', ]; + private static string $specDir = __DIR__ . '/../specifications/source/client-side-encryption'; + public function setUp(): void { parent::setUp(); @@ -140,19 +142,9 @@ public static function assertCommandMatches(stdClass $expected, stdClass $actual static::assertDocumentsMatch($expected, $actual); } - public static function createTestClient(?string $uri = null, array $options = [], array $driverOptions = []): Client - { - if (isset($driverOptions['autoEncryption']) && getenv('CRYPT_SHARED_LIB_PATH')) { - $driverOptions['autoEncryption']['extraOptions']['cryptSharedLibPath'] = getenv('CRYPT_SHARED_LIB_PATH'); - } - - return parent::createTestClient($uri, $options, $driverOptions); - } - /** * Execute an individual test case from the specification. * - * @dataProvider provideTests * @param stdClass $test Individual "tests[]" document * @param array $runOn Top-level "runOn" array with server requirements * @param array $data Top-level "data" array to initialize collection @@ -161,16 +153,13 @@ public static function createTestClient(?string $uri = null, array $options = [] * @param string $databaseName Name of database under test * @param string $collectionName Name of collection under test */ + #[DataProvider('provideTests')] public function testClientSideEncryption(stdClass $test, ?array $runOn, array $data, ?stdClass $encryptedFields = null, ?array $keyVaultData = null, ?stdClass $jsonSchema = null, ?string $databaseName = null, ?string $collectionName = null): void { if (isset(self::$incompleteTests[$this->dataDescription()])) { $this->markTestIncomplete(self::$incompleteTests[$this->dataDescription()]); } - if (str_starts_with($this->dataDescription(), 'fle2v2-Range-') && version_compare(phpversion('mongodb'), '1.20.0dev', '>=')) { - $this->markTestIncomplete('Range protocol V1 is not supported by ext-mongodb 1.20+'); - } - if (isset($runOn)) { $this->checkServerRequirements($runOn); } @@ -222,11 +211,11 @@ public function testClientSideEncryption(stdClass $test, ?array $runOn, array $d } } - public function provideTests() + public static function provideTests() { $testArgs = []; - foreach (glob(__DIR__ . '/client-side-encryption/tests/*.json') as $filename) { + foreach (glob(self::$specDir . '/tests/legacy/*.json') as $filename) { $group = basename($filename, '.json'); /* Some tests need to differentiate int32 and int64 BSON types. @@ -277,8 +266,8 @@ public function provideTests() * Prose test 2: Data Key and Double Encryption * * @see https://github.com/mongodb/specifications/tree/master/source/client-side-encryption/tests#data-key-and-double-encryption - * @dataProvider dataKeyProvider */ + #[DataProvider('dataKeyProvider')] public function testDataKeyAndDoubleEncryption(string $providerName, $masterKey): void { $client = static::createTestClient(); @@ -347,8 +336,8 @@ function ($command) use (&$insertCommand): void { $this->assertSame(Binary::TYPE_UUID, $dataKeyId->getType()); $this->assertNotNull($insertCommand); - $this->assertObjectHasAttribute('writeConcern', $insertCommand); - $this->assertObjectHasAttribute('w', $insertCommand->writeConcern); + $this->assertObjectHasProperty('writeConcern', $insertCommand); + $this->assertObjectHasProperty('w', $insertCommand->writeConcern); $this->assertSame(WriteConcern::MAJORITY, $insertCommand->writeConcern->w); $keys = $client->selectCollection('keyvault', 'datakeys')->find(['_id' => $dataKeyId]); @@ -416,16 +405,16 @@ public static function dataKeyProvider() * Prose test 3: External Key Vault * * @see https://github.com/mongodb/specifications/tree/master/source/client-side-encryption/tests#external-key-vault-test - * @testWith [false] - * [true] */ + #[TestWith([false])] + #[TestWith([true])] public function testExternalKeyVault($withExternalKeyVault): void { $client = static::createTestClient(); $client->selectCollection('db', 'coll')->drop(); self::insertKeyVaultData($client, [ - $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/external/external-key.json')), + $this->decodeJson(file_get_contents(self::$specDir . '/external/external-key.json')), ]); $encryptionOpts = [ @@ -441,7 +430,7 @@ public function testExternalKeyVault($withExternalKeyVault): void $autoEncryptionOpts = $encryptionOpts + [ 'schemaMap' => [ - 'db.coll' => $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/external/external-schema.json')), + 'db.coll' => $this->decodeJson(file_get_contents(self::$specDir . '/external/external-schema.json')), ], ]; @@ -564,17 +553,17 @@ static function (self $test, Collection $collection, array $document): void { * Prose test 4: BSON Size Limits and Batch Splitting * * @see https://github.com/mongodb/specifications/tree/master/source/client-side-encryption/tests#bson-size-limits-and-batch-splitting - * @dataProvider provideBSONSizeLimitsAndBatchSplittingTests */ + #[DataProvider('provideBSONSizeLimitsAndBatchSplittingTests')] public function testBSONSizeLimitsAndBatchSplitting(Closure $test): void { $client = static::createTestClient(); $client->selectCollection('db', 'coll')->drop(); - $client->selectDatabase('db')->createCollection('coll', ['validator' => ['$jsonSchema' => $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/limits/limits-schema.json'))]]); + $client->selectDatabase('db')->createCollection('coll', ['validator' => ['$jsonSchema' => $this->decodeJson(file_get_contents(self::$specDir . '/limits/limits-schema.json'))]]); self::insertKeyVaultData($client, [ - $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/limits/limits-key.json')), + $this->decodeJson(file_get_contents(self::$specDir . '/limits/limits-key.json')), ]); $autoEncryptionOpts = [ @@ -589,7 +578,7 @@ public function testBSONSizeLimitsAndBatchSplitting(Closure $test): void $collection = $clientEncrypted->selectCollection('db', 'coll'); - $document = json_decode(file_get_contents(__DIR__ . '/client-side-encryption/limits/limits-doc.json'), true, 512, JSON_THROW_ON_ERROR); + $document = json_decode(file_get_contents(self::$specDir . '/limits/limits-doc.json'), true, 512, JSON_THROW_ON_ERROR); $test($this, $collection, $document); } @@ -622,7 +611,7 @@ public function testViewsAreProhibited(): void $previous = $e->getPrevious(); $this->assertInstanceOf(EncryptionException::class, $previous); - $this->assertSame('cannot auto encrypt a view', $previous->getMessage()); + $this->assertStringContainsString('cannot auto encrypt a view', $previous->getMessage()); } } @@ -630,26 +619,26 @@ public function testViewsAreProhibited(): void * Prose test 6: BSON Corpus * * @see https://github.com/mongodb/specifications/tree/master/source/client-side-encryption/tests#corpus-test - * @testWith [true] - * [false] */ + #[TestWith([true])] + #[TestWith([false])] public function testCorpus($schemaMap = true): void { $client = static::createTestClient(); $client->selectDatabase('db')->dropCollection('coll'); - $schema = $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/corpus/corpus-schema.json')); + $schema = $this->decodeJson(file_get_contents(self::$specDir . '/corpus/corpus-schema.json')); if (! $schemaMap) { $client->selectDatabase('db')->createCollection('coll', ['validator' => ['$jsonSchema' => $schema]]); } self::insertKeyVaultData($client, [ - $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/corpus/corpus-key-local.json')), - $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/corpus/corpus-key-aws.json')), - $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/corpus/corpus-key-azure.json')), - $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/corpus/corpus-key-gcp.json')), - $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/corpus/corpus-key-kmip.json')), + $this->decodeJson(file_get_contents(self::$specDir . '/corpus/corpus-key-local.json')), + $this->decodeJson(file_get_contents(self::$specDir . '/corpus/corpus-key-aws.json')), + $this->decodeJson(file_get_contents(self::$specDir . '/corpus/corpus-key-azure.json')), + $this->decodeJson(file_get_contents(self::$specDir . '/corpus/corpus-key-gcp.json')), + $this->decodeJson(file_get_contents(self::$specDir . '/corpus/corpus-key-kmip.json')), ]); $encryptionOpts = [ @@ -674,7 +663,7 @@ public function testCorpus($schemaMap = true): void ]; } - $corpus = (array) $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/corpus/corpus.json')); + $corpus = (array) $this->decodeJson(file_get_contents(self::$specDir . '/corpus/corpus.json')); $corpusCopied = []; $clientEncrypted = static::createTestClient(null, [], ['autoEncryption' => $autoEncryptionOpts]); @@ -705,7 +694,7 @@ public function testCorpus($schemaMap = true): void $this->assertDocumentsMatch($corpus, $corpusDecrypted); - $corpusEncryptedExpected = (array) $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/corpus/corpus-encrypted.json')); + $corpusEncryptedExpected = (array) $this->decodeJson(file_get_contents(self::$specDir . '/corpus/corpus-encrypted.json')); $corpusEncryptedActual = $client->selectCollection('db', 'coll')->findOne(['_id' => 'client_side_encryption_corpus'], ['typeMap' => ['root' => 'array', 'document' => stdClass::class, 'array' => 'array']]); foreach ($corpusEncryptedExpected as $fieldName => $expectedData) { @@ -739,8 +728,8 @@ public function testCorpus($schemaMap = true): void * Prose test 7: Custom Endpoint * * @see https://github.com/mongodb/specifications/tree/master/source/client-side-encryption/tests#custom-endpoint-test - * @dataProvider customEndpointProvider */ + #[DataProvider('customEndpointProvider')] public function testCustomEndpoint(Closure $test): void { $client = static::createTestClient(); @@ -763,7 +752,7 @@ public function testCustomEndpoint(Closure $test): void 'kmsProviders' => [ 'azure' => Context::getAzureCredentials() + ['identityPlatformEndpoint' => 'doesnotexist.invalid:443'], 'gcp' => Context::getGCPCredentials() + ['endpoint' => 'doesnotexist.invalid:443'], - 'kmip' => ['endpoint' => 'doesnotexist.local:5698'], + 'kmip' => ['endpoint' => 'doesnotexist.invalid:5698'], ], 'tlsOptions' => [ 'kmip' => Context::getKmsTlsOptions(), @@ -811,9 +800,9 @@ static function (self $test, ClientEncryption $clientEncryption, ClientEncryptio ]; yield 'Test 4' => [ - static function (self $test, ClientEncryption $clientEncryption, ClientEncryption $clientEncryptionInvalid) use ($awsMasterKey): void { + static function (self $test, ClientEncryption $clientEncryption, ClientEncryption $clientEncryptionInvalid) use ($kmipMasterKey): void { $test->expectException(ConnectionException::class); - $clientEncryption->createDataKey('aws', ['masterKey' => $awsMasterKey + ['endpoint' => 'kms.us-east-1.amazonaws.com:12345']]); + $clientEncryption->createDataKey('kmip', ['masterKey' => $kmipMasterKey + ['endpoint' => 'localhost:12345']]); }, ]; @@ -874,7 +863,7 @@ static function (self $test, ClientEncryption $clientEncryption, ClientEncryptio $test->assertSame('test', $clientEncryption->decrypt($encrypted)); $test->expectException(RuntimeException::class); - $test->expectExceptionMessageMatches('#doesnotexist.local#'); + $test->expectExceptionMessageMatches('#doesnotexist.invalid#'); $clientEncryptionInvalid->createDataKey('kmip', ['masterKey' => $kmipMasterKey]); }, ]; @@ -891,10 +880,10 @@ static function (self $test, ClientEncryption $clientEncryption, ClientEncryptio yield 'Test 12' => [ static function (self $test, ClientEncryption $clientEncryption, ClientEncryption $clientEncryptionInvalid) use ($kmipMasterKey): void { - $kmipMasterKey['endpoint'] = 'doesnotexist.local:5698'; + $kmipMasterKey['endpoint'] = 'doesnotexist.invalid:5698'; $test->expectException(RuntimeException::class); - $test->expectExceptionMessageMatches('#doesnotexist.local#'); + $test->expectExceptionMessageMatches('#doesnotexist.invalid#'); $clientEncryption->createDataKey('kmip', ['masterKey' => $kmipMasterKey]); }, ]; @@ -917,7 +906,7 @@ public function testBypassSpawningMongocryptdViaLoadingSharedLibrary(): void 'local' => ['key' => new Binary(base64_decode(self::LOCAL_MASTERKEY))], ], 'schemaMap' => [ - 'db.coll' => $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/external/external-schema.json')), + 'db.coll' => $this->decodeJson(file_get_contents(self::$specDir . '/external/external-schema.json')), ], 'extraOptions' => [ 'mongocryptdBypassSpawn' => true, @@ -959,7 +948,7 @@ public function testBypassSpawningMongocryptdViaBypassSpawn(): void 'local' => ['key' => new Binary(base64_decode(self::LOCAL_MASTERKEY))], ], 'schemaMap' => [ - 'db.coll' => $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/external/external-schema.json')), + 'db.coll' => $this->decodeJson(file_get_contents(self::$specDir . '/external/external-schema.json')), ], 'extraOptions' => [ 'mongocryptdBypassSpawn' => true, @@ -1019,7 +1008,7 @@ public function testBypassSpawningMongocryptdViaBypassAutoEncryption(): void /** * Prose test 8: Bypass spawning mongocryptd (via bypassQueryAnalysis) * - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#via-bypassqueryanalysis + * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#via-bypassqueryanalysis */ public function testBypassSpawningMongocryptdViaBypassQueryAnalysis(): void { @@ -1053,7 +1042,7 @@ public function testBypassSpawningMongocryptdViaBypassQueryAnalysis(): void /** * Prose test 10: KMS TLS Tests (Invalid KMS Certificate) * - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#invalid-kms-certificate + * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#invalid-kms-certificate */ public function testInvalidKmsCertificate(): void { @@ -1081,7 +1070,7 @@ public function testInvalidKmsCertificate(): void /** * Prose test 10: KMS TLS Tests (Invalid Hostname in KMS Certificate) * - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#invalid-hostname-in-kms-certificate + * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#invalid-hostname-in-kms-certificate */ public function testInvalidHostnameInKmsCertificate(): void { @@ -1109,9 +1098,9 @@ public function testInvalidHostnameInKmsCertificate(): void /** * Prose test 11: KMS TLS Options * - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#kms-tls-options-tests - * @dataProvider provideKmsTlsOptionsTests + * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#kms-tls-options-tests */ + #[DataProvider('provideKmsTlsOptionsTests')] public function testKmsTlsOptions(Closure $test): void { $client = static::createTestClient(); @@ -1192,7 +1181,7 @@ public static function provideKmsTlsOptionsTests() // Note: expected exception messages below assume OpenSSL is used - // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#case-1-aws + // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-1-aws yield 'AWS: client_encryption_no_client_cert' => [ static function (self $test, ClientEncryption $clientEncryptionNoClientCert, ClientEncryption $clientEncryptionWithTls, ClientEncryption $clientEncryptionExpired, ClientEncryption $clientEncryptionInvalidHostname) use ($awsMasterKey): void { $test->expectException(ConnectionException::class); @@ -1225,7 +1214,7 @@ static function (self $test, ClientEncryption $clientEncryptionNoClientCert, Cli }, ]; - // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#case-2-azure + // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-2-azure yield 'Azure: client_encryption_no_client_cert' => [ static function (self $test, ClientEncryption $clientEncryptionNoClientCert, ClientEncryption $clientEncryptionWithTls, ClientEncryption $clientEncryptionExpired, ClientEncryption $clientEncryptionInvalidHostname) use ($azureMasterKey): void { $test->expectException(ConnectionException::class); @@ -1258,7 +1247,7 @@ static function (self $test, ClientEncryption $clientEncryptionNoClientCert, Cli }, ]; - // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#case-3-gcp + // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-3-gcp yield 'GCP: client_encryption_no_client_cert' => [ static function (self $test, ClientEncryption $clientEncryptionNoClientCert, ClientEncryption $clientEncryptionWithTls, ClientEncryption $clientEncryptionExpired, ClientEncryption $clientEncryptionInvalidHostname) use ($gcpMasterKey): void { $test->expectException(ConnectionException::class); @@ -1291,7 +1280,7 @@ static function (self $test, ClientEncryption $clientEncryptionNoClientCert, Cli }, ]; - // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#case-4-kmip + // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-4-kmip yield 'KMIP: client_encryption_no_client_cert' => [ static function (self $test, ClientEncryption $clientEncryptionNoClientCert, ClientEncryption $clientEncryptionWithTls, ClientEncryption $clientEncryptionExpired, ClientEncryption $clientEncryptionInvalidHostname) use ($kmipMasterKey): void { $test->expectException(ConnectionException::class); @@ -1327,9 +1316,9 @@ static function (self $test, ClientEncryption $clientEncryptionNoClientCert, Cli /** * Prose test 12: Explicit Encryption * - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#explicit-encryption - * @dataProvider provideExplicitEncryptionTests + * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#explicit-encryption */ + #[DataProvider('provideExplicitEncryptionTests')] public function testExplicitEncryption(Closure $test): void { if ($this->isStandalone()) { @@ -1339,8 +1328,8 @@ public function testExplicitEncryption(Closure $test): void $this->skipIfServerVersion('<', '7.0.0', 'Explicit encryption tests require MongoDB 7.0 or later'); // Test setup - $encryptedFields = $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/etc/data/encryptedFields.json')); - $key1Document = $this->decodeJson(file_get_contents(__DIR__ . '/client-side-encryption/etc/data/keys/key1-document.json')); + $encryptedFields = $this->decodeJson(file_get_contents(self::$specDir . '/etc/data/encryptedFields.json')); + $key1Document = $this->decodeJson(file_get_contents(self::$specDir . '/etc/data/keys/key1-document.json')); $key1Id = $key1Document->_id; $client = static::createTestClient(); @@ -1376,7 +1365,7 @@ public function testExplicitEncryption(Closure $test): void public static function provideExplicitEncryptionTests() { - // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#case-1-can-insert-encrypted-indexed-and-find + // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-1-can-insert-encrypted-indexed-and-find yield 'Case 1: can insert encrypted indexed and find' => [ static function (self $test, ClientEncryption $clientEncryption, Client $encryptedClient, Client $keyVaultClient, Binary $key1Id): void { $value = 'encrypted indexed value'; @@ -1404,7 +1393,7 @@ static function (self $test, ClientEncryption $clientEncryption, Client $encrypt }, ]; - // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#case-2-can-insert-encrypted-indexed-and-find-with-non-zero-contention + // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-2-can-insert-encrypted-indexed-and-find-with-non-zero-contention yield 'Case 2: can insert encrypted indexed and find with non-zero contention' => [ static function (self $test, ClientEncryption $clientEncryption, Client $encryptedClient, Client $keyVaultClient, Binary $key1Id): void { $value = 'encrypted indexed value'; @@ -1453,7 +1442,7 @@ static function (self $test, ClientEncryption $clientEncryption, Client $encrypt }, ]; - // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#case-3-can-insert-encrypted-unindexed + // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-3-can-insert-encrypted-unindexed yield 'Case 3: can insert encrypted unindexed' => [ static function (self $test, ClientEncryption $clientEncryption, Client $encryptedClient, Client $keyVaultClient, Binary $key1Id): void { $value = 'encrypted unindexed value'; @@ -1473,7 +1462,7 @@ static function (self $test, ClientEncryption $clientEncryption, Client $encrypt }, ]; - // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#case-4-can-roundtrip-encrypted-indexed + // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-4-can-roundtrip-encrypted-indexed yield 'Case 4: can roundtrip encrypted indexed' => [ static function (self $test, ClientEncryption $clientEncryption, Client $encryptedClient, Client $keyVaultClient, Binary $key1Id): void { $value = 'encrypted indexed value'; @@ -1488,7 +1477,7 @@ static function (self $test, ClientEncryption $clientEncryption, Client $encrypt }, ]; - // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#case-5-can-roundtrip-encrypted-unindexed + // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-5-can-roundtrip-encrypted-unindexed yield 'Case 5: can roundtrip encrypted unindexed' => [ static function (self $test, ClientEncryption $clientEncryption, Client $encryptedClient, Client $keyVaultClient, Binary $key1Id): void { $value = 'encrypted unindexed value'; @@ -1506,9 +1495,9 @@ static function (self $test, ClientEncryption $clientEncryption, Client $encrypt /** * Prose test 13: Unique Index on keyAltNames * - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#unique-index-on-keyaltnames - * @dataProvider provideUniqueIndexOnKeyAltNamesTests + * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#unique-index-on-keyaltnames */ + #[DataProvider('provideUniqueIndexOnKeyAltNamesTests')] public function testUniqueIndexOnKeyAltNames(Closure $test): void { // Test setup @@ -1539,7 +1528,7 @@ public function testUniqueIndexOnKeyAltNames(Closure $test): void public static function provideUniqueIndexOnKeyAltNamesTests() { - // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#case-1-createdatakey + // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-1-createdatakey yield 'Case 1: createDataKey()' => [ static function (self $test, Client $client, ClientEncryption $clientEncryption): void { $clientEncryption->createDataKey('local', ['keyAltNames' => ['abc']]); @@ -1560,16 +1549,16 @@ static function (self $test, Client $client, ClientEncryption $clientEncryption) }, ]; - // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#case-2-addkeyaltname + // See: https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-2-addkeyaltname yield 'Case 2: addKeyAltName()' => [ static function (self $test, Client $client, ClientEncryption $clientEncryption): void { $keyId = $clientEncryption->createDataKey('local'); $keyBeforeUpdate = $clientEncryption->addKeyAltName($keyId, 'abc'); - $test->assertObjectNotHasAttribute('keyAltNames', $keyBeforeUpdate); + $test->assertObjectNotHasProperty('keyAltNames', $keyBeforeUpdate); $keyBeforeUpdate = $clientEncryption->addKeyAltName($keyId, 'abc'); - $test->assertObjectHasAttribute('keyAltNames', $keyBeforeUpdate); + $test->assertObjectHasProperty('keyAltNames', $keyBeforeUpdate); $test->assertIsArray($keyBeforeUpdate->keyAltNames); $test->assertContains('abc', $keyBeforeUpdate->keyAltNames); @@ -1583,7 +1572,7 @@ static function (self $test, Client $client, ClientEncryption $clientEncryption) $originalKeyId = $clientEncryption->getKeyByAltName('def')->_id; $originalKeyBeforeUpdate = $clientEncryption->addKeyAltName($originalKeyId, 'def'); - $test->assertObjectHasAttribute('keyAltNames', $originalKeyBeforeUpdate); + $test->assertObjectHasProperty('keyAltNames', $originalKeyBeforeUpdate); $test->assertIsArray($originalKeyBeforeUpdate->keyAltNames); $test->assertContains('def', $originalKeyBeforeUpdate->keyAltNames); }, @@ -1594,8 +1583,8 @@ static function (self $test, Client $client, ClientEncryption $clientEncryption) * Prose test 14: Decryption Events * * @see https://github.com/mongodb/specifications/tree/master/source/client-side-encryption/tests#decryption-events - * @dataProvider provideDecryptionEventsTests */ + #[DataProvider('provideDecryptionEventsTests')] public function testDecryptionEvents(Closure $test): void { // Test setup @@ -1698,7 +1687,7 @@ static function (self $test, Client $setupClient, ClientEncryption $clientEncryp try { $encryptedClient->selectCollection('db', 'decryption_events')->aggregate([]); $test->fail('Expected exception to be thrown'); - } catch (ConnectionTimeoutException $e) { + } catch (ConnectionTimeoutException) { $test->addToAssertionCount(1); } @@ -1743,10 +1732,10 @@ static function (self $test, Client $setupClient, ClientEncryption $clientEncryp * Prose test 15: On-demand AWS Credentials * * @see https://github.com/mongodb/specifications/tree/master/source/client-side-encryption/tests#on-demand-aws-credentials - * @group csfle-without-aws-creds - * @testWith [true] - * [false] */ + #[TestWith([true])] + #[TestWith([false])] + #[Group('csfle-without-aws-creds')] public function testOnDemandAwsCredentials(bool $shouldSucceed): void { $hasCredentials = (getenv('AWS_ACCESS_KEY_ID') && getenv('AWS_SECRET_ACCESS_KEY')); @@ -1785,9 +1774,9 @@ public function testOnDemandAwsCredentials(bool $shouldSucceed): void /** * Prose test 16: RewrapManyDataKey * - * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.rst#rewrap - * @dataProvider provideRewrapManyDataKeySrcAndDstProviders + * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#rewrap */ + #[DataProvider('provideRewrapManyDataKeySrcAndDstProviders')] public function testRewrapManyDataKey(string $srcProvider, string $dstProvider): void { $providerMasterKeys = [ @@ -1839,10 +1828,10 @@ public function testRewrapManyDataKey(string $srcProvider, string $dstProvider): $result = $clientEncryption2->rewrapManyDataKey([], $rewrapManyDataKeyOpts); - $this->assertObjectHasAttribute('bulkWriteResult', $result); + $this->assertObjectHasProperty('bulkWriteResult', $result); $this->assertIsObject($result->bulkWriteResult); // libmongoc uses different field names for its BulkWriteResult - $this->assertObjectHasAttribute('nModified', $result->bulkWriteResult); + $this->assertObjectHasProperty('nModified', $result->bulkWriteResult); $this->assertSame(1, $result->bulkWriteResult->nModified); $this->assertSame('test', $clientEncryption1->decrypt($ciphertext)); @@ -1942,7 +1931,7 @@ private function encryptCorpusValue(string $fieldName, stdClass $data, ClientEnc try { $clientEncryption->encrypt($data->value, $encryptionOptions); $this->fail('Expected exception to be thrown'); - } catch (RuntimeException $e) { + } catch (RuntimeException) { } return $data->value; diff --git a/tests/SpecTests/CommandExpectations.php b/tests/SpecTests/CommandExpectations.php index 76a3a0a0a..8adc8cd5c 100644 --- a/tests/SpecTests/CommandExpectations.php +++ b/tests/SpecTests/CommandExpectations.php @@ -37,32 +37,18 @@ class CommandExpectations implements CommandSubscriber /** @var list */ private array $ignoredCommandNames = []; - private Client $observedClient; - - private function __construct(Client $observedClient, array $events) + private function __construct(private Client $observedClient, array $events) { - $this->observedClient = $observedClient; - foreach ($events as $event) { - switch (key((array) $event)) { - case 'command_failed_event': - // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps - $this->expectedEvents[] = [$event->command_failed_event, CommandFailedEvent::class]; - break; - - case 'command_started_event': - // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps - $this->expectedEvents[] = [$event->command_started_event, CommandStartedEvent::class]; - break; - - case 'command_succeeded_event': - // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps - $this->expectedEvents[] = [$event->command_succeeded_event, CommandSucceededEvent::class]; - break; - - default: - throw new LogicException('Unsupported event type: ' . key($event)); - } + $this->expectedEvents[] = match (key((array) $event)) { + // phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps + 'command_failed_event' => [$event->command_failed_event, CommandFailedEvent::class], + // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps + 'command_started_event' => [$event->command_started_event, CommandStartedEvent::class], + // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps + 'command_succeeded_event' => [$event->command_succeeded_event, CommandSucceededEvent::class], + default => throw new LogicException('Unsupported event type: ' . key($event)), + }; } } diff --git a/tests/SpecTests/Context.php b/tests/SpecTests/Context.php index 7731f65db..4d2db90cb 100644 --- a/tests/SpecTests/Context.php +++ b/tests/SpecTests/Context.php @@ -30,10 +30,6 @@ final class Context private ?Client $client = null; - public ?string $collectionName = null; - - public string $databaseName; - public array $defaultWriteOptions = []; public array $outcomeReadOptions = []; @@ -54,10 +50,8 @@ final class Context private ?Client $encryptedClient = null; - private function __construct(string $databaseName, ?string $collectionName) + private function __construct(public string $databaseName, public ?string $collectionName = null) { - $this->databaseName = $databaseName; - $this->collectionName = $collectionName; $this->outcomeCollectionName = $collectionName; $this->internalClient = FunctionalTestCase::createTestClient(); } @@ -111,11 +105,6 @@ public static function fromClientSideEncryption(stdClass $test, $databaseName, $ $autoEncryptionOptions['tlsOptions']->kmip = self::getKmsTlsOptions(); } - - // Intentionally ignore empty values for CRYPT_SHARED_LIB_PATH - if (getenv('CRYPT_SHARED_LIB_PATH')) { - $autoEncryptionOptions['extraOptions']['cryptSharedLibPath'] = getenv('CRYPT_SHARED_LIB_PATH'); - } } if (isset($test->outcome->collection->name)) { @@ -364,18 +353,11 @@ public function replaceArgumentSessionPlaceholder(array &$args): void return; } - switch ($args['session']) { - case 'session0': - $args['session'] = $this->session0; - break; - - case 'session1': - $args['session'] = $this->session1; - break; - - default: - throw new LogicException('Unsupported session placeholder: ' . $args['session']); - } + $args['session'] = match ($args['session']) { + 'session0' => $this->session0, + 'session1' => $this->session1, + default => throw new LogicException('Unsupported session placeholder: ' . $args['session']), + }; } /** @@ -392,18 +374,11 @@ public function replaceCommandSessionPlaceholder(stdClass $command): void return; } - switch ($command->lsid) { - case 'session0': - $command->lsid = $this->session0Lsid; - break; - - case 'session1': - $command->lsid = $this->session1Lsid; - break; - - default: - throw new LogicException('Unsupported session placeholder: ' . $command->lsid); - } + $command->lsid = match ($command->lsid) { + 'session0' => $this->session0Lsid, + 'session1' => $this->session1Lsid, + default => throw new LogicException('Unsupported session placeholder: ' . $command->lsid), + }; } public function selectCollection($databaseName, $collectionName, array $collectionOptions = [], array $databaseOptions = []) diff --git a/tests/SpecTests/Crud/Prose11_BulkWriteBatchSplitsWhenNamespaceExceedsMessageSizeTest.php b/tests/SpecTests/Crud/Prose11_BulkWriteBatchSplitsWhenNamespaceExceedsMessageSizeTest.php new file mode 100644 index 000000000..ae6a46d5d --- /dev/null +++ b/tests/SpecTests/Crud/Prose11_BulkWriteBatchSplitsWhenNamespaceExceedsMessageSizeTest.php @@ -0,0 +1,123 @@ +skipIfServerVersion('<', '8.0', 'bulkWrite command is not supported'); + + $this->client = self::createTestClient(); + + $hello = $this->getPrimaryServer()->getInfo(); + self::assertIsInt($maxBsonObjectSize = $hello['maxBsonObjectSize'] ?? null); + self::assertIsInt($maxMessageSizeBytes = $hello['maxMessageSizeBytes'] ?? null); + + $opsBytes = $maxMessageSizeBytes - 1122; + $this->numModels = (int) ($opsBytes / $maxBsonObjectSize); + $remainderBytes = $opsBytes % $maxBsonObjectSize; + + // Use namespaces specific to the test, as they are relevant to batch calculations + $this->dropCollection('db', 'coll'); + $collection = $this->client->selectCollection('db', 'coll'); + + $this->bulkWrite = ClientBulkWrite::createWithCollection($collection); + + for ($i = 0; $i < $this->numModels; ++$i) { + $this->bulkWrite->insertOne(['a' => str_repeat('b', $maxBsonObjectSize - 57)]); + } + + if ($remainderBytes >= 217) { + ++$this->numModels; + $this->bulkWrite->insertOne(['a' => str_repeat('b', $remainderBytes - 57)]); + } + } + + public function testNoBatchSplittingRequired(): void + { + $subscriber = $this->createSubscriber(); + $this->client->addSubscriber($subscriber); + + $this->bulkWrite->insertOne(['a' => 'b']); + + $result = $this->client->bulkWrite($this->bulkWrite); + + self::assertSame($this->numModels + 1, $result->getInsertedCount()); + self::assertCount(1, $subscriber->commandStartedEvents); + $command = $subscriber->commandStartedEvents[0]->getCommand(); + self::assertCount($this->numModels + 1, $command->ops); + self::assertCount(1, $command->nsInfo); + self::assertSame('db.coll', $command->nsInfo[0]->ns ?? null); + } + + public function testBatchSplittingRequired(): void + { + $subscriber = $this->createSubscriber(); + $this->client->addSubscriber($subscriber); + + $secondCollectionName = str_repeat('c', 200); + $this->dropCollection('db', $secondCollectionName); + $secondCollection = $this->client->selectCollection('db', $secondCollectionName); + $this->bulkWrite->withCollection($secondCollection)->insertOne(['a' => 'b']); + + $result = $this->client->bulkWrite($this->bulkWrite); + + self::assertSame($this->numModels + 1, $result->getInsertedCount()); + self::assertCount(2, $subscriber->commandStartedEvents); + [$firstEvent, $secondEvent] = $subscriber->commandStartedEvents; + + $firstCommand = $firstEvent->getCommand(); + self::assertCount($this->numModels, $firstCommand->ops); + self::assertCount(1, $firstCommand->nsInfo); + self::assertSame('db.coll', $firstCommand->nsInfo[0]->ns ?? null); + + $secondCommand = $secondEvent->getCommand(); + self::assertCount(1, $secondCommand->ops); + self::assertCount(1, $secondCommand->nsInfo); + self::assertSame($secondCollection->getNamespace(), $secondCommand->nsInfo[0]->ns ?? null); + } + + private function createSubscriber(): CommandSubscriber + { + return new class implements CommandSubscriber { + public array $commandStartedEvents = []; + + public function commandStarted(CommandStartedEvent $event): void + { + if ($event->getCommandName() === 'bulkWrite') { + $this->commandStartedEvents[] = $event; + } + } + + public function commandSucceeded(CommandSucceededEvent $event): void + { + } + + public function commandFailed(CommandFailedEvent $event): void + { + } + }; + } +} diff --git a/tests/SpecTests/Crud/Prose12_BulkWriteExceedsMaxMessageSizeBytesTest.php b/tests/SpecTests/Crud/Prose12_BulkWriteExceedsMaxMessageSizeBytesTest.php new file mode 100644 index 000000000..4fbe5adcd --- /dev/null +++ b/tests/SpecTests/Crud/Prose12_BulkWriteExceedsMaxMessageSizeBytesTest.php @@ -0,0 +1,63 @@ +skipIfServerVersion('<', '8.0', 'bulkWrite command is not supported'); + } + + public function testDocumentTooLarge(): void + { + $client = self::createTestClient(); + + $maxMessageSizeBytes = $this->getPrimaryServer()->getInfo()['maxMessageSizeBytes'] ?? null; + self::assertIsInt($maxMessageSizeBytes); + + $collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName()); + $bulkWrite = ClientBulkWrite::createWithCollection($collection); + $bulkWrite->insertOne(['a' => str_repeat('b', $maxMessageSizeBytes)]); + + try { + $client->bulkWrite($bulkWrite); + self::fail('Exception was not thrown'); + } catch (InvalidArgumentException $e) { + self::assertStringContainsString('unable to send document', $e->getMessage()); + } + } + + public function testNamespaceTooLarge(): void + { + $client = self::createTestClient(); + + $maxMessageSizeBytes = $this->getPrimaryServer()->getInfo()['maxMessageSizeBytes'] ?? null; + self::assertIsInt($maxMessageSizeBytes); + + $collectionName = str_repeat('c', $maxMessageSizeBytes); + $collection = $client->selectCollection($this->getDatabaseName(), $collectionName); + $bulkWrite = ClientBulkWrite::createWithCollection($collection); + $bulkWrite->insertOne(['a' => 'b']); + + try { + $client->bulkWrite($bulkWrite); + self::fail('Exception was not thrown'); + } catch (InvalidArgumentException $e) { + self::assertStringContainsString('unable to send document', $e->getMessage()); + } + } +} diff --git a/tests/SpecTests/Crud/Prose13_BulkWriteUnsupportedForAutoEncryptionTest.php b/tests/SpecTests/Crud/Prose13_BulkWriteUnsupportedForAutoEncryptionTest.php new file mode 100644 index 000000000..c59078f5f --- /dev/null +++ b/tests/SpecTests/Crud/Prose13_BulkWriteUnsupportedForAutoEncryptionTest.php @@ -0,0 +1,40 @@ +skipIfServerVersion('<', '8.0', 'bulkWrite command is not supported'); + + $this->skipIfClientSideEncryptionIsNotSupported(); + + $client = self::createTestClient(null, [], [ + 'autoEncryption' => [ + 'keyVaultNamespace' => $this->getNamespace(), + 'kmsProviders' => ['aws' => ['accessKeyId' => 'foo', 'secretAccessKey' => 'bar']], + ], + ]); + + $collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName()); + $bulkWrite = ClientBulkWrite::createWithCollection($collection); + $bulkWrite->insertOne(['a' => 'b']); + + try { + $client->bulkWrite($bulkWrite); + self::fail('InvalidArgumentException was not thrown'); + } catch (InvalidArgumentException $e) { + self::assertStringContainsString('bulkWrite does not currently support automatic encryption', $e->getMessage()); + } + } +} diff --git a/tests/SpecTests/Crud/Prose15_BulkWriteUnacknowledgedWriteConcernTest.php b/tests/SpecTests/Crud/Prose15_BulkWriteUnacknowledgedWriteConcernTest.php new file mode 100644 index 000000000..f7aa6b5bc --- /dev/null +++ b/tests/SpecTests/Crud/Prose15_BulkWriteUnacknowledgedWriteConcernTest.php @@ -0,0 +1,83 @@ +skipIfServerVersion('<', '8.0', 'bulkWrite command is not supported'); + + $client = self::createTestClient(); + + $hello = $this->getPrimaryServer()->getInfo(); + self::assertIsInt($maxBsonObjectSize = $hello['maxBsonObjectSize'] ?? null); + self::assertIsInt($maxMessageSizeBytes = $hello['maxMessageSizeBytes'] ?? null); + + // Explicitly create the collection to work around SERVER-95537 + $this->createCollection($this->getDatabaseName(), $this->getCollectionName()); + + $collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName()); + $bulkWrite = ClientBulkWrite::createWithCollection($collection, ['ordered' => false]); + + $numModels = (int) ($maxMessageSizeBytes / $maxBsonObjectSize) + 1; + + for ($i = 0; $i < $numModels; ++$i) { + $bulkWrite->insertOne(['a' => str_repeat('b', $maxBsonObjectSize - 500)]); + } + + $subscriber = new class implements CommandSubscriber { + public array $commandStartedEvents = []; + + public function commandStarted(CommandStartedEvent $event): void + { + if ($event->getCommandName() === 'bulkWrite') { + $this->commandStartedEvents[] = $event; + } + } + + public function commandSucceeded(CommandSucceededEvent $event): void + { + } + + public function commandFailed(CommandFailedEvent $event): void + { + } + }; + + $client->addSubscriber($subscriber); + + $result = $client->bulkWrite($bulkWrite, ['writeConcern' => new WriteConcern(0)]); + + self::assertFalse($result->isAcknowledged()); + self::assertCount(2, $subscriber->commandStartedEvents); + [$firstEvent, $secondEvent] = $subscriber->commandStartedEvents; + + $firstCommand = $firstEvent->getCommand(); + self::assertIsArray($firstCommand->ops ?? null); + self::assertCount($numModels - 1, $firstCommand->ops); + self::assertSame(0, $firstCommand->writeConcern->w ?? null); + + $secondCommand = $secondEvent->getCommand(); + self::assertIsArray($secondCommand->ops ?? null); + self::assertCount(1, $secondCommand->ops); + self::assertSame(0, $secondCommand->writeConcern->w ?? null); + + self::assertSame($numModels, $collection->countDocuments()); + } +} diff --git a/tests/SpecTests/Crud/Prose3_BulkWriteSplitsOnMaxWriteBatchSizeTest.php b/tests/SpecTests/Crud/Prose3_BulkWriteSplitsOnMaxWriteBatchSizeTest.php new file mode 100644 index 000000000..4173bffcf --- /dev/null +++ b/tests/SpecTests/Crud/Prose3_BulkWriteSplitsOnMaxWriteBatchSizeTest.php @@ -0,0 +1,68 @@ +skipIfServerVersion('<', '8.0', 'bulkWrite command is not supported'); + + $client = self::createTestClient(); + + $maxWriteBatchSize = $this->getPrimaryServer()->getInfo()['maxWriteBatchSize'] ?? null; + self::assertIsInt($maxWriteBatchSize); + + $this->dropCollection($this->getDatabaseName(), $this->getCollectionName()); + $collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName()); + $bulkWrite = ClientBulkWrite::createWithCollection($collection); + + for ($i = 0; $i < $maxWriteBatchSize + 1; ++$i) { + $bulkWrite->insertOne(['a' => 'b']); + } + + $subscriber = new class implements CommandSubscriber { + public array $commandStartedEvents = []; + + public function commandStarted(CommandStartedEvent $event): void + { + if ($event->getCommandName() === 'bulkWrite') { + $this->commandStartedEvents[] = $event; + } + } + + public function commandSucceeded(CommandSucceededEvent $event): void + { + } + + public function commandFailed(CommandFailedEvent $event): void + { + } + }; + + $client->addSubscriber($subscriber); + + $result = $client->bulkWrite($bulkWrite); + + self::assertSame($maxWriteBatchSize + 1, $result->getInsertedCount()); + self::assertCount(2, $subscriber->commandStartedEvents); + [$firstEvent, $secondEvent] = $subscriber->commandStartedEvents; + self::assertIsArray($firstCommandOps = $firstEvent->getCommand()->ops ?? null); + self::assertCount($maxWriteBatchSize, $firstCommandOps); + self::assertIsArray($secondCommandOps = $secondEvent->getCommand()->ops ?? null); + self::assertCount(1, $secondCommandOps); + self::assertEquals($firstEvent->getOperationId(), $secondEvent->getOperationId()); + } +} diff --git a/tests/SpecTests/Crud/Prose4_BulkWriteSplitsOnMaxMessageSizeBytesTest.php b/tests/SpecTests/Crud/Prose4_BulkWriteSplitsOnMaxMessageSizeBytesTest.php new file mode 100644 index 000000000..74678cedc --- /dev/null +++ b/tests/SpecTests/Crud/Prose4_BulkWriteSplitsOnMaxMessageSizeBytesTest.php @@ -0,0 +1,74 @@ +skipIfServerVersion('<', '8.0', 'bulkWrite command is not supported'); + + $client = self::createTestClient(); + + $hello = $this->getPrimaryServer()->getInfo(); + self::assertIsInt($maxBsonObjectSize = $hello['maxBsonObjectSize'] ?? null); + self::assertIsInt($maxMessageSizeBytes = $hello['maxMessageSizeBytes'] ?? null); + + $numModels = (int) ($maxMessageSizeBytes / $maxBsonObjectSize + 1); + $document = ['a' => str_repeat('b', $maxBsonObjectSize - 500)]; + + $this->dropCollection($this->getDatabaseName(), $this->getCollectionName()); + $collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName()); + $bulkWrite = ClientBulkWrite::createWithCollection($collection); + + for ($i = 0; $i < $numModels; ++$i) { + $bulkWrite->insertOne($document); + } + + $subscriber = new class implements CommandSubscriber { + public array $commandStartedEvents = []; + + public function commandStarted(CommandStartedEvent $event): void + { + if ($event->getCommandName() === 'bulkWrite') { + $this->commandStartedEvents[] = $event; + } + } + + public function commandSucceeded(CommandSucceededEvent $event): void + { + } + + public function commandFailed(CommandFailedEvent $event): void + { + } + }; + + $client->addSubscriber($subscriber); + + $result = $client->bulkWrite($bulkWrite); + + self::assertSame($numModels, $result->getInsertedCount()); + self::assertCount(2, $subscriber->commandStartedEvents); + [$firstEvent, $secondEvent] = $subscriber->commandStartedEvents; + self::assertIsArray($firstCommandOps = $firstEvent->getCommand()->ops ?? null); + self::assertCount($numModels - 1, $firstCommandOps); + self::assertIsArray($secondCommandOps = $secondEvent->getCommand()->ops ?? null); + self::assertCount(1, $secondCommandOps); + self::assertEquals($firstEvent->getOperationId(), $secondEvent->getOperationId()); + } +} diff --git a/tests/SpecTests/Crud/Prose5_BulkWriteCollectsWriteConcernErrorsAcrossBatchesTest.php b/tests/SpecTests/Crud/Prose5_BulkWriteCollectsWriteConcernErrorsAcrossBatchesTest.php new file mode 100644 index 000000000..8a0943db7 --- /dev/null +++ b/tests/SpecTests/Crud/Prose5_BulkWriteCollectsWriteConcernErrorsAcrossBatchesTest.php @@ -0,0 +1,81 @@ +skipIfServerVersion('<', '8.0', 'bulkWrite command is not supported'); + + $client = self::createTestClient(null, ['retryWrites' => false]); + + $maxWriteBatchSize = $this->getPrimaryServer()->getInfo()['maxWriteBatchSize'] ?? null; + self::assertIsInt($maxWriteBatchSize); + + $this->configureFailPoint([ + 'configureFailPoint' => 'failCommand', + 'mode' => ['times' => 2], + 'data' => [ + 'failCommands' => ['bulkWrite'], + 'writeConcernError' => [ + 'code' => 91, // ShutdownInProgress + 'errmsg' => 'Replication is being shut down', + ], + ], + ]); + + $this->dropCollection($this->getDatabaseName(), $this->getCollectionName()); + $collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName()); + $bulkWrite = ClientBulkWrite::createWithCollection($collection); + + for ($i = 0; $i < $maxWriteBatchSize + 1; ++$i) { + $bulkWrite->insertOne(['a' => 'b']); + } + + $subscriber = new class implements CommandSubscriber { + public int $numBulkWriteObserved = 0; + + public function commandStarted(CommandStartedEvent $event): void + { + if ($event->getCommandName() === 'bulkWrite') { + ++$this->numBulkWriteObserved; + } + } + + public function commandSucceeded(CommandSucceededEvent $event): void + { + } + + public function commandFailed(CommandFailedEvent $event): void + { + } + }; + + $client->addSubscriber($subscriber); + + try { + $client->bulkWrite($bulkWrite); + self::fail('BulkWriteCommandException was not thrown'); + } catch (BulkWriteCommandException $e) { + self::assertCount(2, $e->getWriteConcernErrors()); + $partialResult = $e->getPartialResult(); + self::assertNotNull($partialResult); + self::assertSame($maxWriteBatchSize + 1, $partialResult->getInsertedCount()); + self::assertSame(2, $subscriber->numBulkWriteObserved); + } + } +} diff --git a/tests/SpecTests/Crud/Prose6_BulkWriteHandlesWriteErrorsAcrossBatchesTest.php b/tests/SpecTests/Crud/Prose6_BulkWriteHandlesWriteErrorsAcrossBatchesTest.php new file mode 100644 index 000000000..8ea8bcf05 --- /dev/null +++ b/tests/SpecTests/Crud/Prose6_BulkWriteHandlesWriteErrorsAcrossBatchesTest.php @@ -0,0 +1,106 @@ +skipIfServerVersion('<', '8.0', 'bulkWrite command is not supported'); + } + + public function testOrdered(): void + { + $client = self::createTestClient(); + + $maxWriteBatchSize = $this->getPrimaryServer()->getInfo()['maxWriteBatchSize'] ?? null; + self::assertIsInt($maxWriteBatchSize); + + $this->dropCollection($this->getDatabaseName(), $this->getCollectionName()); + $collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName()); + $collection->insertOne(['_id' => 1]); + + $bulkWrite = ClientBulkWrite::createWithCollection($collection, ['ordered' => true]); + + for ($i = 0; $i < $maxWriteBatchSize + 1; ++$i) { + $bulkWrite->insertOne(['_id' => 1]); + } + + $subscriber = $this->createSubscriber(); + $client->addSubscriber($subscriber); + + try { + $client->bulkWrite($bulkWrite); + self::fail('BulkWriteCommandException was not thrown'); + } catch (BulkWriteCommandException $e) { + self::assertCount(1, $e->getWriteErrors()); + self::assertSame(1, $subscriber->numBulkWriteObserved); + } + } + + public function testUnordered(): void + { + $client = self::createTestClient(); + + $maxWriteBatchSize = $this->getPrimaryServer()->getInfo()['maxWriteBatchSize'] ?? null; + self::assertIsInt($maxWriteBatchSize); + + $this->dropCollection($this->getDatabaseName(), $this->getCollectionName()); + $collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName()); + $collection->insertOne(['_id' => 1]); + + $bulkWrite = ClientBulkWrite::createWithCollection($collection, ['ordered' => false]); + + for ($i = 0; $i < $maxWriteBatchSize + 1; ++$i) { + $bulkWrite->insertOne(['_id' => 1]); + } + + $subscriber = $this->createSubscriber(); + $client->addSubscriber($subscriber); + + try { + $client->bulkWrite($bulkWrite); + self::fail('BulkWriteCommandException was not thrown'); + } catch (BulkWriteCommandException $e) { + self::assertCount($maxWriteBatchSize + 1, $e->getWriteErrors()); + self::assertSame(2, $subscriber->numBulkWriteObserved); + } + } + + private function createSubscriber(): CommandSubscriber + { + return new class implements CommandSubscriber { + public int $numBulkWriteObserved = 0; + + public function commandStarted(CommandStartedEvent $event): void + { + if ($event->getCommandName() === 'bulkWrite') { + ++$this->numBulkWriteObserved; + } + } + + public function commandSucceeded(CommandSucceededEvent $event): void + { + } + + public function commandFailed(CommandFailedEvent $event): void + { + } + }; + } +} diff --git a/tests/SpecTests/Crud/Prose7_BulkWriteHandlesCursorRequiringGetMoreTest.php b/tests/SpecTests/Crud/Prose7_BulkWriteHandlesCursorRequiringGetMoreTest.php new file mode 100644 index 000000000..29149babe --- /dev/null +++ b/tests/SpecTests/Crud/Prose7_BulkWriteHandlesCursorRequiringGetMoreTest.php @@ -0,0 +1,72 @@ +skipIfServerVersion('<', '8.0', 'bulkWrite command is not supported'); + + $client = self::createTestClient(); + + $maxBsonObjectSize = $this->getPrimaryServer()->getInfo()['maxBsonObjectSize'] ?? null; + self::assertIsInt($maxBsonObjectSize); + + $this->dropCollection($this->getDatabaseName(), $this->getCollectionName()); + $collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName()); + + $bulkWrite = ClientBulkWrite::createWithCollection($collection, ['verboseResults' => true]); + $bulkWrite->updateOne( + ['_id' => str_repeat('a', (int) ($maxBsonObjectSize / 2))], + ['$set' => ['x' => 1]], + ['upsert' => true], + ); + $bulkWrite->updateOne( + ['_id' => str_repeat('b', (int) ($maxBsonObjectSize / 2))], + ['$set' => ['x' => 1]], + ['upsert' => true], + ); + + $subscriber = new class implements CommandSubscriber { + public int $numGetMoreObserved = 0; + + public function commandStarted(CommandStartedEvent $event): void + { + if ($event->getCommandName() === 'getMore') { + ++$this->numGetMoreObserved; + } + } + + public function commandSucceeded(CommandSucceededEvent $event): void + { + } + + public function commandFailed(CommandFailedEvent $event): void + { + } + }; + + $client->addSubscriber($subscriber); + + $result = $client->bulkWrite($bulkWrite); + + self::assertSame(2, $result->getUpsertedCount()); + self::assertCount(2, $result->getUpdateResults()); + self::assertSame(1, $subscriber->numGetMoreObserved); + } +} diff --git a/tests/SpecTests/Crud/Prose8_BulkWriteHandlesCursorRequiringGetMoreWithinTransactionTest.php b/tests/SpecTests/Crud/Prose8_BulkWriteHandlesCursorRequiringGetMoreWithinTransactionTest.php new file mode 100644 index 000000000..3c4d64d98 --- /dev/null +++ b/tests/SpecTests/Crud/Prose8_BulkWriteHandlesCursorRequiringGetMoreWithinTransactionTest.php @@ -0,0 +1,78 @@ +skipIfServerVersion('<', '8.0', 'bulkWrite command is not supported'); + $this->skipIfTransactionsAreNotSupported(); + + $client = self::createTestClient(); + + $maxBsonObjectSize = $this->getPrimaryServer()->getInfo()['maxBsonObjectSize'] ?? null; + self::assertIsInt($maxBsonObjectSize); + + $this->dropCollection($this->getDatabaseName(), $this->getCollectionName()); + $collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName()); + + $bulkWrite = ClientBulkWrite::createWithCollection($collection, ['verboseResults' => true]); + $bulkWrite->updateOne( + ['_id' => str_repeat('a', (int) ($maxBsonObjectSize / 2))], + ['$set' => ['x' => 1]], + ['upsert' => true], + ); + $bulkWrite->updateOne( + ['_id' => str_repeat('b', (int) ($maxBsonObjectSize / 2))], + ['$set' => ['x' => 1]], + ['upsert' => true], + ); + + $subscriber = new class implements CommandSubscriber { + public int $numGetMoreObserved = 0; + + public function commandStarted(CommandStartedEvent $event): void + { + if ($event->getCommandName() === 'getMore') { + ++$this->numGetMoreObserved; + } + } + + public function commandSucceeded(CommandSucceededEvent $event): void + { + } + + public function commandFailed(CommandFailedEvent $event): void + { + } + }; + + $client->addSubscriber($subscriber); + + $session = $client->startSession(); + $session->startTransaction(); + + /* Note: the prose test does not call for committing the transaction. + * The transaction will be aborted when the Session object is freed. */ + $result = $client->bulkWrite($bulkWrite, ['session' => $session]); + + self::assertSame(2, $result->getUpsertedCount()); + self::assertCount(2, $result->getUpdateResults()); + self::assertSame(1, $subscriber->numGetMoreObserved); + } +} diff --git a/tests/SpecTests/Crud/Prose9_BulkWriteHandlesGetMoreErrorTest.php b/tests/SpecTests/Crud/Prose9_BulkWriteHandlesGetMoreErrorTest.php new file mode 100644 index 000000000..903bf486b --- /dev/null +++ b/tests/SpecTests/Crud/Prose9_BulkWriteHandlesGetMoreErrorTest.php @@ -0,0 +1,100 @@ +skipIfServerVersion('<', '8.0', 'bulkWrite command is not supported'); + + $client = self::createTestClient(); + + $maxBsonObjectSize = $this->getPrimaryServer()->getInfo()['maxBsonObjectSize'] ?? null; + self::assertIsInt($maxBsonObjectSize); + + $this->configureFailPoint([ + 'configureFailPoint' => 'failCommand', + 'mode' => ['times' => 1], + 'data' => [ + 'failCommands' => ['getMore'], + 'errorCode' => self::UNKNOWN_ERROR, + ], + ]); + + $this->dropCollection($this->getDatabaseName(), $this->getCollectionName()); + $collection = $client->selectCollection($this->getDatabaseName(), $this->getCollectionName()); + + $bulkWrite = ClientBulkWrite::createWithCollection($collection, ['verboseResults' => true]); + $bulkWrite->updateOne( + ['_id' => str_repeat('a', (int) ($maxBsonObjectSize / 2))], + ['$set' => ['x' => 1]], + ['upsert' => true], + ); + $bulkWrite->updateOne( + ['_id' => str_repeat('b', (int) ($maxBsonObjectSize / 2))], + ['$set' => ['x' => 1]], + ['upsert' => true], + ); + + $subscriber = new class implements CommandSubscriber { + public int $numGetMoreObserved = 0; + public int $numKillCursorsObserved = 0; + + public function commandStarted(CommandStartedEvent $event): void + { + if ($event->getCommandName() === 'getMore') { + ++$this->numGetMoreObserved; + } elseif ($event->getCommandName() === 'killCursors') { + ++$this->numKillCursorsObserved; + } + } + + public function commandSucceeded(CommandSucceededEvent $event): void + { + } + + public function commandFailed(CommandFailedEvent $event): void + { + } + }; + + $client->addSubscriber($subscriber); + + try { + $client->bulkWrite($bulkWrite); + self::fail('BulkWriteCommandException was not thrown'); + } catch (BulkWriteCommandException $e) { + $errorReply = $e->getErrorReply(); + $this->assertNotNull($errorReply); + $this->assertSame(self::UNKNOWN_ERROR, $errorReply['code'] ?? null); + + // PHPC will also apply the top-level error code to BulkWriteCommandException + $this->assertSame(self::UNKNOWN_ERROR, $e->getCode()); + + $partialResult = $e->getPartialResult(); + self::assertNotNull($partialResult); + self::assertSame(2, $partialResult->getUpsertedCount()); + self::assertCount(1, $partialResult->getUpdateResults()); + self::assertSame(1, $subscriber->numGetMoreObserved); + self::assertSame(1, $subscriber->numKillCursorsObserved); + } + } +} diff --git a/tests/SpecTests/DocumentsMatchConstraint.php b/tests/SpecTests/DocumentsMatchConstraint.php index 1b3680d3f..82f4885d0 100644 --- a/tests/SpecTests/DocumentsMatchConstraint.php +++ b/tests/SpecTests/DocumentsMatchConstraint.php @@ -12,11 +12,10 @@ use RuntimeException; use SebastianBergmann\Comparator\ComparisonFailure; use SebastianBergmann\Comparator\Factory; +use SebastianBergmann\Exporter\Exporter; use stdClass; -use Symfony\Bridge\PhpUnit\ConstraintTrait; use function array_values; -use function get_class; use function get_debug_type; use function is_array; use function is_float; @@ -37,12 +36,6 @@ */ class DocumentsMatchConstraint extends Constraint { - use ConstraintTrait; - - private bool $ignoreExtraKeysInRoot = false; - - private bool $ignoreExtraKeysInEmbedded = false; - /** * TODO: This is not currently used, but was preserved from the design of * TestCase::assertMatchesDocument(), which would sort keys and then compare @@ -52,8 +45,7 @@ class DocumentsMatchConstraint extends Constraint */ private bool $sortKeys = false; - /** @var BSONArray|BSONDocument */ - private $value; + private BSONArray|BSONDocument $value; private ?ComparisonFailure $lastFailure = null; @@ -62,19 +54,16 @@ class DocumentsMatchConstraint extends Constraint /** * Creates a new constraint. * - * @param array|object $value - * @param boolean $ignoreExtraKeysInRoot If true, ignore extra keys within the root document - * @param boolean $ignoreExtraKeysInEmbedded If true, ignore extra keys within embedded documents + * @param boolean $ignoreExtraKeysInRoot If true, ignore extra keys within the root document + * @param boolean $ignoreExtraKeysInEmbedded If true, ignore extra keys within embedded documents */ - public function __construct($value, bool $ignoreExtraKeysInRoot = false, bool $ignoreExtraKeysInEmbedded = false) + public function __construct(array|object $value, private bool $ignoreExtraKeysInRoot = false, private bool $ignoreExtraKeysInEmbedded = false) { $this->value = $this->prepareBSON($value, true, $this->sortKeys); - $this->ignoreExtraKeysInRoot = $ignoreExtraKeysInRoot; - $this->ignoreExtraKeysInEmbedded = $ignoreExtraKeysInEmbedded; $this->comparatorFactory = Factory::getInstance(); } - private function doEvaluate($other, $description = '', $returnResult = false) + public function evaluate($other, string $description = '', bool $returnResult = false): ?bool { /* TODO: If ignoreExtraKeys and sortKeys are both false, then we may be * able to skip preparation, convert both documents to extended JSON, @@ -92,12 +81,12 @@ private function doEvaluate($other, $description = '', $returnResult = false) $this->assertEquals($this->value, $other, $this->ignoreExtraKeysInRoot); $success = true; } catch (RuntimeException $e) { + $exporter = new Exporter(); $this->lastFailure = new ComparisonFailure( $this->value, $other, - $this->exporter()->export($this->value), - $this->exporter()->export($other), - false, + $exporter->export($this->value), + $exporter->export($other), $e->getMessage(), ); } @@ -109,13 +98,12 @@ private function doEvaluate($other, $description = '', $returnResult = false) if (! $success) { $this->fail($other, $description, $this->lastFailure); } + + return null; } - /** - * @param string|string[] $expectedType - * @param mixed $actualValue - */ - private function assertBSONType($expectedType, $actualValue): void + /** @param string|BSONArray[] $expectedType */ + private function assertBSONType(string|BSONArray $expectedType, mixed $actualValue): void { assertThat( $expectedType, @@ -133,11 +121,11 @@ private function assertBSONType($expectedType, $actualValue): void */ private function assertEquals(ArrayObject $expected, ArrayObject $actual, bool $ignoreExtraKeys, string $keyPrefix = ''): void { - if (get_class($expected) !== get_class($actual)) { + if ($expected::class !== $actual::class) { throw new RuntimeException(sprintf( '%s is not instance of expected class "%s"', - $this->exporter()->shortenedExport($actual), - get_class($expected), + (new Exporter())->shortenedExport($actual), + $expected::class, )); } @@ -175,11 +163,10 @@ private function assertEquals(ArrayObject $expected, ArrayObject $actual, bool $ $actualValue, '', '', - false, sprintf( 'Field path "%s": %s is not instance of expected type "%s".', $keyPrefix . $key, - $this->exporter()->shortenedExport($actualValue), + (new Exporter())->shortenedExport($actualValue), $expectedType, ), ); @@ -193,7 +180,6 @@ private function assertEquals(ArrayObject $expected, ArrayObject $actual, bool $ $actualValue, '', '', - false, sprintf('Field path "%s": %s', $keyPrefix . $key, $failure->getMessage()), ); } @@ -210,7 +196,7 @@ private function assertEquals(ArrayObject $expected, ArrayObject $actual, bool $ } } - private function doAdditionalFailureDescription($other) + protected function additionalFailureDescription($other): string { if ($this->lastFailure === null) { return ''; @@ -219,12 +205,12 @@ private function doAdditionalFailureDescription($other) return $this->lastFailure->getMessage(); } - private function doFailureDescription($other) + protected function failureDescription($other): string { return 'two BSON objects are equal'; } - private function doMatches($other) + protected function matches($other): bool { /* TODO: If ignoreExtraKeys and sortKeys are both false, then we may be * able to skip preparation, convert both documents to extended JSON, @@ -237,16 +223,16 @@ private function doMatches($other) try { $this->assertEquals($this->value, $other, $this->ignoreExtraKeysInRoot); - } catch (RuntimeException $e) { + } catch (RuntimeException) { return false; } return true; } - private function doToString() + public function toString(): string { - return 'matches ' . $this->exporter()->export($this->value); + return 'matches ' . (new Exporter())->export($this->value); } private static function isNumeric($value): bool @@ -261,12 +247,10 @@ private static function isNumeric($value): bool * its type and keys. Keys within documents will optionally be sorted. Each * value within the array or document will then be prepared recursively. * - * @param array|object $bson - * @param boolean $isRoot If true, ensure an array value is converted to a document - * @return BSONDocument|BSONArray + * @param boolean $isRoot If true, ensure an array value is converted to a document * @throws InvalidArgumentException if $bson is not an array or object */ - private function prepareBSON($bson, bool $isRoot, bool $sortKeys = false) + private function prepareBSON(array|object $bson, bool $isRoot, bool $sortKeys = false): BSONDocument|BSONArray { if (! is_array($bson) && ! is_object($bson)) { throw new InvalidArgumentException('$bson is not an array or object'); diff --git a/tests/SpecTests/DocumentsMatchConstraintTest.php b/tests/SpecTests/DocumentsMatchConstraintTest.php index f4959882d..f410591bf 100644 --- a/tests/SpecTests/DocumentsMatchConstraintTest.php +++ b/tests/SpecTests/DocumentsMatchConstraintTest.php @@ -16,6 +16,7 @@ use MongoDB\Model\BSONArray; use MongoDB\Model\BSONDocument; use MongoDB\Tests\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use const PHP_INT_SIZE; @@ -70,7 +71,7 @@ public function testIgnoreExtraKeysInEmbedded(): void $this->assertResult(false, $c, [1, ['a' => 2]], 'Keys must have the correct value'); } - /** @dataProvider provideBSONTypes */ + #[DataProvider('provideBSONTypes')] public function testBSONTypeAssertions($type, $value): void { $constraint = new DocumentsMatchConstraint(['x' => ['$$type' => $type]]); @@ -78,7 +79,7 @@ public function testBSONTypeAssertions($type, $value): void $this->assertResult(true, $constraint, ['x' => $value], 'Type matches'); } - public function provideBSONTypes() + public static function provideBSONTypes() { $undefined = Document::fromJSON('{ "x": {"$undefined": true} }')->toPHP()->x; $symbol = Document::fromJSON('{ "x": {"$symbol": "test"} }')->toPHP()->x; @@ -132,7 +133,7 @@ public function testBSONTypeAssertionsWithMultipleTypes(): void $this->assertResult(false, $c2, ['x' => true], 'bool is not number or string'); } - /** @dataProvider errorMessageProvider */ + #[DataProvider('errorMessageProvider')] public function testErrorMessages($expectedMessagePart, DocumentsMatchConstraint $constraint, $actualValue): void { try { @@ -144,7 +145,7 @@ public function testErrorMessages($expectedMessagePart, DocumentsMatchConstraint } } - public function errorMessageProvider() + public static function errorMessageProvider() { return [ 'Root type mismatch' => [ diff --git a/tests/SpecTests/ErrorExpectation.php b/tests/SpecTests/ErrorExpectation.php index df13dcf2a..cc10dcba9 100644 --- a/tests/SpecTests/ErrorExpectation.php +++ b/tests/SpecTests/ErrorExpectation.php @@ -12,7 +12,6 @@ use stdClass; use Throwable; -use function get_class; use function is_array; use function is_string; use function sprintf; @@ -105,7 +104,7 @@ public function assert(TestCase $test, ?Throwable $actual = null): void { if (! $this->isExpected) { if ($actual !== null) { - $test->fail(sprintf("Operation threw unexpected %s: %s\n%s", get_class($actual), $actual->getMessage(), $actual->getTraceAsString())); + $test->fail(sprintf("Operation threw unexpected %s: %s\n%s", $actual::class, $actual->getMessage(), $actual->getTraceAsString())); } $test->addToAssertionCount(1); @@ -164,13 +163,13 @@ private function assertCodeName(TestCase $test, ?Throwable $actual = null): void $result = $actual->getResultDocument(); if (isset($result->writeConcernError)) { - $test->assertObjectHasAttribute('codeName', $result->writeConcernError); + $test->assertObjectHasProperty('codeName', $result->writeConcernError); $test->assertSame($this->codeName, $result->writeConcernError->codeName); return; } - $test->assertObjectHasAttribute('codeName', $result); + $test->assertObjectHasProperty('codeName', $result); $test->assertSame($this->codeName, $result->codeName); } diff --git a/tests/SpecTests/FunctionalTestCase.php b/tests/SpecTests/FunctionalTestCase.php index 16fc999db..6ee6d0e46 100644 --- a/tests/SpecTests/FunctionalTestCase.php +++ b/tests/SpecTests/FunctionalTestCase.php @@ -84,11 +84,8 @@ public static function assertCommandReplyMatches(stdClass $expected, stdClass $a * Asserts that two given documents match. * * Extra keys in the actual value's document(s) will be ignored. - * - * @param array|object $expectedDocument - * @param array|object $actualDocument */ - public static function assertDocumentsMatch($expectedDocument, $actualDocument, string $message = ''): void + public static function assertDocumentsMatch(array|object $expectedDocument, array|object $actualDocument, string $message = ''): void { $constraint = new DocumentsMatchConstraint($expectedDocument, true, true); @@ -100,14 +97,14 @@ public static function assertDocumentsMatch($expectedDocument, $actualDocument, * * Note: this method may modify the $expected object. * - * @see https://github.com/mongodb/specifications/blob/master/source/transactions/tests/README.rst#null-values + * @see https://github.com/mongodb/specifications/blob/master/source/transactions/tests/README.md#null-values * @see https://github.com/mongodb/specifications/blob/09ee1ebc481f1502e3246971a9419e484d736207/source/command-monitoring/tests/README.rst#additional-values */ protected static function assertCommandOmittedFields(stdClass $expected, stdClass $actual): void { foreach ($expected as $key => $value) { if ($value === null) { - static::assertObjectNotHasAttribute($key, $actual); + static::assertObjectNotHasProperty($key, $actual); unset($expected->{$key}); } } @@ -129,18 +126,11 @@ protected function assertOutcomeCollectionData(array $expectedDocuments, int $re $this->assertNotNull($expectedDocument); $this->assertNotNull($actualDocument); - switch ($resultExpectation) { - case ResultExpectation::ASSERT_SAME_DOCUMENT: - $this->assertSameDocument($expectedDocument, $actualDocument); - break; - - case ResultExpectation::ASSERT_DOCUMENTS_MATCH: - $this->assertDocumentsMatch($expectedDocument, $actualDocument); - break; - - default: - $this->fail(sprintf('Invalid result expectation "%d" for %s', $resultExpectation, __METHOD__)); - } + match ($resultExpectation) { + ResultExpectation::ASSERT_SAME_DOCUMENT => $this->assertSameDocument($expectedDocument, $actualDocument), + ResultExpectation::ASSERT_DOCUMENTS_MATCH => $this->assertDocumentsMatch($expectedDocument, $actualDocument), + default => $this->fail(sprintf('Invalid result expectation "%d" for %s', $resultExpectation, __METHOD__)), + }; } } @@ -173,10 +163,8 @@ protected function checkServerRequirements(array $runOn): void * * This decodes the file through the driver's extended JSON parser to ensure * proper handling of special types. - * - * @return array|object */ - protected function decodeJson(string $json) + protected function decodeJson(string $json): array|object { return Document::fromJSON($json)->toPHP(); } @@ -289,18 +277,7 @@ private function isServerlessRequirementSatisfied(?string $serverlessMode): bool return true; } - switch ($serverlessMode) { - case self::SERVERLESS_ALLOW: - return true; - - case self::SERVERLESS_FORBID: - return ! static::isServerless(); - - case self::SERVERLESS_REQUIRE: - return static::isServerless(); - } - - throw new UnexpectedValueException(sprintf('Invalid serverless requirement "%s" found.', $serverlessMode)); + return $serverlessMode !== self::SERVERLESS_REQUIRE; } /** diff --git a/tests/SpecTests/Operation.php b/tests/SpecTests/Operation.php index f7d437542..d605a52aa 100644 --- a/tests/SpecTests/Operation.php +++ b/tests/SpecTests/Operation.php @@ -12,9 +12,9 @@ use MongoDB\Driver\Server; use MongoDB\Driver\Session; use MongoDB\GridFS\Bucket; -use MongoDB\MapReduceResult; use MongoDB\Operation\FindOneAndReplace; use MongoDB\Operation\FindOneAndUpdate; +use PHPUnit\Framework\Assert; use stdClass; use function array_diff_key; @@ -183,10 +183,6 @@ public function assert(FunctionalTestCase $test, Context $context, bool $bubbleE * is not used (e.g. Command Monitoring spec). */ if ($result instanceof Cursor) { $result = $result->toArray(); - } elseif ($result instanceof MapReduceResult) { - /* For mapReduce operations, we ignore the mapReduce metadata - * and only return the result iterator for evaluation. */ - $result = iterator_to_array($result->getIterator()); } } catch (Exception $e) { $exception = $e; @@ -213,10 +209,9 @@ public function assert(FunctionalTestCase $test, Context $context, bool $bubbleE /** * Executes the operation with a given context. * - * @return mixed * @throws LogicException if the operation is unsupported */ - private function execute(FunctionalTestCase $test, Context $context) + private function execute(FunctionalTestCase $test, Context $context): mixed { switch ($this->object) { case self::OBJECT_CLIENT: @@ -266,10 +261,9 @@ private function execute(FunctionalTestCase $test, Context $context) /** * Executes the client operation and return its result. * - * @return mixed * @throws LogicException if the collection operation is unsupported */ - private function executeForClient(Client $client, Context $context) + private function executeForClient(Client $client, Context $context): mixed { $args = $context->prepareOptions($this->arguments); $context->replaceArgumentSessionPlaceholder($args); @@ -295,10 +289,9 @@ private function executeForClient(Client $client, Context $context) /** * Executes the collection operation and return its result. * - * @return mixed * @throws LogicException if the collection operation is unsupported */ - private function executeForCollection(Collection $collection, Context $context) + private function executeForCollection(Collection $collection, Context $context): mixed { $args = $context->prepareOptions($this->arguments); $context->replaceArgumentSessionPlaceholder($args); @@ -414,12 +407,8 @@ private function executeForCollection(Collection $collection, Context $context) return $collection->listIndexes($args); case 'mapReduce': - return $collection->mapReduce( - $args['map'], - $args['reduce'], - $args['out'], - array_diff_key($args, ['map' => 1, 'reduce' => 1, 'out' => 1]), - ); + Assert::markTestSkipped('mapReduce is not supported'); + break; case 'watch': return $collection->watch( @@ -435,10 +424,9 @@ private function executeForCollection(Collection $collection, Context $context) /** * Executes the database operation and return its result. * - * @return mixed * @throws LogicException if the database operation is unsupported */ - private function executeForDatabase(Database $database, Context $context) + private function executeForDatabase(Database $database, Context $context): mixed { $args = $context->prepareOptions($this->arguments); $context->replaceArgumentSessionPlaceholder($args); @@ -488,10 +476,9 @@ private function executeForDatabase(Database $database, Context $context) /** * Executes the GridFS bucket operation and return its result. * - * @return mixed * @throws LogicException if the database operation is unsupported */ - private function executeForGridFSBucket(Bucket $bucket, Context $context) + private function executeForGridFSBucket(Bucket $bucket, Context $context): mixed { $args = $context->prepareOptions($this->arguments); $context->replaceArgumentSessionPlaceholder($args); @@ -529,10 +516,9 @@ private function executeForGridFSBucket(Bucket $bucket, Context $context) /** * Executes the session operation and return its result. * - * @return mixed * @throws LogicException if the session operation is unsupported */ - private function executeForSession(Session $session, FunctionalTestCase $test, Context $context) + private function executeForSession(Session $session, FunctionalTestCase $test, Context $context): mixed { switch ($this->name) { case 'abortTransaction': diff --git a/tests/SpecTests/PrimaryStepDownSpecTest.php b/tests/SpecTests/PrimaryStepDownSpecTest.php index 7fd0be6e1..bc060c061 100644 --- a/tests/SpecTests/PrimaryStepDownSpecTest.php +++ b/tests/SpecTests/PrimaryStepDownSpecTest.php @@ -215,7 +215,7 @@ public function testGetMoreIteration(): void $attempts++; $primary->executeCommand('admin', new Command(['replSetStepDown' => 5, 'force' => true])); $success = true; - } catch (DriverException $e) { + } catch (DriverException) { if ($attempts == 10) { $this->fail(sprintf('Could not successfully execute replSetStepDown within %d attempts', $attempts)); } @@ -270,7 +270,7 @@ private function getTotalConnectionsCreated(?Server $server = null) $cursor = $server->executeCommand( $this->getDatabaseName(), new Command(['serverStatus' => 1]), - new ReadPreference(ReadPreference::PRIMARY), + ['readPreference' => new ReadPreference(ReadPreference::PRIMARY)], ); $cursor->setTypeMap(['root' => 'array', 'document' => 'array']); @@ -289,7 +289,7 @@ private function waitForPrimaryReelection(): void $this->insertDocuments(1); return; - } catch (DriverException $e) { + } catch (DriverException) { $this->client->getManager()->selectServer(); return; diff --git a/tests/SpecTests/ResultExpectation.php b/tests/SpecTests/ResultExpectation.php index 580bdfd0a..b4db23cca 100644 --- a/tests/SpecTests/ResultExpectation.php +++ b/tests/SpecTests/ResultExpectation.php @@ -36,15 +36,12 @@ final class ResultExpectation public const ASSERT_CALLABLE = 11; public const ASSERT_DOCUMENTS_MATCH = 12; - private int $assertionType = self::ASSERT_NOTHING; - - /** @var mixed */ - private $expectedValue; + private mixed $expectedValue; /** @var callable */ private $assertionCallable; - private function __construct(int $assertionType, $expectedValue) + private function __construct(private int $assertionType, $expectedValue) { switch ($assertionType) { case self::ASSERT_BULKWRITE: @@ -66,7 +63,6 @@ private function __construct(int $assertionType, $expectedValue) break; } - $this->assertionType = $assertionType; $this->expectedValue = $expectedValue; } @@ -332,10 +328,9 @@ private static function isArrayOfObjects($array) /** * Determines whether the result is actually an error expectation. * - * @see https://github.com/mongodb/specifications/blob/master/source/transactions/tests/README.rst#test-format - * @param mixed $result + * @see https://github.com/mongodb/specifications/blob/master/source/transactions/tests/README.md#test-format */ - private static function isErrorResult($result): bool + private static function isErrorResult(mixed $result): bool { if (! is_object($result)) { return false; diff --git a/tests/SpecTests/RetryableWrites/Prose3_ReturnOriginalErrorTest.php b/tests/SpecTests/RetryableWrites/Prose3_ReturnOriginalErrorTest.php index 0b80b6af9..55afae5e0 100644 --- a/tests/SpecTests/RetryableWrites/Prose3_ReturnOriginalErrorTest.php +++ b/tests/SpecTests/RetryableWrites/Prose3_ReturnOriginalErrorTest.php @@ -13,7 +13,6 @@ * Prose test 3: Return Original Error * * @see https://github.com/mongodb/specifications/blob/master/source/retryable-writes/tests/README.md - * @group serverless */ class Prose3_ReturnOriginalErrorTest extends FunctionalTestCase { @@ -44,11 +43,8 @@ public function testNoWritesPerformedErrorReturnsOriginalError(): void ]); $subscriber = new class ($this) implements CommandSubscriber { - private FunctionalTestCase $testCase; - - public function __construct(FunctionalTestCase $testCase) + public function __construct(private FunctionalTestCase $testCase) { - $this->testCase = $testCase; } public function commandStarted(CommandStartedEvent $event): void diff --git a/tests/SpecTests/SearchIndexSpecTest.php b/tests/SpecTests/SearchIndexSpecTest.php index d5ed619ef..6f8d3b144 100644 --- a/tests/SpecTests/SearchIndexSpecTest.php +++ b/tests/SpecTests/SearchIndexSpecTest.php @@ -6,6 +6,7 @@ use MongoDB\Collection; use MongoDB\Model\CachingIterator; use MongoDB\Tests\FunctionalTestCase; +use PHPUnit\Framework\Attributes\Group; use function bin2hex; use function count; @@ -18,9 +19,9 @@ /** * Functional tests for the Atlas Search index management. * - * @see https://github.com/mongodb/specifications/blob/master/source/index-management/tests/README.rst#search-index-management-helpers - * @group atlas + * @see https://github.com/mongodb/specifications/blob/master/source/index-management/tests/README.md#search-index-management-helpers */ +#[Group('atlas')] class SearchIndexSpecTest extends FunctionalTestCase { private const WAIT_TIMEOUT_SEC = 300; @@ -28,19 +29,15 @@ class SearchIndexSpecTest extends FunctionalTestCase public function setUp(): void { - if (! self::isAtlas()) { - self::markTestSkipped('Search Indexes are only supported on MongoDB Atlas 7.0+'); - } - parent::setUp(); - $this->skipIfServerVersion('<', '7.0', 'Search Indexes are only supported on MongoDB Atlas 7.0+'); + $this->skipIfAtlasSearchIndexIsNotSupported(); } /** * Case 1: Driver can successfully create and list search indexes * - * @see https://github.com/mongodb/specifications/blob/master/source/index-management/tests/README.rst#case-1-driver-can-successfully-create-and-list-search-indexes + * @see https://github.com/mongodb/specifications/blob/master/source/index-management/tests/README.md#case-1-driver-can-successfully-create-and-list-search-indexes */ public function testCreateAndListSearchIndexes(): void { @@ -64,7 +61,7 @@ public function testCreateAndListSearchIndexes(): void /** * Case 2: Driver can successfully create multiple indexes in batch * - * @see https://github.com/mongodb/specifications/blob/master/source/index-management/tests/README.rst#case-2-driver-can-successfully-create-multiple-indexes-in-batch + * @see https://github.com/mongodb/specifications/blob/master/source/index-management/tests/README.md#case-2-driver-can-successfully-create-multiple-indexes-in-batch */ public function testCreateMultipleIndexesInBatch(): void { @@ -91,7 +88,7 @@ public function testCreateMultipleIndexesInBatch(): void /** * Case 3: Driver can successfully drop search indexes * - * @see https://github.com/mongodb/specifications/blob/master/source/index-management/tests/README.rst#case-3-driver-can-successfully-drop-search-indexes + * @see https://github.com/mongodb/specifications/blob/master/source/index-management/tests/README.md#case-3-driver-can-successfully-drop-search-indexes */ public function testDropSearchIndexes(): void { @@ -117,7 +114,7 @@ public function testDropSearchIndexes(): void /** * Case 4: Driver can update a search index * - * @see https://github.com/mongodb/specifications/blob/master/source/index-management/tests/README.rst#case-4-driver-can-update-a-search-index + * @see https://github.com/mongodb/specifications/blob/master/source/index-management/tests/README.md#case-4-driver-can-update-a-search-index */ public function testUpdateSearchIndex(): void { @@ -147,7 +144,7 @@ public function testUpdateSearchIndex(): void /** * Case 5: dropSearchIndex suppresses namespace not found errors * - * @see https://github.com/mongodb/specifications/blob/master/source/index-management/tests/README.rst#case-5-dropsearchindex-suppresses-namespace-not-found-errors + * @see https://github.com/mongodb/specifications/blob/master/source/index-management/tests/README.md#case-5-dropsearchindex-suppresses-namespace-not-found-errors */ public function testDropSearchIndexSuppressNamespaceNotFoundError(): void { diff --git a/tests/SpecTests/TransactionsSpecTest.php b/tests/SpecTests/TransactionsSpecTest.php index 8053bd4ac..148f29d0f 100644 --- a/tests/SpecTests/TransactionsSpecTest.php +++ b/tests/SpecTests/TransactionsSpecTest.php @@ -10,7 +10,7 @@ /** * Transactions spec prose tests. * - * @see https://github.com/mongodb/specifications/blob/master/source/transactions/tests/README.rst#mongos-pinning-prose-tests + * @see https://github.com/mongodb/specifications/blob/master/source/transactions/tests/README.md#mongos-pinning-prose-tests */ class TransactionsSpecTest extends FunctionalTestCase { diff --git a/tests/SpecTests/client-side-encryption/corpus/corpus-encrypted.json b/tests/SpecTests/client-side-encryption/corpus/corpus-encrypted.json deleted file mode 100644 index 1b72aa8a3..000000000 --- a/tests/SpecTests/client-side-encryption/corpus/corpus-encrypted.json +++ /dev/null @@ -1,9515 +0,0 @@ -{ - "_id": "client_side_encryption_corpus", - "altname_aws": "aws", - "altname_local": "local", - "aws_double_rand_auto_id": { - "kms": "aws", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAABchrWPF5OPeuFpk4tUV325TmoNpGW+L5iPSXcLQIr319WJFIp3EDy5QiAHBfz2rThI7imU4eLXndIUrsjM0S/vg==", - "subType": "06" - } - } - }, - "aws_double_rand_auto_altname": { - "kms": "aws", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAABga5hXFiFvH/wOr0wOHSHFWRZ4pEs/UCC1XJWf46Dod3GY9Ry5j1ZyzeHueJxc4Ym5M8UHKSmJuXmNo9m9ZnkiA==", - "subType": "06" - } - } - }, - "aws_double_rand_explicit_id": { - "kms": "aws", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAABjTYZbsro/YxLWBb88qPXEIDQdzY7UZyK4UaZZ8h62OTxp43Zp9j6WvOEzKhXt4oJPMxlAxyTdqO6MllX5bsDrw==", - "subType": "06" - } - } - }, - "aws_double_rand_explicit_altname": { - "kms": "aws", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAABqkyXdeS3aWH2tRFoKxsIIL3ZH05gkiAEbutrjrdfw0b110iPhuCCOb0gP/nX/NRNCg1kCFZ543Vu0xZ0BRXlvQ==", - "subType": "06" - } - } - }, - "aws_double_det_explicit_id": { - "kms": "aws", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$numberDouble": "1.234" } - }, - "aws_double_det_explicit_altname": { - "kms": "aws", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$numberDouble": "1.234" } - }, - "aws_string_rand_auto_id": { - "kms": "aws", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAACAsI5E0rVT8TpIONY3TnbRvIxUjKsiy9ynVd/fE7U1lndE7KR6dTzs8QWK13kdKxO+njKPeC2ObBX904QmJ65Sw==", - "subType": "06" - } - } - }, - "aws_string_rand_auto_altname": { - "kms": "aws", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAACgBE6J6MRxPSDe+gfJPL8nBvuEIRBYxNS/73LqBTDJYyN/lsHQ6UlFDT5B4EkIPmHPTe+UBMOhZQ1bsP+DK8Aog==", - "subType": "06" - } - } - }, - "aws_string_rand_explicit_id": { - "kms": "aws", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAACbdTVDBWn35M5caKZgLFoiSVeFGKRj5K/QtupKNc8/dPIyCE+/a4PU51G/YIzFpYmp91nLpyq7lD/eJ/V0q66Zw==", - "subType": "06" - } - } - }, - "aws_string_rand_explicit_altname": { - "kms": "aws", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAACa4O+kE2BaqM0E+yiBrbCuE0YEGTrZ7L/+SuWm9gN3UupxwAQpRfxXAuUCTc9u1CXnvL+ga+VJMcWD2bawnn/Rg==", - "subType": "06" - } - } - }, - "aws_string_det_auto_id": { - "kms": "aws", - "type": "string", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAACyvOW8NcqRkZYzujivwVmYptJkic27PWr3Nq3Yv5Njz8cJdoyesVaQan6mn+U3wdfGEH8zbUUISdCx5qgvXEpvw==", - "subType": "06" - } - } - }, - "aws_string_det_explicit_id": { - "kms": "aws", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAACyvOW8NcqRkZYzujivwVmYptJkic27PWr3Nq3Yv5Njz8cJdoyesVaQan6mn+U3wdfGEH8zbUUISdCx5qgvXEpvw==", - "subType": "06" - } - } - }, - "aws_string_det_explicit_altname": { - "kms": "aws", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAACyvOW8NcqRkZYzujivwVmYptJkic27PWr3Nq3Yv5Njz8cJdoyesVaQan6mn+U3wdfGEH8zbUUISdCx5qgvXEpvw==", - "subType": "06" - } - } - }, - "aws_object_rand_auto_id": { - "kms": "aws", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAADI+/afY6Eka8j1VNThWIeGkDZ7vo4/l66a01Z+lVUFFnVLeUV/nz9kM6uTTplNRUa+RXmNmwkoR/BHRnGc7wRNA==", - "subType": "06" - } - } - }, - "aws_object_rand_auto_altname": { - "kms": "aws", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAADzN4hVXWXKerhggRRtwWnDu2W2wQ5KIWb/X1WCZJKTjQSQ5LNHVasabBCa4U1q46PQ5pDDM1PkVjW6o+zzl/4xw==", - "subType": "06" - } - } - }, - "aws_object_rand_explicit_id": { - "kms": "aws", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAADhSs5zKFMuuux3fqFFuPito3N+bp5TgmkUtJtFXjmA/EnLuexGARvEeGUsMJ/n0VzKbbsiE8+AsUNY3o9YXutqQ==", - "subType": "06" - } - } - }, - "aws_object_rand_explicit_altname": { - "kms": "aws", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAADpj8MSov16h26bFDrHepsNkW+tOLOjRP7oj1Tnj75qZ+uqxxVkQ5B/t/Ihk5fikHTJGAcRBR5Vv6kJ/ulMaDnvQ==", - "subType": "06" - } - } - }, - "aws_object_det_explicit_id": { - "kms": "aws", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "x": { "$numberInt": "1" } } - }, - "aws_object_det_explicit_altname": { - "kms": "aws", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "x": { "$numberInt": "1" } } - }, - "aws_array_rand_auto_id": { - "kms": "aws", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAETWDOZ6zV39H2+W+BkwZIoxI3BNF6phKoiBZ9+i4T9uEoyU3TmoTPjuI0YNwR1v/p5/9rlVCG0KLZd16eeMb3zxZXjqh6IAJqfhsBQ7bzBYI=", - "subType": "06" - } - } - }, - "aws_array_rand_auto_altname": { - "kms": "aws", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAE1xeHbld2JjUiPB1k+xMZuIzNSai7mv1iusCswxKEfYCZ7YtR0GDQTxN4676CwhcodSDiysjgOxSFIGlptKCvl0k46LNq0EGypP9yWBLvdjQ=", - "subType": "06" - } - } - }, - "aws_array_rand_explicit_id": { - "kms": "aws", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAEFVa4U2uW65MGihhdOmpZFgnwGTs3VeN5TXXbXJ5cfm0CwXF3EPlzAVjy5WO/+lbvFufpQnIiLH59/kVygmwn+2P9zPNJnSGIJW9gaV8Vye8=", - "subType": "06" - } - } - }, - "aws_array_rand_explicit_altname": { - "kms": "aws", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAE11VXbfg7DJQ5/CB9XdBO0hCrxOkK3RrEjPGJ0FXlUo76IMna1uo+NVmDnM63CRlGE3/TEbZPpp0w0jn4vZLKvBmGr7o7WQusRY4jnRf5oH4=", - "subType": "06" - } - } - }, - "aws_array_det_explicit_id": { - "kms": "aws", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": [ - { "$numberInt": "1" }, - { "$numberInt": "2" }, - { "$numberInt": "3" } - ] - }, - "aws_array_det_explicit_altname": { - "kms": "aws", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": [ - { "$numberInt": "1" }, - { "$numberInt": "2" }, - { "$numberInt": "3" } - ] - }, - "aws_binData=00_rand_auto_id": { - "kms": "aws", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAFpZYSktIHzGLZ6mcBFxywICqxdurqLVJcQR34ngix5YIOOulCYEhBSDzzSEyixEPCuU6cEzeuafpZRHX4qgcr9Q==", - "subType": "06" - } - } - }, - "aws_binData=00_rand_auto_altname": { - "kms": "aws", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAFshzESR9SyR++9r2yeaEjJYScMDez414s8pZkB3C8ihDa+rsyaxNy4yrF7qNEWjFrdFaH7zD2LdlPx+TKZgROlg==", - "subType": "06" - } - } - }, - "aws_binData=00_rand_explicit_id": { - "kms": "aws", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAFpYwZRPDom7qyAe5WW/QNSq97/OYgRT8xUEaaR5pkbQEFd/Cwtl8Aib/3Bs1CT3MVaHVWna2u5Gcc4s/v18zLhg==", - "subType": "06" - } - } - }, - "aws_binData=00_rand_explicit_altname": { - "kms": "aws", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAFBq1RIU1YGHKAS1SAtS42fKtQBHQ/BCQzRutirNdvWlrXxF81LSaS7QgQyycZ2ePiOLsSm2vZS4xaQETeCgRC4g==", - "subType": "06" - } - } - }, - "aws_binData=00_det_auto_id": { - "kms": "aws", - "type": "binData=00", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAF6SJGmfD3hLVc4tLPm4v2zFuHoRxUDLumBR8Q0AlKK2nQPyvuHEPVBD3vQdDi+Q7PwFxmovJsHccr59VnzvpJeg==", - "subType": "06" - } - } - }, - "aws_binData=00_det_explicit_id": { - "kms": "aws", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAF6SJGmfD3hLVc4tLPm4v2zFuHoRxUDLumBR8Q0AlKK2nQPyvuHEPVBD3vQdDi+Q7PwFxmovJsHccr59VnzvpJeg==", - "subType": "06" - } - } - }, - "aws_binData=00_det_explicit_altname": { - "kms": "aws", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAF6SJGmfD3hLVc4tLPm4v2zFuHoRxUDLumBR8Q0AlKK2nQPyvuHEPVBD3vQdDi+Q7PwFxmovJsHccr59VnzvpJeg==", - "subType": "06" - } - } - }, - "aws_binData=04_rand_auto_id": { - "kms": "aws", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAFM5685zqlM8pc3xubtCFuf724g/bWXsebpNzw5E5HrxUqSBBVOvjs3IJH74+Supe169qejY358nOG41mLZvO2wJByvT14qmgUGpgBaLaxPR0=", - "subType": "06" - } - } - }, - "aws_binData=04_rand_auto_altname": { - "kms": "aws", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAFfLqOzpfjz/XYHDLnliUAA5ehi6s+OIjvrLa59ubqEf8DuoCEWlO13Dl8X42IBB4hoSsO2RUeWtc9MeH4SdIUh/xJN3qS7qzjh/H+GvZRdAM=", - "subType": "06" - } - } - }, - "aws_binData=04_rand_explicit_id": { - "kms": "aws", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAFkmKfKAbz9tqVaiM9MRhYttiY3vgDwXpdYLQ4uUgWX89KRayLADWortYL+Oq+roFhO3oiwB9vjeWGIdgbj5wSh/50JT/2Gs85TXFe1GFjfWs=", - "subType": "06" - } - } - }, - "aws_binData=04_rand_explicit_altname": { - "kms": "aws", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAFKbufv83ddN+07Q5Ocq0VxUEV+BesSrVM7Bol3cMlWjHi7P+MrdwhNEa94xlxlDwU3b+RD6kW+AuNEQ2byA3CX2JjZE1gHwN7l0ukXuqpD0A=", - "subType": "06" - } - } - }, - "aws_binData=04_det_auto_id": { - "kms": "aws", - "type": "binData=04", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAFlg7ceq9w/JMhHcNzQks6UrKYAffpUyeWuBIpcuLoB7YbFO61Dphseh77pzZbk3OvmveUq6EtCP2pmsq7hA+QV4hkv6BTn4m6wnXw6ss/qfE=", - "subType": "06" - } - } - }, - "aws_binData=04_det_explicit_id": { - "kms": "aws", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAFlg7ceq9w/JMhHcNzQks6UrKYAffpUyeWuBIpcuLoB7YbFO61Dphseh77pzZbk3OvmveUq6EtCP2pmsq7hA+QV4hkv6BTn4m6wnXw6ss/qfE=", - "subType": "06" - } - } - }, - "aws_binData=04_det_explicit_altname": { - "kms": "aws", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAFlg7ceq9w/JMhHcNzQks6UrKYAffpUyeWuBIpcuLoB7YbFO61Dphseh77pzZbk3OvmveUq6EtCP2pmsq7hA+QV4hkv6BTn4m6wnXw6ss/qfE=", - "subType": "06" - } - } - }, - "aws_undefined_rand_explicit_id": { - "kms": "aws", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$undefined": true } - }, - "aws_undefined_rand_explicit_altname": { - "kms": "aws", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$undefined": true } - }, - "aws_undefined_det_explicit_id": { - "kms": "aws", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$undefined": true } - }, - "aws_undefined_det_explicit_altname": { - "kms": "aws", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$undefined": true } - }, - "aws_objectId_rand_auto_id": { - "kms": "aws", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAHASE+V+LlkmwgF9QNjBK8QBvC973NaTMk6wbd57VB2EpQzrgxMtR5gYzVeqq4xaaHqrncyZCOIxDJkFlaim2NqA==", - "subType": "06" - } - } - }, - "aws_objectId_rand_auto_altname": { - "kms": "aws", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAHf/+9Qj/ozcDoUb8RNBnajU1d9hJ/6fE17IEZnw+ma6v5yH8LqZk9w3dtm6Sfw1unMhcMKrmIgs6kxqRWhNREJg==", - "subType": "06" - } - } - }, - "aws_objectId_rand_explicit_id": { - "kms": "aws", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAHzX8ejVLhoarQ5xgWsJitU/9eBm/Hlt2IIbZtS0SBc80qzkkWTaP9Zl9wrILH/Hwwx8RFnts855eKII3NJFa3BA==", - "subType": "06" - } - } - }, - "aws_objectId_rand_explicit_altname": { - "kms": "aws", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAHG5l6nUCY8f/6xO6TsPDrZHcdPRyMe3muMlY2DxHwv9GJNDR5Ne5VEAzUjnbgoy+B29SX4oY8cXJ6XhVz8mt3Eg==", - "subType": "06" - } - } - }, - "aws_objectId_det_auto_id": { - "kms": "aws", - "type": "objectId", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAHTMY2l+gY8glm4HeSsGfCSfOsTVTzYU8qnQV8iqEFHrO5SBJac59gv3N/jukMwAnt0j6vIIQrROkVetU24YY7sQ==", - "subType": "06" - } - } - }, - "aws_objectId_det_explicit_id": { - "kms": "aws", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAHTMY2l+gY8glm4HeSsGfCSfOsTVTzYU8qnQV8iqEFHrO5SBJac59gv3N/jukMwAnt0j6vIIQrROkVetU24YY7sQ==", - "subType": "06" - } - } - }, - "aws_objectId_det_explicit_altname": { - "kms": "aws", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAHTMY2l+gY8glm4HeSsGfCSfOsTVTzYU8qnQV8iqEFHrO5SBJac59gv3N/jukMwAnt0j6vIIQrROkVetU24YY7sQ==", - "subType": "06" - } - } - }, - "aws_bool_rand_auto_id": { - "kms": "aws", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAISm4UFt1HC2j0ObpTBg7SvF2Dq31i9To2ED4F3JcTihhq0fVzaSCsUz9VTJ0ziHmeNPNdfPPZO6qA/CDEZBO4jg==", - "subType": "06" - } - } - }, - "aws_bool_rand_auto_altname": { - "kms": "aws", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAIj93KeAa96DmZXdB8boFvW19jhJSMmtSs5ag5FDSkH8MdKG2d2VoBOdUlBrL+LHYELqeDHCszY7qCirvb5mIgZg==", - "subType": "06" - } - } - }, - "aws_bool_rand_explicit_id": { - "kms": "aws", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAIMbDFEuHIl5MNEsWnYLIand1vpK6EMv7Mso6qxrN4wHSVVwmxK+GCPgrKoUQsNuTssFWNCu0IhwrXOagDEfmlxw==", - "subType": "06" - } - } - }, - "aws_bool_rand_explicit_altname": { - "kms": "aws", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAIkIaWfmPdxgAV5Rtb6on6T0NGt9GPFDScQD5I/Ch0ngiTCCKceJOjU0ljd3YTgfWRA1p/MlMIV0I5YAWZXKTHlg==", - "subType": "06" - } - } - }, - "aws_bool_det_explicit_id": { - "kms": "aws", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": true - }, - "aws_bool_det_explicit_altname": { - "kms": "aws", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": true - }, - "aws_date_rand_auto_id": { - "kms": "aws", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAJz1VG4+QnQXEE+TGu/pzfPugGMVTiC1xnenG1ByRdPvsERVw9WComWl1tb9tt9oblD7H/q0y1+y8HevkDqohB2Q==", - "subType": "06" - } - } - }, - "aws_date_rand_auto_altname": { - "kms": "aws", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAJa1kI2mIIYWjf7zjf5dD9+psvAQpjZ3nnsoXA5upcIwEtZaC8bxKKHVpOLOP3rTbvT5EV6vLhXkferGoyaqd/8w==", - "subType": "06" - } - } - }, - "aws_date_rand_explicit_id": { - "kms": "aws", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAJ9Q5Xe4UuOLQTUwosk47A6xx40XJcNoICCNtKrHqsUYy0QLCFRc5v4nA0160BVghURizbUtX8iuIp11pnsDyRtA==", - "subType": "06" - } - } - }, - "aws_date_rand_explicit_altname": { - "kms": "aws", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAJkHOdUc/4U82wxWJZ0SYABkJjQqNApkH2Iy/5S+PoatPgynoeSFTU9FmAbuWV/gbtIfBiaCOIjlsdonl/gf9+5w==", - "subType": "06" - } - } - }, - "aws_date_det_auto_id": { - "kms": "aws", - "type": "date", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAJEEpQNsiqMWPqD4lhMkiOJHGE8FxOeYrKPiiAp/bZTrLKyCSS0ZL1WT9H3cGzxWPm5veihCjKqWhjatC/pjtzbQ==", - "subType": "06" - } - } - }, - "aws_date_det_explicit_id": { - "kms": "aws", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAJEEpQNsiqMWPqD4lhMkiOJHGE8FxOeYrKPiiAp/bZTrLKyCSS0ZL1WT9H3cGzxWPm5veihCjKqWhjatC/pjtzbQ==", - "subType": "06" - } - } - }, - "aws_date_det_explicit_altname": { - "kms": "aws", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAJEEpQNsiqMWPqD4lhMkiOJHGE8FxOeYrKPiiAp/bZTrLKyCSS0ZL1WT9H3cGzxWPm5veihCjKqWhjatC/pjtzbQ==", - "subType": "06" - } - } - }, - "aws_null_rand_explicit_id": { - "kms": "aws", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "aws_null_rand_explicit_altname": { - "kms": "aws", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "aws_null_det_explicit_id": { - "kms": "aws", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "aws_null_det_explicit_altname": { - "kms": "aws", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "aws_regex_rand_auto_id": { - "kms": "aws", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAALnhViSt3HqTDzyLN4mWO9srBU8TjRvPWsAJYfj/5sgI/yFuWdrggMs3Aq6G+K3tRrX3Yb+osy5CLiFCxq9WIvAA==", - "subType": "06" - } - } - }, - "aws_regex_rand_auto_altname": { - "kms": "aws", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAALbL2RS2tGQLBZ+6LtXLKAWFKcoKui+u4+gMIlFemLgpdO2eLqrMJB53ccqZImX8ons9UgAwDkiD68hWy8e7KHfg==", - "subType": "06" - } - } - }, - "aws_regex_rand_explicit_id": { - "kms": "aws", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAALa0+ftF6W/0Ul4J9VT/3chXFktE1o+OK4S14h2kyOqDVNA8yMKuyCK5nWl1yZvjJ76TuhEABte23oxcBP5QwalQ==", - "subType": "06" - } - } - }, - "aws_regex_rand_explicit_altname": { - "kms": "aws", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAALS4Yo9Fwk6OTx2CWdnObFT2L4rHngeIbdCyT4/YMJYd+jLU3mph14M1ptZZg+TBIgSPHq+BkvpRDifbMmOVr/Hg==", - "subType": "06" - } - } - }, - "aws_regex_det_auto_id": { - "kms": "aws", - "type": "regex", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAALpwNlokiTCUtTa2Kx9NVGvXR/aKPGhR5iaCT7nHEk4BOiZ9Kr4cRHdPCeZ7A+gjG4cKoT62sm3Fj1FwSOl8J8aQ==", - "subType": "06" - } - } - }, - "aws_regex_det_explicit_id": { - "kms": "aws", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAALpwNlokiTCUtTa2Kx9NVGvXR/aKPGhR5iaCT7nHEk4BOiZ9Kr4cRHdPCeZ7A+gjG4cKoT62sm3Fj1FwSOl8J8aQ==", - "subType": "06" - } - } - }, - "aws_regex_det_explicit_altname": { - "kms": "aws", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAALpwNlokiTCUtTa2Kx9NVGvXR/aKPGhR5iaCT7nHEk4BOiZ9Kr4cRHdPCeZ7A+gjG4cKoT62sm3Fj1FwSOl8J8aQ==", - "subType": "06" - } - } - }, - "aws_dbPointer_rand_auto_id": { - "kms": "aws", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAMfCVAnMNbRGsThnoVGb2KDsCIU2ehcPtebk/TFG4GZvEmculscLLih813lEz5NHS2sAXBn721EzUS7d0TKAPbmEYFwUBnijIQIPvUoUO8AQM=", - "subType": "06" - } - } - }, - "aws_dbPointer_rand_auto_altname": { - "kms": "aws", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAMvYJ5BtaMLVXV+qj85q5WqKRlzlHOBIIxZfUE/BBXUwqSTpJLdQQD++DDh6F2dtorBeYa3oUv2ef3ImASk5j23joU35Pm3Zt9Ci1pMNGodWs=", - "subType": "06" - } - } - }, - "aws_dbPointer_rand_explicit_id": { - "kms": "aws", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAMdsmYtPDw8kKjfB2kWfx5W1oNEkWWct1lRpesN303pUWsawDJpfBx40lg18So2X/g4yGIwpY3qfEKQZA4vCJeT+MTjhRXFjXA7eS/mxv8f3E=", - "subType": "06" - } - } - }, - "aws_dbPointer_rand_explicit_altname": { - "kms": "aws", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAM0hcvS5zmY3mlTp0SfME/rINlflF/sx2KvP0eJTdH+Uk0WHuTkFIJAza+bXvV/gB7iNC350qyzUX3M6NHx/9s/5yBpY8MawTZTZ7WCQIA+ZI=", - "subType": "06" - } - } - }, - "aws_dbPointer_det_auto_id": { - "kms": "aws", - "type": "dbPointer", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAMp4QxbaEOij66L+RtaMekrDSm6QbfJBTQ8lQFhxfq9n7SVuQ9Zwdy14Ja8tyI3cGgQzQ/73rHUJ3CKA4+OYr63skYUkkkdlHxUrIMd5j5woc=", - "subType": "06" - } - } - }, - "aws_dbPointer_det_explicit_id": { - "kms": "aws", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAMp4QxbaEOij66L+RtaMekrDSm6QbfJBTQ8lQFhxfq9n7SVuQ9Zwdy14Ja8tyI3cGgQzQ/73rHUJ3CKA4+OYr63skYUkkkdlHxUrIMd5j5woc=", - "subType": "06" - } - } - }, - "aws_dbPointer_det_explicit_altname": { - "kms": "aws", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAMp4QxbaEOij66L+RtaMekrDSm6QbfJBTQ8lQFhxfq9n7SVuQ9Zwdy14Ja8tyI3cGgQzQ/73rHUJ3CKA4+OYr63skYUkkkdlHxUrIMd5j5woc=", - "subType": "06" - } - } - }, - "aws_javascript_rand_auto_id": { - "kms": "aws", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAN3HzAC9BTD7Jgi0PR4RS/Z6L6QtAQ7VhbKRbX+1smmnYniH6jVBM6zyxMDM8h9YjMPNs8EJrGDnisuf33w5KI/A==", - "subType": "06" - } - } - }, - "aws_javascript_rand_auto_altname": { - "kms": "aws", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAANJpw+znlu3ecSiNyZ0EerVsow4aDRF2auI3Wy69EVexJkQlHO753PjRn8hG/x2kY8ROy5IUU43jaugP5AN1bwNQ==", - "subType": "06" - } - } - }, - "aws_javascript_rand_explicit_id": { - "kms": "aws", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAANzoDiq8uI0+l8COY8YdM9S3rpLvPOHOWmJqJNtOyS0ZXUx1SB5paRJ4W3Eg8KuXEeoFwvBDe9cW9YT66CzkjlBw==", - "subType": "06" - } - } - }, - "aws_javascript_rand_explicit_altname": { - "kms": "aws", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAN/JhtRongJweLC5SdrXHhsFz3p82q3cwXf8Sru21DK6S39S997y3uhVLn0xlX5d94PxK1XVYSjz1oVuMxZouZ7Q==", - "subType": "06" - } - } - }, - "aws_javascript_det_auto_id": { - "kms": "aws", - "type": "javascript", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAANE39aEGiuUZ1WyakVEBgkGzLp5whkIjJ4uiaFLXniRszJL70FRkcf+aFXlA5Y4So9/ODKF76qbSsH4Jk6L+3mog==", - "subType": "06" - } - } - }, - "aws_javascript_det_explicit_id": { - "kms": "aws", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAANE39aEGiuUZ1WyakVEBgkGzLp5whkIjJ4uiaFLXniRszJL70FRkcf+aFXlA5Y4So9/ODKF76qbSsH4Jk6L+3mog==", - "subType": "06" - } - } - }, - "aws_javascript_det_explicit_altname": { - "kms": "aws", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAANE39aEGiuUZ1WyakVEBgkGzLp5whkIjJ4uiaFLXniRszJL70FRkcf+aFXlA5Y4So9/ODKF76qbSsH4Jk6L+3mog==", - "subType": "06" - } - } - }, - "aws_symbol_rand_auto_id": { - "kms": "aws", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAOBv1T9tleM0xwNe7efg/MlShyzvXe3Pmg1GzPl3gjFRHZGWXR578KqX+8oiz65eXGzNuyOFvcpnR2gYCs3NeKeQfctO5plEiIva6nzCI5SK8=", - "subType": "06" - } - } - }, - "aws_symbol_rand_auto_altname": { - "kms": "aws", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAOwLgGws8CMh+GgkEJFAx8tDIflyjsgG+/1FmZZobKAg8NOKqfXjtbnNCbvR28OCk6g/8SqBm8m53G6JciwvthJ0DirdfEexiUqu7IPtaeeyw=", - "subType": "06" - } - } - }, - "aws_symbol_rand_explicit_id": { - "kms": "aws", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAORQi3dNkXzZeruWu19kEhDu6fFD/h47ILzk+OVKQMoriAQC5YFyVRp1yAkIaWsrsPcyCHlfZ99FySSQeqSYbZZNj5FqyonWvDuPTduHDy3CI=", - "subType": "06" - } - } - }, - "aws_symbol_rand_explicit_altname": { - "kms": "aws", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAOj+Yl1pQPiJ6mESOISOyUYsKN/VIvC8f0derhxIPakXkwn57U0sxv+geUkrl3JZDxY3+cX5M1JZmY+PfjaYQhbTorf9RZaVC2Wwo2lMftWi0=", - "subType": "06" - } - } - }, - "aws_symbol_det_auto_id": { - "kms": "aws", - "type": "symbol", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAO5IHripygBGEsVK8RFWZ1rIIVUap8KVDuqOspZpERaj+5ZEfqIcyrP/WK9KdvwOfdOWXfP/mOwuImYgNdbaQe+ejkYe4W0Y0uneCuw88k95Q=", - "subType": "06" - } - } - }, - "aws_symbol_det_explicit_id": { - "kms": "aws", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAO5IHripygBGEsVK8RFWZ1rIIVUap8KVDuqOspZpERaj+5ZEfqIcyrP/WK9KdvwOfdOWXfP/mOwuImYgNdbaQe+ejkYe4W0Y0uneCuw88k95Q=", - "subType": "06" - } - } - }, - "aws_symbol_det_explicit_altname": { - "kms": "aws", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAO5IHripygBGEsVK8RFWZ1rIIVUap8KVDuqOspZpERaj+5ZEfqIcyrP/WK9KdvwOfdOWXfP/mOwuImYgNdbaQe+ejkYe4W0Y0uneCuw88k95Q=", - "subType": "06" - } - } - }, - "aws_javascriptWithScope_rand_auto_id": { - "kms": "aws", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAPT31GSNkY1RM43miv1XPYtDX1vU/xORiM3U0pumjqA+JLU/HMhH++75OcMhcAQqMjm2nZtZScxdGJsJJPEEzqjbFNMJgYc9sqR5uLnzk+2dg=", - "subType": "06" - } - } - }, - "aws_javascriptWithScope_rand_auto_altname": { - "kms": "aws", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAPUxgaKAxSQ1uzOZtzsbtrxtDT2P/zWY6lYsbChXuRUooqvyjXSkNDqKBBA7Gp5BdGiVB/JLR47Tihpbcw1s1yGhwQRvnqeDvPrf91nvElXRY=", - "subType": "06" - } - } - }, - "aws_javascriptWithScope_rand_explicit_id": { - "kms": "aws", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAPv8W0ZtquFCLTG0TqvRjdzKa/4mvqT2FuEGQ0mXG2k2BZh2LY5APr/kgW0tP4eLjHzVld6OLiM9ZKAvENCZ6/fKOvqSwpIfkdLWUIeB4REQg=", - "subType": "06" - } - } - }, - "aws_javascriptWithScope_rand_explicit_altname": { - "kms": "aws", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAPMVhWjaxLffdAOkVgIJpjgNIldMS451NQs3C1jb+pzopHp3DlfZ+AHQpK9reMVVKjaqanhWBpL25q+feA60XVgZPCUDroiRYqMFqU//y0amw=", - "subType": "06" - } - } - }, - "aws_javascriptWithScope_det_explicit_id": { - "kms": "aws", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$code": "x=1", "$scope": {} } - }, - "aws_javascriptWithScope_det_explicit_altname": { - "kms": "aws", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$code": "x=1", "$scope": {} } - }, - "aws_int_rand_auto_id": { - "kms": "aws", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAQFV5b3vsoZe+MT4z8soetpmrWJpm7be41FNu/rdEqHWTG32jCym6762PCNYH5+vA7ldCWQkdt+ncneHsxzPrm9w==", - "subType": "06" - } - } - }, - "aws_int_rand_auto_altname": { - "kms": "aws", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAQY9+QenvU1Tk/dEGZP11uOZJLHAJ9hWHbEhxbtxItt1LsdU/8gOZfypilIO5BUkLT/15PUuXV28GISNh6yIuWhw==", - "subType": "06" - } - } - }, - "aws_int_rand_explicit_id": { - "kms": "aws", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAQruCugbneumhcinuXm89WW1PXVuSOewttp9cpsPPsCRVqe/uAkZOdJnZ2KaEZ9zki2GeqaJTs1qDmaJofc6GMEA==", - "subType": "06" - } - } - }, - "aws_int_rand_explicit_altname": { - "kms": "aws", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAQb15qXl/tejk4pmgkc4pUxzt4eJrv/cetgzgcPVaROAQSzd8ptbgCjaV8vP46uqozRoaDFZbQ06t65c3f0x/Ucw==", - "subType": "06" - } - } - }, - "aws_int_det_auto_id": { - "kms": "aws", - "type": "int", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAQCXo6ieWvfoqkG+rP7J2BV013AVf/oNMmmGWe44VEHahF+qZHzW5I/F2qIA+xgKkk172pFq0iTSOpe+K2WHMKFw==", - "subType": "06" - } - } - }, - "aws_int_det_explicit_id": { - "kms": "aws", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAQCXo6ieWvfoqkG+rP7J2BV013AVf/oNMmmGWe44VEHahF+qZHzW5I/F2qIA+xgKkk172pFq0iTSOpe+K2WHMKFw==", - "subType": "06" - } - } - }, - "aws_int_det_explicit_altname": { - "kms": "aws", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAAQCXo6ieWvfoqkG+rP7J2BV013AVf/oNMmmGWe44VEHahF+qZHzW5I/F2qIA+xgKkk172pFq0iTSOpe+K2WHMKFw==", - "subType": "06" - } - } - }, - "aws_timestamp_rand_auto_id": { - "kms": "aws", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAR63xXG8mrlixkQzD5VBIPE6NHicaWcS5CBhiIJDcZ0x8D9c5TgRJUfCeWhKvWFD4o0DoxcBQ2opPormFDpvmq/g==", - "subType": "06" - } - } - }, - "aws_timestamp_rand_auto_altname": { - "kms": "aws", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAARAgY9LsUxP6gP4gYRvvzZ4iaHVQRNbycATiVag1YNSiDmEr4LYserYuBscdrIy4v3zgGaulFM9KV86bx0ItycZA==", - "subType": "06" - } - } - }, - "aws_timestamp_rand_explicit_id": { - "kms": "aws", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAARLneAZqPcHdzGGnXz2Ne5E7HP9cDC1+yoIwcA8OSF/IlzEjrrMAi3z6Izol6gWDlD7VOh7QYL3sASJOXyzF1hPQ==", - "subType": "06" - } - } - }, - "aws_timestamp_rand_explicit_altname": { - "kms": "aws", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAARH2bU7KNo5SHxiO8JFEcT9wryuHNXyM7ADop1oPcESyay1Nc0WHPD3nr0yMAK481NxOkE3qXyaslu7bcP/744WA==", - "subType": "06" - } - } - }, - "aws_timestamp_det_auto_id": { - "kms": "aws", - "type": "timestamp", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAARG7kGfx0ky+d4Hl/fRBu8oUR1Mph26Dkv3J7fxGYanpzOFMiHIfVO0uwYMvsfzG54y0DDNlS3FmmS13DzepbzGQ==", - "subType": "06" - } - } - }, - "aws_timestamp_det_explicit_id": { - "kms": "aws", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAARG7kGfx0ky+d4Hl/fRBu8oUR1Mph26Dkv3J7fxGYanpzOFMiHIfVO0uwYMvsfzG54y0DDNlS3FmmS13DzepbzGQ==", - "subType": "06" - } - } - }, - "aws_timestamp_det_explicit_altname": { - "kms": "aws", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAARG7kGfx0ky+d4Hl/fRBu8oUR1Mph26Dkv3J7fxGYanpzOFMiHIfVO0uwYMvsfzG54y0DDNlS3FmmS13DzepbzGQ==", - "subType": "06" - } - } - }, - "aws_long_rand_auto_id": { - "kms": "aws", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAASZbes2EdR78crt2pXVElW2YwAQh8HEBapYYeav2VQeg2syXaV/qZuD8ofnAVn4v/DydTTMVMmK+sVU/TlnAu2eA==", - "subType": "06" - } - } - }, - "aws_long_rand_auto_altname": { - "kms": "aws", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAASt+7fmMYH+fLHgybc+sng8/UmKP3YPUEPCz1SXVQljQp6orsCILSgtgGPsdeGnN5NSxh3XzerHs6zlR92fWpZCw==", - "subType": "06" - } - } - }, - "aws_long_rand_explicit_id": { - "kms": "aws", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAS01fF1uo6zYDToJnOT/EbDipzk7YZ6I+IspZF+avjU3XYfpRxT9NdAgKr0euWJwyAsdpWqqCwFummfrPeZOy04A==", - "subType": "06" - } - } - }, - "aws_long_rand_explicit_altname": { - "kms": "aws", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAS6tpH796bqy58mXf38rJvVtA1uBcxBE5yIGQ4RN44oypc/pvw0ouhFI1dkoneKMtAFU/5RygZV+RvQhRtgKn76A==", - "subType": "06" - } - } - }, - "aws_long_det_auto_id": { - "kms": "aws", - "type": "long", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAASC7O/8JeB4WTqQFPuMpFRsAuonPS3yu7IAPZeRPIr03CmM6HNndYIKMoFM13eELNZTdJSgg9u9ItGqRw+/XMHzQ==", - "subType": "06" - } - } - }, - "aws_long_det_explicit_id": { - "kms": "aws", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAASC7O/8JeB4WTqQFPuMpFRsAuonPS3yu7IAPZeRPIr03CmM6HNndYIKMoFM13eELNZTdJSgg9u9ItGqRw+/XMHzQ==", - "subType": "06" - } - } - }, - "aws_long_det_explicit_altname": { - "kms": "aws", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQFkgAAAAAAAAAAAAAAAAAASC7O/8JeB4WTqQFPuMpFRsAuonPS3yu7IAPZeRPIr03CmM6HNndYIKMoFM13eELNZTdJSgg9u9ItGqRw+/XMHzQ==", - "subType": "06" - } - } - }, - "aws_decimal_rand_auto_id": { - "kms": "aws", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAATgf5zW9EgnWHPxj4HAGt472eN9UXP41TaF8V2J7S2zqSpiBZGKDuOIjw2FBSqaNp53vvfl9HpwAuQBJZhrwkBCKRkKV/AAR3/pTpuoqhSKaM=", - "subType": "06" - } - } - }, - "aws_decimal_rand_auto_altname": { - "kms": "aws", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAATPRfvZWdupE2N0W1DXUx7X8Zz7g43jawJL7PbQtTYetI78xRETkMdygwSEHgs+cvnUBBtYIeKRVkOGZQkwf568OclhDiPxUeD38cR5blBq/U=", - "subType": "06" - } - } - }, - "aws_decimal_rand_explicit_id": { - "kms": "aws", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAAT+ZnCg2lSMIohZ9RJ4CNs3LZ0g+nV04cYAmrxTSrTSBPGlZ7Ywh5A2rCss7AUijYZiKiYyZbuAzukbOuVRhdCtm+xo9+DyLAwTezF18okk6Y=", - "subType": "06" - } - } - }, - "aws_decimal_rand_explicit_altname": { - "kms": "aws", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgFkgAAAAAAAAAAAAAAAAAATlnQYASsTZRRHzFjcbCClXartcXBVRrYv7JImMkDmAj6EAjf/ZqpjeykkS/wohMhXaNwyZBdREr+n+GDV7imYoL4WRBOLnqB6hrYidlWqNzE=", - "subType": "06" - } - } - }, - "aws_decimal_det_explicit_id": { - "kms": "aws", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$numberDecimal": "1.234" } - }, - "aws_decimal_det_explicit_altname": { - "kms": "aws", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$numberDecimal": "1.234" } - }, - "aws_minKey_rand_explicit_id": { - "kms": "aws", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$minKey": 1 } - }, - "aws_minKey_rand_explicit_altname": { - "kms": "aws", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$minKey": 1 } - }, - "aws_minKey_det_explicit_id": { - "kms": "aws", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$minKey": 1 } - }, - "aws_minKey_det_explicit_altname": { - "kms": "aws", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$minKey": 1 } - }, - "aws_maxKey_rand_explicit_id": { - "kms": "aws", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$maxKey": 1 } - }, - "aws_maxKey_rand_explicit_altname": { - "kms": "aws", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$maxKey": 1 } - }, - "aws_maxKey_det_explicit_id": { - "kms": "aws", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$maxKey": 1 } - }, - "aws_maxKey_det_explicit_altname": { - "kms": "aws", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$maxKey": 1 } - }, - "local_double_rand_auto_id": { - "kms": "local", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAABGF195CB8nRmK9+KxYO7T96MeXucC/ILQtEEQAS4zrwj3Qz7YEQrf/apvbKTCkn3siN2XSDLQ/7dmddZa9xa9yQ==", - "subType": "06" - } - } - }, - "local_double_rand_auto_altname": { - "kms": "local", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAABY8g18z6ZOjGtfNxaAmU95tXMdoM6qbtDMpB72paqiHZTW1UGB22HPXiEnVz05JTBzzX4fc6tOldX6aJel812Zg==", - "subType": "06" - } - } - }, - "local_double_rand_explicit_id": { - "kms": "local", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAABDlHwN8hYyScEhhx64TdJ2Qp2rmKRg8983zdqIL1914tyPwRQq7ySCOhmFif2S7v4KT+r0uOfimYvKD1n9rKHlg==", - "subType": "06" - } - } - }, - "local_double_rand_explicit_altname": { - "kms": "local", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAB2VnTFlaCRzAZZTQiMWQORFNgXIuAJlHJXIHiYow2eO6JbVghWTpH+MsdafBNPVnc0zKuZBL0Qs2Nuk1xiQaqhA==", - "subType": "06" - } - } - }, - "local_double_det_explicit_id": { - "kms": "local", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$numberDouble": "1.234" } - }, - "local_double_det_explicit_altname": { - "kms": "local", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$numberDouble": "1.234" } - }, - "local_string_rand_auto_id": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAC5NBAPM8q2n9fnkwQfE9so/XcO51plPBNs5VlBRbDw68k9T6/uZ2TWsAvTYtVooY59zHHr2QS3usKbGQB6J61rA==", - "subType": "06" - } - } - }, - "local_string_rand_auto_altname": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACM/EjGMrkYHvSZra26m74upuvLkfKXTs+tTWquGzrgWYLnLt8I6XBIwx1VymS9EybrCU/ewmtgjLUNUFQacIeXA==", - "subType": "06" - } - } - }, - "local_string_rand_explicit_id": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACn4tD26UG8lO9gTZaxen6yXzHo/a2lokeY1ClxHMtJODoJr2JZzIDHP3A9aZ8L4+Vu+nyqphaWyGaGONKu8gpcQ==", - "subType": "06" - } - } - }, - "local_string_rand_explicit_altname": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACZfoO2LjY+IB31FZ1Tq7pHr0DCFKGJqWcXcOrnZ7bV9Euc9f101motJc31sp8nF5CTCfd83VQE0319eQrxDDaSw==", - "subType": "06" - } - } - }, - "local_string_det_auto_id": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACW0cZMYWOY3eoqQQkSdBtS9iHC4CSQA27dy6XJGcmTV8EDuhGNnPmbx0EKFTDb0PCSyCjMyuE4nsgmNYgjTaSuw==", - "subType": "06" - } - } - }, - "local_string_det_explicit_id": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACW0cZMYWOY3eoqQQkSdBtS9iHC4CSQA27dy6XJGcmTV8EDuhGNnPmbx0EKFTDb0PCSyCjMyuE4nsgmNYgjTaSuw==", - "subType": "06" - } - } - }, - "local_string_det_explicit_altname": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACW0cZMYWOY3eoqQQkSdBtS9iHC4CSQA27dy6XJGcmTV8EDuhGNnPmbx0EKFTDb0PCSyCjMyuE4nsgmNYgjTaSuw==", - "subType": "06" - } - } - }, - "local_object_rand_auto_id": { - "kms": "local", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAADlekcUsETAkkKTjCVx5EISJN+sftrQax/VhaWXLyRgRz97adXXmwZkMyt+035SHZsF91i2LaXziMA4RHoP+nKFw==", - "subType": "06" - } - } - }, - "local_object_rand_auto_altname": { - "kms": "local", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAADpaQmy5r6q9gLqEm+FIi/OyQgcuUnrICCP9rC4S3wR6qUHd82IW/3dFQUzwTkaXxgStjopamQMuZ4ESRj0xx0bA==", - "subType": "06" - } - } - }, - "local_object_rand_explicit_id": { - "kms": "local", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAADCHRJCINzWY0u4gZPWEmHg/JoQ8IW4yMfUyzYJCQrEMp4rUeupIuxqSuq2QyLBYZBBv0r7t3lNH49I5qDeav2vA==", - "subType": "06" - } - } - }, - "local_object_rand_explicit_altname": { - "kms": "local", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAADrHQQUnLF1jdNmFY/V266cS28XAB4nOKetHAcSbwkeUxNzgZT1g+XMQaYfcNMMv/ywypKU1KpgLMsEOpm4qcPkQ==", - "subType": "06" - } - } - }, - "local_object_det_explicit_id": { - "kms": "local", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "x": { "$numberInt": "1" } } - }, - "local_object_det_explicit_altname": { - "kms": "local", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "x": { "$numberInt": "1" } } - }, - "local_array_rand_auto_id": { - "kms": "local", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAEXa7bQ5vGPNsLdklM/H+sop8aCL4vlDiVUoVjTAGjTngn2WLcdKLWxaNSyMdJpsI/NsxQJ58YrcwP+yHzi9rZVtRdbg7m8p+CYcq1vUm6UoQ=", - "subType": "06" - } - } - }, - "local_array_rand_auto_altname": { - "kms": "local", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAEVlZlOvtRmGIhcYi/qPl3HKi/qf0yRQrkbVo9rScYkxDCBN9wA55pAWHDQ/5Sjy4d0DwL57k+M1G9e7xSIrv8xXKwoIuuabhSWaIX2eJHroY=", - "subType": "06" - } - } - }, - "local_array_rand_explicit_id": { - "kms": "local", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAEYBLSYHHt2rohezMF4lMjNdqy9CY33EHf+pgRbJwVXZScLDgn9CcqeRsdU8bW5h2qgNpQvoSMBB7pW+Dgp1RauTHZSOd4PcZpAGjwoFDWSSM=", - "subType": "06" - } - } - }, - "local_array_rand_explicit_altname": { - "kms": "local", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAES1IJ8S2NxWekolQockxLJvzFSGfKQ9Xbi55vO8LyWo0sIG9ZgPQXtVQkZ301CsdFduvx9A0vDqQ0MGYc4plxNnpUTizJPRUDyez5dOgZ9tI=", - "subType": "06" - } - } - }, - "local_array_det_explicit_id": { - "kms": "local", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": [ - { "$numberInt": "1" }, - { "$numberInt": "2" }, - { "$numberInt": "3" } - ] - }, - "local_array_det_explicit_altname": { - "kms": "local", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": [ - { "$numberInt": "1" }, - { "$numberInt": "2" }, - { "$numberInt": "3" } - ] - }, - "local_binData=00_rand_auto_id": { - "kms": "local", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAF+hgWs4ZCo9GnmhSM9SDSWzWX4E7Tlp4TwlEy3zfO/rrMREECGB4u8LD8Ju9b8YP+xcZhMI1tcz/vrQS87NffUg==", - "subType": "06" - } - } - }, - "local_binData=00_rand_auto_altname": { - "kms": "local", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAFtEvaXWpGfXC1GlKu0AeRDaeBKHryGoS0tAUr48vfYk7umCr+fJKyXCY9vSv7wCiQxWLe8V/EZWkHsu0zqhJw9w==", - "subType": "06" - } - } - }, - "local_binData=00_rand_explicit_id": { - "kms": "local", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAF/1L5bvmMX3Bk2nAw8KvvRd/7nZ82XHVasT0jrlPhSiJU7ehJMeUCOb7HCHU6KgCzZB9C2W3NoVhLKIhE9ZnYdg==", - "subType": "06" - } - } - }, - "local_binData=00_rand_explicit_altname": { - "kms": "local", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAFK0W5IWKzggR4UU+fhwA2p8YCHLfmx5y1OEtHc/9be9eEYTORACDmWY6207Vd4LhBJCedd+Q5qMm7NRZjjhyLEQ==", - "subType": "06" - } - } - }, - "local_binData=00_det_auto_id": { - "kms": "local", - "type": "binData=00", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAF1ofBnK9+ERP29P/i14GQ/y3muic6tNKY532zCkzQkJSktYCOeXS8DdY1DdaOP/asZWzPTdgwby6/iZcAxJU+xQ==", - "subType": "06" - } - } - }, - "local_binData=00_det_explicit_id": { - "kms": "local", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAF1ofBnK9+ERP29P/i14GQ/y3muic6tNKY532zCkzQkJSktYCOeXS8DdY1DdaOP/asZWzPTdgwby6/iZcAxJU+xQ==", - "subType": "06" - } - } - }, - "local_binData=00_det_explicit_altname": { - "kms": "local", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAF1ofBnK9+ERP29P/i14GQ/y3muic6tNKY532zCkzQkJSktYCOeXS8DdY1DdaOP/asZWzPTdgwby6/iZcAxJU+xQ==", - "subType": "06" - } - } - }, - "local_binData=04_rand_auto_id": { - "kms": "local", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAFxq38aA4k/tYHPwJFRK0pahlo/3zjCe3VHJRqURRA+04lbJCvdkQTawxWlf8o+3Pcetl1UcPTQigdYp5KbIkstuPstLbT+TZXHVD1os9LTRw=", - "subType": "06" - } - } - }, - "local_binData=04_rand_auto_altname": { - "kms": "local", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAFTXNWchCPmCSY0+AL22/kCBmAoDJDX5T18jpJHLdvZtHs0zwD64b9hLvfRK268BlNu4P37KDFE6LT0QzjG7brqzFJf3ZaadDCKeIw1q7DWQs=", - "subType": "06" - } - } - }, - "local_binData=04_rand_explicit_id": { - "kms": "local", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAF7XgMgKjQmWYWmobrYWKiGYCKsy5kTgVweFBuzvFISaZjFsq2hrZB2DwUaOeT6XUPH/Onrdjc3fNElf3FdQDHif4rt+1lh9jEX+nMbRw9i3s=", - "subType": "06" - } - } - }, - "local_binData=04_rand_explicit_altname": { - "kms": "local", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAFGoA/1H0waFLor6LbkUCLC2Wm9j/ZT7yifPbf0G7WvO0+gBLlffr3aJIQ9ik5vxPbmDDMCoYlbEYgb8i9I5tKC17WPhjVH2N2+4l9y7aEmS4=", - "subType": "06" - } - } - }, - "local_binData=04_det_auto_id": { - "kms": "local", - "type": "binData=04", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAFwO3hsD8ee/uwgUiHWem8fGe54LsTJWqgbRCacIe6sxrsyLT6EsVIqg4Sn7Ou+FC3WJbFld5kx8euLe/MHa8FGYjxD97z5j+rUx5tt3T6YbA=", - "subType": "06" - } - } - }, - "local_binData=04_det_explicit_id": { - "kms": "local", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAFwO3hsD8ee/uwgUiHWem8fGe54LsTJWqgbRCacIe6sxrsyLT6EsVIqg4Sn7Ou+FC3WJbFld5kx8euLe/MHa8FGYjxD97z5j+rUx5tt3T6YbA=", - "subType": "06" - } - } - }, - "local_binData=04_det_explicit_altname": { - "kms": "local", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAFwO3hsD8ee/uwgUiHWem8fGe54LsTJWqgbRCacIe6sxrsyLT6EsVIqg4Sn7Ou+FC3WJbFld5kx8euLe/MHa8FGYjxD97z5j+rUx5tt3T6YbA=", - "subType": "06" - } - } - }, - "local_undefined_rand_explicit_id": { - "kms": "local", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$undefined": true } - }, - "local_undefined_rand_explicit_altname": { - "kms": "local", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$undefined": true } - }, - "local_undefined_det_explicit_id": { - "kms": "local", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$undefined": true } - }, - "local_undefined_det_explicit_altname": { - "kms": "local", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$undefined": true } - }, - "local_objectId_rand_auto_id": { - "kms": "local", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAHfvxWRZOzfao3faE3RglL0IcDpBcNwqiGL5KgSokmRxWjjWeiel88Mbo5Plo0SswwNQ2H7C5GVG21L+UbvcW63g==", - "subType": "06" - } - } - }, - "local_objectId_rand_auto_altname": { - "kms": "local", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAHhd9lSOO7bHE7PM+Uxa2v3X1FF66IwyEr0wqnyTaOM+cHQLmec/RlEaRIQ1x2AiW7LwmmVgZ0xBMK9CMh0Lhbyw==", - "subType": "06" - } - } - }, - "local_objectId_rand_explicit_id": { - "kms": "local", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAHETwT9bo+JtboBVW/8GzzMQCpn22iiNJnlxYfyO45jvYJQRs29RRIouCsnFkmC7cfAO3GlVxv113euYjIO7AlAg==", - "subType": "06" - } - } - }, - "local_objectId_rand_explicit_altname": { - "kms": "local", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAHhsguAMBzQUFBAitpJDzKEaMDGUGfvCzmUUhf4rnp8xeall/p91TUudaSMcU11XEgJ0Mym4IbYRd8+TfUai0nvw==", - "subType": "06" - } - } - }, - "local_objectId_det_auto_id": { - "kms": "local", - "type": "objectId", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAH4ElF4AvQ+kkGfhadgKNy3GcYrDZPN6RpzaMYIhcCGDvC9W+cIS9dH1aJbPU7vTPmEZnnynPTDWjw3rAj2+9mOA==", - "subType": "06" - } - } - }, - "local_objectId_det_explicit_id": { - "kms": "local", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAH4ElF4AvQ+kkGfhadgKNy3GcYrDZPN6RpzaMYIhcCGDvC9W+cIS9dH1aJbPU7vTPmEZnnynPTDWjw3rAj2+9mOA==", - "subType": "06" - } - } - }, - "local_objectId_det_explicit_altname": { - "kms": "local", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAH4ElF4AvQ+kkGfhadgKNy3GcYrDZPN6RpzaMYIhcCGDvC9W+cIS9dH1aJbPU7vTPmEZnnynPTDWjw3rAj2+9mOA==", - "subType": "06" - } - } - }, - "local_bool_rand_auto_id": { - "kms": "local", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAIxGld4J/2vSWg5tjQulpkm9C6WeUcLbv2yfKRXPAbmLpv3u4Yrmr5qisJtqmDPTcb993WosvCYAh0UGW+zpsdEg==", - "subType": "06" - } - } - }, - "local_bool_rand_auto_altname": { - "kms": "local", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAIpUFPiS2uoW1Aqs0WQkBa201OBmsuJ8WUKcv5aBPASkcwfaw9qSWs3QrbEDR2GyoU4SeYOByCAQMzXCPoIYAFdQ==", - "subType": "06" - } - } - }, - "local_bool_rand_explicit_id": { - "kms": "local", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAIJuzu1a60meYlU3LMjw/7G4Vh/lqKopxdpGWoLXEmY/NoHgX6Fkv9iTwxv/Nv8rZwtawpFV+mQUG/6A1IHMBASQ==", - "subType": "06" - } - } - }, - "local_bool_rand_explicit_altname": { - "kms": "local", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAIn9VjxL5TdGgJLckNHRrIaL32L31q5OERRZG2M5OYKk66TnrlfEs+ykcDvGwMGKpr/PYjY5kBHDc/oELGJJbWRQ==", - "subType": "06" - } - } - }, - "local_bool_det_explicit_id": { - "kms": "local", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": true - }, - "local_bool_det_explicit_altname": { - "kms": "local", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": true - }, - "local_date_rand_auto_id": { - "kms": "local", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAJPPv4MC5xzt2uxPGBHH9g2z03o9SQjjmuxt97Ub1UcKCCHsGED3bx6YSrocuEMiFFI4d5Fqgl8HNeS4j0PR0tYA==", - "subType": "06" - } - } - }, - "local_date_rand_auto_altname": { - "kms": "local", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAJ6i2A9Hi4xWlOMjFMGpwaRctR1VFnb4El166n18RvjKic46V+WoadvLHS32RhPOvkLVYwIeU4C+vrO5isBNoUdw==", - "subType": "06" - } - } - }, - "local_date_rand_explicit_id": { - "kms": "local", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAJHcniV7Q0C8ZTWrE0hp5i5bUPlrrRdNLZckfODw8XNVtVPDjbznglccQmI7w1t8kOVp65eKzVzUOXN0YkqA+1QA==", - "subType": "06" - } - } - }, - "local_date_rand_explicit_altname": { - "kms": "local", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAJKCUCjC3hsmEKKYwGP3ceh3zR+ArE8LYFOQfN87aEsTr60VrzHXmsE8PvizRhhMnrp07ljzQkuat39L+0QSR2qQ==", - "subType": "06" - } - } - }, - "local_date_det_auto_id": { - "kms": "local", - "type": "date", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAJ1GMYQTruoKr6fv9XCbcVkx/3yivymPSMEkPCRDYxQv45w4TqBKMDfpRd1TOLOv1qvcb+gjH+z5IfVBMp2IpG/Q==", - "subType": "06" - } - } - }, - "local_date_det_explicit_id": { - "kms": "local", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAJ1GMYQTruoKr6fv9XCbcVkx/3yivymPSMEkPCRDYxQv45w4TqBKMDfpRd1TOLOv1qvcb+gjH+z5IfVBMp2IpG/Q==", - "subType": "06" - } - } - }, - "local_date_det_explicit_altname": { - "kms": "local", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAJ1GMYQTruoKr6fv9XCbcVkx/3yivymPSMEkPCRDYxQv45w4TqBKMDfpRd1TOLOv1qvcb+gjH+z5IfVBMp2IpG/Q==", - "subType": "06" - } - } - }, - "local_null_rand_explicit_id": { - "kms": "local", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "local_null_rand_explicit_altname": { - "kms": "local", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "local_null_det_explicit_id": { - "kms": "local", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "local_null_det_explicit_altname": { - "kms": "local", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "local_regex_rand_auto_id": { - "kms": "local", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAALXKw7zSgqQj1AKoWO0MoMxsBuu0cMB6KdJQCRKdupoLV/Y22owwsVpDDMv5sgUpkG5YIV+Fz7taHodXE07qHopw==", - "subType": "06" - } - } - }, - "local_regex_rand_auto_altname": { - "kms": "local", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAALntOLXq7VW1+jwba/dSbidMo2bewNo7AtK9A1CPwk9XrjUQaEOQxfRpho3BYQEo2U67fQdsY/tyhaj4jduHn9JQ==", - "subType": "06" - } - } - }, - "local_regex_rand_explicit_id": { - "kms": "local", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAALlMMG2iS/gEOEsVKR7sxBJP2IUzZ+aRbozDSkqADncresBvaPBSE17lng5NG7H1JRCAcP1rH/Te+0CrMd7JpRAQ==", - "subType": "06" - } - } - }, - "local_regex_rand_explicit_altname": { - "kms": "local", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAL1YNnlVu5+njDLxh1LMhIPOH19RykAXhxrUbCy6TI5MLQsAOSgAJbXOTXeKr0D8/Ff0phToWOKl193gOOIp8yZQ==", - "subType": "06" - } - } - }, - "local_regex_det_auto_id": { - "kms": "local", - "type": "regex", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAALiZbL5nFIZl7cSLH5E3wK3jJeAeFc7hLHNITtLAu+o10raEs5i/UCihMHmkf8KHZxghs056pfm5BjPzlL9x7IHQ==", - "subType": "06" - } - } - }, - "local_regex_det_explicit_id": { - "kms": "local", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAALiZbL5nFIZl7cSLH5E3wK3jJeAeFc7hLHNITtLAu+o10raEs5i/UCihMHmkf8KHZxghs056pfm5BjPzlL9x7IHQ==", - "subType": "06" - } - } - }, - "local_regex_det_explicit_altname": { - "kms": "local", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAALiZbL5nFIZl7cSLH5E3wK3jJeAeFc7hLHNITtLAu+o10raEs5i/UCihMHmkf8KHZxghs056pfm5BjPzlL9x7IHQ==", - "subType": "06" - } - } - }, - "local_dbPointer_rand_auto_id": { - "kms": "local", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAMUdAA9uOSk1tXJVe/CG3Ps6avYTEF1eHj1wSlCHkFxqlMtTO+rIQpikpjH0MrcXvEEdAO8g5hFZ01I7DWyK5AAxTxDqVF+kOaQ2VfKs6hyuo=", - "subType": "06" - } - } - }, - "local_dbPointer_rand_auto_altname": { - "kms": "local", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAMiNqvqLwZrPnsF235z+Obl1K9iEXdJ5GucMGpJdRG4lRvRE0Oy1vh6ztNTpYPY/tXyUFTBWlzl/lITalSEm/dT1Bnlh0iPAFrAiNySf662og=", - "subType": "06" - } - } - }, - "local_dbPointer_rand_explicit_id": { - "kms": "local", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAM+Tn31YcKiowBTJWRYCYAEO7UARDE2/jTVGEKXCpiwEqqP3JSAS0b80zYt8dxo5mVhUo2a02ClKrB8vs+B6sU1kXrahSaVSEHZlRSGN9fWgo=", - "subType": "06" - } - } - }, - "local_dbPointer_rand_explicit_altname": { - "kms": "local", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAMdOZZUvpJIqG9qiOLy5x4BdftyHipPDZn/eeLEc7ir3v4jJsY3dsv6fQERo5U9lMynNGA9PJePVzq5tWsIMX0EcCQcMfGmosfkYDzN1OX99A=", - "subType": "06" - } - } - }, - "local_dbPointer_det_auto_id": { - "kms": "local", - "type": "dbPointer", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAMQWace2C1w3yqtmo/rgz3YtIDnx1Ia/oDsoHnnMZlEy5RoK3uosi1hvNAZCSg3Sen0H7MH3XVhGGMCL4cS69uJ0ENSvh+K6fiZzAXCKUPfvM=", - "subType": "06" - } - } - }, - "local_dbPointer_det_explicit_id": { - "kms": "local", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAMQWace2C1w3yqtmo/rgz3YtIDnx1Ia/oDsoHnnMZlEy5RoK3uosi1hvNAZCSg3Sen0H7MH3XVhGGMCL4cS69uJ0ENSvh+K6fiZzAXCKUPfvM=", - "subType": "06" - } - } - }, - "local_dbPointer_det_explicit_altname": { - "kms": "local", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAMQWace2C1w3yqtmo/rgz3YtIDnx1Ia/oDsoHnnMZlEy5RoK3uosi1hvNAZCSg3Sen0H7MH3XVhGGMCL4cS69uJ0ENSvh+K6fiZzAXCKUPfvM=", - "subType": "06" - } - } - }, - "local_javascript_rand_auto_id": { - "kms": "local", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAANNL2AMKwTDyMIvxLKhBxZKx50C0tBdkLwuXmuMcrUqZeH8bsvjtttoM9LWkkileMyeTWgxblJ1b+uQ+V+4VT6fA==", - "subType": "06" - } - } - }, - "local_javascript_rand_auto_altname": { - "kms": "local", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAANBjBlHGw3K3TWQHpvfa1z0bKhNnVFC/lZArIexo3wjdGq3MdkGA5cuBIp87HHmOIv6o/pvQ9K74v48RQl+JH44A==", - "subType": "06" - } - } - }, - "local_javascript_rand_explicit_id": { - "kms": "local", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAANjvM7u3vNVyKpyI7g5kbzBpHPzXzOQToDSng5/c9yjMG+qi4TPtOyassobJOnMmDYBLyqRXCl/GsDLprbg5jxuA==", - "subType": "06" - } - } - }, - "local_javascript_rand_explicit_altname": { - "kms": "local", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAANMtO7KneuVx4gSOjX4MQjKL80zJhnt+efDBylkpNsqKyxBXB60nkiredGzwaK3/4QhIfGJrC1fQpwUwu/v1L17g==", - "subType": "06" - } - } - }, - "local_javascript_det_auto_id": { - "kms": "local", - "type": "javascript", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAANmQsg9E/BzGJVNVhSNyunS/TH0332oVFdPS6gjX0Cp/JC0YhB97DLz3N4e/q8ECaz7tTdQt9JacNUgxo+YCULUA==", - "subType": "06" - } - } - }, - "local_javascript_det_explicit_id": { - "kms": "local", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAANmQsg9E/BzGJVNVhSNyunS/TH0332oVFdPS6gjX0Cp/JC0YhB97DLz3N4e/q8ECaz7tTdQt9JacNUgxo+YCULUA==", - "subType": "06" - } - } - }, - "local_javascript_det_explicit_altname": { - "kms": "local", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAANmQsg9E/BzGJVNVhSNyunS/TH0332oVFdPS6gjX0Cp/JC0YhB97DLz3N4e/q8ECaz7tTdQt9JacNUgxo+YCULUA==", - "subType": "06" - } - } - }, - "local_symbol_rand_auto_id": { - "kms": "local", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAOOuO2b23mekwI8b6gWeEgRy1lLOCsNyBKvdmizK7/oOVKCvd+3kwUn9a6TxygooiVAN/Aohr1cjb8jRlMPWpkP0iO0+Tt6+vkizgFsQW4iio=", - "subType": "06" - } - } - }, - "local_symbol_rand_auto_altname": { - "kms": "local", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAOhN4QPOcmGnFKGvTfhz6TQleDA02X6oWULLHTnOUJYfE3OUSyf2ULEQh1yhdKdwXMuYVgGl28pMosiwkBShrXYe5ZlMjiZCIMZWSdUMV0tXk=", - "subType": "06" - } - } - }, - "local_symbol_rand_explicit_id": { - "kms": "local", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAO9aWi9RliwQHdXHoJME9VyN6XgyGd95Eclx+ZFYfLxBGAuUnPNjSfVuNZwYdyKC8JX79+mYhk7IXmcGV4z+4486sxyLk3idi4Kmpz2ESqV5g=", - "subType": "06" - } - } - }, - "local_symbol_rand_explicit_altname": { - "kms": "local", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAO/qev3DPfpkQoSW9aHOyalwfI/VYDQVN5VMINx4kw2vEqHiI1HRdZRPOz3q74TlQEy3TMNMTYdCvh5bpN/PptRZCTQbzP6ugz9dTp79w5/Ok=", - "subType": "06" - } - } - }, - "local_symbol_det_auto_id": { - "kms": "local", - "type": "symbol", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAOsg5cs6VpZWoTOFg4ztZmpj8kSTeCArVcI1Zz2pOnmMqNv/vcKQGhKSBbfniMripr7iuiYtlgkHGsdO2FqUp6Jb8NEWm5uWqdNU21zR9SRkE=", - "subType": "06" - } - } - }, - "local_symbol_det_explicit_id": { - "kms": "local", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAOsg5cs6VpZWoTOFg4ztZmpj8kSTeCArVcI1Zz2pOnmMqNv/vcKQGhKSBbfniMripr7iuiYtlgkHGsdO2FqUp6Jb8NEWm5uWqdNU21zR9SRkE=", - "subType": "06" - } - } - }, - "local_symbol_det_explicit_altname": { - "kms": "local", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAOsg5cs6VpZWoTOFg4ztZmpj8kSTeCArVcI1Zz2pOnmMqNv/vcKQGhKSBbfniMripr7iuiYtlgkHGsdO2FqUp6Jb8NEWm5uWqdNU21zR9SRkE=", - "subType": "06" - } - } - }, - "local_javascriptWithScope_rand_auto_id": { - "kms": "local", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAP5gLMvLOAc6vGAvC7bGmEC4eweptAiX3A7L0iCoHps/wm0FBLkfpF6F4pCjVYiY1lTID38wliRLPyhntCj+cfvlMfKSjouNgXMIWyQ8GKZ2c=", - "subType": "06" - } - } - }, - "local_javascriptWithScope_rand_auto_altname": { - "kms": "local", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAPVsw9Opn/P5SAdJhX4MTxIcsmaG8isIN4NKPi9k1u/Vj7AVkcxYqwurAghaJpmfoAgMruvzi1hcKvd05yHd9Nk0vkvODwDgnjJB6QO+qUce8=", - "subType": "06" - } - } - }, - "local_javascriptWithScope_rand_explicit_id": { - "kms": "local", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAPLUa+nsrqiHkVdE5K1xl/ZsiZqQznG2yVXyA3b3loBylbcL2NEBp1JUeGnPZ0y5ZK4AmoL6NMH2Io313rW3V8FTArs/OOQWPRJSe6h0M3wXk=", - "subType": "06" - } - } - }, - "local_javascriptWithScope_rand_explicit_altname": { - "kms": "local", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAPzUKaXCH0JImSlY73HVop9g9c0YssNEiA7Dy7Vji61avxvnuJJfghDchdwwaY7Vc8+0bymoanUWcErRctLzjm+1uKeMnFQokR8wFtnS3PgpQ=", - "subType": "06" - } - } - }, - "local_javascriptWithScope_det_explicit_id": { - "kms": "local", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$code": "x=1", "$scope": {} } - }, - "local_javascriptWithScope_det_explicit_altname": { - "kms": "local", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$code": "x=1", "$scope": {} } - }, - "local_int_rand_auto_id": { - "kms": "local", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAQHXpXb3KlHA2KFTBgl0VoLCu0CUf1ae4DckkwDorbredVSqxvA5e+NvVudY5yuea6bC9F57JlbjI8NWYAUw4q0Q==", - "subType": "06" - } - } - }, - "local_int_rand_auto_altname": { - "kms": "local", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAQSxXMF4+TKV+a3lcxXky8VepEqdg5wI/jg+C4CAUgNurq2XhgrxyqiMjkU8z07tfyoLYyX6P+dTrwj6nzvvchCw==", - "subType": "06" - } - } - }, - "local_int_rand_explicit_id": { - "kms": "local", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAQmzteYnshCI8HBGd7UYUKvcg4xl6M8PRyi1xX/WHbjyQkAJXxczS8hO91wuqStE3tBNSmulUejz9S691ufTd6ZA==", - "subType": "06" - } - } - }, - "local_int_rand_explicit_altname": { - "kms": "local", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAQLCHLru//++QSoWVEyw2v6TUfCnlrPJXrpLLezWf16vK85jTfm8vJbb2X2UzX04wGzVL9tCFFsWX6Z5gHXhgSBg==", - "subType": "06" - } - } - }, - "local_int_det_auto_id": { - "kms": "local", - "type": "int", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAQIxWjLBromNUgiOoeoZ4RUJUYIfhfOmab0sa4qYlS9bgYI41FU6BtzaOevR16O9i+uACbiHL0X6FMXKjOmiRAug==", - "subType": "06" - } - } - }, - "local_int_det_explicit_id": { - "kms": "local", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAQIxWjLBromNUgiOoeoZ4RUJUYIfhfOmab0sa4qYlS9bgYI41FU6BtzaOevR16O9i+uACbiHL0X6FMXKjOmiRAug==", - "subType": "06" - } - } - }, - "local_int_det_explicit_altname": { - "kms": "local", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAQIxWjLBromNUgiOoeoZ4RUJUYIfhfOmab0sa4qYlS9bgYI41FU6BtzaOevR16O9i+uACbiHL0X6FMXKjOmiRAug==", - "subType": "06" - } - } - }, - "local_timestamp_rand_auto_id": { - "kms": "local", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAARntIycg0Xkd16GEa//VSJI4Rkl7dT6MpRa+D3MiTEeio5Yy8zGK0u2BtEP/9MCRQw2hJDYj5znVqwhdduM0OTiA==", - "subType": "06" - } - } - }, - "local_timestamp_rand_auto_altname": { - "kms": "local", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAARWA9Ox5ejDPeWxfjbRgcGCtF/G5yrPMbBJD9ESDFc0NaVe0sdNNTisEVxsSkn7M/S4FCibKh+C8femr7xhu1iTw==", - "subType": "06" - } - } - }, - "local_timestamp_rand_explicit_id": { - "kms": "local", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAARrEfOL4+4Qh7IkhHnHcBEANGfMF8n2wUDnsZ0lXEb0fACKzaN5OKaxMIQBs/3pFBw721qRfCHY+ByKeaQuABbzg==", - "subType": "06" - } - } - }, - "local_timestamp_rand_explicit_altname": { - "kms": "local", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAARW8nwmnBt+LFIAcFWvOzX8llrGcveQKFhyYUIth9d7wtpTyc9myFp8GBQCnjDpKzA6lPmbqVYeLU0L9q0h6SHGQ==", - "subType": "06" - } - } - }, - "local_timestamp_det_auto_id": { - "kms": "local", - "type": "timestamp", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAR6uMylGytMq8QDr5Yz3w9HlW2MkGt6yIgUKcXYSaXru8eer+EkLv66/vy5rHqTfV0+8ryoi+d+PWO5U6b3Ng5Gg==", - "subType": "06" - } - } - }, - "local_timestamp_det_explicit_id": { - "kms": "local", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAR6uMylGytMq8QDr5Yz3w9HlW2MkGt6yIgUKcXYSaXru8eer+EkLv66/vy5rHqTfV0+8ryoi+d+PWO5U6b3Ng5Gg==", - "subType": "06" - } - } - }, - "local_timestamp_det_explicit_altname": { - "kms": "local", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAR6uMylGytMq8QDr5Yz3w9HlW2MkGt6yIgUKcXYSaXru8eer+EkLv66/vy5rHqTfV0+8ryoi+d+PWO5U6b3Ng5Gg==", - "subType": "06" - } - } - }, - "local_long_rand_auto_id": { - "kms": "local", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAASrinKUOpHIB7MNRmCAPWcP4CjZwfr5JaRT3G/GqY9B/6csj3+N9jmo1fYvM8uHcnmf5hzDDOamaE2FF1jDKkrHw==", - "subType": "06" - } - } - }, - "local_long_rand_auto_altname": { - "kms": "local", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAShWMPYDkCpTC2XLYyykPJMihASLKn6HHcB2Eh7jFwQb/8D1HCQoPmOHMyXaN4AtIKm1oqEfma6FSnEPENQoledQ==", - "subType": "06" - } - } - }, - "local_long_rand_explicit_id": { - "kms": "local", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAASd2h34ZLib+GiYayrm/FIZ/weg8wF41T0PfF8NCLTJCoT7gIkdpNRz2zkkQgZMR31efNKtsM8Bs4wgZbkrXsXWg==", - "subType": "06" - } - } - }, - "local_long_rand_explicit_altname": { - "kms": "local", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAASPAvdjz+a3FvXqDSjazaGqwZxrfXlfFB5/VjQFXQB0gpodCEaz1qaLSKfCWBg83ftrYKa/1sa44gU5NBthDfDwQ==", - "subType": "06" - } - } - }, - "local_long_det_auto_id": { - "kms": "local", - "type": "long", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAASQk372m/hW3WX82/GH+ikPv3QUwK7Hh/RBpAguiNxMdNhkgA/y2gznVNm17t6djyub7+d5zN4P5PLS/EOm2kjtw==", - "subType": "06" - } - } - }, - "local_long_det_explicit_id": { - "kms": "local", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAASQk372m/hW3WX82/GH+ikPv3QUwK7Hh/RBpAguiNxMdNhkgA/y2gznVNm17t6djyub7+d5zN4P5PLS/EOm2kjtw==", - "subType": "06" - } - } - }, - "local_long_det_explicit_altname": { - "kms": "local", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAASQk372m/hW3WX82/GH+ikPv3QUwK7Hh/RBpAguiNxMdNhkgA/y2gznVNm17t6djyub7+d5zN4P5PLS/EOm2kjtw==", - "subType": "06" - } - } - }, - "local_decimal_rand_auto_id": { - "kms": "local", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAATLnMMDZhnGSn5F5xHhsJXxiTGXd61Eq6fgppOlxUNVlsZNYyr5tZ3owfTTqRuD9yRg97x65WiHewBBnJJSeirCTAy9zZxWPVlJSiC0gO7rbM=", - "subType": "06" - } - } - }, - "local_decimal_rand_auto_altname": { - "kms": "local", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAATenMh7NKQioGjpuEojIrYKFaJhbuGxUgu2yTTbe3TndhgHryhW9GXiUqo8WTpnXqpC5E/z03ZYLWfCbe7qGdL6T7bbrTpaTaWZnnAm3XaCqY=", - "subType": "06" - } - } - }, - "local_decimal_rand_explicit_id": { - "kms": "local", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAT9vqXuKRh+2HxeCMr+pQYdhYNw7xrTdU4dySWz0X6tCK7LZO5AV72utmRJxID7Bqv1ZlXAk00V92oDLyKG9kHeG5+S34QE/aLCPsAWcppfxY=", - "subType": "06" - } - } - }, - "local_decimal_rand_explicit_altname": { - "kms": "local", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAATtqOCFMbOkls3LikQNXlnlkRr5gJns1+5Kvbt7P7texMa/QlXkYSHhtwESyfOcCQ2sw1T0eZ9DDuNaznpdK2KIqZBkVEC9iMoxqIqXF7Nab0=", - "subType": "06" - } - } - }, - "local_decimal_det_explicit_id": { - "kms": "local", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$numberDecimal": "1.234" } - }, - "local_decimal_det_explicit_altname": { - "kms": "local", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$numberDecimal": "1.234" } - }, - "local_minKey_rand_explicit_id": { - "kms": "local", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$minKey": 1 } - }, - "local_minKey_rand_explicit_altname": { - "kms": "local", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$minKey": 1 } - }, - "local_minKey_det_explicit_id": { - "kms": "local", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$minKey": 1 } - }, - "local_minKey_det_explicit_altname": { - "kms": "local", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$minKey": 1 } - }, - "local_maxKey_rand_explicit_id": { - "kms": "local", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$maxKey": 1 } - }, - "local_maxKey_rand_explicit_altname": { - "kms": "local", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$maxKey": 1 } - }, - "local_maxKey_det_explicit_id": { - "kms": "local", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { "$maxKey": 1 } - }, - "local_maxKey_det_explicit_altname": { - "kms": "local", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { "$maxKey": 1 } - }, - "payload=0,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACcsBdT93ivCyvtkfQz9qb1A9Ll+I6hnGE0kFy3rmVG6xAvipmRJSoVq3iv7iUEDvaqmPXfjeH8h8cPYT86v3XSg==", - "subType": "06" - } - } - }, - "payload=1,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACQOzpNBEGSrANr3Wl8uYpqeIc7pjc8e2LS2FaSrb8tM9F3mR1FqGgfJtn3eD+HZf3Y3WEDGK8975a/1BufkMqIQ==", - "subType": "06" - } - } - }, - "payload=2,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACyGJEcuN1pG5oSEyxuKFwqddGHVU5Untbib7LkmtoJe9HngTofkOpeHZH/hV6Z3CFxLu6WFliJoySsFFbnFy9ag==", - "subType": "06" - } - } - }, - "payload=3,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACLbp4w6mx45lR1vvgmeRja/y8U+WnR2oH4IpfrDi4lKM+JPVnJweiN3/1wAy+sXSy0S1Yh9yxmhh9ISoTkAuVxw==", - "subType": "06" - } - } - }, - "payload=4,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACG0qMY/GPZ/2CR61cxbuizywefyMZVdeTCn5KFjqwejgxeBwX0JmGNHKKWbQIDQykRFv0q0WHUgsRmRhaotNCyQ==", - "subType": "06" - } - } - }, - "payload=5,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACJI1onNpQfZhaYWrPEzHvNaJRqUDZK2xoyonB5E473BPgp3zvn0Jmz1deL8GzS+HlkjCrx39OvHyVt3+3S0kYYw==", - "subType": "06" - } - } - }, - "payload=6,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAClyKY9tZBjl7SewSXr3MdoWRDUNgLaXDUjENpjyYvi/54EQ9a+J/LAAh1892i+mLpYxEUAmcftPyfX3VhbCgUQw==", - "subType": "06" - } - } - }, - "payload=7,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACAMbEA+kNvnVV7B//ds2/QoVot061kbazoMwB/psB5eFdLVB5qApAXEWgQEMwkNnsTUYbtSduQz6uGwdagtNBRw==", - "subType": "06" - } - } - }, - "payload=8,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACzdSK/d7Ni6D8qUgNopnEU5ia1K5llhBGk3O1Tf71t4ThnQjYW9eI/rIohWmev5CGWLHhwuvvKUtFcTAe+NMQww==", - "subType": "06" - } - } - }, - "payload=9,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACzQcEa+ktF2EZf35TtyatnSGGaIVvFhZNuo5P3VwQvoONJrK2cSad7PBDAv3xDAB+VPZAigXAGQvd051sHooOHg==", - "subType": "06" - } - } - }, - "payload=10,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACpfoDmApsR5xOD3TDhcHeD7Jco3kPFuuWjDpHtMepMOJ3S0c+ngGGhzPGZtEz2xuD/E7AQn1ryp/WAQ+WwkaJkQ==", - "subType": "06" - } - } - }, - "payload=11,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACICMRXmx3oKqYv0IpmzkSMBIGT4Li3MPBF4Lw1s5F69WvZApD58glIKB6b7koIrF5qc2Wrb1/Nw+stRv0zvQ8Y9CcFV4OHm6WoEw+XDlWXJ4=", - "subType": "06" - } - } - }, - "payload=12,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACTArUn0WUTojQC4fSvq3TwJVTsZNhWAK2WB057u2EnkUzMC0xsbU6611W6Okx6idZ7pMudXpBC34fRDrJPXOu3BxK+ZLCOWS2FqsvWq3HeTY=", - "subType": "06" - } - } - }, - "payload=13,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACU1Ojn7EM2i+5KK2Beh1gPLhryK3Y7PtaZ/v4JvstxuAV4OHOR9yROP7pwenHXxczkWXvcyMY9OCdmHO8pkQkXO21798IPkDDN/ejJUFI0Uw=", - "subType": "06" - } - } - }, - "payload=14,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAAC0ZLwSliCbcr/e1uiYWk6gRuD/5qiyulQ7IUNWjhpBR6SLUfX2+yExLzps9hoOp53j9zRSKIzyleZ8yGLTLeN+Lz9BUe2ZT+sV8NiqZz3pkA=", - "subType": "06" - } - } - }, - "payload=15,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACQ9pmlQeFDr+jEhFwjL/eGVxdv70JdnkLaKdJ3/jkvCX1VPU5HmQIi+JWY3Rrw844E/6sBR6zIODn5aM0WfyP8a2zKRAWaVQZ7n+QE9hDN/8=", - "subType": "06" - } - } - }, - "payload=16,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AizggCwAAAAAAAAAAAAAAAACiOcItInDGHqvkH0I3udp5nnX32XzDeqya/3KDjgZPT5GHek1vFTZ4924JVxFqFQz+No9rOVmyxm8O2fxjTK2vsjtADzKGnMTtFYZqghYCuc=", - "subType": "06" - } - } - }, - "payload=0,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACijFptWQy7a1Y0rpXEvamXWI9v9dnx0Qj84/mKUsVpc3agkQ0B04uPYeROdt2MeEeiZoEKVWV0NjBocAQCEz7dw==", - "subType": "06" - } - } - }, - "payload=1,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAChR90taVWsZk+++sgibX6CnFeQQHNoB8V+n2gmDe3CIT/t+WvhMf9D+mQipbAlrUyHgGihKMHcvAZ5RZ/spaH4Q==", - "subType": "06" - } - } - }, - "payload=2,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAC67wemDv1Xdu7+EMR9LMBTOxfyAqsGaxQibwamZItzplslL/Dp3t9g9vPuNzq0dWwhnfxQ9GBe8OA3dtRaifYCA==", - "subType": "06" - } - } - }, - "payload=3,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACVLxch+uC7weXrbtylCo1m4HYZmh0sd9JCrlTECO2M56JK1X9a30i2BDUdhPuoTvvODv74CGXkZKdist3o0mGAQ==", - "subType": "06" - } - } - }, - "payload=4,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACexfIZGkOYaCGktOUc6cgAYg7Bd/C5ZYmdb7b8+rd5BKWbthW6N6CxhDIyh/DHvkPAeIzfTYA2/9w6tsjfD/TPQ==", - "subType": "06" - } - } - }, - "payload=5,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACjUH/dPW4egOvFMJJnpWK8v27MeLkbXC4GFl1j+wPqTsIEeIWkzEmcXjHLTQGE2GplHHc/zxwRwD2dXdbzvsCDw==", - "subType": "06" - } - } - }, - "payload=6,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACzvS+QkGlvb05pNn+vBMml09yKmE8yM6lwccNIST5uZSsUxXf2hrxPtO7Ylc4lmBAJt/9bcM59JIeT9fpYMc75w==", - "subType": "06" - } - } - }, - "payload=7,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACSf2RxHJpRuh4j8nS1dfonUtsJEwgqfWrwOsfuT/tAGXgDN0ObUpzL2K7G2vmePjP4dwycCSIL3+2j34bqBJK1Q==", - "subType": "06" - } - } - }, - "payload=8,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACu96YYeLXXoYdEZYNU9UAZjSd6G4fOE1edrA6/RjZKVGWKxftmvj5g1VAOiom0XuTZUe1ihbnwhvKexeoa3Vc8Q==", - "subType": "06" - } - } - }, - "payload=9,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACX+UjBKo9+N0Z+mbyqZqkQv2ETMSn6aPTONWgJtw5nWklcxKjUSSLI+8LW/6M6Xf9a7177GsqmV2f/yCRF58Xtw==", - "subType": "06" - } - } - }, - "payload=10,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACL6TVscFzIJ9+Zj6LsCZ9xhaZuTZdvz1nJe4l69nKyj9hCjnyuiV6Ve4AXwQ5W1wiPfkJ0fCZS33NwiHw7QQ/vg==", - "subType": "06" - } - } - }, - "payload=11,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACPLq7IcWhTVwkKmy0flN7opoQzx7tTe1eD9JIc25FC9B6KGQkdcRDglDDR7/m6+kBtTnq88y63vBgomTxA8ZxQE+3pB7zCiBhX0QznuXvP44=", - "subType": "06" - } - } - }, - "payload=12,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACxv7v4pKtom5z1g9FUuyjEWAbdzJ3ytPNZlOfVr6KZnUPhIH7PfCz3/lTdYYWBTj01+SUZiC/7ruof9QDhsSiNWP7nUyHpQ/C3joI/BBjtDA=", - "subType": "06" - } - } - }, - "payload=13,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACZhiElQ/MvyVMwMkZPu8pT54Ap6TlpVSEbE4nIQzzeU3XKVuspMdI5IXvvgfULXKXc+AOu6oQXZ+wAJ1tErVOsb48HF1g0wbXbBA31C5qLEM=", - "subType": "06" - } - } - }, - "payload=14,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACdp8mDOeDuDLhE0LzTOT2p0CMaUsAQrGCzmiK6Ab9xvaIcPPcejUcpdO3XXAS/pPab4+TUwO5GbI5pDJ29zwaOiOz2H3OJ2m2p5BHQp9mCys=", - "subType": "06" - } - } - }, - "payload=15,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAACmtLohoP/gotuon2IvnGeLEfCWHRMhG9Wp4tPu/vbJJkJkbQTP35HRG9VrMV7KKrEQbOsJ2Y6UDBra4tyjn0fIkwwc/0X9i+xaP+TrwpNabE=", - "subType": "06" - } - } - }, - "payload=16,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASzggCwAAAAAAAAAAAAAAAAC6s9eUtSneKWj3/A7S+bPZLj3t1WtUh7ltW80b8jCRzA+kOI26j1MEb1tt68HgcnH1IJ3YQ/+UHlV95OgwSnIxlib/HJn3U0s8mpuCWe1Auo=", - "subType": "06" - } - } - }, - "azure_double_rand_auto_id": { - "kms": "azure", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAB0S2kOZe54q6iZqeTLndkX+kehTKtb30jTP7FS+Zx+cxhFs626OrGY+jrH41cLfroCccacyNHUZFRinfqZPNOyw==", - "subType": "06" - } - } - }, - "azure_double_rand_auto_altname": { - "kms": "azure", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAABYViH7PLjCIdmTibW9dGCJADwXx2dRSMYxEmulPu89clAoeLDa8pwJ7YxLFQCcTGmZRfmp58dDDAzV8tyyE8QMg==", - "subType": "06" - } - } - }, - "azure_double_rand_explicit_id": { - "kms": "azure", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAABeRahSj4pniBp0rLIEZE8MdeyiIKcYuTZiuGzGiXbFbntEPow88DFHIBSxbMGR7p/8jCpPL+GqBwFkPkafXbMzg==", - "subType": "06" - } - } - }, - "azure_double_rand_explicit_altname": { - "kms": "azure", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAABdaa3vKtO4cAEUjYJfOPl1KbbgeWtphfUuJd6MxR9VReNSf1jc+kONwmkPVQs2WyZ1n+TSQMGRoBp1nHRttDdTg==", - "subType": "06" - } - } - }, - "azure_double_det_explicit_id": { - "kms": "azure", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDouble": "1.2339999999999999858" - } - }, - "azure_double_det_explicit_altname": { - "kms": "azure", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDouble": "1.2339999999999999858" - } - }, - "azure_string_rand_auto_id": { - "kms": "azure", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAACeoztcDg9oZ7ixHinReWQTrAumpsfyb0E1s3BGOFHgBCi1tW79CEXfqN8riFRc1YeRTlN4k5ShgHaBWBlax+XoQ==", - "subType": "06" - } - } - }, - "azure_string_rand_auto_altname": { - "kms": "azure", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAACov9cXQvDHeKOS5Gxcxa8vdAcTsTXDYgUucGzsCyh4TnTWKGQEVk3DHndUXX569TKCjq5QsC//oWEwweCn1nZ4g==", - "subType": "06" - } - } - }, - "azure_string_rand_explicit_id": { - "kms": "azure", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAACKU5qTdMdO0buQ/37ZRANUAAafcsoNMOTxJsDOfkqUb+/kRgM1ePlwVvk4EJiAGhJ/4SEmEOpwv05TT3PxGur2Q==", - "subType": "06" - } - } - }, - "azure_string_rand_explicit_altname": { - "kms": "azure", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAACX/ODKGHUyAKxoJ/c/3lEDBTc+eP/VS8OHrLhYoP96McpnFSgYi5jfUwvrFYa715fkass4N0nAHE6TzoGTYyk6Q==", - "subType": "06" - } - } - }, - "azure_string_det_auto_id": { - "kms": "azure", - "type": "string", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAACmVI7YK4JLOzutEdQ79he817Vk5EDP/3hXwOlGmERZCtp8J8HcqClhV+pyvRLGbwmlh12fbSs9nEp7mrobQm9wA==", - "subType": "06" - } - } - }, - "azure_string_det_explicit_id": { - "kms": "azure", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAACmVI7YK4JLOzutEdQ79he817Vk5EDP/3hXwOlGmERZCtp8J8HcqClhV+pyvRLGbwmlh12fbSs9nEp7mrobQm9wA==", - "subType": "06" - } - } - }, - "azure_string_det_explicit_altname": { - "kms": "azure", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAACmVI7YK4JLOzutEdQ79he817Vk5EDP/3hXwOlGmERZCtp8J8HcqClhV+pyvRLGbwmlh12fbSs9nEp7mrobQm9wA==", - "subType": "06" - } - } - }, - "azure_object_rand_auto_id": { - "kms": "azure", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAADWkZMsfCo4dOPMH1RXC7GkZFt1RCjJf0vaLDA09ih1Jl47SOetZELQ7B1TQjRQitktzrfD43jk8Fn4J5ZYZu1qQ==", - "subType": "06" - } - } - }, - "azure_object_rand_auto_altname": { - "kms": "azure", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAADJFMymfstltZP1oAqj4bgbCk8uLGtCd12eLqvSq0ZO+JDvls7PAovwmoWwigHunP8BBXT8sLydK+jn1sHfnhrlw==", - "subType": "06" - } - } - }, - "azure_object_rand_explicit_id": { - "kms": "azure", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAADCen+XrLYKg7gIVubVfdbQwuJ0mFHxhSUUyyBWj4RCeLeLUYXckboPGixXWB9XdwcOnInfF9u6qvktY67GtYASQ==", - "subType": "06" - } - } - }, - "azure_object_rand_explicit_altname": { - "kms": "azure", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAADnUyp/7eLmxxxOdsP+mNuJABK4PQoKFWDAY7lDrH6MYa03ryASOihPZWYZWXZLrbAf7cQQhElEkKqKwY8+NXgqg==", - "subType": "06" - } - } - }, - "azure_object_det_explicit_id": { - "kms": "azure", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "azure_object_det_explicit_altname": { - "kms": "azure", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "azure_array_rand_auto_id": { - "kms": "azure", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAEtk14WyoatZcNPlg3y/XJNsBt6neFJeQwR06B9rMGV58oIsmeE5zMtUOBYTgzlnwyKpqI/XVAg8s1VxvsrvGCyLVPwGVyDztwtMgVSW6QM3s=", - "subType": "06" - } - } - }, - "azure_array_rand_auto_altname": { - "kms": "azure", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAERTO63J4Nj1BpFlqVduA2IrAiGoV4jEOH3FnFgx7ZP7da/YBmLX/bc1EqdpC8v4faHxp74iU0xAB0yW4WgySDX7rriL5cw9sMpqgLRaBxGug=", - "subType": "06" - } - } - }, - "azure_array_rand_explicit_id": { - "kms": "azure", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAEs09qQdNVwh+KFqKPREQkw0XFdRNHAvjYJzs5MDE9+QxvtKlmVKSK3wkxDdCrcH4r7ePV2nCy2h1IHYqaDnnt4s5dSawI2l88iTT+bBcCSrU=", - "subType": "06" - } - } - }, - "azure_array_rand_explicit_altname": { - "kms": "azure", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAEaQ/YL50up4YIMJuVJSiAP06IQ+YjdKLIfkN/prbOZMiXErcD1Vq1hwGhfGdpEsLVu8E7IhJb4wakVC/2dLZoRP95az6HqRRauNNZAIQMKfY=", - "subType": "06" - } - } - }, - "azure_array_det_explicit_id": { - "kms": "azure", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "azure_array_det_explicit_altname": { - "kms": "azure", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "azure_binData=00_rand_auto_id": { - "kms": "azure", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAFl/leuLAHf1p6aRKHdFyN9FM6MW2XzBemql2xQgqkwJ6YOQXW6Pu/aI1scXVOrvrSu3+wBvByjHu++1AqFgzZRQ==", - "subType": "06" - } - } - }, - "azure_binData=00_rand_auto_altname": { - "kms": "azure", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAF4Nq/LwyufT/mx0LtFSkupNHTuyjbr4yUy1N5/37XhkpqZ1e4sWCHGNaTDEm5+cvdnbqZ/MMkBv855dc8N7vnGA==", - "subType": "06" - } - } - }, - "azure_binData=00_rand_explicit_id": { - "kms": "azure", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAFv1Kbv54uXJ76Ih63vtmszQtzkXqDlv8LDCFO3sjzu70+tgRXOhLm3J8uZpwoiNkgM6oNLn0en7tnEekYB9++CA==", - "subType": "06" - } - } - }, - "azure_binData=00_rand_explicit_altname": { - "kms": "azure", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAFgcYC1n7cGGXpv0qf1Kb8t9y/6kbhscGt2QJkQpAiqadFPPYDU/wwaKdDz94NpAHMZizUbhf9tvZ3UXl1bozhDA==", - "subType": "06" - } - } - }, - "azure_binData=00_det_auto_id": { - "kms": "azure", - "type": "binData=00", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAFvswfP3+jgia6rAyrypvbso3Xm4d7MEgJRUCWFYzA+9ov++vmeirgoTp/rFavTNOPb+61fvl1WKbVwrgODusaMg==", - "subType": "06" - } - } - }, - "azure_binData=00_det_explicit_id": { - "kms": "azure", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAFvswfP3+jgia6rAyrypvbso3Xm4d7MEgJRUCWFYzA+9ov++vmeirgoTp/rFavTNOPb+61fvl1WKbVwrgODusaMg==", - "subType": "06" - } - } - }, - "azure_binData=00_det_explicit_altname": { - "kms": "azure", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAFvswfP3+jgia6rAyrypvbso3Xm4d7MEgJRUCWFYzA+9ov++vmeirgoTp/rFavTNOPb+61fvl1WKbVwrgODusaMg==", - "subType": "06" - } - } - }, - "azure_binData=04_rand_auto_id": { - "kms": "azure", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAFMzMC3BLn/zWE9dxpcD8G0h4aifSY0zSHS9xTVJXgq21s2WU++Ov2UvHatVozmtZltsUN9JvSWqOBQRkFsrXvI7bc4lYfOoOmfpTHFcRDA/c=", - "subType": "06" - } - } - }, - "azure_binData=04_rand_auto_altname": { - "kms": "azure", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAFDlBN5hUTcjamOg/sgyeG0S52kphsjUgvlpuqHYz6VVdLtZ69cGHOVqqyml3x2rVqWUZJjd4ZodOhlwWq9p+i5IYNot2QaBvi8NZSaiThTc0=", - "subType": "06" - } - } - }, - "azure_binData=04_rand_explicit_id": { - "kms": "azure", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAFjvS2ozJuAL3rCvyBpraVtgL91OMdiskmgYnyfKlzd8EhYLd1cL4yxnTUjRXx+W+p8uN0/QZo+mynhcWnwcq83raY+I1HftSTx+S6rZ0qyDM=", - "subType": "06" - } - } - }, - "azure_binData=04_rand_explicit_altname": { - "kms": "azure", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAFqUMd/I0yOdy5W4THvFc6yrgSzB6arkRs/06b0M9Ii+QtAY6vbz+/aJ0Iy3Jm8TahC1wOZVmTj5luQpr+PHZMCEAFadv+0K/Nsx6xVhAh9gg=", - "subType": "06" - } - } - }, - "azure_binData=04_det_auto_id": { - "kms": "azure", - "type": "binData=04", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAFmN+KMrERGmfmue8/hG4D+ZcGzxC2HntdYBLjEolzvS9FV5JH/adxyUAnMpyL8FNznARL51rbv/G1nXPn9mPabsQ4BtWEAQbHx9TiXd+xbB0=", - "subType": "06" - } - } - }, - "azure_binData=04_det_explicit_id": { - "kms": "azure", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAFmN+KMrERGmfmue8/hG4D+ZcGzxC2HntdYBLjEolzvS9FV5JH/adxyUAnMpyL8FNznARL51rbv/G1nXPn9mPabsQ4BtWEAQbHx9TiXd+xbB0=", - "subType": "06" - } - } - }, - "azure_binData=04_det_explicit_altname": { - "kms": "azure", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAFmN+KMrERGmfmue8/hG4D+ZcGzxC2HntdYBLjEolzvS9FV5JH/adxyUAnMpyL8FNznARL51rbv/G1nXPn9mPabsQ4BtWEAQbHx9TiXd+xbB0=", - "subType": "06" - } - } - }, - "azure_undefined_rand_explicit_id": { - "kms": "azure", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "azure_undefined_rand_explicit_altname": { - "kms": "azure", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "azure_undefined_det_explicit_id": { - "kms": "azure", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "azure_undefined_det_explicit_altname": { - "kms": "azure", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "azure_objectId_rand_auto_id": { - "kms": "azure", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAH3sYVJpCKi310YxndMwm5ltEbbiRO1RwZxxeEkzI8tptbNXC8t7RkrT8VSJZ43wbGYCiqH5RZy9v8pYwtUm4STw==", - "subType": "06" - } - } - }, - "azure_objectId_rand_auto_altname": { - "kms": "azure", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAHD7agzVEc0JwesHHhkpGYIDAHQ+3Hc691kqic6YmVvK2N45fD5aRKftaZNs5OxSj3tNHSo7lQ+DVtPj8uSSpsVg==", - "subType": "06" - } - } - }, - "azure_objectId_rand_explicit_id": { - "kms": "azure", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAHEgKgy2mpMLpfeEWqbvQOaRZAy+cEGXGon3e53/JoH6dZneEyyt4ZrcrK6uRqyUPWX0q104JbCYxfbtHtdzWgPQ==", - "subType": "06" - } - } - }, - "azure_objectId_rand_explicit_altname": { - "kms": "azure", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAHqSv6Nruw3TIi7y0FPRjSfnJmWSdv5XMhAtnHNkT8MVuHeM32ayo0yc8dTA1wlkRtAI5JrGxTfERCXYuCojvvXg==", - "subType": "06" - } - } - }, - "azure_objectId_det_auto_id": { - "kms": "azure", - "type": "objectId", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAHcPRjIOyLDUJCDcdWkUySKCFS2AFkIa1OQyQAfC3Zh5HwJ1O7j2o+iYKRerhbni8lBiZH7EUMm1JcxM99lLC5jQ==", - "subType": "06" - } - } - }, - "azure_objectId_det_explicit_id": { - "kms": "azure", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAHcPRjIOyLDUJCDcdWkUySKCFS2AFkIa1OQyQAfC3Zh5HwJ1O7j2o+iYKRerhbni8lBiZH7EUMm1JcxM99lLC5jQ==", - "subType": "06" - } - } - }, - "azure_objectId_det_explicit_altname": { - "kms": "azure", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAHcPRjIOyLDUJCDcdWkUySKCFS2AFkIa1OQyQAfC3Zh5HwJ1O7j2o+iYKRerhbni8lBiZH7EUMm1JcxM99lLC5jQ==", - "subType": "06" - } - } - }, - "azure_bool_rand_auto_id": { - "kms": "azure", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAIYVWPvzSmiCs9LwRlv/AoQWhaS5mzoKX4W26M5eg/gPjOZbEVYOV80pWMxCcZWRAyV/NDWDUmKtRQDMU9b8lCJw==", - "subType": "06" - } - } - }, - "azure_bool_rand_auto_altname": { - "kms": "azure", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAIsAB01Ugqtw4T9SkuJBQN1y/ewpRAyz0vjFPdKI+jmPMmaXpMlXDJU8ZbTKm/nh6sjJCFcY5oZJ83ylbp2gHc6w==", - "subType": "06" - } - } - }, - "azure_bool_rand_explicit_id": { - "kms": "azure", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAIr8/qFd564X1mqHEhB0y7bzGFdrHuw+Gk45nXla3VvGHzeIJy6j2Wdl0uziWslMmBvNp8WweW+jQ6E2Fu7SiojQ==", - "subType": "06" - } - } - }, - "azure_bool_rand_explicit_altname": { - "kms": "azure", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAIWsca5FAnS2zhHnmKmexvvXMTgsZZ7uAFHnjQassUcay6mvIWH4hOnGiRxt5Zm0wO4S6cZq+PZrmEH5/n9rJcJQ==", - "subType": "06" - } - } - }, - "azure_bool_det_explicit_id": { - "kms": "azure", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": true - }, - "azure_bool_det_explicit_altname": { - "kms": "azure", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": true - }, - "azure_date_rand_auto_id": { - "kms": "azure", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAJwKo7XW5daIFlwY1mDAnJdHlcUgF+74oViL28hQGhde63pkPyyS6lPkYrc1gcCK5DL7PwsSX4Vb9SsNAG9860xw==", - "subType": "06" - } - } - }, - "azure_date_rand_auto_altname": { - "kms": "azure", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAJYZdWIqvqTztGKJkSASMEOjyrUFKnYql8fMIEzfEZWx2BYsIkxxOUUUCASg/Jsn09fTLVQ7yLD+LwycuI2uaXsw==", - "subType": "06" - } - } - }, - "azure_date_rand_explicit_id": { - "kms": "azure", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAJuWzKqi3KV8GbGGnT7i9N4BACUuNjt5AgKsjWIfrWRXK1+jRQFq0bYlVWaliT9CNIygL2aTF0H4eHl55PAI84MQ==", - "subType": "06" - } - } - }, - "azure_date_rand_explicit_altname": { - "kms": "azure", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAJ5JTtTuP4zTnEbaVlS/W59SrZ08LOC4ZIl+h+H4RnfHUfBXDwUou+APolVaYko+VZMKecrikdPeewgzWaqazJ1g==", - "subType": "06" - } - } - }, - "azure_date_det_auto_id": { - "kms": "azure", - "type": "date", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAJCREIp/SPolAZcVU1iOmaJaN2tFId5HhrjNmhp6xhA1AIPLnN+U7TAqesxFN7iebR9fXI5fZxYNgyWqQC1rqUJw==", - "subType": "06" - } - } - }, - "azure_date_det_explicit_id": { - "kms": "azure", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAJCREIp/SPolAZcVU1iOmaJaN2tFId5HhrjNmhp6xhA1AIPLnN+U7TAqesxFN7iebR9fXI5fZxYNgyWqQC1rqUJw==", - "subType": "06" - } - } - }, - "azure_date_det_explicit_altname": { - "kms": "azure", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAJCREIp/SPolAZcVU1iOmaJaN2tFId5HhrjNmhp6xhA1AIPLnN+U7TAqesxFN7iebR9fXI5fZxYNgyWqQC1rqUJw==", - "subType": "06" - } - } - }, - "azure_null_rand_explicit_id": { - "kms": "azure", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "azure_null_rand_explicit_altname": { - "kms": "azure", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "azure_null_det_explicit_id": { - "kms": "azure", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "azure_null_det_explicit_altname": { - "kms": "azure", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "azure_regex_rand_auto_id": { - "kms": "azure", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAALsMm3W2ogEiI6m0l8dS5Xhqnw+vMBvN1EesOTqAZOk4tQleX6fWARwUUnjFxbuejU7ISb50fc/Ul+ntL9z/2nHQ==", - "subType": "06" - } - } - }, - "azure_regex_rand_auto_altname": { - "kms": "azure", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAALITQNQI0hfCeMTxH0Hce1Cf5tinQG+Bq8EolUACvxUUQcDqIXfFXn19tV/Qyj4lIdnnwh/18hiswgEpJRK7uLGw==", - "subType": "06" - } - } - }, - "azure_regex_rand_explicit_id": { - "kms": "azure", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAALw/1QI/bKeiGUrrtC+yXOTvxZ2mJjSelPPGOm1mge0ws8DsX0DPHmo6MjhnRO4u0c/LWiE3hwHG2rYjAFlFXZ5A==", - "subType": "06" - } - } - }, - "azure_regex_rand_explicit_altname": { - "kms": "azure", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAL6Sl58UfFCHCZzWIB4r19/ZjeSRAoWeTFCFedKiwyR8/xnL+8jzXK/9+vTIspP6j35lFapr+f4iBNB9WjdpYNKA==", - "subType": "06" - } - } - }, - "azure_regex_det_auto_id": { - "kms": "azure", - "type": "regex", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAALxshM91Tsql/8kPe3dC16oP36XSUIN6godiRVIJLJ+NAwYtEkThthQsln7CrkIxIx6npN6A/hw1CBJERS/cqWhw==", - "subType": "06" - } - } - }, - "azure_regex_det_explicit_id": { - "kms": "azure", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAALxshM91Tsql/8kPe3dC16oP36XSUIN6godiRVIJLJ+NAwYtEkThthQsln7CrkIxIx6npN6A/hw1CBJERS/cqWhw==", - "subType": "06" - } - } - }, - "azure_regex_det_explicit_altname": { - "kms": "azure", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAALxshM91Tsql/8kPe3dC16oP36XSUIN6godiRVIJLJ+NAwYtEkThthQsln7CrkIxIx6npN6A/hw1CBJERS/cqWhw==", - "subType": "06" - } - } - }, - "azure_dbPointer_rand_auto_id": { - "kms": "azure", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAMaAd1v/XCYM2Kzi/f4utR6aHOFORmzZ17EepEjkn5IeKshktUpPWjI/dBwSunn5Qxx2zI3nm06c3SDvp6tw8qb7u4qXjLQYhlsQ0bHvvm+vE=", - "subType": "06" - } - } - }, - "azure_dbPointer_rand_auto_altname": { - "kms": "azure", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAM6VNjkN9bMIzfC7AX0ZhOEXPpyPE0nzYq3c5TNHrgeGWdZDR9GVdbO9t55zQrQJJ2Mmevh8c0WaAUV+YODv7ty6TDBsPbaKWWqMzu/v9RXHo=", - "subType": "06" - } - } - }, - "azure_dbPointer_rand_explicit_id": { - "kms": "azure", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAM66tywuMhwdyUjxfl7EOdKHNCLeIPnct3PgKrAKlOQFjiNQUIA2ShVy0qYpJcvvFsuQ5e8Bjr0IqeBc8mC7n4euRSM1UXpLqI5XHgXMMaYpI=", - "subType": "06" - } - } - }, - "azure_dbPointer_rand_explicit_altname": { - "kms": "azure", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAMtPQEbZ4gWoSYjVZLd5X6j0XxutWY1Ecrys2ErKRgZaxP0uGe8uw0cnr2Z5PYylaYmsSicLwD1PwWY42PKmaGBDraHmdfqDOPvrNxhBrfU/E=", - "subType": "06" - } - } - }, - "azure_dbPointer_det_auto_id": { - "kms": "azure", - "type": "dbPointer", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAMxUcVqq6RpAUCv08qGkmjuwVAIgLeYyh7xZnMeCYVGmhJKIP1Zdt1SvRGRV0jzwCQmXgxNd04adRwJnG/PRQIsL9aH3ilJgEnUbOo1nqR7yw=", - "subType": "06" - } - } - }, - "azure_dbPointer_det_explicit_id": { - "kms": "azure", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAMxUcVqq6RpAUCv08qGkmjuwVAIgLeYyh7xZnMeCYVGmhJKIP1Zdt1SvRGRV0jzwCQmXgxNd04adRwJnG/PRQIsL9aH3ilJgEnUbOo1nqR7yw=", - "subType": "06" - } - } - }, - "azure_dbPointer_det_explicit_altname": { - "kms": "azure", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAMxUcVqq6RpAUCv08qGkmjuwVAIgLeYyh7xZnMeCYVGmhJKIP1Zdt1SvRGRV0jzwCQmXgxNd04adRwJnG/PRQIsL9aH3ilJgEnUbOo1nqR7yw=", - "subType": "06" - } - } - }, - "azure_javascript_rand_auto_id": { - "kms": "azure", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAANWXPb5z3a0S7F26vkmBF3fV+oXYUj15OEtnSlXlUrc+gbhbPDxSvCPnTBEy5sNu4ndkvEZZxYgZInkF2q4rhlfQ==", - "subType": "06" - } - } - }, - "azure_javascript_rand_auto_altname": { - "kms": "azure", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAANN4mcwLz/J4eOUknhVsy6kdF1ThDP8cx6dNpOwJWAiyPHEsn+i6JmMTlfQMBrUp9HB/u3R+jLO5yz4XgLUKE8Tw==", - "subType": "06" - } - } - }, - "azure_javascript_rand_explicit_id": { - "kms": "azure", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAANJ+t5Z8hSQaoNzszzkWndAo4A0avDf9bKFa7euznz8ZYInnl9RUVqWMyxjSuIotAvTyYSJzxh+w2hKCgVf+MjEA==", - "subType": "06" - } - } - }, - "azure_javascript_rand_explicit_altname": { - "kms": "azure", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAANRLOQFpmkEg/KdWMmaurkNtUhy45rgtoipc9kQz6olgDWiMim81XC0AW5cOvjbHXL3w7Du28Kwdsp4j0PTTXHUQ==", - "subType": "06" - } - } - }, - "azure_javascript_det_auto_id": { - "kms": "azure", - "type": "javascript", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAANUrNUS/7/dmKVWBd+2JKGEn1hxbFSyu3p5sDNatukG2m16t4WwxzmYAg8PuQbAxekprs7iaLA+7D2Kn3ZuMSQOw==", - "subType": "06" - } - } - }, - "azure_javascript_det_explicit_id": { - "kms": "azure", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAANUrNUS/7/dmKVWBd+2JKGEn1hxbFSyu3p5sDNatukG2m16t4WwxzmYAg8PuQbAxekprs7iaLA+7D2Kn3ZuMSQOw==", - "subType": "06" - } - } - }, - "azure_javascript_det_explicit_altname": { - "kms": "azure", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAANUrNUS/7/dmKVWBd+2JKGEn1hxbFSyu3p5sDNatukG2m16t4WwxzmYAg8PuQbAxekprs7iaLA+7D2Kn3ZuMSQOw==", - "subType": "06" - } - } - }, - "azure_symbol_rand_auto_id": { - "kms": "azure", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAORMcgtQSU+/2Qlq57neRrVuAFSeSwkqdo+z1fh6IKjyEzhCy+u5bTzSzTopyKJQTCUZA2mSpRezWkM87oiGfhMFkBRVreMcE62eH+BLlgUaM=", - "subType": "06" - } - } - }, - "azure_symbol_rand_auto_altname": { - "kms": "azure", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAOIKlAw/A3nwHn0tO2cYtJx0azB8MGmXtt+bRptzn8yHlUSpMpYaiU0ssBBiLkmMLAITYebLqDk3NHESyP7PvbSfX1E2XVn2Nf694ZqPWMec8=", - "subType": "06" - } - } - }, - "azure_symbol_rand_explicit_id": { - "kms": "azure", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAO8SXW76AEr/6D6zyP1RYwmwdVM2AINaXZn3Ipy+fynWTUV6XIPIRR7xMTttNo2zlh7fgXDZ28PmjooGlQzn0q0JVQmXPCIPM3aqAmMcgyuqg=", - "subType": "06" - } - } - }, - "azure_symbol_rand_explicit_altname": { - "kms": "azure", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAOtoJWm2Ucre0foHIiOutsX1WIyub7t3Lby3/F8zRXn+l6ixlTjAPgWFwpRnYg96Lt2ACDDQ9CO51ejr9qk0b8LDBwG3qU5Cuibsp7vo1VsdI=", - "subType": "06" - } - } - }, - "azure_symbol_det_auto_id": { - "kms": "azure", - "type": "symbol", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAOvp/FMMmWVMkiuN51uFMFBiRQAcc9jftlNsHsLoNtohZaGni26kgX94b+/EI8pdWF5xA/73JlGlij0Rt+vC9s/zTDItRpn0bJL54WPphDcmA=", - "subType": "06" - } - } - }, - "azure_symbol_det_explicit_id": { - "kms": "azure", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAOvp/FMMmWVMkiuN51uFMFBiRQAcc9jftlNsHsLoNtohZaGni26kgX94b+/EI8pdWF5xA/73JlGlij0Rt+vC9s/zTDItRpn0bJL54WPphDcmA=", - "subType": "06" - } - } - }, - "azure_symbol_det_explicit_altname": { - "kms": "azure", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAOvp/FMMmWVMkiuN51uFMFBiRQAcc9jftlNsHsLoNtohZaGni26kgX94b+/EI8pdWF5xA/73JlGlij0Rt+vC9s/zTDItRpn0bJL54WPphDcmA=", - "subType": "06" - } - } - }, - "azure_javascriptWithScope_rand_auto_id": { - "kms": "azure", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAPCw9NnvJyuTYIgZxr1w1UiG85PGZ4rO62DWWDF98HwVM/Y6u7hNdNjkaWjYFsPMl38ioHw/pS8GFR62QmH2RAw/BV0wI7pNy2evANr3i3gKg=", - "subType": "06" - } - } - }, - "azure_javascriptWithScope_rand_auto_altname": { - "kms": "azure", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAPXQzqnQ2UWkIYof8/OfadNMa7iVKAbOaiu7YGm8iVrx+W6uxKLPFugVqHtQ29hYXXf33xr8rqGNxDlAe7/x1OeYEif71f7LUkmKF9WxJV9Ko=", - "subType": "06" - } - } - }, - "azure_javascriptWithScope_rand_explicit_id": { - "kms": "azure", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAP0nxlppgPyjLx0eBempbOlL21G6KbABSrE6+YuNDcsjJjxCQuLR9+aoAwa+yCDEC7GZ1E3oP489edKUuNpE4Ts26jy4aRegu4DmyECUeBwAg=", - "subType": "06" - } - } - }, - "azure_javascriptWithScope_rand_explicit_altname": { - "kms": "azure", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAPO89afu9Sb+cK9wwM1cO1DPjvu5UNyObjjTScy1hy9PzllJGfj7b84f0Ah74jPYsMPwI0Eslu/IYF3+5jmquq5Qp/VUQESlxqRqRK0xIeMfs=", - "subType": "06" - } - } - }, - "azure_javascriptWithScope_det_explicit_id": { - "kms": "azure", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "azure_javascriptWithScope_det_explicit_altname": { - "kms": "azure", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "azure_int_rand_auto_id": { - "kms": "azure", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAQUyy4uWmWdzypsK81q9egREg4s80X3L2hzxJzC+fL08Xzy1z9grpPPCfJrluUVKMMGmmZR8gJPJ70igN3unJbzg==", - "subType": "06" - } - } - }, - "azure_int_rand_auto_altname": { - "kms": "azure", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAQr4gyoHKpGsSJo8CMsYSJk/KilFMJhsDCmxrha7yfNW1uR5sjyZj4B4s6uTXGw76x7aR/AvecDlY3QFJb8L1mjg==", - "subType": "06" - } - } - }, - "azure_int_rand_explicit_id": { - "kms": "azure", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAQ0zgXYPV1MuEFksmDpVDoWkoZQelm3+rYrMiT64KYywO//75799W8TbR3a7O6Q/ErjKQOin2OCp8EWwZqTDdz5w==", - "subType": "06" - } - } - }, - "azure_int_rand_explicit_altname": { - "kms": "azure", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAQG+qz00yizREbP3tla1elMiwf8TKLbUU2XWUP+E0vey/wvbjTTIzqwUlz/b9St77CHJhavypP3hMrngXR9GapbQ==", - "subType": "06" - } - } - }, - "azure_int_det_auto_id": { - "kms": "azure", - "type": "int", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAQCkJH+CataLqp/xBjO77QBprC2xPV+rE+goSZ3C6aqwXIeTYHTOqEbeaFb5iZcqYH5nWvNvnfbZSIMyvSfrPjhw==", - "subType": "06" - } - } - }, - "azure_int_det_explicit_id": { - "kms": "azure", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAQCkJH+CataLqp/xBjO77QBprC2xPV+rE+goSZ3C6aqwXIeTYHTOqEbeaFb5iZcqYH5nWvNvnfbZSIMyvSfrPjhw==", - "subType": "06" - } - } - }, - "azure_int_det_explicit_altname": { - "kms": "azure", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAQCkJH+CataLqp/xBjO77QBprC2xPV+rE+goSZ3C6aqwXIeTYHTOqEbeaFb5iZcqYH5nWvNvnfbZSIMyvSfrPjhw==", - "subType": "06" - } - } - }, - "azure_timestamp_rand_auto_id": { - "kms": "azure", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAARwcXYtx+A7g/zGkjGdkyVxZGCO9Nzj3D70NIpl2TeH2j9qYGP4DenwL1xSgrL2Ez+X58d2BvNhKrjA9y2w1Z8kA==", - "subType": "06" - } - } - }, - "azure_timestamp_rand_auto_altname": { - "kms": "azure", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAARQ0Pjx3l92Aqhn2e1hot2M9rQ6aLPE2Iw8AVhm5AD8FWywWih12Fn2p9+kiE33yKPOCyrTWQHKPtB4yYhqnJgGg==", - "subType": "06" - } - } - }, - "azure_timestamp_rand_explicit_id": { - "kms": "azure", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAARvFMlIzh2IjpHkTJ8buqTOqBA0+CxVDsZacUhSHVMgJLN+0DJsJy8OfkmKMu9Lk5hULY00Udoja87x+79mYfmeQ==", - "subType": "06" - } - } - }, - "azure_timestamp_rand_explicit_altname": { - "kms": "azure", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAAR+2SCd7V5ukAkh7CYpNPIatzTL8osNoA4Mb5jjjbos8eMamImw0fbH8YA+Rdm4CgGdQQ9VDX7MtMWlArkj0Jpew==", - "subType": "06" - } - } - }, - "azure_timestamp_det_auto_id": { - "kms": "azure", - "type": "timestamp", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAARe72T/oC09QGE1vuljb6ZEHa6llEwMLT+C4s9u1fREkOKndpmrOlGE8zOey4teizY1ypOMkIZ8GDQJJ4kLSpNkQ==", - "subType": "06" - } - } - }, - "azure_timestamp_det_explicit_id": { - "kms": "azure", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAARe72T/oC09QGE1vuljb6ZEHa6llEwMLT+C4s9u1fREkOKndpmrOlGE8zOey4teizY1ypOMkIZ8GDQJJ4kLSpNkQ==", - "subType": "06" - } - } - }, - "azure_timestamp_det_explicit_altname": { - "kms": "azure", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAARe72T/oC09QGE1vuljb6ZEHa6llEwMLT+C4s9u1fREkOKndpmrOlGE8zOey4teizY1ypOMkIZ8GDQJJ4kLSpNkQ==", - "subType": "06" - } - } - }, - "azure_long_rand_auto_id": { - "kms": "azure", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAASSSgX7k8iw0xFe0AiIzOu0e0P7Ujyfsk/Cdl0fR5X8V3QLVER+1Qa47Qpb8iWL2VLBSh+55HvIEtvhWn8SwXaog==", - "subType": "06" - } - } - }, - "azure_long_rand_auto_altname": { - "kms": "azure", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAASUhKr5K7ulGTeFbhIvJ2DDE10gRAFn5+2zqnsIFSY8lYV2PBYcENdeNBXZs6kyIAYhJdQyuOChVCerTI5jmQWDw==", - "subType": "06" - } - } - }, - "azure_long_rand_explicit_id": { - "kms": "azure", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAASHxawpjTHdXYRWQSZ7Qi7gFC+o4dW2mPH8s5nQkPFY/EubcJbdAZ5HFp66NfPaDJ/NSH6Vy+TkpX3683RC+bjSQ==", - "subType": "06" - } - } - }, - "azure_long_rand_explicit_altname": { - "kms": "azure", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAASVaMAv6UjuBOUZMJ9qz+58TQWmgaMpS9xrJziJY80ml9aRlDTtRubP7U40CgbDvrtY1QgHbkF/di1XDCB6iXMMg==", - "subType": "06" - } - } - }, - "azure_long_det_auto_id": { - "kms": "azure", - "type": "long", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAS06L8oEPeMvVlA32VlobdOWG24OoyMbv9PyYsHLsbT0bHFwU7lYUSQG9EkYVRNPEDzvXpciE1jT7KT8CRY8XT/g==", - "subType": "06" - } - } - }, - "azure_long_det_explicit_id": { - "kms": "azure", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAS06L8oEPeMvVlA32VlobdOWG24OoyMbv9PyYsHLsbT0bHFwU7lYUSQG9EkYVRNPEDzvXpciE1jT7KT8CRY8XT/g==", - "subType": "06" - } - } - }, - "azure_long_det_explicit_altname": { - "kms": "azure", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQGVERAAAAAAAAAAAAAAAAAS06L8oEPeMvVlA32VlobdOWG24OoyMbv9PyYsHLsbT0bHFwU7lYUSQG9EkYVRNPEDzvXpciE1jT7KT8CRY8XT/g==", - "subType": "06" - } - } - }, - "azure_decimal_rand_auto_id": { - "kms": "azure", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAATJ6LZgPu9F+rPtYsMuvwOx62+g1dAk858BUtE9FjC/300DnbDiolhkHNcyoFs07NYUNgLthW2rISb/ejmsDCt/oqnf8zWYf9vrJEfHaS/Ocw=", - "subType": "06" - } - } - }, - "azure_decimal_rand_auto_altname": { - "kms": "azure", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAATX8eD6qFYWKwIGvXtQG79fXKuPW9hkIV0OwrmNNIqRltw6gPHl+/1X8Q6rgmjCxqvhB05AxTj7xz64gP+ILkPQY8e8VGuCOvOdwDo2IPwy18=", - "subType": "06" - } - } - }, - "azure_decimal_rand_explicit_id": { - "kms": "azure", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAATBjQ9E5wDdTS/iI1XDqGmDBC5aLbPB4nSyrjRLfv1zEoPRjmcHlQmMRJA0mori2VQv6EBFNHeczFCenJaSAkuh77czeXM2vH3T6qwEIDs4dw=", - "subType": "06" - } - } - }, - "azure_decimal_rand_explicit_altname": { - "kms": "azure", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AgGVERAAAAAAAAAAAAAAAAATtkjbhdve7MNuLaTm6qvaewuVUxeC1DMz1fd4RC4jeiBFMd5uZUVJTiOIerwQ6P5G5lkMlezKDWgKl2FUvZH6c7V3JknhsaWcV5iLWGUL6Zc=", - "subType": "06" - } - } - }, - "azure_decimal_det_explicit_id": { - "kms": "azure", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "azure_decimal_det_explicit_altname": { - "kms": "azure", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "azure_minKey_rand_explicit_id": { - "kms": "azure", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "azure_minKey_rand_explicit_altname": { - "kms": "azure", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "azure_minKey_det_explicit_id": { - "kms": "azure", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "azure_minKey_det_explicit_altname": { - "kms": "azure", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "azure_maxKey_rand_explicit_id": { - "kms": "azure", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "azure_maxKey_rand_explicit_altname": { - "kms": "azure", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "azure_maxKey_det_explicit_id": { - "kms": "azure", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "azure_maxKey_det_explicit_altname": { - "kms": "azure", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "gcp_double_rand_auto_id": { - "kms": "gcp", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAABFoHQxnh1XSC0k1B01uFFg7rE9sZVBn4PXo26JX8gx9tuxu+4l9Avb23H9BfOzuWiEc43iw87K/W2y0VfKp5CCg==", - "subType": "06" - } - } - }, - "gcp_double_rand_auto_altname": { - "kms": "gcp", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAABRkZkEtQEFB/r268cNfYRQbN4u5Cxjl9Uh+8wq9TFWLQH2E/9wj2vTLlxQ2cQsM7Qd+XxR5idjfBf9CKAfvUa/A==", - "subType": "06" - } - } - }, - "gcp_double_rand_explicit_id": { - "kms": "gcp", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAABDSUZ+0BbDDEZxCXA+J2T6Js8Uor2dfXSf7s/hpLrg6dxcW2chpht9XLiLOXG5w83TzCAI5pF8cQgBpBpYjR8RQ==", - "subType": "06" - } - } - }, - "gcp_double_rand_explicit_altname": { - "kms": "gcp", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAABCYxugs7L+4S+1rr0VILSbtBm79JPTLuzluQAv0+8hbu5Z6zReOL6Ta1vQH1oA+pSPGYA4euye3zNl1X6ZewbPw==", - "subType": "06" - } - } - }, - "gcp_double_det_explicit_id": { - "kms": "gcp", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDouble": "1.2339999999999999858" - } - }, - "gcp_double_det_explicit_altname": { - "kms": "gcp", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDouble": "1.2339999999999999858" - } - }, - "gcp_string_rand_auto_id": { - "kms": "gcp", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAACx3wSslJEiD80YLTH0n4Bbs4yWVPQl15AU8pZMLLQePqEtI+BJy3t2bqNP1098jS0CGSf+LQmQvXhJn1aNFeMTw==", - "subType": "06" - } - } - }, - "gcp_string_rand_auto_altname": { - "kms": "gcp", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAC5BTe5KP5UxSIk6dJlkz8aaZ/9fg44XPWHafiiL/48lcv3AWbu2gcBo1EDuc1sJQu6XMrtDCRQ7PCHsL7sEQMGQ==", - "subType": "06" - } - } - }, - "gcp_string_rand_explicit_id": { - "kms": "gcp", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAACyJN55OcyXXJ71x8VphTaIuIg6kQtGgVKPhWx0LSdYc6JOjB6LTdA7SEWiSlSWWFZE26UmKcPbkbLDAYf4IVrzQ==", - "subType": "06" - } - } - }, - "gcp_string_rand_explicit_altname": { - "kms": "gcp", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAACoa0d9gqfPP5s3+GoruwzxoQFgli8SmjpTVRLAOcFxqGdfrwSbpYffSw/OR45sZPxXCL6T2MtUvZsl7ukv0jBnw==", - "subType": "06" - } - } - }, - "gcp_string_det_auto_id": { - "kms": "gcp", - "type": "string", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAACTCkyETcWayIZ9YEoQEBVIF3i7iXEe6M3KjYYaSVCYdqSbSHBzlwKWYbP+Xj/MMYBYTLZ1aiRQWCMK4gWPYppZw==", - "subType": "06" - } - } - }, - "gcp_string_det_explicit_id": { - "kms": "gcp", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAACTCkyETcWayIZ9YEoQEBVIF3i7iXEe6M3KjYYaSVCYdqSbSHBzlwKWYbP+Xj/MMYBYTLZ1aiRQWCMK4gWPYppZw==", - "subType": "06" - } - } - }, - "gcp_string_det_explicit_altname": { - "kms": "gcp", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAACTCkyETcWayIZ9YEoQEBVIF3i7iXEe6M3KjYYaSVCYdqSbSHBzlwKWYbP+Xj/MMYBYTLZ1aiRQWCMK4gWPYppZw==", - "subType": "06" - } - } - }, - "gcp_object_rand_auto_id": { - "kms": "gcp", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAADy+8fkyeNYdIK001YogXfKc25zRXS1VGIFVWR6jRfrexy9C8LBBfX3iDwGNPbP2pkC3Tq16OoziQB6iNGf7s7yg==", - "subType": "06" - } - } - }, - "gcp_object_rand_auto_altname": { - "kms": "gcp", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAADixoDdvm57gH8ooOaKI57WyZD5uaPmuYgmrgAFuV8I+oaalqYctnNSYlzQKCMQX/mIcTxvW3oOWY7+IzAz7npvw==", - "subType": "06" - } - } - }, - "gcp_object_rand_explicit_id": { - "kms": "gcp", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAADvq0OAoijgHaVMhsoNMdfWFLyISDo6Y13sYM0CoBXS/oXJNIJJvhgKPbFSV/h4IgiDLy4qNYOTJQvpqt094RPgQ==", - "subType": "06" - } - } - }, - "gcp_object_rand_explicit_altname": { - "kms": "gcp", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAADuTZF7/uqGjFbjzBYspPkxGWvvVAEN/ib8bfPOQrEobtTWuU+ju9H3TlT9DMuFy7RdUZnPB0D3HkM8+zky5xeBw==", - "subType": "06" - } - } - }, - "gcp_object_det_explicit_id": { - "kms": "gcp", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "gcp_object_det_explicit_altname": { - "kms": "gcp", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "gcp_array_rand_auto_id": { - "kms": "gcp", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAE085kJIBX6S93D94bcRjkOegEKsksi2R1cxoVDoOpSdHh3S6bZAOh50W405wvnOKf3KTP9SICDUehQKQZSC026Y5dwVQ2GiM7PtpSedthKJs=", - "subType": "06" - } - } - }, - "gcp_array_rand_auto_altname": { - "kms": "gcp", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAEk/FAXsaqyVr6I+MY5L0axeLhskcEfLZeB8whLMKbjLDLa8Iep+IdrFVSfKo03Zr/7Ah8Js01aT6+Vt4EDMJK0mGKZJOjsrAf3b6RS+Mzebg=", - "subType": "06" - } - } - }, - "gcp_array_rand_explicit_id": { - "kms": "gcp", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAEDY7J9JGiurctYr7ytakNjcryVm42fkubcVpQpUYEkpK/G9NLGjrJuFgNW5ZVjYiPKEBbDB7vEtJqGux0BU++hrvVHNJ3wUT2mbDE18NE4KE=", - "subType": "06" - } - } - }, - "gcp_array_rand_explicit_altname": { - "kms": "gcp", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAErFFlw8W9J2y+751RnYLw0TSK9ThD6sP3i4zPbZtiuhc90RFoJhScvqM9i4sDKuYePZZRLBxdX4EZhZClOmswCGDLCIWsQlSvCwgDcIsRR/w=", - "subType": "06" - } - } - }, - "gcp_array_det_explicit_id": { - "kms": "gcp", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "gcp_array_det_explicit_altname": { - "kms": "gcp", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "gcp_binData=00_rand_auto_id": { - "kms": "gcp", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAF0R5BNkQKfm6wx/tob8nVGDEYV/pvy9UeCqc9gFNuB5d9KxCkgyxryV65rbB90OriqvWFO2jcxzchRYgRI3fQ+A==", - "subType": "06" - } - } - }, - "gcp_binData=00_rand_auto_altname": { - "kms": "gcp", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAF4wcT8XGc3xNdKYDX5/cbUwPDdnkIXlWWCCYeSXSk2oWPxMZnPsVQ44nXKJJsKitoE3r/hL1sSG5239WzCWyx9g==", - "subType": "06" - } - } - }, - "gcp_binData=00_rand_explicit_id": { - "kms": "gcp", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAF07OFs5mlx0AB6QBanaybLuhuFbG+19KxSqHlSgELcz6TQKI6equX97OZdaWSWf2SSeiYm5E6+Y3lgA5l4KxC2A==", - "subType": "06" - } - } - }, - "gcp_binData=00_rand_explicit_altname": { - "kms": "gcp", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAFZ74Q7JMm7y2i3wRmjIRKefhmdnrhP1NXJgploi+44eQ2eRraZsW7peGPYyIfsXEbhgV5+aLmiYgvemBywfdogQ==", - "subType": "06" - } - } - }, - "gcp_binData=00_det_auto_id": { - "kms": "gcp", - "type": "binData=00", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAFhwJkocj36WXoY3mg2GWUrJ5IQTo9MvkwEwRFKdkcxm9pX2PZPK7bN5ZWw3IFcQ/0GfaW6V4LYr8WarZdLF0p5g==", - "subType": "06" - } - } - }, - "gcp_binData=00_det_explicit_id": { - "kms": "gcp", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAFhwJkocj36WXoY3mg2GWUrJ5IQTo9MvkwEwRFKdkcxm9pX2PZPK7bN5ZWw3IFcQ/0GfaW6V4LYr8WarZdLF0p5g==", - "subType": "06" - } - } - }, - "gcp_binData=00_det_explicit_altname": { - "kms": "gcp", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAFhwJkocj36WXoY3mg2GWUrJ5IQTo9MvkwEwRFKdkcxm9pX2PZPK7bN5ZWw3IFcQ/0GfaW6V4LYr8WarZdLF0p5g==", - "subType": "06" - } - } - }, - "gcp_binData=04_rand_auto_id": { - "kms": "gcp", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAFmDO47RTVXzm8D4hfhLICILrQJg3yOwG3HYfCdz7yaanPow2Y6bMxvXxk+kDS29aS8pJKDqJQQoMGc1ZFD3yYKsLQHRi/8rW6TNDQd4sCQ00=", - "subType": "06" - } - } - }, - "gcp_binData=04_rand_auto_altname": { - "kms": "gcp", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAFpiu9Q3LTuPmgdWBqo5Kw0vGF9xU1rMyE4xwR8GccZ7ZMrUcR4AnZnAP7ah5Oz8e7qonNYX4d09obesYSLlIjyK7J7qg+GWiEURgbvmOngaA=", - "subType": "06" - } - } - }, - "gcp_binData=04_rand_explicit_id": { - "kms": "gcp", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAFHRy8dveGuMng9WMmadIp39jD7iEfl3bEjKmzyNoAc0wIcSJZo9kdGbNEwZ4p+A1gz273fmAt/AJwAxwvqdlanLWBr4wiSKz1Mu9VaBcTlyY=", - "subType": "06" - } - } - }, - "gcp_binData=04_rand_explicit_altname": { - "kms": "gcp", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAFiqO+sKodqXuVox0zTbKuY4Ng0QE1If2hDLWXljAEZdYABPk20UJyL/CHR49WP2Cwvi4evJCf8sEfKpR+ugPiyxWzP3iVe6qqTzP93BBjqoc=", - "subType": "06" - } - } - }, - "gcp_binData=04_det_auto_id": { - "kms": "gcp", - "type": "binData=04", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAFEp5Gut6iENHUqDMVdBm4cxQy35gnslTf7vSWW9InFh323BvaTTiubxbxTiMKIa/u47MfMprL9HNQSwgpAQc4lped+YnlRW8RYvTcG4frFtA=", - "subType": "06" - } - } - }, - "gcp_binData=04_det_explicit_id": { - "kms": "gcp", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAFEp5Gut6iENHUqDMVdBm4cxQy35gnslTf7vSWW9InFh323BvaTTiubxbxTiMKIa/u47MfMprL9HNQSwgpAQc4lped+YnlRW8RYvTcG4frFtA=", - "subType": "06" - } - } - }, - "gcp_binData=04_det_explicit_altname": { - "kms": "gcp", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAFEp5Gut6iENHUqDMVdBm4cxQy35gnslTf7vSWW9InFh323BvaTTiubxbxTiMKIa/u47MfMprL9HNQSwgpAQc4lped+YnlRW8RYvTcG4frFtA=", - "subType": "06" - } - } - }, - "gcp_undefined_rand_explicit_id": { - "kms": "gcp", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "gcp_undefined_rand_explicit_altname": { - "kms": "gcp", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "gcp_undefined_det_explicit_id": { - "kms": "gcp", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "gcp_undefined_det_explicit_altname": { - "kms": "gcp", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "gcp_objectId_rand_auto_id": { - "kms": "gcp", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAH8Kt6coc8bPI4QIwS1tIdk6pPA05xlZvrOyAQgvoqaozMtWzG15OunQLDdS3yJ5WRiV7kO6CIKqRrvL2RykB5sw==", - "subType": "06" - } - } - }, - "gcp_objectId_rand_auto_altname": { - "kms": "gcp", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAHU5Yzmz2mbgNQrGSvglgVuv14nQWzipBkZUVSO4eYZ7wLrj/9t0fnizsu7Isgg5oA9fV0Snh/A9pDnHZWoccXUw==", - "subType": "06" - } - } - }, - "gcp_objectId_rand_explicit_id": { - "kms": "gcp", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAHsdq5/FLqbjMDiNzf+6k9yxUtFVjS/xSqErqaboOl21934pAzgkOzBGodpKKFuK0Ta4f3h21XS+84wlIYPMlTtw==", - "subType": "06" - } - } - }, - "gcp_objectId_rand_explicit_altname": { - "kms": "gcp", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAHokIdXxNQ/NBMdMAVNxyVuz/J5pMMdtfxxJxr7PbsRJ3FoD2QNjTgE1Wsz0G4o09Wv9UWD+/mIqPVlLgx1sRtPw==", - "subType": "06" - } - } - }, - "gcp_objectId_det_auto_id": { - "kms": "gcp", - "type": "objectId", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAHkcbaj3Hy3b4HkjRkMgiw5h6jBW7Sc56QSJmAPmVSc2T4B8d79A49dW0RyEiInZJcnVRjrYzUTRtgRaG4/FRd8g==", - "subType": "06" - } - } - }, - "gcp_objectId_det_explicit_id": { - "kms": "gcp", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAHkcbaj3Hy3b4HkjRkMgiw5h6jBW7Sc56QSJmAPmVSc2T4B8d79A49dW0RyEiInZJcnVRjrYzUTRtgRaG4/FRd8g==", - "subType": "06" - } - } - }, - "gcp_objectId_det_explicit_altname": { - "kms": "gcp", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAHkcbaj3Hy3b4HkjRkMgiw5h6jBW7Sc56QSJmAPmVSc2T4B8d79A49dW0RyEiInZJcnVRjrYzUTRtgRaG4/FRd8g==", - "subType": "06" - } - } - }, - "gcp_bool_rand_auto_id": { - "kms": "gcp", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAIf7vUYS5XFrEU4g03lzj9dk8a2MkaQdlH8nE/507D2Gm5XKQLi2jCENZ9UaQm3MQtVr4Uqrgz2GZiQHt9mXcG3w==", - "subType": "06" - } - } - }, - "gcp_bool_rand_auto_altname": { - "kms": "gcp", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAIdOC4Tx/TaVLRtOL/Qh8RUFIzHFB6nSegZoITwZeDethd8V3+R+aIAgzfN3pvmZzagHyVCm2nbNYJNdjOJhuDrg==", - "subType": "06" - } - } - }, - "gcp_bool_rand_explicit_id": { - "kms": "gcp", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAIzB14mX2vaZdiW9kGc+wYEgTCXA0FB5AVEyuERD00+K7U5Otlc6ZUwMtb9nGUu+M7PnnfxiDFHCrUWrTkAZzSUw==", - "subType": "06" - } - } - }, - "gcp_bool_rand_explicit_altname": { - "kms": "gcp", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAIhRLg79ACCMfeERBgG1wirirrZXZzbK11RxHkAbf14Fji2L3sdMBdLBU5I028+rmtDdC7khcNMt11V6XGKpAjnA==", - "subType": "06" - } - } - }, - "gcp_bool_det_explicit_id": { - "kms": "gcp", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": true - }, - "gcp_bool_det_explicit_altname": { - "kms": "gcp", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": true - }, - "gcp_date_rand_auto_id": { - "kms": "gcp", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAJL+mjI8xBmSahOOi3XkGRGxjhGNdJb445KZtRAaUdCV0vMKbrefuiDHJDPCYo7mLYNhRSIhQfs63IFYMrlKP26A==", - "subType": "06" - } - } - }, - "gcp_date_rand_auto_altname": { - "kms": "gcp", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAJbeyqO5FRmqvPYyOb0tdKtK6JOg8QKbCl37/iFeEm7N0T0Pjb8Io4U0ndB3O6fjokc3kDQrZcQkV+OFWIMuKFjw==", - "subType": "06" - } - } - }, - "gcp_date_rand_explicit_id": { - "kms": "gcp", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAJVz3rSYIcoYtM0tZ8pB2Ytgh8RvYPeZvW7aUVJfZkZlIhfUHOHEf5kHqxzt8E1l2n3lmK/7ZVCFUuCCmr8cZyWw==", - "subType": "06" - } - } - }, - "gcp_date_rand_explicit_altname": { - "kms": "gcp", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAJAiQqNyUcpuDEpFt7skp2NSHFCux2XObrIIFgXReYgtWoapL/n4zksJXl89PGavzNPBZbzgEa8uwwAe+S+Y6TLg==", - "subType": "06" - } - } - }, - "gcp_date_det_auto_id": { - "kms": "gcp", - "type": "date", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAJmATV2A1P5DmrS8uES6AMD9y+EU3x7u4K4J0p296iSkCEgIdZZORhPIEnuJK3FHw1II6IEShW2nd7sOJRZSGKcg==", - "subType": "06" - } - } - }, - "gcp_date_det_explicit_id": { - "kms": "gcp", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAJmATV2A1P5DmrS8uES6AMD9y+EU3x7u4K4J0p296iSkCEgIdZZORhPIEnuJK3FHw1II6IEShW2nd7sOJRZSGKcg==", - "subType": "06" - } - } - }, - "gcp_date_det_explicit_altname": { - "kms": "gcp", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAJmATV2A1P5DmrS8uES6AMD9y+EU3x7u4K4J0p296iSkCEgIdZZORhPIEnuJK3FHw1II6IEShW2nd7sOJRZSGKcg==", - "subType": "06" - } - } - }, - "gcp_null_rand_explicit_id": { - "kms": "gcp", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "gcp_null_rand_explicit_altname": { - "kms": "gcp", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "gcp_null_det_explicit_id": { - "kms": "gcp", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "gcp_null_det_explicit_altname": { - "kms": "gcp", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "gcp_regex_rand_auto_id": { - "kms": "gcp", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAALiebb3hWwJRqlgVEhLYKKvo6cnlU7BFnZnvlZ8GuIr11fUvcnS9Tg2m7vPmfL7WVyuNrXlR48x28Es49YuaxuIg==", - "subType": "06" - } - } - }, - "gcp_regex_rand_auto_altname": { - "kms": "gcp", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAALouDFNLVgBXqhJvBRj9DKacuD1AQ2NAVDW93P9NpZDFFwGOFxmKUcklbPj8KkHqvma8ovVUBTLLUDR+tKFRvC2Q==", - "subType": "06" - } - } - }, - "gcp_regex_rand_explicit_id": { - "kms": "gcp", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAALtdcT9+3R1he4eniT+1opqs/YtujFlqzBXssv+hCKhJQVY/IXde32nNpQ1WTgUc7jfIJl/v9HvuA9cDHPtDWWTg==", - "subType": "06" - } - } - }, - "gcp_regex_rand_explicit_altname": { - "kms": "gcp", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAALAwlRAlj4Zpn+wu9eOcs5CsNgrkVwrgmu1tc4wyQp0Lt+3UcplYsXQMrMPcTx3yB0JcI4Kh65n/DrAaA+G/a6iw==", - "subType": "06" - } - } - }, - "gcp_regex_det_auto_id": { - "kms": "gcp", - "type": "regex", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAALbCutQ7D94gk0djewcQiEdMFVVa21+Dn5enQf/mqPi3o7vPy7OejDBk9fiZRffsioRMhlx2cxqa8T3+AkeN96yg==", - "subType": "06" - } - } - }, - "gcp_regex_det_explicit_id": { - "kms": "gcp", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAALbCutQ7D94gk0djewcQiEdMFVVa21+Dn5enQf/mqPi3o7vPy7OejDBk9fiZRffsioRMhlx2cxqa8T3+AkeN96yg==", - "subType": "06" - } - } - }, - "gcp_regex_det_explicit_altname": { - "kms": "gcp", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAALbCutQ7D94gk0djewcQiEdMFVVa21+Dn5enQf/mqPi3o7vPy7OejDBk9fiZRffsioRMhlx2cxqa8T3+AkeN96yg==", - "subType": "06" - } - } - }, - "gcp_dbPointer_rand_auto_id": { - "kms": "gcp", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAMG8P+Y2YNIgknxE0/yPDCHASBvCU1IJwsEyaJPuOjn03enxEN7z/wbjVMN0lGUptDP3SVL+OIZtQ35VRP84MtnbdhcfZWqMhLjzrCjmtHUEg=", - "subType": "06" - } - } - }, - "gcp_dbPointer_rand_auto_altname": { - "kms": "gcp", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAMKCLFUN6ApB5fSVEWazRddhKTEwgqI/mxfe0BBxht69pZQYhTjhOJP0YcIrtr+RCeHOa4FIJgQod1CFOellIzO5YH5CuV4wPxCAlOdbJcBK8=", - "subType": "06" - } - } - }, - "gcp_dbPointer_rand_explicit_id": { - "kms": "gcp", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAM7ULEA6uKKv4Pu4Sa3aAt7dXtEwfQC98aJoLBapHT+xXtn5GWPynOZQNtV3lGaYExQjiGdYbzOcav3SVy/sYTe3ktgkQnuZfe0tk0zyvKIMM=", - "subType": "06" - } - } - }, - "gcp_dbPointer_rand_explicit_altname": { - "kms": "gcp", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAMoMveHO1MadAKuT498xiKWWBUKRbH7k7P2YETDg/BufVw0swos07rk6WJa1vqyF61QEmACjy4pmlK/5P0VfKJBAIvif51YqHPQkobJVS3nVA=", - "subType": "06" - } - } - }, - "gcp_dbPointer_det_auto_id": { - "kms": "gcp", - "type": "dbPointer", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAMz+9m1bE+Th9YeyPmJdtJPO0F5QYsGYtU/Eom/LSoYjDmTmV2ehkKx/cevIxJfZUc+Mvv/uGoeuubGl8tiX4l+f6yLrSIS6QBtIHYKXk+JNE=", - "subType": "06" - } - } - }, - "gcp_dbPointer_det_explicit_id": { - "kms": "gcp", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAMz+9m1bE+Th9YeyPmJdtJPO0F5QYsGYtU/Eom/LSoYjDmTmV2ehkKx/cevIxJfZUc+Mvv/uGoeuubGl8tiX4l+f6yLrSIS6QBtIHYKXk+JNE=", - "subType": "06" - } - } - }, - "gcp_dbPointer_det_explicit_altname": { - "kms": "gcp", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAMz+9m1bE+Th9YeyPmJdtJPO0F5QYsGYtU/Eom/LSoYjDmTmV2ehkKx/cevIxJfZUc+Mvv/uGoeuubGl8tiX4l+f6yLrSIS6QBtIHYKXk+JNE=", - "subType": "06" - } - } - }, - "gcp_javascript_rand_auto_id": { - "kms": "gcp", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAANqBD0ITMn4BaFnDp7BX7vXbRBkFwmjQRVUeBbwsQtv5WVlJMAd/2+w7tyH8Wc44x0/9U/DA5GVhpTrtdDyPBI3w==", - "subType": "06" - } - } - }, - "gcp_javascript_rand_auto_altname": { - "kms": "gcp", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAANtA0q4mbkAaKX4x1xk0/094Mln0wnh2bYnI6s6dh+l2WLDH7A9JMZxCl6kc4uOsEfbOvjP/PLIYtdMGs14EjM5A==", - "subType": "06" - } - } - }, - "gcp_javascript_rand_explicit_id": { - "kms": "gcp", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAANfrW3pmeiFdBFt5tJS6Auq9Wo/J4r/vMRiueLWxig5S1zYuf9kFPJMK/nN9HqQPIcBIJIC2i/uEPgeepaNXACCw==", - "subType": "06" - } - } - }, - "gcp_javascript_rand_explicit_altname": { - "kms": "gcp", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAANL7UZNzpwfwhRn/HflWIE9CSxGYNwLSo9d86HsOJ42rrZKq6HQqm/hiEAg0lyqCxVIVFxYEc2BUWSaq4/+SSyZw==", - "subType": "06" - } - } - }, - "gcp_javascript_det_auto_id": { - "kms": "gcp", - "type": "javascript", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAANB2d97R8nUJqnG0JPsWzyFe5pct5jvUljdkPnlZvLN1ZH+wSu4WmLfjri6IzzYP//f8tywn4Il+R4lZ0Kr/RAeA==", - "subType": "06" - } - } - }, - "gcp_javascript_det_explicit_id": { - "kms": "gcp", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAANB2d97R8nUJqnG0JPsWzyFe5pct5jvUljdkPnlZvLN1ZH+wSu4WmLfjri6IzzYP//f8tywn4Il+R4lZ0Kr/RAeA==", - "subType": "06" - } - } - }, - "gcp_javascript_det_explicit_altname": { - "kms": "gcp", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAANB2d97R8nUJqnG0JPsWzyFe5pct5jvUljdkPnlZvLN1ZH+wSu4WmLfjri6IzzYP//f8tywn4Il+R4lZ0Kr/RAeA==", - "subType": "06" - } - } - }, - "gcp_symbol_rand_auto_id": { - "kms": "gcp", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAOsGdnr6EKcBdOAvYrP0o1pWbhhJbYsqfVwwwS1zq6ZkBayOss2J3TuYwBGXhJFlq3iIiWLdxGQ883XIvuAECnqUNuvpK2rOLwtDg8xJLiH24=", - "subType": "06" - } - } - }, - "gcp_symbol_rand_auto_altname": { - "kms": "gcp", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAOpfa6CUSnJBvnWdd7pSZ2pXAbYm68Yka6xa/fuyhVx/Tc926/JpqmOmQtXqbOj8dZra0rQ3/yxHySwgD7s9Qr+xvyL7LvAguGkGmEV5H4Xz4=", - "subType": "06" - } - } - }, - "gcp_symbol_rand_explicit_id": { - "kms": "gcp", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAO085iqYGFdtjiFWHcNqE0HuKMNHmk49DVh+pX8Pb4p3ehB57JL1nRqaXqHPqhFenxSEInT/te9HQRr+ADcHADvUGsScfm/n85v85nq6X+5y4=", - "subType": "06" - } - } - }, - "gcp_symbol_rand_explicit_altname": { - "kms": "gcp", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAOiidb+2TsbAb2wc7MtDzb/UYsjgVNSw410Sz9pm+Uy7aZROE5SURKXdLjrCH2ZM2a+XCAl3o9yAoNgmAjEvYVxjmyzLK00EVjT42MBOrdA+k=", - "subType": "06" - } - } - }, - "gcp_symbol_det_auto_id": { - "kms": "gcp", - "type": "symbol", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAOFBGo77joqvZl7QQMB9ebMsAI3uro8ILQTJsTUgAqNzSh1mNzqihGHZYe84xtgMrVxNuwcjkidkRbNnLXWLuarOx4tgmOLx5A5G1eYEe3s7Q=", - "subType": "06" - } - } - }, - "gcp_symbol_det_explicit_id": { - "kms": "gcp", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAOFBGo77joqvZl7QQMB9ebMsAI3uro8ILQTJsTUgAqNzSh1mNzqihGHZYe84xtgMrVxNuwcjkidkRbNnLXWLuarOx4tgmOLx5A5G1eYEe3s7Q=", - "subType": "06" - } - } - }, - "gcp_symbol_det_explicit_altname": { - "kms": "gcp", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAOFBGo77joqvZl7QQMB9ebMsAI3uro8ILQTJsTUgAqNzSh1mNzqihGHZYe84xtgMrVxNuwcjkidkRbNnLXWLuarOx4tgmOLx5A5G1eYEe3s7Q=", - "subType": "06" - } - } - }, - "gcp_javascriptWithScope_rand_auto_id": { - "kms": "gcp", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAPUsQHeXWhdmyfQ2Sq1ev1HMuMhBTc/FZFKO9tMMcI9qzjr+z4IdCOFCcx24/T/6NCsDpMiOGNnCdaBCCNRwNM0CTIkpHNLO+RSZORDgAsm9Q=", - "subType": "06" - } - } - }, - "gcp_javascriptWithScope_rand_auto_altname": { - "kms": "gcp", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAPRZawtuu0gErebyFqiQw0LxniWhdeujGzaqfAXriGo/2fU7PalzTlWQa8wsv0y7Q/i1K4JbQwCEFpJWLppmtZshCGbVWjpPljB2BH4NNrLPE=", - "subType": "06" - } - } - }, - "gcp_javascriptWithScope_rand_explicit_id": { - "kms": "gcp", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAP0qkQjuKmKIqdrsrR9djxt+1jFlEL7K9bP1oz7QWuY38dZJOoGwa6G1bP4wDzjsucJLCEgU2IY+t7BHraBFXvR/Aar8ID5eXcvJ7iOPIyqUw=", - "subType": "06" - } - } - }, - "gcp_javascriptWithScope_rand_explicit_altname": { - "kms": "gcp", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAP6L41iuBWGLg3hQZuhXp4MupTQvIT07+/+CRY292sC02mehk5BkuSOEVrehlvyvBJFKia4Bqd/UWvY8PnUPLqFKTLnokONWbAuh36y3gjStw=", - "subType": "06" - } - } - }, - "gcp_javascriptWithScope_det_explicit_id": { - "kms": "gcp", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "gcp_javascriptWithScope_det_explicit_altname": { - "kms": "gcp", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "gcp_int_rand_auto_id": { - "kms": "gcp", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAQ+6oRKWMSvC+3UGrHSyGeVlR9bFnZtFTmYlUoGn04k6ndtCl8rsmBVUV6dMMYd7znnZtTSIGPI8q6jwf/NJjdIw==", - "subType": "06" - } - } - }, - "gcp_int_rand_auto_altname": { - "kms": "gcp", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAQnz5jAbrrdutTPFA4m3MvlVJr3bpurTKY5xjwO5k8DZpeWTJzr+kVEJjG6M8/RgC/0UFNgBBrDbDhYa8PZHRijw==", - "subType": "06" - } - } - }, - "gcp_int_rand_explicit_id": { - "kms": "gcp", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAQfRFoxUgjrv8up/eZ/fLlr/z++d/jFm30nYvKqsnQT7vkmmujJWc8yAtthR9OI6W5biBgAkounqRHhvatLZC6gA==", - "subType": "06" - } - } - }, - "gcp_int_rand_explicit_altname": { - "kms": "gcp", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAQY/ePk59RY6vLejx9a5ITwkT9000KAubVSqMoQwv7lNXO+GKZfZoLHG6k1MA/IxTvl1Zbz1Tw1bTctmj0HPEGNA==", - "subType": "06" - } - } - }, - "gcp_int_det_auto_id": { - "kms": "gcp", - "type": "int", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAQE9RVV9pOuysUUEGKq0u6ztFM0gTpoOHcHsTFQstA7+L9XTvxWEgL3RgNeq5KtKdODlxl62niV8dnQwlSoDSSWw==", - "subType": "06" - } - } - }, - "gcp_int_det_explicit_id": { - "kms": "gcp", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAQE9RVV9pOuysUUEGKq0u6ztFM0gTpoOHcHsTFQstA7+L9XTvxWEgL3RgNeq5KtKdODlxl62niV8dnQwlSoDSSWw==", - "subType": "06" - } - } - }, - "gcp_int_det_explicit_altname": { - "kms": "gcp", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAQE9RVV9pOuysUUEGKq0u6ztFM0gTpoOHcHsTFQstA7+L9XTvxWEgL3RgNeq5KtKdODlxl62niV8dnQwlSoDSSWw==", - "subType": "06" - } - } - }, - "gcp_timestamp_rand_auto_id": { - "kms": "gcp", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAARLnk1LpJIriKr6iiY1yBDGnfkRaHNwWcQyL+mORtYC4+AQ6oMv0qpGrJxS2QCbYY1tGmAISqZHCIExCG+TIv4bw==", - "subType": "06" - } - } - }, - "gcp_timestamp_rand_auto_altname": { - "kms": "gcp", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAARaqYXh9AVZI6gvRZrBwbprE5P3K5Qf4PIK1ca+mLRNOof0EExyAhtku7mYXusLeq0ww/tV6Zt1cA36KsT8a0Nog==", - "subType": "06" - } - } - }, - "gcp_timestamp_rand_explicit_id": { - "kms": "gcp", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAARLXzBjkCN8BpfXDIrb94kuZCD07Uo/DMBfMIWQtAb1++tTheUoY2ClQz33Luh4g8NXwuMJ7h8ufE70N2+b1yrUg==", - "subType": "06" - } - } - }, - "gcp_timestamp_rand_explicit_altname": { - "kms": "gcp", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAARe44QH9ZvTAuHsWhEMoue8eHod+cJpBm+Kl/Xtw7NI/6UTOOHC5Kkg20EvX3+GwXdAGk0bUSCFiTZb/yPox1OlA==", - "subType": "06" - } - } - }, - "gcp_timestamp_det_auto_id": { - "kms": "gcp", - "type": "timestamp", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAARzXjP6d6j/iQxiz1/TC/m+IfAGLFH9wY2ksS//i9x15QttlhcRrT3XmPvxaP5OjTHac4Gq3m2aXiJH56lETyl8A==", - "subType": "06" - } - } - }, - "gcp_timestamp_det_explicit_id": { - "kms": "gcp", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAARzXjP6d6j/iQxiz1/TC/m+IfAGLFH9wY2ksS//i9x15QttlhcRrT3XmPvxaP5OjTHac4Gq3m2aXiJH56lETyl8A==", - "subType": "06" - } - } - }, - "gcp_timestamp_det_explicit_altname": { - "kms": "gcp", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAARzXjP6d6j/iQxiz1/TC/m+IfAGLFH9wY2ksS//i9x15QttlhcRrT3XmPvxaP5OjTHac4Gq3m2aXiJH56lETyl8A==", - "subType": "06" - } - } - }, - "gcp_long_rand_auto_id": { - "kms": "gcp", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAASuGZs48eEyVBJ9vvM6cvRySfuR0WM4kL7lx52rSGXBKtkZywyP5rJwNtRn9WTBMDqc1O/4jUgYXpqHx39SLhUPA==", - "subType": "06" - } - } - }, - "gcp_long_rand_auto_altname": { - "kms": "gcp", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAS/62F71oKTX1GlvOP89uNhXpIyLZ5OdnuLeM/hvL5HWyOudSb06cG3+xnPg3QgppAYFK5X2PGgrEcrA87AykLPg==", - "subType": "06" - } - } - }, - "gcp_long_rand_explicit_id": { - "kms": "gcp", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAASSgx+p4YzTvjZ+GCZCFHEKHNXJUSloPnLRHE4iJ515Epb8Tox7h8/aIAkB3ulnDS9BiT5UKdye2TWf8OBEwkXzg==", - "subType": "06" - } - } - }, - "gcp_long_rand_explicit_altname": { - "kms": "gcp", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAAStqszyEfltpgd3aYeoyqaJX27OX861o06VhNX/N2fdSfKx0NQq/hWlWTkX6hK3hjCijiTtHmhFQR6QLkHD/6THw==", - "subType": "06" - } - } - }, - "gcp_long_det_auto_id": { - "kms": "gcp", - "type": "long", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAS0wJHtZKnxJlWnlSu0xuq7bZR25UdwcbdCRSaXBC0EXEFuqlzrZSn1lcwKPKGZQO8EQ6SdQDqK95alMLmM8eQrQ==", - "subType": "06" - } - } - }, - "gcp_long_det_explicit_id": { - "kms": "gcp", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAS0wJHtZKnxJlWnlSu0xuq7bZR25UdwcbdCRSaXBC0EXEFuqlzrZSn1lcwKPKGZQO8EQ6SdQDqK95alMLmM8eQrQ==", - "subType": "06" - } - } - }, - "gcp_long_det_explicit_altname": { - "kms": "gcp", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ARgjwAAAAAAAAAAAAAAAAAAS0wJHtZKnxJlWnlSu0xuq7bZR25UdwcbdCRSaXBC0EXEFuqlzrZSn1lcwKPKGZQO8EQ6SdQDqK95alMLmM8eQrQ==", - "subType": "06" - } - } - }, - "gcp_decimal_rand_auto_id": { - "kms": "gcp", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAATg4U3nbHBX/Az3ie2yurEIJO6cFryQWKiCpBbx1z0NF7RXd7kFC1XzaY6zcBjfl2AfRO8FFmgjTmFXb6gTRSSF0iAZJZTslfe3n6YFtwSKDI=", - "subType": "06" - } - } - }, - "gcp_decimal_rand_auto_altname": { - "kms": "gcp", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAATdSSyp0ewboV5zI3T3TV/FOrdx0UQbFHhqcH+yqpotoWPSw5dxE+BEoihYLeaPKuVU/rUIY4TUv05Egj7Ovg62Kpk3cPscxsGtE/T2Ppbt6o=", - "subType": "06" - } - } - }, - "gcp_decimal_rand_explicit_id": { - "kms": "gcp", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAATl7k20T22pf5Y9knVwIDyOIlbHyZBJqyi3Mai8APEZIYjpSKDKs8QNAH69CIjupyge8Izw4Cuch0bRrvMbp6YFfrUgk1JIQ4iLKkqqzHpBTY=", - "subType": "06" - } - } - }, - "gcp_decimal_rand_explicit_altname": { - "kms": "gcp", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AhgjwAAAAAAAAAAAAAAAAAATF7YLkhkuLhXdxrQk2fJTs128tRNYHeodkqw7ha/TxW3Czr5gE272gnkdzfNoS7uu9XwOr1yjrC6y/8gHALAWn77WvGrAlBktLQbIIinsuds=", - "subType": "06" - } - } - }, - "gcp_decimal_det_explicit_id": { - "kms": "gcp", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "gcp_decimal_det_explicit_altname": { - "kms": "gcp", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "gcp_minKey_rand_explicit_id": { - "kms": "gcp", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "gcp_minKey_rand_explicit_altname": { - "kms": "gcp", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "gcp_minKey_det_explicit_id": { - "kms": "gcp", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "gcp_minKey_det_explicit_altname": { - "kms": "gcp", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "gcp_maxKey_rand_explicit_id": { - "kms": "gcp", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "gcp_maxKey_rand_explicit_altname": { - "kms": "gcp", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "gcp_maxKey_det_explicit_id": { - "kms": "gcp", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "gcp_maxKey_det_explicit_altname": { - "kms": "gcp", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "kmip_double_rand_auto_id": { - "kms": "kmip", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAB1hL/nPkpQtqxQUANbIJr30PQ98vPvaoy4JWUoElOL+cCnrSra3o7W+12dydy0rCS2EKrVm7Fw0C8L9nf1hpWjw==", - "subType": "06" - } - } - }, - "kmip_double_rand_auto_altname": { - "kms": "kmip", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAABxlcphy2SxXlkRBvO1Z3nNUqchmeOhIhkdYBbbW7CwYeLVRDciXFsZN73Nb9Bm+W4IpUNpo6mqFEtfjevIjtFyg==", - "subType": "06" - } - } - }, - "kmip_double_rand_explicit_id": { - "kms": "kmip", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAABx5AfRSiblFc1DGwxRIaUSP2kaM76ryzPUKL9KnEgnX1kjIlFz5B15uMht2cxdrntHFe1qZZk8V9PxTBpWZhJ8Q==", - "subType": "06" - } - } - }, - "kmip_double_rand_explicit_altname": { - "kms": "kmip", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAABXUC9v9HPrmU9tINzFmr2sQM9f7GHDus+y5T4pWX28PRtfnTysN/ANCfB9RosoR/wuKsbznwwD2JfSzOvlKo3PQ==", - "subType": "06" - } - } - }, - "kmip_double_det_explicit_id": { - "kms": "kmip", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDouble": "1.2339999999999999858" - } - }, - "kmip_double_det_explicit_altname": { - "kms": "kmip", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDouble": "1.2339999999999999858" - } - }, - "kmip_string_rand_auto_id": { - "kms": "kmip", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAACGHmqW1qbfqVlfB0x0CkXCk9smhs3yXsxJ/8eypSgbDQqVLSW2nf5bbHpnoCHHNtQ7I7ZBXzPzDLH2GgMJpopeQ==", - "subType": "06" - } - } - }, - "kmip_string_rand_auto_altname": { - "kms": "kmip", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAC9BJTD1pEMbslAjbJYt7yx/jzKkcZF3axu96+NYwp8afUCjXG5TOUZzODOwkbJuWgr7DBxa2GkZTvaAEk86h+Ow==", - "subType": "06" - } - } - }, - "kmip_string_rand_explicit_id": { - "kms": "kmip", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAACQlG28ECy8KHXC7GEPdC8+raBo2RMJwl5pofcPaTGkPUEbkreguMd1mYctNb90vXxby1nNeJY4o5zJJCMiNhNXg==", - "subType": "06" - } - } - }, - "kmip_string_rand_explicit_altname": { - "kms": "kmip", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAACbWuK+3nzeKSNVjmgHb0Ii7rA+CsAd+gYubPiMiHXZwE/o6i9FYWN+t/VK3p4K0CwIi6q3cycrMb2IgcvM27Q7Q==", - "subType": "06" - } - } - }, - "kmip_string_det_auto_id": { - "kms": "kmip", - "type": "string", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAC5OZgr9keCXOIj5Fi06i4win1xt7gpsyPA4Os+HdFn1MIP9tnktvWNRb8Rqhuj2O9KO83brx74Hu3EQ4nT6uCMw==", - "subType": "06" - } - } - }, - "kmip_string_det_explicit_id": { - "kms": "kmip", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAC5OZgr9keCXOIj5Fi06i4win1xt7gpsyPA4Os+HdFn1MIP9tnktvWNRb8Rqhuj2O9KO83brx74Hu3EQ4nT6uCMw==", - "subType": "06" - } - } - }, - "kmip_string_det_explicit_altname": { - "kms": "kmip", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAC5OZgr9keCXOIj5Fi06i4win1xt7gpsyPA4Os+HdFn1MIP9tnktvWNRb8Rqhuj2O9KO83brx74Hu3EQ4nT6uCMw==", - "subType": "06" - } - } - }, - "kmip_object_rand_auto_id": { - "kms": "kmip", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAADh2nGqaAUwHDRVjqYpj8JAPH7scmiHp1Z9SGBZQ6Fapxm+zWDdTBHyitM9U69BctJ5DaaafyqFOj5yr6sJ+ebJQ==", - "subType": "06" - } - } - }, - "kmip_object_rand_auto_altname": { - "kms": "kmip", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAD1YhOKyNle4y0Qbeio1HlCULLeTCALCLgKSITd50bilD+oDyqQawixJAwphcdjhLdFzbFwst5RWqpsiWMPHx4hQ==", - "subType": "06" - } - } - }, - "kmip_object_rand_explicit_id": { - "kms": "kmip", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAADveILoWFgX7AhUWCv8UL52TUa75qHuoNadnTQydJlqd6PVmtRKj+8vS7VwxNWPaH4wB1Tk7emMyFEbZpvvzjxqQ==", - "subType": "06" - } - } - }, - "kmip_object_rand_explicit_altname": { - "kms": "kmip", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAADB/LN9V/4SROJn+ESHRLM7wwcUltQUx3+LbbYXjPDXiiV14HK76Iyy6ZxJ+M5qC9bRj3afhTKuWLBblB8WwksOg==", - "subType": "06" - } - } - }, - "kmip_object_det_explicit_id": { - "kms": "kmip", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "kmip_object_det_explicit_altname": { - "kms": "kmip", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "kmip_array_rand_auto_id": { - "kms": "kmip", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAEasWXQam8XtOkSO0nEttMCQ0iZ4V8DDmhMKyQDFDsiNHyF2h98Ya/xFv4ZSlbpGWXPBvBATEGgov/PDg2vhVi53y4Pk33RHfY60hABuksp3o=", - "subType": "06" - } - } - }, - "kmip_array_rand_auto_altname": { - "kms": "kmip", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAEj3A1DYSEHm/3SlEmusA+pewxRPUoZ2NAjs60ioEBlCw9n6yiiB+X8d/w40TKsjZcOSfh05NC0z3gnpqQvrNolkxkvi9dmFiZeiiv5vBZUPI=", - "subType": "06" - } - } - }, - "kmip_array_rand_explicit_id": { - "kms": "kmip", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAEqeJW+L6lP0bn5QcD0FMI0C8vv2n5kV7SKgqKi1o5mxaxmp3Cjlspf7yumfSiQ5js6G9yJVAvHuxlqv14UFyR9RgXS0PIA8WzsAqkL0sJSw0=", - "subType": "06" - } - } - }, - "kmip_array_rand_explicit_altname": { - "kms": "kmip", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAEnPlPwy0B1VKuNum1GzkZwQjZia5jNYL5bf/k+PbfhnToTRWGxx8+E3R7XXp6YT/rFkjPlzU8ww9+iZNo2oqNpYuHdrIC8ybhO6HZAlvcERo=", - "subType": "06" - } - } - }, - "kmip_array_det_explicit_id": { - "kms": "kmip", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "kmip_array_det_explicit_altname": { - "kms": "kmip", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "kmip_binData=00_rand_auto_id": { - "kms": "kmip", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAFliNDZ6DmjoVcYQBCKDI9njpBsDELg+TD6XLF7xbZnMaJCCHLHr7w3x2/xFfrFSN44CtGAKOniYPCMAspaxHqOA==", - "subType": "06" - } - } - }, - "kmip_binData=00_rand_auto_altname": { - "kms": "kmip", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAF/P8LPmHKGgG0l5/Xi7jdkwfxpGPxoY0417suCvN6zjM3JNdufytzkektrm9CbBb1SnZCGYF9c0FCMzFG+tN/dg==", - "subType": "06" - } - } - }, - "kmip_binData=00_rand_explicit_id": { - "kms": "kmip", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAFWI0N4RbnYdEiFrzNpbRN9p+bSLm8Lthiu4K3/CvBg6GQpLMVQFhjW01Bud0lxpT2ohRnOK+ASUhiFcUU/t/lWQ==", - "subType": "06" - } - } - }, - "kmip_binData=00_rand_explicit_altname": { - "kms": "kmip", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAFQZvAtpY4cjEr1rJWVoUGaZKmzocSJ0muHose7Tk5kRDczjFa4Jcu4hN7JLM9qz2z4g+WJC3KQTdW4ZBXStke/Q==", - "subType": "06" - } - } - }, - "kmip_binData=00_det_auto_id": { - "kms": "kmip", - "type": "binData=00", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAFohIHrvzu8xLxVHsnYEDhZmv8BpEoEtFSjMUQzvBLUInvvTuU/rOzlVL88CkAEII7M3hcvrz8FKY7b7lC1veoYg==", - "subType": "06" - } - } - }, - "kmip_binData=00_det_explicit_id": { - "kms": "kmip", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAFohIHrvzu8xLxVHsnYEDhZmv8BpEoEtFSjMUQzvBLUInvvTuU/rOzlVL88CkAEII7M3hcvrz8FKY7b7lC1veoYg==", - "subType": "06" - } - } - }, - "kmip_binData=00_det_explicit_altname": { - "kms": "kmip", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAFohIHrvzu8xLxVHsnYEDhZmv8BpEoEtFSjMUQzvBLUInvvTuU/rOzlVL88CkAEII7M3hcvrz8FKY7b7lC1veoYg==", - "subType": "06" - } - } - }, - "kmip_binData=04_rand_auto_id": { - "kms": "kmip", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAFn7rhdO8tYq77uVxcqd9Qjz84Yg7JnJMYf0ULTMTh1vJHacckkhXw+8fIMMiAKwuOVwGkMAtu5RBvrFqdfxryCg8RLTxu1YYVthufiClEIS0=", - "subType": "06" - } - } - }, - "kmip_binData=04_rand_auto_altname": { - "kms": "kmip", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAFwwXQx9dKyoyHq7GBMmHzYe9ysoJK/f/ZWzA6nErau9MtX1gqi7VRsYqkamb47/zVbsLZwPMmdgNyPxEh3kqbV2D61t5RG2A3VeqhO1pTF8c=", - "subType": "06" - } - } - }, - "kmip_binData=04_rand_explicit_id": { - "kms": "kmip", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAFALeGeinJ8DE+WZniLdCIW2gfJUj445Ukp9PvRLgBXLGedl8mIXlLF2eu3BA9vP6s5y9w6peQjhn+oEofrsUVYD2duyzeIRMKgNiNchjf6TU=", - "subType": "06" - } - } - }, - "kmip_binData=04_rand_explicit_altname": { - "kms": "kmip", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAF06Fx8CO3OSKE3fGri0VwK0e22YiG9LH2QkDTsRdFbT2lBm+bDD9FrEY8vKWS5RljMuysaxjBOzZ98d2LEs6k8LMOm83Nz/RESe4ZbbcfdQ0=", - "subType": "06" - } - } - }, - "kmip_binData=04_det_auto_id": { - "kms": "kmip", - "type": "binData=04", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAFzmZI909fJgxOykJtvOlv5LsX8z6BxUX2Xg5TsIwOxJMPSC8usm/zR7sZawoVBOuJxtNVLY/8oNP/4pFtAmQo02bUOtTo1yxNz/IZa9x+Q5E=", - "subType": "06" - } - } - }, - "kmip_binData=04_det_explicit_id": { - "kms": "kmip", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAFzmZI909fJgxOykJtvOlv5LsX8z6BxUX2Xg5TsIwOxJMPSC8usm/zR7sZawoVBOuJxtNVLY/8oNP/4pFtAmQo02bUOtTo1yxNz/IZa9x+Q5E=", - "subType": "06" - } - } - }, - "kmip_binData=04_det_explicit_altname": { - "kms": "kmip", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAFzmZI909fJgxOykJtvOlv5LsX8z6BxUX2Xg5TsIwOxJMPSC8usm/zR7sZawoVBOuJxtNVLY/8oNP/4pFtAmQo02bUOtTo1yxNz/IZa9x+Q5E=", - "subType": "06" - } - } - }, - "kmip_undefined_rand_explicit_id": { - "kms": "kmip", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "kmip_undefined_rand_explicit_altname": { - "kms": "kmip", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "kmip_undefined_det_explicit_id": { - "kms": "kmip", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "kmip_undefined_det_explicit_altname": { - "kms": "kmip", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "kmip_objectId_rand_auto_id": { - "kms": "kmip", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAHZFzE908RuO5deEt3t2QQdT12ybwqbm8D+sMJrdKt2Wp4kVPsw4ocAGGsRYN6VXe46P5fmyG5HqVWn0hkflZnQg==", - "subType": "06" - } - } - }, - "kmip_objectId_rand_auto_altname": { - "kms": "kmip", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAH3dPKyCCStvOtVGzlgIS33fsl8OAwQblt9i21pOVuLiliY1Tup9EtkSic88+nNEtXnq9gRknRzLthXv/k1ql+7Q==", - "subType": "06" - } - } - }, - "kmip_objectId_rand_explicit_id": { - "kms": "kmip", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAHcEjxVfHDSfLzFxAuK/rs/Pn/XV7jLkgKXZYeY0PNlRi1MHojN2AvQqI3J2rOvAjuYfikGcpvGPp/goqUbV9HYw==", - "subType": "06" - } - } - }, - "kmip_objectId_rand_explicit_altname": { - "kms": "kmip", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAHX65sNHnRYpx3VbWPCdQyFe7u0Y5ItabLEduqDeVsPk/iK4X3GjCSHQfw1yPi+CA+/veVpgdonwws6RiYV4ZZ5Q==", - "subType": "06" - } - } - }, - "kmip_objectId_det_auto_id": { - "kms": "kmip", - "type": "objectId", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAHKU7mcdGEq2WGrDB6TicipLQstAk6G3PkiNt5F3bMavpKLjz04UBrd8aWGVG2gJTTON1UKRztiYFgRvb8f+LK/Q==", - "subType": "06" - } - } - }, - "kmip_objectId_det_explicit_id": { - "kms": "kmip", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAHKU7mcdGEq2WGrDB6TicipLQstAk6G3PkiNt5F3bMavpKLjz04UBrd8aWGVG2gJTTON1UKRztiYFgRvb8f+LK/Q==", - "subType": "06" - } - } - }, - "kmip_objectId_det_explicit_altname": { - "kms": "kmip", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAHKU7mcdGEq2WGrDB6TicipLQstAk6G3PkiNt5F3bMavpKLjz04UBrd8aWGVG2gJTTON1UKRztiYFgRvb8f+LK/Q==", - "subType": "06" - } - } - }, - "kmip_bool_rand_auto_id": { - "kms": "kmip", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAIw/xgJlKEvErmVtue3X3RFsOI2sttAbxnzh1INc9GUQ2vok1VwYt9k88RxMPiOwMAZG7P1MlAdx7zt865onPKOw==", - "subType": "06" - } - } - }, - "kmip_bool_rand_auto_altname": { - "kms": "kmip", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAIn8IuzlNHbpTgXOd1wEp364zJOBxj2Zf7a9B5osUV1sDY0G1OVpEnuDvZeUsdiUSyRjTTxzyuD/KZlKZ3+qrnrA==", - "subType": "06" - } - } - }, - "kmip_bool_rand_explicit_id": { - "kms": "kmip", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAI3Nz9PdjUYQRGfTtvYSR8EQuUKFL0wdlEdfSCTBmMBhBPuuF9KxqCgy+ldVu1DRRgg3346DOKEEtE9BJPPInJ6Q==", - "subType": "06" - } - } - }, - "kmip_bool_rand_explicit_altname": { - "kms": "kmip", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAIEGjqoerIZBk8Rw+YTO7jFKWzagDS8mEpD+9Wm1Q0r0ZHUmV0dQZcIqRV4oUk8U8uHUn0N3t2qGLr+rhUs4GH/g==", - "subType": "06" - } - } - }, - "kmip_bool_det_explicit_id": { - "kms": "kmip", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": true - }, - "kmip_bool_det_explicit_altname": { - "kms": "kmip", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": true - }, - "kmip_date_rand_auto_id": { - "kms": "kmip", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAJgr0v4xetUXjlLcPcyKv/rzjtWOKp9CZJcm23Noglu5RR/rXJS0qKI+W9MmJ64TMf27KvaJ0UXwfTRrvOC1plCg==", - "subType": "06" - } - } - }, - "kmip_date_rand_auto_altname": { - "kms": "kmip", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAJoeysAaiPsVK+JL1P1vD/9xF92m5kKidUdn6yklPlSKN4VVEBTymDetTLujULs1u1TlrS71jVLxo3xEwpG/KQvg==", - "subType": "06" - } - } - }, - "kmip_date_rand_explicit_id": { - "kms": "kmip", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAJVwu4+Su0DktpnZvzTBHYpWbWTq5gho/SLijrcIrFJcvq4YrjjPCXv+odCl95tkH+J1RlJdQ5Cr0umEIazLa6GA==", - "subType": "06" - } - } - }, - "kmip_date_rand_explicit_altname": { - "kms": "kmip", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAJWTYpjbDkIf82QXHMGrvd0SqhP8cBIakfYJf5aNcNrs86vxRhiG3KwETWPeOOlPZ6n1WjE2bOLB+DJTAxmJvahA==", - "subType": "06" - } - } - }, - "kmip_date_det_auto_id": { - "kms": "kmip", - "type": "date", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAJ/+sQrUqQh+JADSVIKM0d68gDUhDy37M1z1uvROzQw6hUAbQeD0DWdztADKg560UTPM4uOgH4NAyhLyBLMrWWHg==", - "subType": "06" - } - } - }, - "kmip_date_det_explicit_id": { - "kms": "kmip", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAJ/+sQrUqQh+JADSVIKM0d68gDUhDy37M1z1uvROzQw6hUAbQeD0DWdztADKg560UTPM4uOgH4NAyhLyBLMrWWHg==", - "subType": "06" - } - } - }, - "kmip_date_det_explicit_altname": { - "kms": "kmip", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAJ/+sQrUqQh+JADSVIKM0d68gDUhDy37M1z1uvROzQw6hUAbQeD0DWdztADKg560UTPM4uOgH4NAyhLyBLMrWWHg==", - "subType": "06" - } - } - }, - "kmip_null_rand_explicit_id": { - "kms": "kmip", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "kmip_null_rand_explicit_altname": { - "kms": "kmip", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "kmip_null_det_explicit_id": { - "kms": "kmip", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "kmip_null_det_explicit_altname": { - "kms": "kmip", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "kmip_regex_rand_auto_id": { - "kms": "kmip", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAALi8avMfpxSlDsSTqdxO8O2B1M79gOElyUIdXySQo7mvgHlf4oHQ7r94lL9dnsA2t/jmUmBKoGypaUQUSQE+9x+A==", - "subType": "06" - } - } - }, - "kmip_regex_rand_auto_altname": { - "kms": "kmip", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAALfHerZ/KolaBrb5qi3SpeNVW+i/nh5mkcdtQg5f1pHePr68KryHucM/XDAzbMqrPlag2/41STGYdJqzYO7Mbppg==", - "subType": "06" - } - } - }, - "kmip_regex_rand_explicit_id": { - "kms": "kmip", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAALOhKDVAN5cuDyB1EuRFWgKKt0wGJ63E5pPY8Tq2TXMNgCxUUc5O+TE+Ux4ls/uMyOBA3gPzND0CZKiru0i7ACUQ==", - "subType": "06" - } - } - }, - "kmip_regex_rand_explicit_altname": { - "kms": "kmip", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAALK3Hg8xX9gX+d3vKh7aosRP9CS2CIFeG9sapZv3OAPv1eWjY62Cp/G16kJ0BQt33RYD+DzD3gWupfUSyNZR0gng==", - "subType": "06" - } - } - }, - "kmip_regex_det_auto_id": { - "kms": "kmip", - "type": "regex", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAALaQXA8rItT7ELVxO8XtAWdHuiXFFPmnMhS5PMrUy/6mRtbq4fvU9dascW7ozonKOh8ad6+MIT7B/STv9dVBF4Kw==", - "subType": "06" - } - } - }, - "kmip_regex_det_explicit_id": { - "kms": "kmip", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAALaQXA8rItT7ELVxO8XtAWdHuiXFFPmnMhS5PMrUy/6mRtbq4fvU9dascW7ozonKOh8ad6+MIT7B/STv9dVBF4Kw==", - "subType": "06" - } - } - }, - "kmip_regex_det_explicit_altname": { - "kms": "kmip", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAALaQXA8rItT7ELVxO8XtAWdHuiXFFPmnMhS5PMrUy/6mRtbq4fvU9dascW7ozonKOh8ad6+MIT7B/STv9dVBF4Kw==", - "subType": "06" - } - } - }, - "kmip_dbPointer_rand_auto_id": { - "kms": "kmip", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAMoGkfmmUWTI+0aW7jVyCJ5Dgru1SCXBUmJSRzDL0D57pNruQ+79tVVcI6Uz5j87DhZFxShHbPjj583vLOOBNM3WGzZCpqH3serhHTWvXK+NM=", - "subType": "06" - } - } - }, - "kmip_dbPointer_rand_auto_altname": { - "kms": "kmip", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAMwu1WaRhhv43xgxLNxuenbND9M6mxGtCs9o4J5+yfL95XNB9Daie3RcLlyngz0pncBie6IqjhTycXsxTLQ94Jdg6m5GD5cU541LYKvhbv5f4=", - "subType": "06" - } - } - }, - "kmip_dbPointer_rand_explicit_id": { - "kms": "kmip", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAM+CIoCAisUwhhJtWQLolxQGQWafniwYyvaJQHmJC94Uwbf1gPfhMR42v2VtrmIVP0J0BaP/xf0cco2/qWRdKGZpgkK2CK6M972NtnZ/2x03A=", - "subType": "06" - } - } - }, - "kmip_dbPointer_rand_explicit_altname": { - "kms": "kmip", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAMjbeE9+EaJYjGfeAuxsV8teOdsW8bfnlkvji/tE11Zq89UMGx+oUsZzeLjUgVZ5nxsZKCZjEAq+DPnwFVC+MgqNeqWL7fRChODFlPGH2ZC+8=", - "subType": "06" - } - } - }, - "kmip_dbPointer_det_auto_id": { - "kms": "kmip", - "type": "dbPointer", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAM5B+fjbjYCZzCYUu4N/pJI3srCCXN+OCCHweeweqmpIEmB7yw87bQRIMGtCm6HuekcZ5J5q+nY5AQb0du/wh1YIoOrC3u4w7ZcLHkDmuAJPg=", - "subType": "06" - } - } - }, - "kmip_dbPointer_det_explicit_id": { - "kms": "kmip", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAM5B+fjbjYCZzCYUu4N/pJI3srCCXN+OCCHweeweqmpIEmB7yw87bQRIMGtCm6HuekcZ5J5q+nY5AQb0du/wh1YIoOrC3u4w7ZcLHkDmuAJPg=", - "subType": "06" - } - } - }, - "kmip_dbPointer_det_explicit_altname": { - "kms": "kmip", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAM5B+fjbjYCZzCYUu4N/pJI3srCCXN+OCCHweeweqmpIEmB7yw87bQRIMGtCm6HuekcZ5J5q+nY5AQb0du/wh1YIoOrC3u4w7ZcLHkDmuAJPg=", - "subType": "06" - } - } - }, - "kmip_javascript_rand_auto_id": { - "kms": "kmip", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAANuzlkWs/c8xArrAxPgYuCeShjj1zCfIMHOTPohspcyNofo9iY3P5MlhEOprZDiS8dBFg6EB7fZDzDdczx6VCN2A==", - "subType": "06" - } - } - }, - "kmip_javascript_rand_auto_altname": { - "kms": "kmip", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAANwJ72y7UqCBJh1NwVRiE3vU1ex7FMv/X5YWCMuO9MHPMo4g1V5eaO4KfOr+K8+9NtkflgMpeDkvwP92rfR5ud5Q==", - "subType": "06" - } - } - }, - "kmip_javascript_rand_explicit_id": { - "kms": "kmip", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAANj5q+888itRnLsw9PNGsBLhgqpvem5IJBOE2292r6zwjVueoEK/2I2PesRnn0esnkwdia1ADoMkcLUegwcFRkWQ==", - "subType": "06" - } - } - }, - "kmip_javascript_rand_explicit_altname": { - "kms": "kmip", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAANnvbnmApys7OIe8LGTsZKDG1F1G1SI/rfZVmF6q1fq5U7feYPp1ejb2t2S2+v7LfcOHytsQWGcYuWCDcl+vosvQ==", - "subType": "06" - } - } - }, - "kmip_javascript_det_auto_id": { - "kms": "kmip", - "type": "javascript", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAANOR9R/Da8j5iVxllLiGFlv4U/bVn/PyN9/5WeGJkGJeE/j/osKrKx6IL1igI0YVI+pKKzsINqJGIv+bJX0s7MNw==", - "subType": "06" - } - } - }, - "kmip_javascript_det_explicit_id": { - "kms": "kmip", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAANOR9R/Da8j5iVxllLiGFlv4U/bVn/PyN9/5WeGJkGJeE/j/osKrKx6IL1igI0YVI+pKKzsINqJGIv+bJX0s7MNw==", - "subType": "06" - } - } - }, - "kmip_javascript_det_explicit_altname": { - "kms": "kmip", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAANOR9R/Da8j5iVxllLiGFlv4U/bVn/PyN9/5WeGJkGJeE/j/osKrKx6IL1igI0YVI+pKKzsINqJGIv+bJX0s7MNw==", - "subType": "06" - } - } - }, - "kmip_symbol_rand_auto_id": { - "kms": "kmip", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAOe+vXpJSkmBM3WkxZrn4ea9/C6iNyMXWUzkQIzIYlnbkyu8od8nfOdhobUhoFxcKnvdaxN1s5NhJ1FA97RN/upGYN+AI/7cTCElmFSpdSvkI=", - "subType": "06" - } - } - }, - "kmip_symbol_rand_auto_altname": { - "kms": "kmip", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAOPpCgK6Hc/M2elOJkwIU9J7PZa+h1chody2yvfDu/UlB6T5sxnEZ6aEY/ISNLhJlhsRzuApSgFOmnrcG6Eg9VnSKin2yK0ll+VFxQEDHAcSA=", - "subType": "06" - } - } - }, - "kmip_symbol_rand_explicit_id": { - "kms": "kmip", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAOVoHX9GaOn71L5D9TpZmmxkx/asr0FHCLG5ZgLLA04yIhZHsDjt2DiVGGO/Mf4KwvoBn7Cf08qMhW7rQh2LgvvSLBO3zbw5l+MZ/bSn+Jylo=", - "subType": "06" - } - } - }, - "kmip_symbol_rand_explicit_altname": { - "kms": "kmip", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAOPobmcO/I4QObtCUEmGWpSCJ6tlYyhbO59q78LZBucSNl7DSkf/13tOJ9t+WKXACcMKVMmfPoFsgHbVj1nKWULBT07n1OWWDTZkuMD6C2+Fc=", - "subType": "06" - } - } - }, - "kmip_symbol_det_auto_id": { - "kms": "kmip", - "type": "symbol", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAOPpwX4mafoQJYHuzYfbKW1JunpjpB7Nd2slTC3n8Hsas9wQYf9VkModQhe5M4wZHOIXpehaODRcjKKfKRmpnNBOURSLm/ORJvy+UxtSLsnqo=", - "subType": "06" - } - } - }, - "kmip_symbol_det_explicit_id": { - "kms": "kmip", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAOPpwX4mafoQJYHuzYfbKW1JunpjpB7Nd2slTC3n8Hsas9wQYf9VkModQhe5M4wZHOIXpehaODRcjKKfKRmpnNBOURSLm/ORJvy+UxtSLsnqo=", - "subType": "06" - } - } - }, - "kmip_symbol_det_explicit_altname": { - "kms": "kmip", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAOPpwX4mafoQJYHuzYfbKW1JunpjpB7Nd2slTC3n8Hsas9wQYf9VkModQhe5M4wZHOIXpehaODRcjKKfKRmpnNBOURSLm/ORJvy+UxtSLsnqo=", - "subType": "06" - } - } - }, - "kmip_javascriptWithScope_rand_auto_id": { - "kms": "kmip", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAPW2VMMm+EvsYpVtJQhsxgxgvV35kr9nxqKxP2qqIOAOQ58R/1oyYScFkNwB/tw0A1/zdvhoo+ERa7c0tjLIojFrosXhX2N/8Z4VnbZruz0Nk=", - "subType": "06" - } - } - }, - "kmip_javascriptWithScope_rand_auto_altname": { - "kms": "kmip", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAPjPq9BQR4EwG/CD+RthOJY04m99LCl/shY6HnaU/QL627kN1dbBAG5vs+MXfa+glg8waVTNgB94vm3j72FMV1ZOKvbl4faWF1Rl2EOpOlR9U=", - "subType": "06" - } - } - }, - "kmip_javascriptWithScope_rand_explicit_id": { - "kms": "kmip", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAPtqebrCAidKzBMvp3B5/vBeetqeCoMKS+vo+hLAYooXrnBunWxwRHpr45XYUvroG3aqOMkLtVZSgw8sO6Y/3z1viO2G0sGQW1ZMoW0/PX5Uw=", - "subType": "06" - } - } - }, - "kmip_javascriptWithScope_rand_explicit_altname": { - "kms": "kmip", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAPtkJwXKlq8Fx1f1+9HFofM4uKi6lHQRFRyiOyUFJYxxZY1LR/2WXXTqWz3MWtrcJFCB+QSVOb1N/ieC7AZUboPgIuPJISM3Hu5VU2x/Isbdc=", - "subType": "06" - } - } - }, - "kmip_javascriptWithScope_det_explicit_id": { - "kms": "kmip", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "kmip_javascriptWithScope_det_explicit_altname": { - "kms": "kmip", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "kmip_int_rand_auto_id": { - "kms": "kmip", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAQ50kE7Tby9od2OsmIGZhp9k/mj4vy/YdnmF6YsSPxihbjV1vXGMraI/nGCr+0H1riwzq3m4sCT7aPw2VgiuwKMA==", - "subType": "06" - } - } - }, - "kmip_int_rand_auto_altname": { - "kms": "kmip", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAQkNL14OSMX/bJbsLtB/UumRoat6QOY7fvwZxRrkXTS3VJVHigthI1cUX7Is/uUsY8oHOfk/ZuHklQkifmfdcklQ==", - "subType": "06" - } - } - }, - "kmip_int_rand_explicit_id": { - "kms": "kmip", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAQtN2gNVU9Itoj+vgcK/4jEB5baSUH+Qz2WqTY7m0XaA3bPWGFCiWY4Sdw+qovednrSSSbC+azWi1QYclFRraldQ==", - "subType": "06" - } - } - }, - "kmip_int_rand_explicit_altname": { - "kms": "kmip", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAQk6uBqwXXFF9zEM4bc124goI3pBy2Jdi8Cd0ycKkjXrPG7GVCUm2UMbO+zEzYODeVo35N11g2yMXcv9RVgjWtNA==", - "subType": "06" - } - } - }, - "kmip_int_det_auto_id": { - "kms": "kmip", - "type": "int", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAQgrkPEf+RBZMn/J7HZObqEfus8icYls6ecaUrlabI6v1ALgxLuv23WSIfTr6mqpQCounqdA14DWS/Wl3kSkVC0w==", - "subType": "06" - } - } - }, - "kmip_int_det_explicit_id": { - "kms": "kmip", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAQgrkPEf+RBZMn/J7HZObqEfus8icYls6ecaUrlabI6v1ALgxLuv23WSIfTr6mqpQCounqdA14DWS/Wl3kSkVC0w==", - "subType": "06" - } - } - }, - "kmip_int_det_explicit_altname": { - "kms": "kmip", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAQgrkPEf+RBZMn/J7HZObqEfus8icYls6ecaUrlabI6v1ALgxLuv23WSIfTr6mqpQCounqdA14DWS/Wl3kSkVC0w==", - "subType": "06" - } - } - }, - "kmip_timestamp_rand_auto_id": { - "kms": "kmip", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAAR2Cu3o2e/u5o69MndeZPJU5ngVA1G2MNYn00t+up/GlmaUC1ni1CVl0ZR0EVZ0gCDUrfxwPISPib8y23tNjbsog==", - "subType": "06" - } - } - }, - "kmip_timestamp_rand_auto_altname": { - "kms": "kmip", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAARgi8stgSQwqnN4Ws2ZBILOREsjreZcS1MBerL7dbGLVfzW99tqECglhGokkrE0aY69L0xMgcAUIaFRN4GanQAPg==", - "subType": "06" - } - } - }, - "kmip_timestamp_rand_explicit_id": { - "kms": "kmip", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAARPxEEI8L5Q3Jybu88BLdf31T3uYEUbijgSlKlkTt141RYrlE8nxtiYU5/5H9GXBis0Qq1s2C+MauD2h/cNijTCA==", - "subType": "06" - } - } - }, - "kmip_timestamp_rand_explicit_altname": { - "kms": "kmip", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAARh/QaU1dnGbii4LtXCpT5o6vencc8E2fzarjJFbSEd0ixW/UV1ppZdvD729d0umkaIwIEVA4q+XVvHfl/ckKPFg==", - "subType": "06" - } - } - }, - "kmip_timestamp_det_auto_id": { - "kms": "kmip", - "type": "timestamp", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAARqdpLb72mmzb75QBrE+ATMfS5LLqzAD/1g5ScT8zfgh0IHsZZBWCJlSVRNC12Sgr3zdXHMtYp8C3OZT6/tPkQGg==", - "subType": "06" - } - } - }, - "kmip_timestamp_det_explicit_id": { - "kms": "kmip", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAARqdpLb72mmzb75QBrE+ATMfS5LLqzAD/1g5ScT8zfgh0IHsZZBWCJlSVRNC12Sgr3zdXHMtYp8C3OZT6/tPkQGg==", - "subType": "06" - } - } - }, - "kmip_timestamp_det_explicit_altname": { - "kms": "kmip", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAARqdpLb72mmzb75QBrE+ATMfS5LLqzAD/1g5ScT8zfgh0IHsZZBWCJlSVRNC12Sgr3zdXHMtYp8C3OZT6/tPkQGg==", - "subType": "06" - } - } - }, - "kmip_long_rand_auto_id": { - "kms": "kmip", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAASVv+ClXkh9spIaXWJYRV/o8UZjG+WWWrNpIjZ9LQn2bXakrKJ3REvdkrzGuxASmBhBYTplEyvxVCJwXuWRAGGYw==", - "subType": "06" - } - } - }, - "kmip_long_rand_auto_altname": { - "kms": "kmip", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAASeAz/dK+Gc4/jx3W07B2rNFvQ0LoyCllFRvRVGu1Xf1NByc4cRZLOMzlr99syz/fifF6WY30bOi5Pani9QtFuGg==", - "subType": "06" - } - } - }, - "kmip_long_rand_explicit_id": { - "kms": "kmip", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAASP1HD9uoDlwTldaznKxW71JUQcLsa4/cUWzeTnelQwdpohCbZsM8fBZBqgwwTWnjpYY/LBUipC6yhwLKfUXBoBQ==", - "subType": "06" - } - } - }, - "kmip_long_rand_explicit_altname": { - "kms": "kmip", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAASnGPH77bS/ETB1hn+VTvsBrxEvIHA6EAb8Z2SEz6BHt7SVeI+I7DLERvRVpV5kNJFcKgXDrvRmD+Et0rhSmk9sw==", - "subType": "06" - } - } - }, - "kmip_long_det_auto_id": { - "kms": "kmip", - "type": "long", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAS+zKmtijSTPOEVlpwmaeMIOuzVNuZpV4Jw9zP8Yqa1xYtlItXDozqdibacRaA74KU49KNySdR1T7fxwxa2OOTrQ==", - "subType": "06" - } - } - }, - "kmip_long_det_explicit_id": { - "kms": "kmip", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAS+zKmtijSTPOEVlpwmaeMIOuzVNuZpV4Jw9zP8Yqa1xYtlItXDozqdibacRaA74KU49KNySdR1T7fxwxa2OOTrQ==", - "subType": "06" - } - } - }, - "kmip_long_det_explicit_altname": { - "kms": "kmip", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "ASjCDwAAAAAAAAAAAAAAAAAS+zKmtijSTPOEVlpwmaeMIOuzVNuZpV4Jw9zP8Yqa1xYtlItXDozqdibacRaA74KU49KNySdR1T7fxwxa2OOTrQ==", - "subType": "06" - } - } - }, - "kmip_decimal_rand_auto_id": { - "kms": "kmip", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAATu/BbCc5Ti9SBlMR2B8zj3Q1yQ16Uob+10LWaT5QKS192IcnBGy4wmmNkIsTys060xUby9KKQF80dVPnjYfqJwEXCe/pVaPQZftE0DolKv78=", - "subType": "06" - } - } - }, - "kmip_decimal_rand_auto_altname": { - "kms": "kmip", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAATpq6/dtxq2ZUZHrK10aB0YjjPalEaXYcyAyRZjfXWAYCLZdT9sIybjX3Axjxisim+VSHx0QU7oXkKUfcbLgHyjUXj8g9059FHxKFkUsNv4Z8=", - "subType": "06" - } - } - }, - "kmip_decimal_rand_explicit_id": { - "kms": "kmip", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAATS++9KcfM7uiShZYxRpFPrBJquKv7dyvFRTjnxs6aaaPo0fiqpv6bco/cMLsldEVpWDEA/Tc2HtSXYPp4UJsMfASyBjoxCloL5SaRWyD9Ye8=", - "subType": "06" - } - } - }, - "kmip_decimal_rand_explicit_altname": { - "kms": "kmip", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AijCDwAAAAAAAAAAAAAAAAATREcETS5KoAGyj/P45owPrdFfy5ng8Z1ND+F+780lLddOyPeDnIsa7yg6uvhTZ65mHfGLvKcFocclYenq/AX1dY4xdjLRg/AfT088A27ORUA=", - "subType": "06" - } - } - }, - "kmip_decimal_det_explicit_id": { - "kms": "kmip", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "kmip_decimal_det_explicit_altname": { - "kms": "kmip", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "kmip_minKey_rand_explicit_id": { - "kms": "kmip", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "kmip_minKey_rand_explicit_altname": { - "kms": "kmip", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "kmip_minKey_det_explicit_id": { - "kms": "kmip", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "kmip_minKey_det_explicit_altname": { - "kms": "kmip", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "kmip_maxKey_rand_explicit_id": { - "kms": "kmip", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "kmip_maxKey_rand_explicit_altname": { - "kms": "kmip", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "kmip_maxKey_det_explicit_id": { - "kms": "kmip", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "kmip_maxKey_det_explicit_altname": { - "kms": "kmip", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - } -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/corpus/corpus-key-aws.json b/tests/SpecTests/client-side-encryption/corpus/corpus-key-aws.json deleted file mode 100644 index eca6cf912..000000000 --- a/tests/SpecTests/client-side-encryption/corpus/corpus-key-aws.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "status": { - "$numberInt": "1" - }, - "_id": { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "region": "us-east-1", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "provider": "aws" - }, - "updateDate": { - "$date": { - "$numberLong": "1557827033449" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1557827033449" - } - }, - "keyAltNames": ["aws"] -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/corpus/corpus-key-azure.json b/tests/SpecTests/client-side-encryption/corpus/corpus-key-azure.json deleted file mode 100644 index 31a564edb..000000000 --- a/tests/SpecTests/client-side-encryption/corpus/corpus-key-azure.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "_id": { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "n+HWZ0ZSVOYA3cvQgP7inN4JSXfOH85IngmeQxRpQHjCCcqT3IFqEWNlrsVHiz3AELimHhX4HKqOLWMUeSIT6emUDDoQX9BAv8DR1+E1w4nGs/NyEneac78EYFkK3JysrFDOgl2ypCCTKAypkn9CkAx1if4cfgQE93LW4kczcyHdGiH36CIxrCDGv1UzAvERN5Qa47DVwsM6a+hWsF2AAAJVnF0wYLLJU07TuRHdMrrphPWXZsFgyV+lRqJ7DDpReKNO8nMPLV/mHqHBHGPGQiRdb9NoJo8CvokGz4+KE8oLwzKf6V24dtwZmRkrsDV4iOhvROAzz+Euo1ypSkL3mw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1601573901680" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1601573901680" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "azure", - "keyVaultEndpoint": "key-vault-csfle.vault.azure.net", - "keyName": "key-name-csfle" - }, - "keyAltNames": ["azure"] -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/corpus/corpus-key-gcp.json b/tests/SpecTests/client-side-encryption/corpus/corpus-key-gcp.json deleted file mode 100644 index 79d6999b0..000000000 --- a/tests/SpecTests/client-side-encryption/corpus/corpus-key-gcp.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "_id": { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "CiQAIgLj0WyktnB4dfYHo5SLZ41K4ASQrjJUaSzl5vvVH0G12G0SiQEAjlV8XPlbnHDEDFbdTO4QIe8ER2/172U1ouLazG0ysDtFFIlSvWX5ZnZUrRMmp/R2aJkzLXEt/zf8Mn4Lfm+itnjgo5R9K4pmPNvvPKNZX5C16lrPT+aA+rd+zXFSmlMg3i5jnxvTdLHhg3G7Q/Uv1ZIJskKt95bzLoe0tUVzRWMYXLIEcohnQg==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1601574333107" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1601574333107" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "gcp", - "projectId": "devprod-drivers", - "location": "global", - "keyRing": "key-ring-csfle", - "keyName": "key-name-csfle" - }, - "keyAltNames": ["gcp"] -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/corpus/corpus-key-kmip.json b/tests/SpecTests/client-side-encryption/corpus/corpus-key-kmip.json deleted file mode 100644 index 7c7069700..000000000 --- a/tests/SpecTests/client-side-encryption/corpus/corpus-key-kmip.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "_id": { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "eUYDyB0HuWb+lQgUwO+6qJQyTTDTY2gp9FbemL7ZFo0pvr0x6rm6Ff9OVUTGH6HyMKipaeHdiIJU1dzsLwvqKvi7Beh+U4iaIWX/K0oEg1GOsJc0+Z/in8gNHbGUYLmycHViM3LES3kdt7FdFSUl5rEBHrM71yoNEXImz17QJWMGOuT4x6yoi2pvnaRJwfrI4DjpmnnTrDMac92jgZehbg==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1634220190041" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1634220190041" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "kmip", - "keyId": "1" - }, - "keyAltNames": ["kmip"] -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/corpus/corpus-key-local.json b/tests/SpecTests/client-side-encryption/corpus/corpus-key-local.json deleted file mode 100644 index b3fe0723b..000000000 --- a/tests/SpecTests/client-side-encryption/corpus/corpus-key-local.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "status": { - "$numberInt": "1" - }, - "_id": { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "local" - }, - "updateDate": { - "$date": { - "$numberLong": "1557827033449" - } - }, - "keyMaterial": { - "$binary": { - "base64": "Ce9HSz/HKKGkIt4uyy+jDuKGA+rLC2cycykMo6vc8jXxqa1UVDYHWq1r+vZKbnnSRBfB981akzRKZCFpC05CTyFqDhXv6OnMjpG97OZEREGIsHEYiJkBW0jJJvfLLgeLsEpBzsro9FztGGXASxyxFRZFhXvHxyiLOKrdWfs7X1O/iK3pEoHMx6uSNSfUOgbebLfIqW7TO++iQS5g1xovXA==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1557827033449" - } - }, - "keyAltNames": [ "local" ] -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/corpus/corpus-schema.json b/tests/SpecTests/client-side-encryption/corpus/corpus-schema.json deleted file mode 100644 index e74bc914f..000000000 --- a/tests/SpecTests/client-side-encryption/corpus/corpus-schema.json +++ /dev/null @@ -1,6335 +0,0 @@ -{ - "bsonType": "object", - "properties": { - "aws_double_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "double" - } - } - } - }, - "aws_double_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "double" - } - } - } - }, - "aws_double_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_double_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_string_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "string" - } - } - } - }, - "aws_string_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "string" - } - } - } - }, - "aws_string_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_string_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_string_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "string" - } - } - } - }, - "aws_string_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_string_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_object_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "object" - } - } - } - }, - "aws_object_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "object" - } - } - } - }, - "aws_object_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_object_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_array_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "array" - } - } - } - }, - "aws_array_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "array" - } - } - } - }, - "aws_array_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_array_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_binData=00_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "aws_binData=00_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "aws_binData=00_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_binData=00_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_binData=00_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "binData" - } - } - } - }, - "aws_binData=00_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_binData=00_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_binData=04_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "aws_binData=04_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "aws_binData=04_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_binData=04_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_binData=04_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "binData" - } - } - } - }, - "aws_binData=04_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_binData=04_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_objectId_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "objectId" - } - } - } - }, - "aws_objectId_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "objectId" - } - } - } - }, - "aws_objectId_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_objectId_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_objectId_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "objectId" - } - } - } - }, - "aws_objectId_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_objectId_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_bool_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "bool" - } - } - } - }, - "aws_bool_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "bool" - } - } - } - }, - "aws_bool_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_bool_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_date_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "date" - } - } - } - }, - "aws_date_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "date" - } - } - } - }, - "aws_date_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_date_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_date_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "date" - } - } - } - }, - "aws_date_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_date_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_regex_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "regex" - } - } - } - }, - "aws_regex_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "regex" - } - } - } - }, - "aws_regex_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_regex_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_regex_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "regex" - } - } - } - }, - "aws_regex_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_regex_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_dbPointer_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "dbPointer" - } - } - } - }, - "aws_dbPointer_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "dbPointer" - } - } - } - }, - "aws_dbPointer_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_dbPointer_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_dbPointer_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "dbPointer" - } - } - } - }, - "aws_dbPointer_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_dbPointer_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_javascript_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascript" - } - } - } - }, - "aws_javascript_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascript" - } - } - } - }, - "aws_javascript_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_javascript_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_javascript_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "javascript" - } - } - } - }, - "aws_javascript_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_javascript_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_symbol_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "symbol" - } - } - } - }, - "aws_symbol_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "symbol" - } - } - } - }, - "aws_symbol_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_symbol_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_symbol_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "symbol" - } - } - } - }, - "aws_symbol_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_symbol_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_javascriptWithScope_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascriptWithScope" - } - } - } - }, - "aws_javascriptWithScope_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascriptWithScope" - } - } - } - }, - "aws_javascriptWithScope_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_javascriptWithScope_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_int_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "int" - } - } - } - }, - "aws_int_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "int" - } - } - } - }, - "aws_int_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_int_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_int_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "int" - } - } - } - }, - "aws_int_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_int_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_timestamp_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "timestamp" - } - } - } - }, - "aws_timestamp_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "timestamp" - } - } - } - }, - "aws_timestamp_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_timestamp_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_timestamp_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "timestamp" - } - } - } - }, - "aws_timestamp_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_timestamp_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_long_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "long" - } - } - } - }, - "aws_long_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "long" - } - } - } - }, - "aws_long_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_long_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_long_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "long" - } - } - } - }, - "aws_long_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_long_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_decimal_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AWSAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "decimal" - } - } - } - }, - "aws_decimal_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_aws", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "decimal" - } - } - } - }, - "aws_decimal_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "aws_decimal_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_double_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "double" - } - } - } - }, - "local_double_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "double" - } - } - } - }, - "local_double_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_double_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_string_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "string" - } - } - } - }, - "local_string_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "string" - } - } - } - }, - "local_string_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_string_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_string_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "string" - } - } - } - }, - "local_string_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_string_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_object_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "object" - } - } - } - }, - "local_object_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "object" - } - } - } - }, - "local_object_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_object_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_array_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "array" - } - } - } - }, - "local_array_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "array" - } - } - } - }, - "local_array_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_array_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_binData=00_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "local_binData=00_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "local_binData=00_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_binData=00_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_binData=00_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "binData" - } - } - } - }, - "local_binData=00_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_binData=00_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_binData=04_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "local_binData=04_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "local_binData=04_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_binData=04_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_binData=04_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "binData" - } - } - } - }, - "local_binData=04_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_binData=04_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_objectId_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "objectId" - } - } - } - }, - "local_objectId_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "objectId" - } - } - } - }, - "local_objectId_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_objectId_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_objectId_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "objectId" - } - } - } - }, - "local_objectId_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_objectId_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_bool_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "bool" - } - } - } - }, - "local_bool_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "bool" - } - } - } - }, - "local_bool_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_bool_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_date_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "date" - } - } - } - }, - "local_date_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "date" - } - } - } - }, - "local_date_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_date_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_date_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "date" - } - } - } - }, - "local_date_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_date_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_regex_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "regex" - } - } - } - }, - "local_regex_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "regex" - } - } - } - }, - "local_regex_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_regex_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_regex_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "regex" - } - } - } - }, - "local_regex_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_regex_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_dbPointer_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "dbPointer" - } - } - } - }, - "local_dbPointer_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "dbPointer" - } - } - } - }, - "local_dbPointer_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_dbPointer_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_dbPointer_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "dbPointer" - } - } - } - }, - "local_dbPointer_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_dbPointer_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_javascript_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascript" - } - } - } - }, - "local_javascript_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascript" - } - } - } - }, - "local_javascript_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_javascript_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_javascript_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "javascript" - } - } - } - }, - "local_javascript_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_javascript_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_symbol_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "symbol" - } - } - } - }, - "local_symbol_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "symbol" - } - } - } - }, - "local_symbol_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_symbol_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_symbol_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "symbol" - } - } - } - }, - "local_symbol_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_symbol_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_javascriptWithScope_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascriptWithScope" - } - } - } - }, - "local_javascriptWithScope_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascriptWithScope" - } - } - } - }, - "local_javascriptWithScope_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_javascriptWithScope_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_int_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "int" - } - } - } - }, - "local_int_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "int" - } - } - } - }, - "local_int_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_int_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_int_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "int" - } - } - } - }, - "local_int_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_int_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_timestamp_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "timestamp" - } - } - } - }, - "local_timestamp_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "timestamp" - } - } - } - }, - "local_timestamp_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_timestamp_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_timestamp_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "timestamp" - } - } - } - }, - "local_timestamp_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_timestamp_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_long_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "long" - } - } - } - }, - "local_long_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "long" - } - } - } - }, - "local_long_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_long_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_long_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "long" - } - } - } - }, - "local_long_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_long_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_decimal_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "decimal" - } - } - } - }, - "local_decimal_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_local", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "decimal" - } - } - } - }, - "local_decimal_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "local_decimal_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_double_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "double" - } - } - } - }, - "azure_double_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "double" - } - } - } - }, - "azure_double_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_double_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_string_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "string" - } - } - } - }, - "azure_string_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "string" - } - } - } - }, - "azure_string_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_string_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_string_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "string" - } - } - } - }, - "azure_string_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_string_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_object_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "object" - } - } - } - }, - "azure_object_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "object" - } - } - } - }, - "azure_object_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_object_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_array_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "array" - } - } - } - }, - "azure_array_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "array" - } - } - } - }, - "azure_array_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_array_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_binData=00_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "azure_binData=00_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "azure_binData=00_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_binData=00_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_binData=00_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "binData" - } - } - } - }, - "azure_binData=00_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_binData=00_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_binData=04_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "azure_binData=04_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "azure_binData=04_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_binData=04_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_binData=04_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "binData" - } - } - } - }, - "azure_binData=04_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_binData=04_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_objectId_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "objectId" - } - } - } - }, - "azure_objectId_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "objectId" - } - } - } - }, - "azure_objectId_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_objectId_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_objectId_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "objectId" - } - } - } - }, - "azure_objectId_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_objectId_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_bool_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "bool" - } - } - } - }, - "azure_bool_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "bool" - } - } - } - }, - "azure_bool_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_bool_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_date_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "date" - } - } - } - }, - "azure_date_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "date" - } - } - } - }, - "azure_date_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_date_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_date_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "date" - } - } - } - }, - "azure_date_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_date_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_regex_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "regex" - } - } - } - }, - "azure_regex_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "regex" - } - } - } - }, - "azure_regex_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_regex_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_regex_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "regex" - } - } - } - }, - "azure_regex_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_regex_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_dbPointer_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "dbPointer" - } - } - } - }, - "azure_dbPointer_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "dbPointer" - } - } - } - }, - "azure_dbPointer_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_dbPointer_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_dbPointer_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "dbPointer" - } - } - } - }, - "azure_dbPointer_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_dbPointer_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_javascript_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascript" - } - } - } - }, - "azure_javascript_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascript" - } - } - } - }, - "azure_javascript_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_javascript_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_javascript_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "javascript" - } - } - } - }, - "azure_javascript_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_javascript_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_symbol_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "symbol" - } - } - } - }, - "azure_symbol_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "symbol" - } - } - } - }, - "azure_symbol_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_symbol_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_symbol_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "symbol" - } - } - } - }, - "azure_symbol_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_symbol_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_javascriptWithScope_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascriptWithScope" - } - } - } - }, - "azure_javascriptWithScope_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascriptWithScope" - } - } - } - }, - "azure_javascriptWithScope_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_javascriptWithScope_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_int_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "int" - } - } - } - }, - "azure_int_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "int" - } - } - } - }, - "azure_int_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_int_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_int_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "int" - } - } - } - }, - "azure_int_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_int_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_timestamp_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "timestamp" - } - } - } - }, - "azure_timestamp_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "timestamp" - } - } - } - }, - "azure_timestamp_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_timestamp_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_timestamp_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "timestamp" - } - } - } - }, - "azure_timestamp_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_timestamp_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_long_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "long" - } - } - } - }, - "azure_long_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "long" - } - } - } - }, - "azure_long_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_long_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_long_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "long" - } - } - } - }, - "azure_long_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_long_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_decimal_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZUREAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "decimal" - } - } - } - }, - "azure_decimal_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_azure", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "decimal" - } - } - } - }, - "azure_decimal_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "azure_decimal_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_double_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "double" - } - } - } - }, - "gcp_double_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "double" - } - } - } - }, - "gcp_double_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_double_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_string_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "string" - } - } - } - }, - "gcp_string_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "string" - } - } - } - }, - "gcp_string_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_string_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_string_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "string" - } - } - } - }, - "gcp_string_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_string_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_object_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "object" - } - } - } - }, - "gcp_object_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "object" - } - } - } - }, - "gcp_object_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_object_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_array_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "array" - } - } - } - }, - "gcp_array_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "array" - } - } - } - }, - "gcp_array_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_array_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_binData=00_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "gcp_binData=00_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "gcp_binData=00_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_binData=00_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_binData=00_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "binData" - } - } - } - }, - "gcp_binData=00_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_binData=00_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_binData=04_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "gcp_binData=04_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "gcp_binData=04_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_binData=04_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_binData=04_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "binData" - } - } - } - }, - "gcp_binData=04_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_binData=04_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_objectId_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "objectId" - } - } - } - }, - "gcp_objectId_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "objectId" - } - } - } - }, - "gcp_objectId_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_objectId_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_objectId_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "objectId" - } - } - } - }, - "gcp_objectId_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_objectId_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_bool_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "bool" - } - } - } - }, - "gcp_bool_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "bool" - } - } - } - }, - "gcp_bool_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_bool_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_date_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "date" - } - } - } - }, - "gcp_date_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "date" - } - } - } - }, - "gcp_date_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_date_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_date_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "date" - } - } - } - }, - "gcp_date_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_date_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_regex_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "regex" - } - } - } - }, - "gcp_regex_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "regex" - } - } - } - }, - "gcp_regex_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_regex_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_regex_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "regex" - } - } - } - }, - "gcp_regex_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_regex_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_dbPointer_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "dbPointer" - } - } - } - }, - "gcp_dbPointer_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "dbPointer" - } - } - } - }, - "gcp_dbPointer_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_dbPointer_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_dbPointer_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "dbPointer" - } - } - } - }, - "gcp_dbPointer_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_dbPointer_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_javascript_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascript" - } - } - } - }, - "gcp_javascript_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascript" - } - } - } - }, - "gcp_javascript_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_javascript_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_javascript_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "javascript" - } - } - } - }, - "gcp_javascript_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_javascript_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_symbol_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "symbol" - } - } - } - }, - "gcp_symbol_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "symbol" - } - } - } - }, - "gcp_symbol_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_symbol_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_symbol_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "symbol" - } - } - } - }, - "gcp_symbol_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_symbol_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_javascriptWithScope_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascriptWithScope" - } - } - } - }, - "gcp_javascriptWithScope_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascriptWithScope" - } - } - } - }, - "gcp_javascriptWithScope_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_javascriptWithScope_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_int_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "int" - } - } - } - }, - "gcp_int_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "int" - } - } - } - }, - "gcp_int_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_int_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_int_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "int" - } - } - } - }, - "gcp_int_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_int_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_timestamp_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "timestamp" - } - } - } - }, - "gcp_timestamp_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "timestamp" - } - } - } - }, - "gcp_timestamp_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_timestamp_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_timestamp_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "timestamp" - } - } - } - }, - "gcp_timestamp_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_timestamp_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_long_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "long" - } - } - } - }, - "gcp_long_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "long" - } - } - } - }, - "gcp_long_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_long_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_long_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "long" - } - } - } - }, - "gcp_long_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_long_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_decimal_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCPAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "decimal" - } - } - } - }, - "gcp_decimal_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_gcp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "decimal" - } - } - } - }, - "gcp_decimal_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "gcp_decimal_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_double_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "double" - } - } - } - }, - "kmip_double_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "double" - } - } - } - }, - "kmip_double_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_double_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_string_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "string" - } - } - } - }, - "kmip_string_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "string" - } - } - } - }, - "kmip_string_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_string_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_string_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "string" - } - } - } - }, - "kmip_string_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_string_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_object_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "object" - } - } - } - }, - "kmip_object_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "object" - } - } - } - }, - "kmip_object_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_object_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_array_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "array" - } - } - } - }, - "kmip_array_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "array" - } - } - } - }, - "kmip_array_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_array_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_binData=00_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "kmip_binData=00_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "kmip_binData=00_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_binData=00_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_binData=00_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "binData" - } - } - } - }, - "kmip_binData=00_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_binData=00_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_binData=04_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "kmip_binData=04_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "binData" - } - } - } - }, - "kmip_binData=04_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_binData=04_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_binData=04_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "binData" - } - } - } - }, - "kmip_binData=04_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_binData=04_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_objectId_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "objectId" - } - } - } - }, - "kmip_objectId_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "objectId" - } - } - } - }, - "kmip_objectId_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_objectId_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_objectId_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "objectId" - } - } - } - }, - "kmip_objectId_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_objectId_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_bool_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "bool" - } - } - } - }, - "kmip_bool_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "bool" - } - } - } - }, - "kmip_bool_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_bool_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_date_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "date" - } - } - } - }, - "kmip_date_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "date" - } - } - } - }, - "kmip_date_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_date_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_date_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "date" - } - } - } - }, - "kmip_date_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_date_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_regex_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "regex" - } - } - } - }, - "kmip_regex_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "regex" - } - } - } - }, - "kmip_regex_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_regex_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_regex_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "regex" - } - } - } - }, - "kmip_regex_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_regex_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_dbPointer_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "dbPointer" - } - } - } - }, - "kmip_dbPointer_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "dbPointer" - } - } - } - }, - "kmip_dbPointer_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_dbPointer_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_dbPointer_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "dbPointer" - } - } - } - }, - "kmip_dbPointer_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_dbPointer_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_javascript_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascript" - } - } - } - }, - "kmip_javascript_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascript" - } - } - } - }, - "kmip_javascript_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_javascript_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_javascript_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "javascript" - } - } - } - }, - "kmip_javascript_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_javascript_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_symbol_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "symbol" - } - } - } - }, - "kmip_symbol_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "symbol" - } - } - } - }, - "kmip_symbol_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_symbol_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_symbol_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "symbol" - } - } - } - }, - "kmip_symbol_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_symbol_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_javascriptWithScope_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascriptWithScope" - } - } - } - }, - "kmip_javascriptWithScope_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "javascriptWithScope" - } - } - } - }, - "kmip_javascriptWithScope_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_javascriptWithScope_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_int_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "int" - } - } - } - }, - "kmip_int_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "int" - } - } - } - }, - "kmip_int_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_int_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_int_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "int" - } - } - } - }, - "kmip_int_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_int_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_timestamp_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "timestamp" - } - } - } - }, - "kmip_timestamp_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "timestamp" - } - } - } - }, - "kmip_timestamp_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_timestamp_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_timestamp_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "timestamp" - } - } - } - }, - "kmip_timestamp_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_timestamp_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_long_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "long" - } - } - } - }, - "kmip_long_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "long" - } - } - } - }, - "kmip_long_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_long_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_long_det_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic", - "bsonType": "long" - } - } - } - }, - "kmip_long_det_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_long_det_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_decimal_rand_auto_id": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "KMIPAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "decimal" - } - } - } - }, - "kmip_decimal_rand_auto_altname": { - "bsonType": "object", - "properties": { - "value": { - "encrypt": { - "keyId": "/altname_kmip", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random", - "bsonType": "decimal" - } - } - } - }, - "kmip_decimal_rand_explicit_id": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - }, - "kmip_decimal_rand_explicit_altname": { - "bsonType": "object", - "properties": { - "value": { - "bsonType": "binData" - } - } - } - } -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/corpus/corpus.json b/tests/SpecTests/client-side-encryption/corpus/corpus.json deleted file mode 100644 index 559711b34..000000000 --- a/tests/SpecTests/client-side-encryption/corpus/corpus.json +++ /dev/null @@ -1,8619 +0,0 @@ -{ - "_id": "client_side_encryption_corpus", - "altname_aws": "aws", - "altname_local": "local", - "altname_azure": "azure", - "altname_gcp": "gcp", - "altname_kmip": "kmip", - "aws_double_rand_auto_id": { - "kms": "aws", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "aws_double_rand_auto_altname": { - "kms": "aws", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "aws_double_rand_explicit_id": { - "kms": "aws", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "aws_double_rand_explicit_altname": { - "kms": "aws", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "aws_double_det_explicit_id": { - "kms": "aws", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDouble": "1.234" - } - }, - "aws_double_det_explicit_altname": { - "kms": "aws", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDouble": "1.234" - } - }, - "aws_string_rand_auto_id": { - "kms": "aws", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "aws_string_rand_auto_altname": { - "kms": "aws", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": "mongodb" - }, - "aws_string_rand_explicit_id": { - "kms": "aws", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "aws_string_rand_explicit_altname": { - "kms": "aws", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": "mongodb" - }, - "aws_string_det_auto_id": { - "kms": "aws", - "type": "string", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "aws_string_det_explicit_id": { - "kms": "aws", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "aws_string_det_explicit_altname": { - "kms": "aws", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": "mongodb" - }, - "aws_object_rand_auto_id": { - "kms": "aws", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "aws_object_rand_auto_altname": { - "kms": "aws", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "aws_object_rand_explicit_id": { - "kms": "aws", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "aws_object_rand_explicit_altname": { - "kms": "aws", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "aws_object_det_explicit_id": { - "kms": "aws", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "aws_object_det_explicit_altname": { - "kms": "aws", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "aws_array_rand_auto_id": { - "kms": "aws", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "aws_array_rand_auto_altname": { - "kms": "aws", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "aws_array_rand_explicit_id": { - "kms": "aws", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "aws_array_rand_explicit_altname": { - "kms": "aws", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "aws_array_det_explicit_id": { - "kms": "aws", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "aws_array_det_explicit_altname": { - "kms": "aws", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "aws_binData=00_rand_auto_id": { - "kms": "aws", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "aws_binData=00_rand_auto_altname": { - "kms": "aws", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "aws_binData=00_rand_explicit_id": { - "kms": "aws", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "aws_binData=00_rand_explicit_altname": { - "kms": "aws", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "aws_binData=00_det_auto_id": { - "kms": "aws", - "type": "binData=00", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "aws_binData=00_det_explicit_id": { - "kms": "aws", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "aws_binData=00_det_explicit_altname": { - "kms": "aws", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "aws_binData=04_rand_auto_id": { - "kms": "aws", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "aws_binData=04_rand_auto_altname": { - "kms": "aws", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "aws_binData=04_rand_explicit_id": { - "kms": "aws", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "aws_binData=04_rand_explicit_altname": { - "kms": "aws", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "aws_binData=04_det_auto_id": { - "kms": "aws", - "type": "binData=04", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "aws_binData=04_det_explicit_id": { - "kms": "aws", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "aws_binData=04_det_explicit_altname": { - "kms": "aws", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "aws_undefined_rand_explicit_id": { - "kms": "aws", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "aws_undefined_rand_explicit_altname": { - "kms": "aws", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "aws_undefined_det_explicit_id": { - "kms": "aws", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "aws_undefined_det_explicit_altname": { - "kms": "aws", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "aws_objectId_rand_auto_id": { - "kms": "aws", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "aws_objectId_rand_auto_altname": { - "kms": "aws", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "aws_objectId_rand_explicit_id": { - "kms": "aws", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "aws_objectId_rand_explicit_altname": { - "kms": "aws", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "aws_objectId_det_auto_id": { - "kms": "aws", - "type": "objectId", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "aws_objectId_det_explicit_id": { - "kms": "aws", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "aws_objectId_det_explicit_altname": { - "kms": "aws", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "aws_bool_rand_auto_id": { - "kms": "aws", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": true - }, - "aws_bool_rand_auto_altname": { - "kms": "aws", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": true - }, - "aws_bool_rand_explicit_id": { - "kms": "aws", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": true - }, - "aws_bool_rand_explicit_altname": { - "kms": "aws", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": true - }, - "aws_bool_det_explicit_id": { - "kms": "aws", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": true - }, - "aws_bool_det_explicit_altname": { - "kms": "aws", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": true - }, - "aws_date_rand_auto_id": { - "kms": "aws", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "aws_date_rand_auto_altname": { - "kms": "aws", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "aws_date_rand_explicit_id": { - "kms": "aws", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "aws_date_rand_explicit_altname": { - "kms": "aws", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "aws_date_det_auto_id": { - "kms": "aws", - "type": "date", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "aws_date_det_explicit_id": { - "kms": "aws", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "aws_date_det_explicit_altname": { - "kms": "aws", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "aws_null_rand_explicit_id": { - "kms": "aws", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "aws_null_rand_explicit_altname": { - "kms": "aws", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "aws_null_det_explicit_id": { - "kms": "aws", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "aws_null_det_explicit_altname": { - "kms": "aws", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "aws_regex_rand_auto_id": { - "kms": "aws", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "aws_regex_rand_auto_altname": { - "kms": "aws", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "aws_regex_rand_explicit_id": { - "kms": "aws", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "aws_regex_rand_explicit_altname": { - "kms": "aws", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "aws_regex_det_auto_id": { - "kms": "aws", - "type": "regex", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "aws_regex_det_explicit_id": { - "kms": "aws", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "aws_regex_det_explicit_altname": { - "kms": "aws", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "aws_dbPointer_rand_auto_id": { - "kms": "aws", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "aws_dbPointer_rand_auto_altname": { - "kms": "aws", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "aws_dbPointer_rand_explicit_id": { - "kms": "aws", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "aws_dbPointer_rand_explicit_altname": { - "kms": "aws", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "aws_dbPointer_det_auto_id": { - "kms": "aws", - "type": "dbPointer", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "aws_dbPointer_det_explicit_id": { - "kms": "aws", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "aws_dbPointer_det_explicit_altname": { - "kms": "aws", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "aws_javascript_rand_auto_id": { - "kms": "aws", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "aws_javascript_rand_auto_altname": { - "kms": "aws", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "aws_javascript_rand_explicit_id": { - "kms": "aws", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "aws_javascript_rand_explicit_altname": { - "kms": "aws", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "aws_javascript_det_auto_id": { - "kms": "aws", - "type": "javascript", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "aws_javascript_det_explicit_id": { - "kms": "aws", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "aws_javascript_det_explicit_altname": { - "kms": "aws", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "aws_symbol_rand_auto_id": { - "kms": "aws", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "aws_symbol_rand_auto_altname": { - "kms": "aws", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "aws_symbol_rand_explicit_id": { - "kms": "aws", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "aws_symbol_rand_explicit_altname": { - "kms": "aws", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "aws_symbol_det_auto_id": { - "kms": "aws", - "type": "symbol", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "aws_symbol_det_explicit_id": { - "kms": "aws", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "aws_symbol_det_explicit_altname": { - "kms": "aws", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "aws_javascriptWithScope_rand_auto_id": { - "kms": "aws", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "aws_javascriptWithScope_rand_auto_altname": { - "kms": "aws", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "aws_javascriptWithScope_rand_explicit_id": { - "kms": "aws", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "aws_javascriptWithScope_rand_explicit_altname": { - "kms": "aws", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "aws_javascriptWithScope_det_explicit_id": { - "kms": "aws", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "aws_javascriptWithScope_det_explicit_altname": { - "kms": "aws", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "aws_int_rand_auto_id": { - "kms": "aws", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "aws_int_rand_auto_altname": { - "kms": "aws", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "aws_int_rand_explicit_id": { - "kms": "aws", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "aws_int_rand_explicit_altname": { - "kms": "aws", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "aws_int_det_auto_id": { - "kms": "aws", - "type": "int", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "aws_int_det_explicit_id": { - "kms": "aws", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "aws_int_det_explicit_altname": { - "kms": "aws", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "aws_timestamp_rand_auto_id": { - "kms": "aws", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "aws_timestamp_rand_auto_altname": { - "kms": "aws", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "aws_timestamp_rand_explicit_id": { - "kms": "aws", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "aws_timestamp_rand_explicit_altname": { - "kms": "aws", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "aws_timestamp_det_auto_id": { - "kms": "aws", - "type": "timestamp", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "aws_timestamp_det_explicit_id": { - "kms": "aws", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "aws_timestamp_det_explicit_altname": { - "kms": "aws", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "aws_long_rand_auto_id": { - "kms": "aws", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "aws_long_rand_auto_altname": { - "kms": "aws", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "aws_long_rand_explicit_id": { - "kms": "aws", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "aws_long_rand_explicit_altname": { - "kms": "aws", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "aws_long_det_auto_id": { - "kms": "aws", - "type": "long", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "aws_long_det_explicit_id": { - "kms": "aws", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "aws_long_det_explicit_altname": { - "kms": "aws", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "aws_decimal_rand_auto_id": { - "kms": "aws", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "aws_decimal_rand_auto_altname": { - "kms": "aws", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "aws_decimal_rand_explicit_id": { - "kms": "aws", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "aws_decimal_rand_explicit_altname": { - "kms": "aws", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "aws_decimal_det_explicit_id": { - "kms": "aws", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "aws_decimal_det_explicit_altname": { - "kms": "aws", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "aws_minKey_rand_explicit_id": { - "kms": "aws", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "aws_minKey_rand_explicit_altname": { - "kms": "aws", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "aws_minKey_det_explicit_id": { - "kms": "aws", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "aws_minKey_det_explicit_altname": { - "kms": "aws", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "aws_maxKey_rand_explicit_id": { - "kms": "aws", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "aws_maxKey_rand_explicit_altname": { - "kms": "aws", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "aws_maxKey_det_explicit_id": { - "kms": "aws", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "aws_maxKey_det_explicit_altname": { - "kms": "aws", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "local_double_rand_auto_id": { - "kms": "local", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "local_double_rand_auto_altname": { - "kms": "local", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "local_double_rand_explicit_id": { - "kms": "local", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "local_double_rand_explicit_altname": { - "kms": "local", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "local_double_det_explicit_id": { - "kms": "local", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDouble": "1.234" - } - }, - "local_double_det_explicit_altname": { - "kms": "local", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDouble": "1.234" - } - }, - "local_string_rand_auto_id": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "local_string_rand_auto_altname": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": "mongodb" - }, - "local_string_rand_explicit_id": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "local_string_rand_explicit_altname": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": "mongodb" - }, - "local_string_det_auto_id": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "local_string_det_explicit_id": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "local_string_det_explicit_altname": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": "mongodb" - }, - "local_object_rand_auto_id": { - "kms": "local", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "local_object_rand_auto_altname": { - "kms": "local", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "local_object_rand_explicit_id": { - "kms": "local", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "local_object_rand_explicit_altname": { - "kms": "local", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "local_object_det_explicit_id": { - "kms": "local", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "local_object_det_explicit_altname": { - "kms": "local", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "local_array_rand_auto_id": { - "kms": "local", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "local_array_rand_auto_altname": { - "kms": "local", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "local_array_rand_explicit_id": { - "kms": "local", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "local_array_rand_explicit_altname": { - "kms": "local", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "local_array_det_explicit_id": { - "kms": "local", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "local_array_det_explicit_altname": { - "kms": "local", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "local_binData=00_rand_auto_id": { - "kms": "local", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "local_binData=00_rand_auto_altname": { - "kms": "local", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "local_binData=00_rand_explicit_id": { - "kms": "local", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "local_binData=00_rand_explicit_altname": { - "kms": "local", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "local_binData=00_det_auto_id": { - "kms": "local", - "type": "binData=00", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "local_binData=00_det_explicit_id": { - "kms": "local", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "local_binData=00_det_explicit_altname": { - "kms": "local", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "local_binData=04_rand_auto_id": { - "kms": "local", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "local_binData=04_rand_auto_altname": { - "kms": "local", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "local_binData=04_rand_explicit_id": { - "kms": "local", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "local_binData=04_rand_explicit_altname": { - "kms": "local", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "local_binData=04_det_auto_id": { - "kms": "local", - "type": "binData=04", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "local_binData=04_det_explicit_id": { - "kms": "local", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "local_binData=04_det_explicit_altname": { - "kms": "local", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "local_undefined_rand_explicit_id": { - "kms": "local", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "local_undefined_rand_explicit_altname": { - "kms": "local", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "local_undefined_det_explicit_id": { - "kms": "local", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "local_undefined_det_explicit_altname": { - "kms": "local", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "local_objectId_rand_auto_id": { - "kms": "local", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "local_objectId_rand_auto_altname": { - "kms": "local", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "local_objectId_rand_explicit_id": { - "kms": "local", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "local_objectId_rand_explicit_altname": { - "kms": "local", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "local_objectId_det_auto_id": { - "kms": "local", - "type": "objectId", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "local_objectId_det_explicit_id": { - "kms": "local", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "local_objectId_det_explicit_altname": { - "kms": "local", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "local_bool_rand_auto_id": { - "kms": "local", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": true - }, - "local_bool_rand_auto_altname": { - "kms": "local", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": true - }, - "local_bool_rand_explicit_id": { - "kms": "local", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": true - }, - "local_bool_rand_explicit_altname": { - "kms": "local", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": true - }, - "local_bool_det_explicit_id": { - "kms": "local", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": true - }, - "local_bool_det_explicit_altname": { - "kms": "local", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": true - }, - "local_date_rand_auto_id": { - "kms": "local", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "local_date_rand_auto_altname": { - "kms": "local", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "local_date_rand_explicit_id": { - "kms": "local", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "local_date_rand_explicit_altname": { - "kms": "local", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "local_date_det_auto_id": { - "kms": "local", - "type": "date", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "local_date_det_explicit_id": { - "kms": "local", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "local_date_det_explicit_altname": { - "kms": "local", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "local_null_rand_explicit_id": { - "kms": "local", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "local_null_rand_explicit_altname": { - "kms": "local", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "local_null_det_explicit_id": { - "kms": "local", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "local_null_det_explicit_altname": { - "kms": "local", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "local_regex_rand_auto_id": { - "kms": "local", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "local_regex_rand_auto_altname": { - "kms": "local", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "local_regex_rand_explicit_id": { - "kms": "local", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "local_regex_rand_explicit_altname": { - "kms": "local", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "local_regex_det_auto_id": { - "kms": "local", - "type": "regex", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "local_regex_det_explicit_id": { - "kms": "local", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "local_regex_det_explicit_altname": { - "kms": "local", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "local_dbPointer_rand_auto_id": { - "kms": "local", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "local_dbPointer_rand_auto_altname": { - "kms": "local", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "local_dbPointer_rand_explicit_id": { - "kms": "local", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "local_dbPointer_rand_explicit_altname": { - "kms": "local", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "local_dbPointer_det_auto_id": { - "kms": "local", - "type": "dbPointer", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "local_dbPointer_det_explicit_id": { - "kms": "local", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "local_dbPointer_det_explicit_altname": { - "kms": "local", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "local_javascript_rand_auto_id": { - "kms": "local", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "local_javascript_rand_auto_altname": { - "kms": "local", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "local_javascript_rand_explicit_id": { - "kms": "local", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "local_javascript_rand_explicit_altname": { - "kms": "local", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "local_javascript_det_auto_id": { - "kms": "local", - "type": "javascript", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "local_javascript_det_explicit_id": { - "kms": "local", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "local_javascript_det_explicit_altname": { - "kms": "local", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "local_symbol_rand_auto_id": { - "kms": "local", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "local_symbol_rand_auto_altname": { - "kms": "local", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "local_symbol_rand_explicit_id": { - "kms": "local", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "local_symbol_rand_explicit_altname": { - "kms": "local", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "local_symbol_det_auto_id": { - "kms": "local", - "type": "symbol", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "local_symbol_det_explicit_id": { - "kms": "local", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "local_symbol_det_explicit_altname": { - "kms": "local", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "local_javascriptWithScope_rand_auto_id": { - "kms": "local", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "local_javascriptWithScope_rand_auto_altname": { - "kms": "local", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "local_javascriptWithScope_rand_explicit_id": { - "kms": "local", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "local_javascriptWithScope_rand_explicit_altname": { - "kms": "local", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "local_javascriptWithScope_det_explicit_id": { - "kms": "local", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "local_javascriptWithScope_det_explicit_altname": { - "kms": "local", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "local_int_rand_auto_id": { - "kms": "local", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "local_int_rand_auto_altname": { - "kms": "local", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "local_int_rand_explicit_id": { - "kms": "local", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "local_int_rand_explicit_altname": { - "kms": "local", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "local_int_det_auto_id": { - "kms": "local", - "type": "int", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "local_int_det_explicit_id": { - "kms": "local", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "local_int_det_explicit_altname": { - "kms": "local", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "local_timestamp_rand_auto_id": { - "kms": "local", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "local_timestamp_rand_auto_altname": { - "kms": "local", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "local_timestamp_rand_explicit_id": { - "kms": "local", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "local_timestamp_rand_explicit_altname": { - "kms": "local", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "local_timestamp_det_auto_id": { - "kms": "local", - "type": "timestamp", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "local_timestamp_det_explicit_id": { - "kms": "local", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "local_timestamp_det_explicit_altname": { - "kms": "local", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "local_long_rand_auto_id": { - "kms": "local", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "local_long_rand_auto_altname": { - "kms": "local", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "local_long_rand_explicit_id": { - "kms": "local", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "local_long_rand_explicit_altname": { - "kms": "local", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "local_long_det_auto_id": { - "kms": "local", - "type": "long", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "local_long_det_explicit_id": { - "kms": "local", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "local_long_det_explicit_altname": { - "kms": "local", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "local_decimal_rand_auto_id": { - "kms": "local", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "local_decimal_rand_auto_altname": { - "kms": "local", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "local_decimal_rand_explicit_id": { - "kms": "local", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "local_decimal_rand_explicit_altname": { - "kms": "local", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "local_decimal_det_explicit_id": { - "kms": "local", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "local_decimal_det_explicit_altname": { - "kms": "local", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "local_minKey_rand_explicit_id": { - "kms": "local", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "local_minKey_rand_explicit_altname": { - "kms": "local", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "local_minKey_det_explicit_id": { - "kms": "local", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "local_minKey_det_explicit_altname": { - "kms": "local", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "local_maxKey_rand_explicit_id": { - "kms": "local", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "local_maxKey_rand_explicit_altname": { - "kms": "local", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "local_maxKey_det_explicit_id": { - "kms": "local", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "local_maxKey_det_explicit_altname": { - "kms": "local", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "azure_double_rand_auto_id": { - "kms": "azure", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "azure_double_rand_auto_altname": { - "kms": "azure", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "azure_double_rand_explicit_id": { - "kms": "azure", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "azure_double_rand_explicit_altname": { - "kms": "azure", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "azure_double_det_explicit_id": { - "kms": "azure", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDouble": "1.234" - } - }, - "azure_double_det_explicit_altname": { - "kms": "azure", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDouble": "1.234" - } - }, - "azure_string_rand_auto_id": { - "kms": "azure", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "azure_string_rand_auto_altname": { - "kms": "azure", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": "mongodb" - }, - "azure_string_rand_explicit_id": { - "kms": "azure", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "azure_string_rand_explicit_altname": { - "kms": "azure", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": "mongodb" - }, - "azure_string_det_auto_id": { - "kms": "azure", - "type": "string", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "azure_string_det_explicit_id": { - "kms": "azure", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "azure_string_det_explicit_altname": { - "kms": "azure", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": "mongodb" - }, - "azure_object_rand_auto_id": { - "kms": "azure", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "azure_object_rand_auto_altname": { - "kms": "azure", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "azure_object_rand_explicit_id": { - "kms": "azure", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "azure_object_rand_explicit_altname": { - "kms": "azure", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "azure_object_det_explicit_id": { - "kms": "azure", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "azure_object_det_explicit_altname": { - "kms": "azure", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "azure_array_rand_auto_id": { - "kms": "azure", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "azure_array_rand_auto_altname": { - "kms": "azure", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "azure_array_rand_explicit_id": { - "kms": "azure", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "azure_array_rand_explicit_altname": { - "kms": "azure", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "azure_array_det_explicit_id": { - "kms": "azure", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "azure_array_det_explicit_altname": { - "kms": "azure", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "azure_binData=00_rand_auto_id": { - "kms": "azure", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "azure_binData=00_rand_auto_altname": { - "kms": "azure", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "azure_binData=00_rand_explicit_id": { - "kms": "azure", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "azure_binData=00_rand_explicit_altname": { - "kms": "azure", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "azure_binData=00_det_auto_id": { - "kms": "azure", - "type": "binData=00", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "azure_binData=00_det_explicit_id": { - "kms": "azure", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "azure_binData=00_det_explicit_altname": { - "kms": "azure", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "azure_binData=04_rand_auto_id": { - "kms": "azure", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "azure_binData=04_rand_auto_altname": { - "kms": "azure", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "azure_binData=04_rand_explicit_id": { - "kms": "azure", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "azure_binData=04_rand_explicit_altname": { - "kms": "azure", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "azure_binData=04_det_auto_id": { - "kms": "azure", - "type": "binData=04", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "azure_binData=04_det_explicit_id": { - "kms": "azure", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "azure_binData=04_det_explicit_altname": { - "kms": "azure", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "azure_undefined_rand_explicit_id": { - "kms": "azure", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "azure_undefined_rand_explicit_altname": { - "kms": "azure", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "azure_undefined_det_explicit_id": { - "kms": "azure", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "azure_undefined_det_explicit_altname": { - "kms": "azure", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "azure_objectId_rand_auto_id": { - "kms": "azure", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "azure_objectId_rand_auto_altname": { - "kms": "azure", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "azure_objectId_rand_explicit_id": { - "kms": "azure", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "azure_objectId_rand_explicit_altname": { - "kms": "azure", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "azure_objectId_det_auto_id": { - "kms": "azure", - "type": "objectId", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "azure_objectId_det_explicit_id": { - "kms": "azure", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "azure_objectId_det_explicit_altname": { - "kms": "azure", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "azure_bool_rand_auto_id": { - "kms": "azure", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": true - }, - "azure_bool_rand_auto_altname": { - "kms": "azure", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": true - }, - "azure_bool_rand_explicit_id": { - "kms": "azure", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": true - }, - "azure_bool_rand_explicit_altname": { - "kms": "azure", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": true - }, - "azure_bool_det_explicit_id": { - "kms": "azure", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": true - }, - "azure_bool_det_explicit_altname": { - "kms": "azure", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": true - }, - "azure_date_rand_auto_id": { - "kms": "azure", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "azure_date_rand_auto_altname": { - "kms": "azure", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "azure_date_rand_explicit_id": { - "kms": "azure", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "azure_date_rand_explicit_altname": { - "kms": "azure", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "azure_date_det_auto_id": { - "kms": "azure", - "type": "date", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "azure_date_det_explicit_id": { - "kms": "azure", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "azure_date_det_explicit_altname": { - "kms": "azure", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "azure_null_rand_explicit_id": { - "kms": "azure", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "azure_null_rand_explicit_altname": { - "kms": "azure", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "azure_null_det_explicit_id": { - "kms": "azure", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "azure_null_det_explicit_altname": { - "kms": "azure", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "azure_regex_rand_auto_id": { - "kms": "azure", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "azure_regex_rand_auto_altname": { - "kms": "azure", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "azure_regex_rand_explicit_id": { - "kms": "azure", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "azure_regex_rand_explicit_altname": { - "kms": "azure", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "azure_regex_det_auto_id": { - "kms": "azure", - "type": "regex", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "azure_regex_det_explicit_id": { - "kms": "azure", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "azure_regex_det_explicit_altname": { - "kms": "azure", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "azure_dbPointer_rand_auto_id": { - "kms": "azure", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "azure_dbPointer_rand_auto_altname": { - "kms": "azure", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "azure_dbPointer_rand_explicit_id": { - "kms": "azure", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "azure_dbPointer_rand_explicit_altname": { - "kms": "azure", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "azure_dbPointer_det_auto_id": { - "kms": "azure", - "type": "dbPointer", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "azure_dbPointer_det_explicit_id": { - "kms": "azure", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "azure_dbPointer_det_explicit_altname": { - "kms": "azure", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "azure_javascript_rand_auto_id": { - "kms": "azure", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "azure_javascript_rand_auto_altname": { - "kms": "azure", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "azure_javascript_rand_explicit_id": { - "kms": "azure", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "azure_javascript_rand_explicit_altname": { - "kms": "azure", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "azure_javascript_det_auto_id": { - "kms": "azure", - "type": "javascript", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "azure_javascript_det_explicit_id": { - "kms": "azure", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "azure_javascript_det_explicit_altname": { - "kms": "azure", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "azure_symbol_rand_auto_id": { - "kms": "azure", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "azure_symbol_rand_auto_altname": { - "kms": "azure", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "azure_symbol_rand_explicit_id": { - "kms": "azure", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "azure_symbol_rand_explicit_altname": { - "kms": "azure", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "azure_symbol_det_auto_id": { - "kms": "azure", - "type": "symbol", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "azure_symbol_det_explicit_id": { - "kms": "azure", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "azure_symbol_det_explicit_altname": { - "kms": "azure", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "azure_javascriptWithScope_rand_auto_id": { - "kms": "azure", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "azure_javascriptWithScope_rand_auto_altname": { - "kms": "azure", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "azure_javascriptWithScope_rand_explicit_id": { - "kms": "azure", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "azure_javascriptWithScope_rand_explicit_altname": { - "kms": "azure", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "azure_javascriptWithScope_det_explicit_id": { - "kms": "azure", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "azure_javascriptWithScope_det_explicit_altname": { - "kms": "azure", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "azure_int_rand_auto_id": { - "kms": "azure", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "azure_int_rand_auto_altname": { - "kms": "azure", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "azure_int_rand_explicit_id": { - "kms": "azure", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "azure_int_rand_explicit_altname": { - "kms": "azure", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "azure_int_det_auto_id": { - "kms": "azure", - "type": "int", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "azure_int_det_explicit_id": { - "kms": "azure", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "azure_int_det_explicit_altname": { - "kms": "azure", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "azure_timestamp_rand_auto_id": { - "kms": "azure", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "azure_timestamp_rand_auto_altname": { - "kms": "azure", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "azure_timestamp_rand_explicit_id": { - "kms": "azure", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "azure_timestamp_rand_explicit_altname": { - "kms": "azure", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "azure_timestamp_det_auto_id": { - "kms": "azure", - "type": "timestamp", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "azure_timestamp_det_explicit_id": { - "kms": "azure", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "azure_timestamp_det_explicit_altname": { - "kms": "azure", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "azure_long_rand_auto_id": { - "kms": "azure", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "azure_long_rand_auto_altname": { - "kms": "azure", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "azure_long_rand_explicit_id": { - "kms": "azure", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "azure_long_rand_explicit_altname": { - "kms": "azure", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "azure_long_det_auto_id": { - "kms": "azure", - "type": "long", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "azure_long_det_explicit_id": { - "kms": "azure", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "azure_long_det_explicit_altname": { - "kms": "azure", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "azure_decimal_rand_auto_id": { - "kms": "azure", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "azure_decimal_rand_auto_altname": { - "kms": "azure", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "azure_decimal_rand_explicit_id": { - "kms": "azure", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "azure_decimal_rand_explicit_altname": { - "kms": "azure", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "azure_decimal_det_explicit_id": { - "kms": "azure", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "azure_decimal_det_explicit_altname": { - "kms": "azure", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "azure_minKey_rand_explicit_id": { - "kms": "azure", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "azure_minKey_rand_explicit_altname": { - "kms": "azure", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "azure_minKey_det_explicit_id": { - "kms": "azure", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "azure_minKey_det_explicit_altname": { - "kms": "azure", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "azure_maxKey_rand_explicit_id": { - "kms": "azure", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "azure_maxKey_rand_explicit_altname": { - "kms": "azure", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "azure_maxKey_det_explicit_id": { - "kms": "azure", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "azure_maxKey_det_explicit_altname": { - "kms": "azure", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "gcp_double_rand_auto_id": { - "kms": "gcp", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "gcp_double_rand_auto_altname": { - "kms": "gcp", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "gcp_double_rand_explicit_id": { - "kms": "gcp", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "gcp_double_rand_explicit_altname": { - "kms": "gcp", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "gcp_double_det_explicit_id": { - "kms": "gcp", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDouble": "1.234" - } - }, - "gcp_double_det_explicit_altname": { - "kms": "gcp", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDouble": "1.234" - } - }, - "gcp_string_rand_auto_id": { - "kms": "gcp", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "gcp_string_rand_auto_altname": { - "kms": "gcp", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": "mongodb" - }, - "gcp_string_rand_explicit_id": { - "kms": "gcp", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "gcp_string_rand_explicit_altname": { - "kms": "gcp", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": "mongodb" - }, - "gcp_string_det_auto_id": { - "kms": "gcp", - "type": "string", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "gcp_string_det_explicit_id": { - "kms": "gcp", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "gcp_string_det_explicit_altname": { - "kms": "gcp", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": "mongodb" - }, - "gcp_object_rand_auto_id": { - "kms": "gcp", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "gcp_object_rand_auto_altname": { - "kms": "gcp", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "gcp_object_rand_explicit_id": { - "kms": "gcp", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "gcp_object_rand_explicit_altname": { - "kms": "gcp", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "gcp_object_det_explicit_id": { - "kms": "gcp", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "gcp_object_det_explicit_altname": { - "kms": "gcp", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "gcp_array_rand_auto_id": { - "kms": "gcp", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "gcp_array_rand_auto_altname": { - "kms": "gcp", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "gcp_array_rand_explicit_id": { - "kms": "gcp", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "gcp_array_rand_explicit_altname": { - "kms": "gcp", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "gcp_array_det_explicit_id": { - "kms": "gcp", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "gcp_array_det_explicit_altname": { - "kms": "gcp", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "gcp_binData=00_rand_auto_id": { - "kms": "gcp", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "gcp_binData=00_rand_auto_altname": { - "kms": "gcp", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "gcp_binData=00_rand_explicit_id": { - "kms": "gcp", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "gcp_binData=00_rand_explicit_altname": { - "kms": "gcp", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "gcp_binData=00_det_auto_id": { - "kms": "gcp", - "type": "binData=00", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "gcp_binData=00_det_explicit_id": { - "kms": "gcp", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "gcp_binData=00_det_explicit_altname": { - "kms": "gcp", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "gcp_binData=04_rand_auto_id": { - "kms": "gcp", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "gcp_binData=04_rand_auto_altname": { - "kms": "gcp", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "gcp_binData=04_rand_explicit_id": { - "kms": "gcp", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "gcp_binData=04_rand_explicit_altname": { - "kms": "gcp", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "gcp_binData=04_det_auto_id": { - "kms": "gcp", - "type": "binData=04", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "gcp_binData=04_det_explicit_id": { - "kms": "gcp", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "gcp_binData=04_det_explicit_altname": { - "kms": "gcp", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "gcp_undefined_rand_explicit_id": { - "kms": "gcp", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "gcp_undefined_rand_explicit_altname": { - "kms": "gcp", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "gcp_undefined_det_explicit_id": { - "kms": "gcp", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "gcp_undefined_det_explicit_altname": { - "kms": "gcp", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "gcp_objectId_rand_auto_id": { - "kms": "gcp", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "gcp_objectId_rand_auto_altname": { - "kms": "gcp", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "gcp_objectId_rand_explicit_id": { - "kms": "gcp", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "gcp_objectId_rand_explicit_altname": { - "kms": "gcp", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "gcp_objectId_det_auto_id": { - "kms": "gcp", - "type": "objectId", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "gcp_objectId_det_explicit_id": { - "kms": "gcp", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "gcp_objectId_det_explicit_altname": { - "kms": "gcp", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "gcp_bool_rand_auto_id": { - "kms": "gcp", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": true - }, - "gcp_bool_rand_auto_altname": { - "kms": "gcp", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": true - }, - "gcp_bool_rand_explicit_id": { - "kms": "gcp", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": true - }, - "gcp_bool_rand_explicit_altname": { - "kms": "gcp", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": true - }, - "gcp_bool_det_explicit_id": { - "kms": "gcp", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": true - }, - "gcp_bool_det_explicit_altname": { - "kms": "gcp", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": true - }, - "gcp_date_rand_auto_id": { - "kms": "gcp", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "gcp_date_rand_auto_altname": { - "kms": "gcp", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "gcp_date_rand_explicit_id": { - "kms": "gcp", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "gcp_date_rand_explicit_altname": { - "kms": "gcp", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "gcp_date_det_auto_id": { - "kms": "gcp", - "type": "date", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "gcp_date_det_explicit_id": { - "kms": "gcp", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "gcp_date_det_explicit_altname": { - "kms": "gcp", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "gcp_null_rand_explicit_id": { - "kms": "gcp", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "gcp_null_rand_explicit_altname": { - "kms": "gcp", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "gcp_null_det_explicit_id": { - "kms": "gcp", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "gcp_null_det_explicit_altname": { - "kms": "gcp", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "gcp_regex_rand_auto_id": { - "kms": "gcp", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "gcp_regex_rand_auto_altname": { - "kms": "gcp", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "gcp_regex_rand_explicit_id": { - "kms": "gcp", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "gcp_regex_rand_explicit_altname": { - "kms": "gcp", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "gcp_regex_det_auto_id": { - "kms": "gcp", - "type": "regex", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "gcp_regex_det_explicit_id": { - "kms": "gcp", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "gcp_regex_det_explicit_altname": { - "kms": "gcp", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "gcp_dbPointer_rand_auto_id": { - "kms": "gcp", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "gcp_dbPointer_rand_auto_altname": { - "kms": "gcp", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "gcp_dbPointer_rand_explicit_id": { - "kms": "gcp", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "gcp_dbPointer_rand_explicit_altname": { - "kms": "gcp", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "gcp_dbPointer_det_auto_id": { - "kms": "gcp", - "type": "dbPointer", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "gcp_dbPointer_det_explicit_id": { - "kms": "gcp", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "gcp_dbPointer_det_explicit_altname": { - "kms": "gcp", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "gcp_javascript_rand_auto_id": { - "kms": "gcp", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "gcp_javascript_rand_auto_altname": { - "kms": "gcp", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "gcp_javascript_rand_explicit_id": { - "kms": "gcp", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "gcp_javascript_rand_explicit_altname": { - "kms": "gcp", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "gcp_javascript_det_auto_id": { - "kms": "gcp", - "type": "javascript", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "gcp_javascript_det_explicit_id": { - "kms": "gcp", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "gcp_javascript_det_explicit_altname": { - "kms": "gcp", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "gcp_symbol_rand_auto_id": { - "kms": "gcp", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "gcp_symbol_rand_auto_altname": { - "kms": "gcp", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "gcp_symbol_rand_explicit_id": { - "kms": "gcp", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "gcp_symbol_rand_explicit_altname": { - "kms": "gcp", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "gcp_symbol_det_auto_id": { - "kms": "gcp", - "type": "symbol", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "gcp_symbol_det_explicit_id": { - "kms": "gcp", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "gcp_symbol_det_explicit_altname": { - "kms": "gcp", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "gcp_javascriptWithScope_rand_auto_id": { - "kms": "gcp", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "gcp_javascriptWithScope_rand_auto_altname": { - "kms": "gcp", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "gcp_javascriptWithScope_rand_explicit_id": { - "kms": "gcp", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "gcp_javascriptWithScope_rand_explicit_altname": { - "kms": "gcp", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "gcp_javascriptWithScope_det_explicit_id": { - "kms": "gcp", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "gcp_javascriptWithScope_det_explicit_altname": { - "kms": "gcp", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "gcp_int_rand_auto_id": { - "kms": "gcp", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "gcp_int_rand_auto_altname": { - "kms": "gcp", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "gcp_int_rand_explicit_id": { - "kms": "gcp", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "gcp_int_rand_explicit_altname": { - "kms": "gcp", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "gcp_int_det_auto_id": { - "kms": "gcp", - "type": "int", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "gcp_int_det_explicit_id": { - "kms": "gcp", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "gcp_int_det_explicit_altname": { - "kms": "gcp", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "gcp_timestamp_rand_auto_id": { - "kms": "gcp", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "gcp_timestamp_rand_auto_altname": { - "kms": "gcp", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "gcp_timestamp_rand_explicit_id": { - "kms": "gcp", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "gcp_timestamp_rand_explicit_altname": { - "kms": "gcp", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "gcp_timestamp_det_auto_id": { - "kms": "gcp", - "type": "timestamp", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "gcp_timestamp_det_explicit_id": { - "kms": "gcp", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "gcp_timestamp_det_explicit_altname": { - "kms": "gcp", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "gcp_long_rand_auto_id": { - "kms": "gcp", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "gcp_long_rand_auto_altname": { - "kms": "gcp", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "gcp_long_rand_explicit_id": { - "kms": "gcp", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "gcp_long_rand_explicit_altname": { - "kms": "gcp", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "gcp_long_det_auto_id": { - "kms": "gcp", - "type": "long", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "gcp_long_det_explicit_id": { - "kms": "gcp", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "gcp_long_det_explicit_altname": { - "kms": "gcp", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "gcp_decimal_rand_auto_id": { - "kms": "gcp", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "gcp_decimal_rand_auto_altname": { - "kms": "gcp", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "gcp_decimal_rand_explicit_id": { - "kms": "gcp", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "gcp_decimal_rand_explicit_altname": { - "kms": "gcp", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "gcp_decimal_det_explicit_id": { - "kms": "gcp", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "gcp_decimal_det_explicit_altname": { - "kms": "gcp", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "gcp_minKey_rand_explicit_id": { - "kms": "gcp", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "gcp_minKey_rand_explicit_altname": { - "kms": "gcp", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "gcp_minKey_det_explicit_id": { - "kms": "gcp", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "gcp_minKey_det_explicit_altname": { - "kms": "gcp", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "gcp_maxKey_rand_explicit_id": { - "kms": "gcp", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "gcp_maxKey_rand_explicit_altname": { - "kms": "gcp", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "gcp_maxKey_det_explicit_id": { - "kms": "gcp", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "gcp_maxKey_det_explicit_altname": { - "kms": "gcp", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "kmip_double_rand_auto_id": { - "kms": "kmip", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "kmip_double_rand_auto_altname": { - "kms": "kmip", - "type": "double", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "kmip_double_rand_explicit_id": { - "kms": "kmip", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "kmip_double_rand_explicit_altname": { - "kms": "kmip", - "type": "double", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDouble": "1.234" - } - }, - "kmip_double_det_explicit_id": { - "kms": "kmip", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDouble": "1.234" - } - }, - "kmip_double_det_explicit_altname": { - "kms": "kmip", - "type": "double", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDouble": "1.234" - } - }, - "kmip_string_rand_auto_id": { - "kms": "kmip", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "kmip_string_rand_auto_altname": { - "kms": "kmip", - "type": "string", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": "mongodb" - }, - "kmip_string_rand_explicit_id": { - "kms": "kmip", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "kmip_string_rand_explicit_altname": { - "kms": "kmip", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": "mongodb" - }, - "kmip_string_det_auto_id": { - "kms": "kmip", - "type": "string", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "kmip_string_det_explicit_id": { - "kms": "kmip", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "mongodb" - }, - "kmip_string_det_explicit_altname": { - "kms": "kmip", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": "mongodb" - }, - "kmip_object_rand_auto_id": { - "kms": "kmip", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "kmip_object_rand_auto_altname": { - "kms": "kmip", - "type": "object", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "kmip_object_rand_explicit_id": { - "kms": "kmip", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "kmip_object_rand_explicit_altname": { - "kms": "kmip", - "type": "object", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "kmip_object_det_explicit_id": { - "kms": "kmip", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "kmip_object_det_explicit_altname": { - "kms": "kmip", - "type": "object", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "x": { - "$numberInt": "1" - } - } - }, - "kmip_array_rand_auto_id": { - "kms": "kmip", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "kmip_array_rand_auto_altname": { - "kms": "kmip", - "type": "array", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "kmip_array_rand_explicit_id": { - "kms": "kmip", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "kmip_array_rand_explicit_altname": { - "kms": "kmip", - "type": "array", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "kmip_array_det_explicit_id": { - "kms": "kmip", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "kmip_array_det_explicit_altname": { - "kms": "kmip", - "type": "array", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": [ - { - "$numberInt": "1" - }, - { - "$numberInt": "2" - }, - { - "$numberInt": "3" - } - ] - }, - "kmip_binData=00_rand_auto_id": { - "kms": "kmip", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "kmip_binData=00_rand_auto_altname": { - "kms": "kmip", - "type": "binData=00", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "kmip_binData=00_rand_explicit_id": { - "kms": "kmip", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "kmip_binData=00_rand_explicit_altname": { - "kms": "kmip", - "type": "binData=00", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "kmip_binData=00_det_auto_id": { - "kms": "kmip", - "type": "binData=00", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "kmip_binData=00_det_explicit_id": { - "kms": "kmip", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "kmip_binData=00_det_explicit_altname": { - "kms": "kmip", - "type": "binData=00", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AQIDBA==", - "subType": "00" - } - } - }, - "kmip_binData=04_rand_auto_id": { - "kms": "kmip", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "kmip_binData=04_rand_auto_altname": { - "kms": "kmip", - "type": "binData=04", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "kmip_binData=04_rand_explicit_id": { - "kms": "kmip", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "kmip_binData=04_rand_explicit_altname": { - "kms": "kmip", - "type": "binData=04", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "kmip_binData=04_det_auto_id": { - "kms": "kmip", - "type": "binData=04", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "kmip_binData=04_det_explicit_id": { - "kms": "kmip", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "kmip_binData=04_det_explicit_altname": { - "kms": "kmip", - "type": "binData=04", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$binary": { - "base64": "AAECAwQFBgcICQoLDA0ODw==", - "subType": "04" - } - } - }, - "kmip_undefined_rand_explicit_id": { - "kms": "kmip", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "kmip_undefined_rand_explicit_altname": { - "kms": "kmip", - "type": "undefined", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "kmip_undefined_det_explicit_id": { - "kms": "kmip", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$undefined": true - } - }, - "kmip_undefined_det_explicit_altname": { - "kms": "kmip", - "type": "undefined", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$undefined": true - } - }, - "kmip_objectId_rand_auto_id": { - "kms": "kmip", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "kmip_objectId_rand_auto_altname": { - "kms": "kmip", - "type": "objectId", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "kmip_objectId_rand_explicit_id": { - "kms": "kmip", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "kmip_objectId_rand_explicit_altname": { - "kms": "kmip", - "type": "objectId", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "kmip_objectId_det_auto_id": { - "kms": "kmip", - "type": "objectId", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "kmip_objectId_det_explicit_id": { - "kms": "kmip", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "kmip_objectId_det_explicit_altname": { - "kms": "kmip", - "type": "objectId", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$oid": "01234567890abcdef0123456" - } - }, - "kmip_bool_rand_auto_id": { - "kms": "kmip", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": true - }, - "kmip_bool_rand_auto_altname": { - "kms": "kmip", - "type": "bool", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": true - }, - "kmip_bool_rand_explicit_id": { - "kms": "kmip", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": true - }, - "kmip_bool_rand_explicit_altname": { - "kms": "kmip", - "type": "bool", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": true - }, - "kmip_bool_det_explicit_id": { - "kms": "kmip", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": true - }, - "kmip_bool_det_explicit_altname": { - "kms": "kmip", - "type": "bool", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": true - }, - "kmip_date_rand_auto_id": { - "kms": "kmip", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "kmip_date_rand_auto_altname": { - "kms": "kmip", - "type": "date", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "kmip_date_rand_explicit_id": { - "kms": "kmip", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "kmip_date_rand_explicit_altname": { - "kms": "kmip", - "type": "date", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "kmip_date_det_auto_id": { - "kms": "kmip", - "type": "date", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "kmip_date_det_explicit_id": { - "kms": "kmip", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "kmip_date_det_explicit_altname": { - "kms": "kmip", - "type": "date", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$date": { - "$numberLong": "12345" - } - } - }, - "kmip_null_rand_explicit_id": { - "kms": "kmip", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "kmip_null_rand_explicit_altname": { - "kms": "kmip", - "type": "null", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "kmip_null_det_explicit_id": { - "kms": "kmip", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": null - }, - "kmip_null_det_explicit_altname": { - "kms": "kmip", - "type": "null", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": null - }, - "kmip_regex_rand_auto_id": { - "kms": "kmip", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "kmip_regex_rand_auto_altname": { - "kms": "kmip", - "type": "regex", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "kmip_regex_rand_explicit_id": { - "kms": "kmip", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "kmip_regex_rand_explicit_altname": { - "kms": "kmip", - "type": "regex", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "kmip_regex_det_auto_id": { - "kms": "kmip", - "type": "regex", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "kmip_regex_det_explicit_id": { - "kms": "kmip", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "kmip_regex_det_explicit_altname": { - "kms": "kmip", - "type": "regex", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$regularExpression": { - "pattern": ".*", - "options": "" - } - } - }, - "kmip_dbPointer_rand_auto_id": { - "kms": "kmip", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "kmip_dbPointer_rand_auto_altname": { - "kms": "kmip", - "type": "dbPointer", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "kmip_dbPointer_rand_explicit_id": { - "kms": "kmip", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "kmip_dbPointer_rand_explicit_altname": { - "kms": "kmip", - "type": "dbPointer", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "kmip_dbPointer_det_auto_id": { - "kms": "kmip", - "type": "dbPointer", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "kmip_dbPointer_det_explicit_id": { - "kms": "kmip", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "kmip_dbPointer_det_explicit_altname": { - "kms": "kmip", - "type": "dbPointer", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$dbPointer": { - "$ref": "db.example", - "$id": { - "$oid": "01234567890abcdef0123456" - } - } - } - }, - "kmip_javascript_rand_auto_id": { - "kms": "kmip", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "kmip_javascript_rand_auto_altname": { - "kms": "kmip", - "type": "javascript", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "kmip_javascript_rand_explicit_id": { - "kms": "kmip", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "kmip_javascript_rand_explicit_altname": { - "kms": "kmip", - "type": "javascript", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "kmip_javascript_det_auto_id": { - "kms": "kmip", - "type": "javascript", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "kmip_javascript_det_explicit_id": { - "kms": "kmip", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "kmip_javascript_det_explicit_altname": { - "kms": "kmip", - "type": "javascript", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1" - } - }, - "kmip_symbol_rand_auto_id": { - "kms": "kmip", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "kmip_symbol_rand_auto_altname": { - "kms": "kmip", - "type": "symbol", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "kmip_symbol_rand_explicit_id": { - "kms": "kmip", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "kmip_symbol_rand_explicit_altname": { - "kms": "kmip", - "type": "symbol", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "kmip_symbol_det_auto_id": { - "kms": "kmip", - "type": "symbol", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "kmip_symbol_det_explicit_id": { - "kms": "kmip", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "kmip_symbol_det_explicit_altname": { - "kms": "kmip", - "type": "symbol", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$symbol": "mongodb-symbol" - } - }, - "kmip_javascriptWithScope_rand_auto_id": { - "kms": "kmip", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "kmip_javascriptWithScope_rand_auto_altname": { - "kms": "kmip", - "type": "javascriptWithScope", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "kmip_javascriptWithScope_rand_explicit_id": { - "kms": "kmip", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "kmip_javascriptWithScope_rand_explicit_altname": { - "kms": "kmip", - "type": "javascriptWithScope", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "kmip_javascriptWithScope_det_explicit_id": { - "kms": "kmip", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "kmip_javascriptWithScope_det_explicit_altname": { - "kms": "kmip", - "type": "javascriptWithScope", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$code": "x=1", - "$scope": {} - } - }, - "kmip_int_rand_auto_id": { - "kms": "kmip", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "kmip_int_rand_auto_altname": { - "kms": "kmip", - "type": "int", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "kmip_int_rand_explicit_id": { - "kms": "kmip", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "kmip_int_rand_explicit_altname": { - "kms": "kmip", - "type": "int", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "kmip_int_det_auto_id": { - "kms": "kmip", - "type": "int", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "kmip_int_det_explicit_id": { - "kms": "kmip", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "kmip_int_det_explicit_altname": { - "kms": "kmip", - "type": "int", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberInt": "123" - } - }, - "kmip_timestamp_rand_auto_id": { - "kms": "kmip", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "kmip_timestamp_rand_auto_altname": { - "kms": "kmip", - "type": "timestamp", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "kmip_timestamp_rand_explicit_id": { - "kms": "kmip", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "kmip_timestamp_rand_explicit_altname": { - "kms": "kmip", - "type": "timestamp", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "kmip_timestamp_det_auto_id": { - "kms": "kmip", - "type": "timestamp", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "kmip_timestamp_det_explicit_id": { - "kms": "kmip", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "kmip_timestamp_det_explicit_altname": { - "kms": "kmip", - "type": "timestamp", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$timestamp": { - "t": 0, - "i": 12345 - } - } - }, - "kmip_long_rand_auto_id": { - "kms": "kmip", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "kmip_long_rand_auto_altname": { - "kms": "kmip", - "type": "long", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "kmip_long_rand_explicit_id": { - "kms": "kmip", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "kmip_long_rand_explicit_altname": { - "kms": "kmip", - "type": "long", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "kmip_long_det_auto_id": { - "kms": "kmip", - "type": "long", - "algo": "det", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "kmip_long_det_explicit_id": { - "kms": "kmip", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "kmip_long_det_explicit_altname": { - "kms": "kmip", - "type": "long", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberLong": "456" - } - }, - "kmip_decimal_rand_auto_id": { - "kms": "kmip", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "id", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "kmip_decimal_rand_auto_altname": { - "kms": "kmip", - "type": "decimal", - "algo": "rand", - "method": "auto", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "kmip_decimal_rand_explicit_id": { - "kms": "kmip", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "kmip_decimal_rand_explicit_altname": { - "kms": "kmip", - "type": "decimal", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": true, - "value": { - "$numberDecimal": "1.234" - } - }, - "kmip_decimal_det_explicit_id": { - "kms": "kmip", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "kmip_decimal_det_explicit_altname": { - "kms": "kmip", - "type": "decimal", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$numberDecimal": "1.234" - } - }, - "kmip_minKey_rand_explicit_id": { - "kms": "kmip", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "kmip_minKey_rand_explicit_altname": { - "kms": "kmip", - "type": "minKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "kmip_minKey_det_explicit_id": { - "kms": "kmip", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "kmip_minKey_det_explicit_altname": { - "kms": "kmip", - "type": "minKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$minKey": 1 - } - }, - "kmip_maxKey_rand_explicit_id": { - "kms": "kmip", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "kmip_maxKey_rand_explicit_altname": { - "kms": "kmip", - "type": "maxKey", - "algo": "rand", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "kmip_maxKey_det_explicit_id": { - "kms": "kmip", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "kmip_maxKey_det_explicit_altname": { - "kms": "kmip", - "type": "maxKey", - "algo": "det", - "method": "explicit", - "identifier": "altname", - "allowed": false, - "value": { - "$maxKey": 1 - } - }, - "payload=0,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "" - }, - "payload=1,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "a" - }, - "payload=2,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aa" - }, - "payload=3,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaa" - }, - "payload=4,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaa" - }, - "payload=5,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaa" - }, - "payload=6,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaa" - }, - "payload=7,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaa" - }, - "payload=8,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaa" - }, - "payload=9,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaa" - }, - "payload=10,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaaa" - }, - "payload=11,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaaaa" - }, - "payload=12,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaaaaa" - }, - "payload=13,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaaaaaa" - }, - "payload=14,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaaaaaaa" - }, - "payload=15,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaaaaaaaa" - }, - "payload=16,algo=rand": { - "kms": "local", - "type": "string", - "algo": "rand", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaaaaaaaaa" - }, - "payload=0,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "" - }, - "payload=1,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "a" - }, - "payload=2,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aa" - }, - "payload=3,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaa" - }, - "payload=4,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaa" - }, - "payload=5,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaa" - }, - "payload=6,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaa" - }, - "payload=7,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaa" - }, - "payload=8,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaa" - }, - "payload=9,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaa" - }, - "payload=10,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaaa" - }, - "payload=11,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaaaa" - }, - "payload=12,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaaaaa" - }, - "payload=13,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaaaaaa" - }, - "payload=14,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaaaaaaa" - }, - "payload=15,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaaaaaaaa" - }, - "payload=16,algo=det": { - "kms": "local", - "type": "string", - "algo": "det", - "method": "explicit", - "identifier": "id", - "allowed": true, - "value": "aaaaaaaaaaaaaaaa" - } -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/etc/data/encryptedFields.json b/tests/SpecTests/client-side-encryption/etc/data/encryptedFields.json deleted file mode 100644 index 88abe5a60..000000000 --- a/tests/SpecTests/client-side-encryption/etc/data/encryptedFields.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/etc/data/keys/key1-document.json b/tests/SpecTests/client-side-encryption/etc/data/keys/key1-document.json deleted file mode 100644 index 566b56c35..000000000 --- a/tests/SpecTests/client-side-encryption/etc/data/keys/key1-document.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } -} diff --git a/tests/SpecTests/client-side-encryption/etc/data/keys/key1-id.json b/tests/SpecTests/client-side-encryption/etc/data/keys/key1-id.json deleted file mode 100644 index 7d18f52eb..000000000 --- a/tests/SpecTests/client-side-encryption/etc/data/keys/key1-id.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } -} diff --git a/tests/SpecTests/client-side-encryption/etc/data/keys/key2-document.json b/tests/SpecTests/client-side-encryption/etc/data/keys/key2-document.json deleted file mode 100644 index a654d980b..000000000 --- a/tests/SpecTests/client-side-encryption/etc/data/keys/key2-document.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "_id": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } -} diff --git a/tests/SpecTests/client-side-encryption/etc/data/keys/key2-id.json b/tests/SpecTests/client-side-encryption/etc/data/keys/key2-id.json deleted file mode 100644 index 6e9b87bbc..000000000 --- a/tests/SpecTests/client-side-encryption/etc/data/keys/key2-id.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } -} diff --git a/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-Date.json b/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-Date.json deleted file mode 100644 index defa6e37f..000000000 --- a/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-Date.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-DecimalNoPrecision.json b/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-DecimalNoPrecision.json deleted file mode 100644 index dbe28e9c1..000000000 --- a/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-DecimalNoPrecision.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-DecimalPrecision.json b/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-DecimalPrecision.json deleted file mode 100644 index 538ab20f0..000000000 --- a/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-DecimalPrecision.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-DoubleNoPrecision.json b/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-DoubleNoPrecision.json deleted file mode 100644 index fb4f46d37..000000000 --- a/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-DoubleNoPrecision.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-DoublePrecision.json b/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-DoublePrecision.json deleted file mode 100644 index 07d1c84d6..000000000 --- a/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-DoublePrecision.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-Int.json b/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-Int.json deleted file mode 100644 index 4f0b4854e..000000000 --- a/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-Int.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-Long.json b/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-Long.json deleted file mode 100644 index 32fe1ea15..000000000 --- a/tests/SpecTests/client-side-encryption/etc/data/range-encryptedFields-Long.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/external/external-key.json b/tests/SpecTests/client-side-encryption/external/external-key.json deleted file mode 100644 index b3fe0723b..000000000 --- a/tests/SpecTests/client-side-encryption/external/external-key.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "status": { - "$numberInt": "1" - }, - "_id": { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "local" - }, - "updateDate": { - "$date": { - "$numberLong": "1557827033449" - } - }, - "keyMaterial": { - "$binary": { - "base64": "Ce9HSz/HKKGkIt4uyy+jDuKGA+rLC2cycykMo6vc8jXxqa1UVDYHWq1r+vZKbnnSRBfB981akzRKZCFpC05CTyFqDhXv6OnMjpG97OZEREGIsHEYiJkBW0jJJvfLLgeLsEpBzsro9FztGGXASxyxFRZFhXvHxyiLOKrdWfs7X1O/iK3pEoHMx6uSNSfUOgbebLfIqW7TO++iQS5g1xovXA==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1557827033449" - } - }, - "keyAltNames": [ "local" ] -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/external/external-schema.json b/tests/SpecTests/client-side-encryption/external/external-schema.json deleted file mode 100644 index 7d8cad8c3..000000000 --- a/tests/SpecTests/client-side-encryption/external/external-schema.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "properties": { - "encrypted": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" -} diff --git a/tests/SpecTests/client-side-encryption/limits/limits-doc.json b/tests/SpecTests/client-side-encryption/limits/limits-doc.json deleted file mode 100644 index 53de52326..000000000 --- a/tests/SpecTests/client-side-encryption/limits/limits-doc.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "00": "a", - "01": "a", - "02": "a", - "03": "a", - "04": "a", - "05": "a", - "06": "a", - "07": "a", - "08": "a", - "09": "a", - "10": "a", - "11": "a", - "12": "a", - "13": "a", - "14": "a", - "15": "a", - "16": "a", - "17": "a", - "18": "a", - "19": "a", - "20": "a", - "21": "a", - "22": "a", - "23": "a", - "24": "a", - "25": "a", - "26": "a", - "27": "a", - "28": "a", - "29": "a", - "30": "a", - "31": "a", - "32": "a", - "33": "a", - "34": "a", - "35": "a", - "36": "a", - "37": "a", - "38": "a", - "39": "a", - "40": "a", - "41": "a", - "42": "a", - "43": "a", - "44": "a", - "45": "a", - "46": "a", - "47": "a", - "48": "a", - "49": "a", - "50": "a", - "51": "a", - "52": "a", - "53": "a", - "54": "a", - "55": "a", - "56": "a", - "57": "a", - "58": "a", - "59": "a", - "60": "a", - "61": "a", - "62": "a", - "63": "a", - "64": "a", - "65": "a", - "66": "a", - "67": "a", - "68": "a", - "69": "a", - "70": "a", - "71": "a", - "72": "a", - "73": "a", - "74": "a", - "75": "a", - "76": "a", - "77": "a", - "78": "a", - "79": "a", - "80": "a", - "81": "a", - "82": "a", - "83": "a", - "84": "a", - "85": "a", - "86": "a", - "87": "a", - "88": "a", - "89": "a", - "90": "a", - "91": "a", - "92": "a", - "93": "a", - "94": "a", - "95": "a", - "96": "a", - "97": "a", - "98": "a", - "99": "a" -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/limits/limits-key.json b/tests/SpecTests/client-side-encryption/limits/limits-key.json deleted file mode 100644 index b3fe0723b..000000000 --- a/tests/SpecTests/client-side-encryption/limits/limits-key.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "status": { - "$numberInt": "1" - }, - "_id": { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "local" - }, - "updateDate": { - "$date": { - "$numberLong": "1557827033449" - } - }, - "keyMaterial": { - "$binary": { - "base64": "Ce9HSz/HKKGkIt4uyy+jDuKGA+rLC2cycykMo6vc8jXxqa1UVDYHWq1r+vZKbnnSRBfB981akzRKZCFpC05CTyFqDhXv6OnMjpG97OZEREGIsHEYiJkBW0jJJvfLLgeLsEpBzsro9FztGGXASxyxFRZFhXvHxyiLOKrdWfs7X1O/iK3pEoHMx6uSNSfUOgbebLfIqW7TO++iQS5g1xovXA==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1557827033449" - } - }, - "keyAltNames": [ "local" ] -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/limits/limits-schema.json b/tests/SpecTests/client-side-encryption/limits/limits-schema.json deleted file mode 100644 index c06908d9c..000000000 --- a/tests/SpecTests/client-side-encryption/limits/limits-schema.json +++ /dev/null @@ -1,1405 +0,0 @@ -{ - "properties": { - "00": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "01": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "02": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "03": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "04": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "05": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "06": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "07": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "08": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "09": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "10": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "11": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "12": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "13": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "14": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "15": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "16": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "17": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "18": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "19": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "20": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "21": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "22": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "23": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "24": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "25": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "26": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "27": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "28": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "29": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "30": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "31": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "32": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "33": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "34": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "35": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "36": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "37": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "38": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "39": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "40": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "41": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "42": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "43": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "44": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "45": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "46": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "47": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "48": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "49": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "50": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "51": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "52": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "53": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "54": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "55": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "56": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "57": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "58": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "59": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "60": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "61": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "62": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "63": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "64": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "65": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "66": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "67": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "68": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "69": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "70": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "71": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "72": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "73": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "74": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "75": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "76": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "77": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "78": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "79": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "80": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "81": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "82": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "83": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "84": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "85": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "86": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "87": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "88": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "89": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "90": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "91": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "92": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "93": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "94": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "95": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "96": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "97": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "98": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "99": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "LOCALAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" -} \ No newline at end of file diff --git a/tests/SpecTests/client-side-encryption/tests/aggregate.json b/tests/SpecTests/client-side-encryption/tests/aggregate.json deleted file mode 100644 index 7de725b71..000000000 --- a/tests/SpecTests/client-side-encryption/tests/aggregate.json +++ /dev/null @@ -1,390 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "Aggregate with deterministic encryption", - "skipReason": "SERVER-39395", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encrypted_string": "457-55-5642" - } - } - ] - }, - "result": [ - { - "_id": 1, - "encrypted_string": "string0" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "default", - "pipeline": [ - { - "$match": { - "encrypted_string": "457-55-5642" - } - } - ] - }, - "command_name": "aggregate" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "Aggregate with empty pipeline", - "skipReason": "SERVER-40829 hides agg support behind enableTestCommands flag.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "aggregate", - "arguments": { - "pipeline": [] - }, - "result": [ - { - "_id": 1, - "encrypted_string": "string0" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "default", - "pipeline": [], - "cursor": {} - }, - "command_name": "aggregate" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "Aggregate should fail with random encryption", - "skipReason": "SERVER-39395", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "random": "abc" - } - } - ] - }, - "result": { - "errorContains": "Cannot query on fields encrypted with the randomized encryption" - } - } - ] - }, - { - "description": "Database aggregate should fail", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "aggregate", - "object": "database", - "arguments": { - "pipeline": [ - { - "$currentOp": { - "allUsers": false, - "idleConnections": false, - "localOps": true - } - }, - { - "$match": { - "command.aggregate": { - "$eq": 1 - } - } - }, - { - "$project": { - "command": 1 - } - }, - { - "$project": { - "command.lsid": 0 - } - } - ] - }, - "result": { - "errorContains": "non-collection command not supported for auto encryption: aggregate" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/awsTemporary.json b/tests/SpecTests/client-side-encryption/tests/awsTemporary.json deleted file mode 100644 index 10eb85fee..000000000 --- a/tests/SpecTests/client-side-encryption/tests/awsTemporary.json +++ /dev/null @@ -1,225 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "Insert a document with auto encryption using the AWS provider with temporary credentials", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "awsTemporary": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault" - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "Insert with invalid temporary credentials", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "awsTemporaryNoSessionToken": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0" - } - }, - "result": { - "errorContains": "security token" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/azureKMS.json b/tests/SpecTests/client-side-encryption/tests/azureKMS.json deleted file mode 100644 index b0f511137..000000000 --- a/tests/SpecTests/client-side-encryption/tests/azureKMS.json +++ /dev/null @@ -1,235 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "json_schema": { - "properties": { - "encrypted_string_aws": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "encrypted_string_azure": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZURE+AAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "encrypted_string_gcp": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCP+AAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "encrypted_string_local": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "encrypted_string_kmip": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "dBHpr8aITfeBQ15grpbLpQ==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "encrypted_string_kmip_delegated": { - "encrypt": { - "keyId": [ - { - "$uuid": "7411e9af-c688-4df7-8143-5e60ae96cba6" - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "AZURE+AAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "n+HWZ0ZSVOYA3cvQgP7inN4JSXfOH85IngmeQxRpQHjCCcqT3IFqEWNlrsVHiz3AELimHhX4HKqOLWMUeSIT6emUDDoQX9BAv8DR1+E1w4nGs/NyEneac78EYFkK3JysrFDOgl2ypCCTKAypkn9CkAx1if4cfgQE93LW4kczcyHdGiH36CIxrCDGv1UzAvERN5Qa47DVwsM6a+hWsF2AAAJVnF0wYLLJU07TuRHdMrrphPWXZsFgyV+lRqJ7DDpReKNO8nMPLV/mHqHBHGPGQiRdb9NoJo8CvokGz4+KE8oLwzKf6V24dtwZmRkrsDV4iOhvROAzz+Euo1ypSkL3mw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1601573901680" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1601573901680" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "azure", - "keyVaultEndpoint": "key-vault-csfle.vault.azure.net", - "keyName": "key-name-csfle" - }, - "keyAltNames": [ - "altname", - "azure_altname" - ] - } - ], - "tests": [ - { - "description": "Insert a document with auto encryption using Azure KMS provider", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "azure": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string_azure": "string0" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AZURE+AAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault" - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_string_azure": { - "$binary": { - "base64": "AQGVERPgAAAAAAAAAAAAAAAC5DbBSwPwfSlBrDtRuglvNvCXD1KzDuCKY2P+4bRFtHDjpTOE2XuytPAUaAbXf1orsPq59PVZmsbTZbt2CB8qaQ==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string_azure": { - "$binary": { - "base64": "AQGVERPgAAAAAAAAAAAAAAAC5DbBSwPwfSlBrDtRuglvNvCXD1KzDuCKY2P+4bRFtHDjpTOE2XuytPAUaAbXf1orsPq59PVZmsbTZbt2CB8qaQ==", - "subType": "06" - } - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/badQueries.json b/tests/SpecTests/client-side-encryption/tests/badQueries.json deleted file mode 100644 index 4968307ba..000000000 --- a/tests/SpecTests/client-side-encryption/tests/badQueries.json +++ /dev/null @@ -1,1446 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "$text unconditionally fails", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "$text": { - "$search": "search text" - } - } - }, - "result": { - "errorContains": "Unsupported match expression operator for encryption" - } - } - ] - }, - { - "description": "$where unconditionally fails", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "$where": { - "$code": "function() { return true }" - } - } - }, - "result": { - "errorContains": "Unsupported match expression operator for encryption" - } - } - ] - }, - { - "description": "$bit operators succeed on unencrypted, error on encrypted", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$bitsAllClear": 35 - } - } - }, - "result": [] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$bitsAllClear": 35 - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$bitsAllSet": 35 - } - } - }, - "result": [] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$bitsAllSet": 35 - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$bitsAnyClear": 35 - } - } - }, - "result": [] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$bitsAnyClear": 35 - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$bitsAnySet": 35 - } - } - }, - "result": [] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$bitsAnySet": 35 - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - } - ] - }, - { - "description": "geo operators succeed on unencrypted, error on encrypted", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$near": [ - 0, - 0 - ] - } - } - }, - "result": { - "errorContains": "unable to find index" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$near": [ - 0, - 0 - ] - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$nearSphere": [ - 0, - 0 - ] - } - } - }, - "result": { - "errorContains": "unable to find index" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$nearSphere": [ - 0, - 0 - ] - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$geoIntersects": { - "$geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 1 - ], - [ - 0, - 0 - ] - ] - ] - } - } - } - } - }, - "result": [] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$geoIntersects": { - "$geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 1 - ], - [ - 0, - 0 - ] - ] - ] - } - } - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$geoWithin": { - "$geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 1 - ], - [ - 0, - 0 - ] - ] - ] - } - } - } - } - }, - "result": [] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$geoWithin": { - "$geometry": { - "type": "Polygon", - "coordinates": [ - [ - [ - 0, - 0 - ], - [ - 1, - 0 - ], - [ - 1, - 1 - ], - [ - 0, - 0 - ] - ] - ] - } - } - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - } - ] - }, - { - "description": "inequality operators succeed on unencrypted, error on encrypted", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$gt": 1 - } - } - }, - "result": [] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$gt": 1 - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$lt": 1 - } - } - }, - "result": [] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$lt": 1 - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$gte": 1 - } - } - }, - "result": [] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$gte": 1 - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$lte": 1 - } - } - }, - "result": [] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$lte": 1 - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - } - ] - }, - { - "description": "other misc operators succeed on unencrypted, error on encrypted", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$mod": [ - 3, - 1 - ] - } - } - }, - "result": [] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$mod": [ - 3, - 1 - ] - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$regex": "pattern", - "$options": "" - } - } - }, - "result": [] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$regex": "pattern", - "$options": "" - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$size": 2 - } - } - }, - "result": [] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$size": 2 - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$type": 2 - } - } - }, - "result": [] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$type": 2 - } - } - }, - "result": { - "errorContains": "Invalid match expression operator on encrypted field" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$eq": null - } - } - }, - "result": [ - { - "_id": 1, - "encrypted_string": "string0" - }, - { - "_id": 2, - "encrypted_string": "string1" - } - ] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$eq": null - } - } - }, - "result": { - "errorContains": "Illegal equality to null predicate for encrypted field" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "unencrypted": { - "$in": [ - null - ] - } - } - }, - "result": [ - { - "_id": 1, - "encrypted_string": "string0" - }, - { - "_id": 2, - "encrypted_string": "string1" - } - ] - }, - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$in": [ - null - ] - } - } - }, - "result": { - "errorContains": "Illegal equality to null inside $in against an encrypted field" - } - } - ] - }, - { - "description": "$addToSet succeeds on unencrypted, error on encrypted", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$addToSet": { - "unencrypted": [ - "a" - ] - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$addToSet": { - "encrypted_string": [ - "a" - ] - } - } - }, - "result": { - "errorContains": "$addToSet not allowed on encrypted values" - } - } - ] - }, - { - "description": "$inc succeeds on unencrypted, error on encrypted", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$inc": { - "unencrypted": 1 - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$inc": { - "encrypted_string": 1 - } - } - }, - "result": { - "errorContains": "$inc and $mul not allowed on encrypted values" - } - } - ] - }, - { - "description": "$mul succeeds on unencrypted, error on encrypted", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$mul": { - "unencrypted": 1 - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$mul": { - "encrypted_string": 1 - } - } - }, - "result": { - "errorContains": "$inc and $mul not allowed on encrypted values" - } - } - ] - }, - { - "description": "$max succeeds on unencrypted, error on encrypted", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$max": { - "unencrypted": 1 - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$max": { - "encrypted_string": 1 - } - } - }, - "result": { - "errorContains": "$max and $min not allowed on encrypted values" - } - } - ] - }, - { - "description": "$min succeeds on unencrypted, error on encrypted", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$min": { - "unencrypted": 1 - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$min": { - "encrypted_string": 1 - } - } - }, - "result": { - "errorContains": "$max and $min not allowed on encrypted values" - } - } - ] - }, - { - "description": "$currentDate succeeds on unencrypted, error on encrypted", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$currentDate": { - "unencrypted": true - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$currentDate": { - "encrypted_string": true - } - } - }, - "result": { - "errorContains": "$currentDate not allowed on encrypted values" - } - } - ] - }, - { - "description": "$pop succeeds on unencrypted, error on encrypted", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$pop": { - "unencrypted": 1 - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 0, - "upsertedCount": 0 - } - }, - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$pop": { - "encrypted_string": 1 - } - } - }, - "result": { - "errorContains": "$pop not allowed on encrypted values" - } - } - ] - }, - { - "description": "$pull succeeds on unencrypted, error on encrypted", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$pull": { - "unencrypted": 1 - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 0, - "upsertedCount": 0 - } - }, - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$pull": { - "encrypted_string": 1 - } - } - }, - "result": { - "errorContains": "$pull not allowed on encrypted values" - } - } - ] - }, - { - "description": "$pullAll succeeds on unencrypted, error on encrypted", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$pullAll": { - "unencrypted": [ - 1 - ] - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 0, - "upsertedCount": 0 - } - }, - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$pullAll": { - "encrypted_string": [ - 1 - ] - } - } - }, - "result": { - "errorContains": "$pullAll not allowed on encrypted values" - } - } - ] - }, - { - "description": "$push succeeds on unencrypted, error on encrypted", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$push": { - "unencrypted": 1 - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$push": { - "encrypted_string": 1 - } - } - }, - "result": { - "errorContains": "$push not allowed on encrypted values" - } - } - ] - }, - { - "description": "array filters on encrypted fields does not error in mongocryptd, but errors in mongod", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$set": { - "encrypted_string.$[i].x": 1 - } - }, - "arrayFilters": [ - { - "i.x": 1 - } - ] - }, - "result": { - "errorContains": "Array update operations not allowed on encrypted values" - } - } - ] - }, - { - "description": "positional operator succeeds on unencrypted, errors on encrypted", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": { - "unencrypted": 1 - }, - "update": { - "$set": { - "unencrypted.$": 1 - } - } - }, - "result": { - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0 - } - }, - { - "name": "updateOne", - "arguments": { - "filter": { - "encrypted_string": "abc" - }, - "update": { - "$set": { - "encrypted_string.$": "abc" - } - } - }, - "result": { - "errorContains": "Cannot encrypt fields below '$' positional update operator" - } - } - ] - }, - { - "description": "an update that would produce an array on an encrypted field errors", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$set": { - "encrypted_string": [ - 1, - 2 - ] - } - } - }, - "result": { - "errorContains": "Cannot encrypt element of type" - } - } - ] - }, - { - "description": "an insert with encrypted field on _id errors", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - }, - "schemaMap": { - "default.default": { - "properties": { - "_id": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1 - } - }, - "result": { - "errorContains": "Invalid schema containing the 'encrypt' keyword." - } - } - ] - }, - { - "description": "an insert with an array value for an encrypted field fails", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "encrypted_string": [ - "123", - "456" - ] - } - }, - "result": { - "errorContains": "Cannot encrypt element of type" - } - } - ] - }, - { - "description": "an insert with a Timestamp(0,0) value in the top-level fails", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "random": { - "$timestamp": { - "t": 0, - "i": 0 - } - } - } - }, - "result": { - "errorContains": "A command that inserts cannot supply Timestamp(0, 0) for an encrypted" - } - } - ] - }, - { - "description": "distinct with the key referring to a field where the keyID is a JSON Pointer errors", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "distinct", - "arguments": { - "filter": {}, - "fieldName": "encrypted_w_altname" - }, - "result": { - "errorContains": "The distinct key is not allowed to be marked for encryption with a non-UUID keyId" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/badSchema.json b/tests/SpecTests/client-side-encryption/tests/badSchema.json deleted file mode 100644 index 1fd0f8ed3..000000000 --- a/tests/SpecTests/client-side-encryption/tests/badSchema.json +++ /dev/null @@ -1,254 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "Schema with an encrypted field in an array", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - } - }, - "bsonType": "array" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0" - } - }, - "result": { - "errorContains": "Invalid schema" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "Schema without specifying parent object types", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "foo": { - "properties": { - "bar": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - } - } - } - } - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0" - } - }, - "result": { - "errorContains": "Invalid schema" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "Schema with siblings of encrypt document", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - }, - "bsonType": "object" - } - } - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0" - } - }, - "result": { - "errorContains": "'encrypt' cannot be used in conjunction with 'bsonType'" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - }, - { - "description": "Schema with logical keywords", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "anyOf": [ - { - "properties": { - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - } - } - } - ] - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0" - } - }, - "result": { - "errorContains": "Invalid schema" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/basic.json b/tests/SpecTests/client-side-encryption/tests/basic.json deleted file mode 100644 index 3ed066f53..000000000 --- a/tests/SpecTests/client-side-encryption/tests/basic.json +++ /dev/null @@ -1,350 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "Insert with deterministic encryption, then find it", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0" - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": [ - { - "_id": 1, - "encrypted_string": "string0" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": 1 - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "Insert with randomized encryption, then find it", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "random": "123" - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": [ - { - "_id": 1, - "random": "123" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "random": { - "$$type": "binData" - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": 1 - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "random": { - "$$type": "binData" - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/bulk.json b/tests/SpecTests/client-side-encryption/tests/bulk.json deleted file mode 100644 index 1b62e5e8a..000000000 --- a/tests/SpecTests/client-side-encryption/tests/bulk.json +++ /dev/null @@ -1,333 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "Bulk write with encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0", - "random": "abc" - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 2, - "encrypted_string": "string1" - } - } - }, - { - "name": "updateOne", - "arguments": { - "filter": { - "encrypted_string": "string0" - }, - "update": { - "$set": { - "encrypted_string": "string1" - } - } - } - }, - { - "name": "deleteOne", - "arguments": { - "filter": { - "$and": [ - { - "encrypted_string": "string1" - }, - { - "_id": 2 - } - ] - } - } - } - ], - "options": { - "ordered": true - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - }, - "random": { - "$$type": "binData" - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "update": "default", - "updates": [ - { - "q": { - "encrypted_string": { - "$eq": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - }, - "u": { - "$set": { - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - } - } - ], - "ordered": true - }, - "command_name": "update" - } - }, - { - "command_started_event": { - "command": { - "delete": "default", - "deletes": [ - { - "q": { - "$and": [ - { - "encrypted_string": { - "$eq": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - }, - { - "_id": { - "$eq": 2 - } - } - ] - }, - "limit": 1 - } - ], - "ordered": true - }, - "command_name": "delete" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - }, - "random": { - "$$type": "binData" - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/bypassAutoEncryption.json b/tests/SpecTests/client-side-encryption/tests/bypassAutoEncryption.json deleted file mode 100644 index 9d09cb3fa..000000000 --- a/tests/SpecTests/client-side-encryption/tests/bypassAutoEncryption.json +++ /dev/null @@ -1,402 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "Insert with bypassAutoEncryption", - "clientOptions": { - "autoEncryptOpts": { - "bypassAutoEncryption": true, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 2, - "encrypted_string": "string0" - }, - "bypassDocumentValidation": true - } - }, - { - "name": "find", - "arguments": { - "filter": {} - }, - "result": [ - { - "_id": 1, - "encrypted_string": "string0" - }, - { - "_id": 2, - "encrypted_string": "string0" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 2, - "encrypted_string": "string0" - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": {} - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": "string0" - } - ] - } - } - }, - { - "description": "Insert with bypassAutoEncryption for local schema", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "bypassAutoEncryption": true, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 2, - "encrypted_string": "string0" - }, - "bypassDocumentValidation": true - } - }, - { - "name": "find", - "arguments": { - "filter": {} - }, - "result": [ - { - "_id": 1, - "encrypted_string": "string0" - }, - { - "_id": 2, - "encrypted_string": "string0" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 2, - "encrypted_string": "string0" - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": {} - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": "string0" - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/bypassedCommand.json b/tests/SpecTests/client-side-encryption/tests/bypassedCommand.json deleted file mode 100644 index 18054a70c..000000000 --- a/tests/SpecTests/client-side-encryption/tests/bypassedCommand.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "json_schema": {}, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "ping is bypassed", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "runCommand", - "object": "database", - "command_name": "ping", - "arguments": { - "command": { - "ping": 1 - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "ping": 1 - }, - "command_name": "ping" - } - } - ] - }, - { - "description": "kill op is not bypassed", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "runCommand", - "object": "database", - "command_name": "killOp", - "arguments": { - "command": { - "killOp": 1, - "op": 1234 - } - }, - "result": { - "errorContains": "command not supported for auto encryption: killOp" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/count.json b/tests/SpecTests/client-side-encryption/tests/count.json deleted file mode 100644 index 9df8cd639..000000000 --- a/tests/SpecTests/client-side-encryption/tests/count.json +++ /dev/null @@ -1,229 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "Count with deterministic encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "count", - "arguments": { - "filter": { - "encrypted_string": "string0" - } - }, - "result": 2 - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "count": "default", - "query": { - "encrypted_string": { - "$eq": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - } - }, - "command_name": "count" - } - } - ] - }, - { - "description": "Count fails when filtering on a random encrypted field", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "count", - "arguments": { - "filter": { - "random": "abc" - } - }, - "result": { - "errorContains": "Cannot query on fields encrypted with the randomized encryption" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/countDocuments.json b/tests/SpecTests/client-side-encryption/tests/countDocuments.json deleted file mode 100644 index 07ff97f26..000000000 --- a/tests/SpecTests/client-side-encryption/tests/countDocuments.json +++ /dev/null @@ -1,241 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "countDocuments with deterministic encryption", - "skipReason": "waiting on SERVER-39395", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "countDocuments", - "arguments": { - "filter": { - "encrypted_string": "string0" - } - }, - "result": 1 - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "default", - "pipeline": [ - { - "$match": { - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "command_name": "aggregate" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/create-and-createIndexes.json b/tests/SpecTests/client-side-encryption/tests/create-and-createIndexes.json deleted file mode 100644 index 48638a97c..000000000 --- a/tests/SpecTests/client-side-encryption/tests/create-and-createIndexes.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "tests": [ - { - "description": "create is OK", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "unencryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "unencryptedCollection", - "validator": { - "unencrypted_string": "foo" - } - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "unencryptedCollection" - } - } - ] - }, - { - "description": "createIndexes is OK", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "unencryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "unencryptedCollection" - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "command": { - "createIndexes": "unencryptedCollection", - "indexes": [ - { - "name": "name", - "key": { - "name": 1 - } - } - ] - } - } - }, - { - "name": "assertIndexExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "unencryptedCollection", - "index": "name" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/delete.json b/tests/SpecTests/client-side-encryption/tests/delete.json deleted file mode 100644 index a6f4ffde9..000000000 --- a/tests/SpecTests/client-side-encryption/tests/delete.json +++ /dev/null @@ -1,340 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "deleteOne with deterministic encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "deleteOne", - "arguments": { - "filter": { - "encrypted_string": "string0" - } - }, - "result": { - "deletedCount": 1 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "delete": "default", - "deletes": [ - { - "q": { - "encrypted_string": { - "$eq": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - }, - "limit": 1 - } - ], - "ordered": true - }, - "command_name": "delete" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "deleteMany with deterministic encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "deleteMany", - "arguments": { - "filter": { - "encrypted_string": { - "$in": [ - "string0", - "string1" - ] - } - } - }, - "result": { - "deletedCount": 2 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "delete": "default", - "deletes": [ - { - "q": { - "encrypted_string": { - "$in": [ - { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - }, - { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - ] - } - }, - "limit": 0 - } - ], - "ordered": true - }, - "command_name": "delete" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/distinct.json b/tests/SpecTests/client-side-encryption/tests/distinct.json deleted file mode 100644 index 9786b0781..000000000 --- a/tests/SpecTests/client-side-encryption/tests/distinct.json +++ /dev/null @@ -1,276 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 3, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "distinct with deterministic encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "distinct", - "arguments": { - "filter": { - "encrypted_string": "string0" - }, - "fieldName": "encrypted_string" - }, - "result": [ - "string0" - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "distinct": "default", - "key": "encrypted_string", - "query": { - "encrypted_string": { - "$eq": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - } - }, - "command_name": "distinct" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 3, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "Distinct fails when filtering on a random encrypted field", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "distinct", - "arguments": { - "filter": { - "random": "abc" - }, - "fieldName": "encrypted_string" - }, - "result": { - "errorContains": "Cannot query on fields encrypted with the randomized encryption" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/explain.json b/tests/SpecTests/client-side-encryption/tests/explain.json deleted file mode 100644 index 8ca3b48d3..000000000 --- a/tests/SpecTests/client-side-encryption/tests/explain.json +++ /dev/null @@ -1,239 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "Explain a find with deterministic encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "runCommand", - "object": "database", - "command_name": "explain", - "arguments": { - "command": { - "explain": { - "find": "default", - "filter": { - "encrypted_string": "string1" - } - } - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "explain": { - "find": "default", - "filter": { - "encrypted_string": { - "$eq": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - } - }, - "verbosity": "allPlansExecution" - }, - "command_name": "explain" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/find.json b/tests/SpecTests/client-side-encryption/tests/find.json deleted file mode 100644 index 1feddab0e..000000000 --- a/tests/SpecTests/client-side-encryption/tests/find.json +++ /dev/null @@ -1,408 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - }, - "random": { - "$binary": { - "base64": "AgAAAAAAAAAAAAAAAAAAAAACyfp+lXvKOi7f5vh6ZsCijLEaXFKq1X06RmyS98ZvmMQGixTw8HM1f/bGxZjGwvYwjXOkIEb7Exgb8p2KCDI5TQ==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "Find with deterministic encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": "string0" - } - }, - "result": [ - { - "_id": 1, - "encrypted_string": "string0" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "encrypted_string": { - "$eq": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - }, - "random": { - "$binary": { - "base64": "AgAAAAAAAAAAAAAAAAAAAAACyfp+lXvKOi7f5vh6ZsCijLEaXFKq1X06RmyS98ZvmMQGixTw8HM1f/bGxZjGwvYwjXOkIEb7Exgb8p2KCDI5TQ==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "Find with $in with deterministic encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "encrypted_string": { - "$in": [ - "string0", - "string1" - ] - } - } - }, - "result": [ - { - "_id": 1, - "encrypted_string": "string0" - }, - { - "_id": 2, - "encrypted_string": "string1", - "random": "abc" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "encrypted_string": { - "$in": [ - { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - }, - { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - ] - } - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - }, - "random": { - "$binary": { - "base64": "AgAAAAAAAAAAAAAAAAAAAAACyfp+lXvKOi7f5vh6ZsCijLEaXFKq1X06RmyS98ZvmMQGixTw8HM1f/bGxZjGwvYwjXOkIEb7Exgb8p2KCDI5TQ==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "Find fails when filtering on a random encrypted field", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "random": "abc" - } - }, - "result": { - "errorContains": "Cannot query on fields encrypted with the randomized encryption" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/findOneAndDelete.json b/tests/SpecTests/client-side-encryption/tests/findOneAndDelete.json deleted file mode 100644 index e418a4581..000000000 --- a/tests/SpecTests/client-side-encryption/tests/findOneAndDelete.json +++ /dev/null @@ -1,221 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "findOneAndDelete with deterministic encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "findOneAndDelete", - "arguments": { - "filter": { - "encrypted_string": "string0" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "default", - "query": { - "encrypted_string": { - "$eq": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - }, - "remove": true - }, - "command_name": "findAndModify" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/findOneAndReplace.json b/tests/SpecTests/client-side-encryption/tests/findOneAndReplace.json deleted file mode 100644 index 78baca843..000000000 --- a/tests/SpecTests/client-side-encryption/tests/findOneAndReplace.json +++ /dev/null @@ -1,227 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "findOneAndReplace with deterministic encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "findOneAndReplace", - "arguments": { - "filter": { - "encrypted_string": "string0" - }, - "replacement": { - "encrypted_string": "string1" - }, - "returnDocument": "Before" - }, - "result": { - "_id": 1, - "encrypted_string": "string0" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "default", - "query": { - "encrypted_string": { - "$eq": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - }, - "update": { - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - }, - "command_name": "findAndModify" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/findOneAndUpdate.json b/tests/SpecTests/client-side-encryption/tests/findOneAndUpdate.json deleted file mode 100644 index 1d8585115..000000000 --- a/tests/SpecTests/client-side-encryption/tests/findOneAndUpdate.json +++ /dev/null @@ -1,231 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "findOneAndUpdate with deterministic encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "encrypted_string": "string0" - }, - "update": { - "$set": { - "encrypted_string": "string1" - } - }, - "returnDocument": "Before" - }, - "result": { - "_id": 1, - "encrypted_string": "string0" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "default", - "query": { - "encrypted_string": { - "$eq": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - }, - "update": { - "$set": { - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - } - }, - "command_name": "findAndModify" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-BypassQueryAnalysis.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-BypassQueryAnalysis.json deleted file mode 100644 index 9b28df2f9..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-BypassQueryAnalysis.json +++ /dev/null @@ -1,261 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "BypassQueryAnalysis decrypts", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - }, - "bypassQueryAnalysis": true - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedIndexed": { - "$binary": { - "base64": "C18BAAAFZAAgAAAAANnt+eLTkv4GdDPl8IAfJOvTzArOgFJQ2S/DcLza4W0DBXMAIAAAAAD2u+omZme3P2gBPehMQyQHQ153tPN1+z7bksYA9jKTpAVwADAAAAAAUnCOQqIvmR65YKyYnsiVfVrg9hwUVO3RhhKExo3RWOzgaS0QdsBL5xKFS0JhZSoWBXUAEAAAAAQSNFZ4EjSYdhI0EjRWeJASEHQAAgAAAAV2AFAAAAAAEjRWeBI0mHYSNBI0VniQEpQbp/ZJpWBKeDtKLiXb0P2E9wvc0g3f373jnYQYlJquOrlPOoEy3ngsHPJuSUijvWDsrQzqYa349K7G/66qaXEFZQAgAAAAAOuac/eRLYakKX6B0vZ1r3QodOQFfjqJD+xlGiPu4/PsBWwAIAAAAACkm0o9bj6j0HuADKc0svbqO2UHj6GrlNdF6yKNxh63xRJrAAAAAAAAAAAAAA==", - "subType": "06" - } - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": [ - { - "_id": 1, - "encryptedIndexed": "123" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedIndexed": { - "$binary": { - "base64": "C18BAAAFZAAgAAAAANnt+eLTkv4GdDPl8IAfJOvTzArOgFJQ2S/DcLza4W0DBXMAIAAAAAD2u+omZme3P2gBPehMQyQHQ153tPN1+z7bksYA9jKTpAVwADAAAAAAUnCOQqIvmR65YKyYnsiVfVrg9hwUVO3RhhKExo3RWOzgaS0QdsBL5xKFS0JhZSoWBXUAEAAAAAQSNFZ4EjSYdhI0EjRWeJASEHQAAgAAAAV2AFAAAAAAEjRWeBI0mHYSNBI0VniQEpQbp/ZJpWBKeDtKLiXb0P2E9wvc0g3f373jnYQYlJquOrlPOoEy3ngsHPJuSUijvWDsrQzqYa349K7G/66qaXEFZQAgAAAAAOuac/eRLYakKX6B0vZ1r3QodOQFfjqJD+xlGiPu4/PsBWwAIAAAAACkm0o9bj6j0HuADKc0svbqO2UHj6GrlNdF6yKNxh63xRJrAAAAAAAAAAAAAA==", - "subType": "06" - } - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": 1 - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encryptedIndexed": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "31eCYlbQoVboc5zwC8IoyJVSkag9PxREka8dkmbXJeY=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Compact.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Compact.json deleted file mode 100644 index 868095e1e..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Compact.json +++ /dev/null @@ -1,233 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - }, - { - "_id": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "Compact works", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "runCommand", - "object": "database", - "command_name": "compactStructuredEncryptionData", - "arguments": { - "command": { - "compactStructuredEncryptionData": "default" - } - }, - "result": { - "ok": 1 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "compactStructuredEncryptionData": "default", - "compactionTokens": { - "encryptedIndexed": { - "$binary": { - "base64": "noN+05JsuO1oDg59yypIGj45i+eFH6HOTXOPpeZ//Mk=", - "subType": "00" - } - }, - "encryptedUnindexed": { - "$binary": { - "base64": "SWO8WEoZ2r2Kx/muQKb7+COizy85nIIUFiHh4K9kcvA=", - "subType": "00" - } - } - } - }, - "command_name": "compactStructuredEncryptionData" - } - } - ] - }, - { - "description": "Compact errors on an unencrypted client", - "operations": [ - { - "name": "runCommand", - "object": "database", - "command_name": "compactStructuredEncryptionData", - "arguments": { - "command": { - "compactStructuredEncryptionData": "default" - } - }, - "result": { - "errorContains": "'compactStructuredEncryptionData.compactionTokens' is missing" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-CreateCollection-OldServer.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-CreateCollection-OldServer.json deleted file mode 100644 index c266aa6b8..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-CreateCollection-OldServer.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "6.0.0", - "maxServerVersion": "6.3.99", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "tests": [ - { - "description": "driver returns an error if creating a QEv2 collection on unsupported server", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - }, - "encryptedFieldsMap": { - "default.encryptedCollection": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - } - ] - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - }, - "result": { - "errorContains": "Driver support of Queryable Encryption is incompatible with server. Upgrade server to use Queryable Encryption." - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.esc" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecc" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecoc" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-CreateCollection.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-CreateCollection.json deleted file mode 100644 index c324be8ab..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-CreateCollection.json +++ /dev/null @@ -1,1758 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "tests": [ - { - "description": "state collections and index are created", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - }, - "encryptedFieldsMap": { - "default.encryptedCollection": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.esc" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecc" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecoc" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection" - } - }, - { - "name": "assertIndexExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection", - "index": "__safeContent___1" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.esc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.ecoc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "encryptedCollection" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "enxcol_.encryptedCollection.esc", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "enxcol_.encryptedCollection.ecoc", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "encryptedCollection", - "encryptedFields": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "createIndexes": "encryptedCollection", - "indexes": [ - { - "name": "__safeContent___1", - "key": { - "__safeContent__": 1 - } - } - ] - }, - "command_name": "createIndexes", - "database_name": "default" - } - } - ] - }, - { - "description": "default state collection names are applied", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - }, - "encryptedFieldsMap": { - "default.encryptedCollection": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.esc" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecc" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecoc" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection" - } - }, - { - "name": "assertIndexExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection", - "index": "__safeContent___1" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.esc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.ecoc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "encryptedCollection" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "enxcol_.encryptedCollection.esc", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "enxcol_.encryptedCollection.ecoc", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "encryptedCollection", - "encryptedFields": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "createIndexes": "encryptedCollection", - "indexes": [ - { - "name": "__safeContent___1", - "key": { - "__safeContent__": 1 - } - } - ] - }, - "command_name": "createIndexes", - "database_name": "default" - } - } - ] - }, - { - "description": "drop removes all state collections", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - }, - "encryptedFieldsMap": { - "default.encryptedCollection": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.esc" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecc" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecoc" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection" - } - }, - { - "name": "assertIndexExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection", - "index": "__safeContent___1" - } - }, - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecoc" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection" - } - }, - { - "name": "assertIndexNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection", - "index": "__safeContent___1" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.esc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.ecoc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "encryptedCollection" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "enxcol_.encryptedCollection.esc", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "enxcol_.encryptedCollection.ecoc", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "encryptedCollection", - "encryptedFields": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "createIndexes": "encryptedCollection", - "indexes": [ - { - "name": "__safeContent___1", - "key": { - "__safeContent__": 1 - } - } - ] - }, - "command_name": "createIndexes", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.esc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.ecoc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "encryptedCollection" - }, - "command_name": "drop", - "database_name": "default" - } - } - ] - }, - { - "description": "CreateCollection without encryptedFields.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - }, - "encryptedFieldsMap": { - "default.encryptedCollection": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "plaintextCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "plaintextCollection" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "plaintextCollection" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "plaintextCollection" - } - }, - "command_name": "listCollections", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "plaintextCollection" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "plaintextCollection" - }, - "command_name": "create", - "database_name": "default" - } - } - ] - }, - { - "description": "CreateCollection from encryptedFieldsMap.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - }, - "encryptedFieldsMap": { - "default.encryptedCollection": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.esc" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecc" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecoc" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection" - } - }, - { - "name": "assertIndexExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection", - "index": "__safeContent___1" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.esc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.ecoc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "encryptedCollection" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "enxcol_.encryptedCollection.esc", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "enxcol_.encryptedCollection.ecoc", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "encryptedCollection", - "encryptedFields": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "createIndexes": "encryptedCollection", - "indexes": [ - { - "name": "__safeContent___1", - "key": { - "__safeContent__": 1 - } - } - ] - }, - "command_name": "createIndexes", - "database_name": "default" - } - } - ] - }, - { - "description": "CreateCollection from encryptedFields.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection", - "encryptedFields": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection", - "encryptedFields": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.esc" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecc" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecoc" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection" - } - }, - { - "name": "assertIndexExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection", - "index": "__safeContent___1" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.esc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.ecoc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "encryptedCollection" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "enxcol_.encryptedCollection.esc", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "enxcol_.encryptedCollection.ecoc", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "encryptedCollection", - "encryptedFields": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "encryptedCollection" - } - }, - "command_name": "listCollections", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "createIndexes": "encryptedCollection", - "indexes": [ - { - "name": "__safeContent___1", - "key": { - "__safeContent__": 1 - } - } - ] - }, - "command_name": "createIndexes", - "database_name": "default" - } - } - ] - }, - { - "description": "DropCollection from encryptedFieldsMap", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - }, - "encryptedFieldsMap": { - "default.encryptedCollection": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.esc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.ecoc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "encryptedCollection" - }, - "command_name": "drop", - "database_name": "default" - } - } - ] - }, - { - "description": "DropCollection from encryptedFields", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - }, - "encryptedFieldsMap": {} - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection", - "encryptedFields": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection", - "encryptedFields": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.esc" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecc" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecoc" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection" - } - }, - { - "name": "assertIndexExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection", - "index": "__safeContent___1" - } - }, - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection", - "encryptedFields": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.esc" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecoc" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.esc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.ecoc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "encryptedCollection" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "enxcol_.encryptedCollection.esc", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "enxcol_.encryptedCollection.ecoc", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "encryptedCollection", - "encryptedFields": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "encryptedCollection" - } - }, - "command_name": "listCollections", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "createIndexes": "encryptedCollection", - "indexes": [ - { - "name": "__safeContent___1", - "key": { - "__safeContent__": 1 - } - } - ] - }, - "command_name": "createIndexes", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.esc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.ecoc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "encryptedCollection" - }, - "command_name": "drop", - "database_name": "default" - } - } - ] - }, - { - "description": "DropCollection from remote encryptedFields", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - }, - "encryptedFieldsMap": {} - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection", - "encryptedFields": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection", - "encryptedFields": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.esc" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecc" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecoc" - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection" - } - }, - { - "name": "assertIndexExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection", - "index": "__safeContent___1" - } - }, - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.esc" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "enxcol_.encryptedCollection.ecoc" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.esc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.ecoc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "encryptedCollection" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "enxcol_.encryptedCollection.esc", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "enxcol_.encryptedCollection.ecoc", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "create": "encryptedCollection", - "encryptedFields": { - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - }, - "command_name": "create", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "encryptedCollection" - } - }, - "command_name": "listCollections", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "createIndexes": "encryptedCollection", - "indexes": [ - { - "name": "__safeContent___1", - "key": { - "__safeContent__": 1 - } - } - ] - }, - "command_name": "createIndexes", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "encryptedCollection" - } - }, - "command_name": "listCollections", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.esc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "enxcol_.encryptedCollection.ecoc" - }, - "command_name": "drop", - "database_name": "default" - } - }, - { - "command_started_event": { - "command": { - "drop": "encryptedCollection" - }, - "command_name": "drop", - "database_name": "default" - } - } - ] - }, - { - "description": "encryptedFields are consulted for metadata collection names", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - }, - "encryptedFieldsMap": { - "default.encryptedCollection": { - "escCollection": "invalid_esc_name", - "ecocCollection": "invalid_ecoc_name", - "fields": [ - { - "path": "firstName", - "bsonType": "string", - "keyId": { - "$binary": { - "subType": "04", - "base64": "AAAAAAAAAAAAAAAAAAAAAA==" - } - } - } - ] - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - }, - "result": { - "errorContains": "Encrypted State Collection name should follow" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-DecryptExistingData.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-DecryptExistingData.json deleted file mode 100644 index 1fb4c1d1b..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-DecryptExistingData.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encryptedUnindexed": { - "$binary": { - "base64": "BqvN76sSNJh2EjQSNFZ4kBICTQaVZPWgXp41I7mPV1rLFTtw1tXzjcdSEyxpKKqujlko5TeizkB9hHQ009dVY1+fgIiDcefh+eQrm3CkhQ==", - "subType": "06" - } - } - } - ], - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 decrypt of existing data succeeds", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": [ - { - "_id": 1, - "encryptedUnindexed": "value123" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": 1 - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Delete.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Delete.json deleted file mode 100644 index ddfe57b00..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Delete.json +++ /dev/null @@ -1,284 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "Delete can query an FLE2 indexed field", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedIndexed": "value123" - } - } - }, - { - "name": "deleteOne", - "arguments": { - "filter": { - "encryptedIndexed": "value123" - } - }, - "result": { - "deletedCount": 1 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedIndexed": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "delete": "default", - "deletes": [ - { - "q": { - "encryptedIndexed": { - "$eq": { - "$binary": { - "base64": "DIkAAAAFZAAgAAAAAPtVteJQAlgb2YMa/+7YWH00sbQPyt7L6Rb8OwBdMmL2BXMAIAAAAAAd44hgVKnEnTFlwNVC14oyc9OZOTspeymusqkRQj57nAVsACAAAAAAaZ9s3G+4znfxStxeOZwcZy1OhzjMGc5hjmdMN+b/w6kSY20AAAAAAAAAAAAA", - "subType": "06" - } - } - } - }, - "limit": 1 - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "command_name": "delete" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-EncryptedFields-vs-EncryptedFieldsMap.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-EncryptedFields-vs-EncryptedFieldsMap.json deleted file mode 100644 index bdc5c99bc..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-EncryptedFields-vs-EncryptedFieldsMap.json +++ /dev/null @@ -1,212 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "encryptedFieldsMap is preferred over remote encryptedFields", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - }, - "encryptedFieldsMap": { - "default.default": { - "fields": [] - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedUnindexed": { - "$binary": { - "base64": "BqvN76sSNJh2EjQSNFZ4kBICTQaVZPWgXp41I7mPV1rLFTtw1tXzjcdSEyxpKKqujlko5TeizkB9hHQ009dVY1+fgIiDcefh+eQrm3CkhQ==", - "subType": "06" - } - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": [ - { - "_id": 1, - "encryptedUnindexed": "value123" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedUnindexed": { - "$binary": { - "base64": "BqvN76sSNJh2EjQSNFZ4kBICTQaVZPWgXp41I7mPV1rLFTtw1tXzjcdSEyxpKKqujlko5TeizkB9hHQ009dVY1+fgIiDcefh+eQrm3CkhQ==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": 1 - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encryptedUnindexed": { - "$binary": { - "base64": "BqvN76sSNJh2EjQSNFZ4kBICTQaVZPWgXp41I7mPV1rLFTtw1tXzjcdSEyxpKKqujlko5TeizkB9hHQ009dVY1+fgIiDcefh+eQrm3CkhQ==", - "subType": "06" - } - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-EncryptedFields-vs-jsonSchema.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-EncryptedFields-vs-jsonSchema.json deleted file mode 100644 index 8e0c6dafa..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-EncryptedFields-vs-jsonSchema.json +++ /dev/null @@ -1,300 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "json_schema": { - "properties": {}, - "bsonType": "object" - }, - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "encryptedFields is preferred over jsonSchema", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedIndexed": "123" - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedIndexed": "123" - } - }, - "result": [ - { - "_id": 1, - "encryptedIndexed": "123" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedIndexed": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "encryptedIndexed": { - "$eq": { - "$binary": { - "base64": "DIkAAAAFZAAgAAAAAPGmZcUzdE/FPILvRSyAScGvZparGI2y9rJ/vSBxgCujBXMAIAAAAACi1RjmndKqgnXy7xb22RzUbnZl1sOZRXPOC0KcJkAxmQVsACAAAAAApJtKPW4+o9B7gAynNLL26jtlB4+hq5TXResijcYet8USY20AAAAAAAAAAAAA", - "subType": "06" - } - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encryptedIndexed": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "31eCYlbQoVboc5zwC8IoyJVSkag9PxREka8dkmbXJeY=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-EncryptedFieldsMap-defaults.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-EncryptedFieldsMap-defaults.json deleted file mode 100644 index 1c0a057ca..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-EncryptedFieldsMap-defaults.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "key_vault_data": [], - "tests": [ - { - "description": "default state collections are applied to encryptionInformation", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - }, - "encryptedFieldsMap": { - "default.default": { - "fields": [] - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "foo": { - "$binary": { - "base64": "BYkAAAAFZAAgAAAAAE8KGPgq7h3n9nH5lfHcia8wtOTLwGkZNLBesb6PULqbBXMAIAAAAACq0558QyD3c3jkR5k0Zc9UpQK8ByhXhtn2d1xVQnuJ3AVjACAAAAAA1003zUWGwD4zVZ0KeihnZOthS3V6CEHUfnJZcIYHefISY20AAAAAAAAAAAAA", - "subType": "06" - } - } - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "foo": { - "$binary": { - "base64": "BYkAAAAFZAAgAAAAAE8KGPgq7h3n9nH5lfHcia8wtOTLwGkZNLBesb6PULqbBXMAIAAAAACq0558QyD3c3jkR5k0Zc9UpQK8ByhXhtn2d1xVQnuJ3AVjACAAAAAA1003zUWGwD4zVZ0KeihnZOthS3V6CEHUfnJZcIYHefISY20AAAAAAAAAAAAA", - "subType": "06" - } - } - } - ], - "encryptionInformation": { - "type": { - "$numberInt": "1" - }, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [] - } - } - }, - "ordered": true - }, - "command_name": "insert" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "foo": { - "$binary": { - "base64": "BYkAAAAFZAAgAAAAAE8KGPgq7h3n9nH5lfHcia8wtOTLwGkZNLBesb6PULqbBXMAIAAAAACq0558QyD3c3jkR5k0Zc9UpQK8ByhXhtn2d1xVQnuJ3AVjACAAAAAA1003zUWGwD4zVZ0KeihnZOthS3V6CEHUfnJZcIYHefISY20AAAAAAAAAAAAA", - "subType": "06" - } - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-FindOneAndUpdate.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-FindOneAndUpdate.json deleted file mode 100644 index c5e689a3d..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-FindOneAndUpdate.json +++ /dev/null @@ -1,560 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "findOneAndUpdate can query an FLE2 indexed field", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedIndexed": "value123" - } - } - }, - { - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "encryptedIndexed": "value123" - }, - "update": { - "$set": { - "foo": "bar" - } - }, - "returnDocument": "Before" - }, - "result": { - "_id": 1, - "encryptedIndexed": "value123" - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedIndexed": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "default", - "query": { - "encryptedIndexed": { - "$eq": { - "$binary": { - "base64": "DIkAAAAFZAAgAAAAAPtVteJQAlgb2YMa/+7YWH00sbQPyt7L6Rb8OwBdMmL2BXMAIAAAAAAd44hgVKnEnTFlwNVC14oyc9OZOTspeymusqkRQj57nAVsACAAAAAAaZ9s3G+4znfxStxeOZwcZy1OhzjMGc5hjmdMN+b/w6kSY20AAAAAAAAAAAAA", - "subType": "06" - } - } - } - }, - "update": { - "$set": { - "foo": "bar" - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "command_name": "findAndModify" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encryptedIndexed": { - "$$type": "binData" - }, - "foo": "bar", - "__safeContent__": [ - { - "$binary": { - "base64": "ThpoKfQ8AkOzkFfNC1+9PF0pY2nIzfXvRdxQgjkNbBw=", - "subType": "00" - } - } - ] - } - ] - } - } - }, - { - "description": "findOneAndUpdate can modify an FLE2 indexed field", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedIndexed": "value123" - } - } - }, - { - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "encryptedIndexed": "value123" - }, - "update": { - "$set": { - "encryptedIndexed": "value456" - } - }, - "returnDocument": "Before" - }, - "result": { - "_id": 1, - "encryptedIndexed": "value123" - } - }, - { - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": [ - { - "encryptedIndexed": "value456" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedIndexed": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "default", - "query": { - "encryptedIndexed": { - "$eq": { - "$binary": { - "base64": "DIkAAAAFZAAgAAAAAPtVteJQAlgb2YMa/+7YWH00sbQPyt7L6Rb8OwBdMmL2BXMAIAAAAAAd44hgVKnEnTFlwNVC14oyc9OZOTspeymusqkRQj57nAVsACAAAAAAaZ9s3G+4znfxStxeOZwcZy1OhzjMGc5hjmdMN+b/w6kSY20AAAAAAAAAAAAA", - "subType": "06" - } - } - } - }, - "update": { - "$set": { - "encryptedIndexed": { - "$$type": "binData" - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "command_name": "findAndModify" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": { - "$eq": 1 - } - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encryptedIndexed": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "rhe7/w8Ob8Unl44rGr/moScx6m5VODQnscDhF4Nkn6g=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-InsertFind-Indexed.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-InsertFind-Indexed.json deleted file mode 100644 index 6e156ffc6..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-InsertFind-Indexed.json +++ /dev/null @@ -1,296 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "Insert and find FLE2 indexed field", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedIndexed": "123" - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedIndexed": "123" - } - }, - "result": [ - { - "_id": 1, - "encryptedIndexed": "123" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedIndexed": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "encryptedIndexed": { - "$eq": { - "$binary": { - "base64": "DIkAAAAFZAAgAAAAAPGmZcUzdE/FPILvRSyAScGvZparGI2y9rJ/vSBxgCujBXMAIAAAAACi1RjmndKqgnXy7xb22RzUbnZl1sOZRXPOC0KcJkAxmQVsACAAAAAApJtKPW4+o9B7gAynNLL26jtlB4+hq5TXResijcYet8USY20AAAAAAAAAAAAA", - "subType": "06" - } - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encryptedIndexed": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "31eCYlbQoVboc5zwC8IoyJVSkag9PxREka8dkmbXJeY=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-InsertFind-Unindexed.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-InsertFind-Unindexed.json deleted file mode 100644 index 48280f5bd..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-InsertFind-Unindexed.json +++ /dev/null @@ -1,248 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "Insert and find FLE2 unindexed field", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedUnindexed": "value123" - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": [ - { - "_id": 1, - "encryptedUnindexed": "value123" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedUnindexed": { - "$$type": "binData" - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": { - "$eq": 1 - } - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encryptedUnindexed": { - "$$type": "binData" - } - } - ] - } - } - }, - { - "description": "Query with an unindexed field fails", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedUnindexed": "value123" - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedUnindexed": "value123" - } - }, - "result": { - "errorContains": "encrypt" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-MissingKey.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-MissingKey.json deleted file mode 100644 index 1e655f0a9..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-MissingKey.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "encryptedUnindexed": { - "$binary": { - "base64": "BqvN76sSNJh2EjQSNFZ4kBICTQaVZPWgXp41I7mPV1rLFTtw1tXzjcdSEyxpKKqujlko5TeizkB9hHQ009dVY1+fgIiDcefh+eQrm3CkhQ==", - "subType": "06" - } - } - } - ], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - }, - "key_vault_data": [], - "tests": [ - { - "description": "FLE2 encrypt fails with missing key", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedIndexed": "123" - } - }, - "result": { - "errorContains": "not all keys requested were satisfied" - } - } - ] - }, - { - "description": "FLE2 decrypt fails with missing key", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": {} - }, - "result": { - "errorContains": "not all keys requested were satisfied" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-NoEncryption.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-NoEncryption.json deleted file mode 100644 index a6843c473..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-NoEncryption.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "key_vault_data": [], - "encrypted_fields": { - "fields": [] - }, - "tests": [ - { - "description": "insert with no encryption succeeds", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "foo": "bar" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "foo": "bar" - } - ], - "ordered": true - }, - "command_name": "insert" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "foo": "bar" - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Compact.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Compact.json deleted file mode 100644 index bba9f2553..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Compact.json +++ /dev/null @@ -1,290 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ], - "serverless": "forbid" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "Compact works with 'range' fields", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "command_name": "compactStructuredEncryptionData", - "arguments": { - "command": { - "compactStructuredEncryptionData": "default" - } - }, - "result": { - "ok": 1 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedInt": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "compactStructuredEncryptionData": "default", - "compactionTokens": { - "encryptedInt": { - "ecoc": { - "$binary": { - "base64": "noN+05JsuO1oDg59yypIGj45i+eFH6HOTXOPpeZ//Mk=", - "subType": "00" - } - }, - "anchorPaddingToken": { - "$binary": { - "base64": "QxKJD2If48p0l8NAXf2Kr0aleMd/dATSjBK6hTpNMyc=", - "subType": "00" - } - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "compactStructuredEncryptionData" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-Aggregate.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-Aggregate.json deleted file mode 100644 index df2161cc3..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-Aggregate.json +++ /dev/null @@ -1,508 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Date. Aggregate.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDate": { - "$gt": { - "$date": { - "$numberLong": "0" - } - } - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDate": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDate": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "default", - "pipeline": [ - { - "$match": { - "encryptedDate": { - "$gt": { - "$binary": { - "base64": "DXUFAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABWQAIAAAAAB99ZW/7KwXKzl5M3XQsAJ3JbEef90IoxFYBArNiYzlgQVzACAAAAAAYO/qaw0+92HAryxOUG7iK6hnIy3OaUA9jIqtHdvcq8YFbAAgAAAAAHrUYj8A0hVgc6VklpDiljOnykrUSfEsjm56XO/bsfKdAAMzAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzQAfQAAAAVkACAAAAAAV22FGF7ZDwK/EYiGNMlm/QuT3saQdyJM/Fn+ZyQug1oFcwAgAAAAACo7GwCvbcs5UHQMgds9/1QMklEVdjZigpuOFGrDmmxtBWwAIAAAAADQbYYPxlCMMGe2MulbiurApFLoeJSMvTeDU3pyEA2jNwADNQB9AAAABWQAIAAAAADFspsMG7yHjKppyllon1KqAsTrHaZ6JzNqnSz8o6iTvwVzACAAAAAAeiA5pqVIQQ9s6UY/P8v5Jjkl3I7iFNeLDYehikrINrsFbAAgAAAAAFjBTzTpNxDEkA0vSRj0jCED9KDRlboMVyilKyDz5YR4AAM2AH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWwAIAAAAAA9/YU9eI3D7QbXKIw/3/gzWJ6MZrCYhG0j1wNKgRQp5wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAAJbW4AAAAAAAAAAAAJbXgAyAAAAAAAAAAA", - "subType": "06" - } - } - } - } - } - ], - "cursor": {}, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - } - } - } - }, - "command_name": "aggregate" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDate": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedDate": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "25j9sQXZCihCmHKvTHgaBsAVZFcGPn7JjHdrCGlwyyw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FA74j21GUEJb1DJBOpR9nVnjaDZnd8yAQNuaW9Qi26g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kJv//KVkbrobIBf+QeWC5jxn20mx/P0R1N6aCSMgKM8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zB+Whi9IUUGxfLEe+lGuIzLX4LFbIhaIAm5lRk65QTc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ybO1QU3CgvhO8JgRXH+HxKszWcpl5aGDYYVa75fHa1g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X3Y3eSAbbMg//JgiHHiFpYOpV61t8kkDexI+CQyitH4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SlNHXyqVFGDPrX/2ppwog6l4pwj3PKda2TkZbqgfSfA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "McjV8xwTF3xI7863DYOBdyvIv6UpzThl6v9vBRk05bI=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-Correctness.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-Correctness.json deleted file mode 100644 index fae25a1c0..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-Correctness.json +++ /dev/null @@ -1,1842 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "Find with $gt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDate": { - "$gt": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - ] - } - ] - }, - { - "description": "Find with $gte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDate": { - "$gte": { - "$date": { - "$numberLong": "0" - } - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - }, - { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - ] - } - ] - }, - { - "description": "Find with $gt with no results", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDate": { - "$gt": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - "result": [] - } - ] - }, - { - "description": "Find with $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDate": { - "$lt": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - "result": [ - { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - ] - } - ] - }, - { - "description": "Find with $lte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDate": { - "$lte": { - "$date": { - "$numberLong": "1" - } - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - }, - { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - ] - } - ] - }, - { - "description": "Find with $lt below min", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDate": { - "$lt": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - "result": { - "errorContains": "must be greater than the range minimum" - } - } - ] - }, - { - "description": "Find with $gt above max", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDate": { - "$gt": { - "$date": { - "$numberLong": "200" - } - } - } - } - }, - "result": { - "errorContains": "must be less than the range maximum" - } - } - ] - }, - { - "description": "Find with $gt and $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDate": { - "$gt": { - "$date": { - "$numberLong": "0" - } - }, - "$lt": { - "$date": { - "$numberLong": "2" - } - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - ] - } - ] - }, - { - "description": "Find with equality", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - }, - "result": [ - { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - ] - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - ] - } - ] - }, - { - "description": "Find with full range", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDate": { - "$gte": { - "$date": { - "$numberLong": "0" - } - }, - "$lte": { - "$date": { - "$numberLong": "200" - } - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - }, - { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - ] - } - ] - }, - { - "description": "Find with $in", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDate": { - "$in": [ - { - "$date": { - "$numberLong": "0" - } - } - ] - } - } - }, - "result": [ - { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - ] - } - ] - }, - { - "description": "Insert out of range", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "-1" - } - } - } - }, - "result": { - "errorContains": "value must be greater than or equal to the minimum value" - } - } - ] - }, - { - "description": "Insert min and max", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 200, - "encryptedDate": { - "$date": { - "$numberLong": "200" - } - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - }, - { - "_id": 200, - "encryptedDate": { - "$date": { - "$numberLong": "200" - } - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDate": { - "$gte": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - }, - { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gt with no results", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDate": { - "$gt": { - "$date": { - "$numberLong": "1" - } - } - } - } - } - ] - }, - "result": [] - } - ] - }, - { - "description": "Aggregate with $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDate": { - "$lt": { - "$date": { - "$numberLong": "1" - } - } - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - ] - } - ] - }, - { - "description": "Aggregate with $lte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDate": { - "$lte": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - }, - { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - ] - } - ] - }, - { - "description": "Aggregate with $lt below min", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDate": { - "$lt": { - "$date": { - "$numberLong": "0" - } - } - } - } - } - ] - }, - "result": { - "errorContains": "must be greater than the range minimum" - } - } - ] - }, - { - "description": "Aggregate with $gt above max", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDate": { - "$gt": { - "$date": { - "$numberLong": "200" - } - } - } - } - } - ] - }, - "result": { - "errorContains": "must be less than the range maximum" - } - } - ] - }, - { - "description": "Aggregate with $gt and $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDate": { - "$gt": { - "$date": { - "$numberLong": "0" - } - }, - "$lt": { - "$date": { - "$numberLong": "2" - } - } - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - ] - } - ] - }, - { - "description": "Aggregate with equality", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - ] - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - ] - } - ] - }, - { - "description": "Aggregate with full range", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDate": { - "$gte": { - "$date": { - "$numberLong": "0" - } - }, - "$lte": { - "$date": { - "$numberLong": "200" - } - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - }, - { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - ] - } - ] - }, - { - "description": "Aggregate with $in", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDate": { - "$in": [ - { - "$date": { - "$numberLong": "0" - } - } - ] - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - ] - } - ] - }, - { - "description": "Wrong type: Insert Double", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$numberDouble": "0" - } - } - }, - "result": { - "errorContains": "cannot encrypt element" - } - } - ] - }, - { - "description": "Wrong type: Find Double", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "encryptedDate": { - "$gte": { - "$numberDouble": "0" - } - } - } - }, - "result": { - "errorContains": "value type is a date" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-Delete.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-Delete.json deleted file mode 100644 index b4f15d9b1..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-Delete.json +++ /dev/null @@ -1,442 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Date. Delete.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "deleteOne", - "arguments": { - "filter": { - "encryptedDate": { - "$gt": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - "result": { - "deletedCount": 1 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDate": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDate": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "delete": "default", - "deletes": [ - { - "q": { - "encryptedDate": { - "$gt": { - "$binary": { - "base64": "DXUFAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABWQAIAAAAAB99ZW/7KwXKzl5M3XQsAJ3JbEef90IoxFYBArNiYzlgQVzACAAAAAAYO/qaw0+92HAryxOUG7iK6hnIy3OaUA9jIqtHdvcq8YFbAAgAAAAAHrUYj8A0hVgc6VklpDiljOnykrUSfEsjm56XO/bsfKdAAMzAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzQAfQAAAAVkACAAAAAAV22FGF7ZDwK/EYiGNMlm/QuT3saQdyJM/Fn+ZyQug1oFcwAgAAAAACo7GwCvbcs5UHQMgds9/1QMklEVdjZigpuOFGrDmmxtBWwAIAAAAADQbYYPxlCMMGe2MulbiurApFLoeJSMvTeDU3pyEA2jNwADNQB9AAAABWQAIAAAAADFspsMG7yHjKppyllon1KqAsTrHaZ6JzNqnSz8o6iTvwVzACAAAAAAeiA5pqVIQQ9s6UY/P8v5Jjkl3I7iFNeLDYehikrINrsFbAAgAAAAAFjBTzTpNxDEkA0vSRj0jCED9KDRlboMVyilKyDz5YR4AAM2AH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWwAIAAAAAA9/YU9eI3D7QbXKIw/3/gzWJ6MZrCYhG0j1wNKgRQp5wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAAJbW4AAAAAAAAAAAAJbXgAyAAAAAAAAAAA", - "subType": "06" - } - } - } - }, - "limit": 1 - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - } - } - } - }, - "command_name": "delete" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDate": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-FindOneAndUpdate.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-FindOneAndUpdate.json deleted file mode 100644 index 97ab4aaeb..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-FindOneAndUpdate.json +++ /dev/null @@ -1,514 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Date. FindOneAndUpdate.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "encryptedDate": { - "$gt": { - "$date": { - "$numberLong": "0" - } - } - } - }, - "update": { - "$set": { - "encryptedDate": { - "$date": { - "$numberLong": "2" - } - } - } - }, - "returnDocument": "Before" - }, - "result": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDate": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDate": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "default", - "query": { - "encryptedDate": { - "$gt": { - "$binary": { - "base64": "DXUFAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABWQAIAAAAAB99ZW/7KwXKzl5M3XQsAJ3JbEef90IoxFYBArNiYzlgQVzACAAAAAAYO/qaw0+92HAryxOUG7iK6hnIy3OaUA9jIqtHdvcq8YFbAAgAAAAAHrUYj8A0hVgc6VklpDiljOnykrUSfEsjm56XO/bsfKdAAMzAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzQAfQAAAAVkACAAAAAAV22FGF7ZDwK/EYiGNMlm/QuT3saQdyJM/Fn+ZyQug1oFcwAgAAAAACo7GwCvbcs5UHQMgds9/1QMklEVdjZigpuOFGrDmmxtBWwAIAAAAADQbYYPxlCMMGe2MulbiurApFLoeJSMvTeDU3pyEA2jNwADNQB9AAAABWQAIAAAAADFspsMG7yHjKppyllon1KqAsTrHaZ6JzNqnSz8o6iTvwVzACAAAAAAeiA5pqVIQQ9s6UY/P8v5Jjkl3I7iFNeLDYehikrINrsFbAAgAAAAAFjBTzTpNxDEkA0vSRj0jCED9KDRlboMVyilKyDz5YR4AAM2AH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWwAIAAAAAA9/YU9eI3D7QbXKIw/3/gzWJ6MZrCYhG0j1wNKgRQp5wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAAJbW4AAAAAAAAAAAAJbXgAyAAAAAAAAAAA", - "subType": "06" - } - } - } - }, - "update": { - "$set": { - "encryptedDate": { - "$$type": "binData" - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - } - } - } - }, - "command_name": "findAndModify" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDate": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedDate": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "hyDcE6QQjPrYJaIS/n7evEZFYcm31Tj89CpEYGF45cI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "F08nMDWDZc+DbWM7XCEJNNCEYyinRmrvGP7EWhmp4is=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cXH4688amcDc8kZOJq4UP8cE3R58Zl7e+Qo/1jyspps=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uURBxvTp3FBCVkd+LPqyuY7d6rMW6SGIJQEPY/wtkZI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jG3hax1L3RBp9t38vUt53FsBxgr/+Si/vVISpAylYpE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kwtIW8MhH9Ky5xNjBx8gFA/SHh2YVphie7g5FGBzals=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FHflwFuEMu4xX0ZApHi+pdlBH+oevAtXckCUb5Wv0xU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ty4cnzJdAlbQKnh7px3GEYjBnvO+jIOaKjoTRDtmh3M=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-InsertFind.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-InsertFind.json deleted file mode 100644 index a011c388e..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-InsertFind.json +++ /dev/null @@ -1,499 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Date. Insert and Find.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDate": { - "$gt": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDate": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDate": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "encryptedDate": { - "$gt": { - "$binary": { - "base64": "DXUFAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABWQAIAAAAAB99ZW/7KwXKzl5M3XQsAJ3JbEef90IoxFYBArNiYzlgQVzACAAAAAAYO/qaw0+92HAryxOUG7iK6hnIy3OaUA9jIqtHdvcq8YFbAAgAAAAAHrUYj8A0hVgc6VklpDiljOnykrUSfEsjm56XO/bsfKdAAMzAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzQAfQAAAAVkACAAAAAAV22FGF7ZDwK/EYiGNMlm/QuT3saQdyJM/Fn+ZyQug1oFcwAgAAAAACo7GwCvbcs5UHQMgds9/1QMklEVdjZigpuOFGrDmmxtBWwAIAAAAADQbYYPxlCMMGe2MulbiurApFLoeJSMvTeDU3pyEA2jNwADNQB9AAAABWQAIAAAAADFspsMG7yHjKppyllon1KqAsTrHaZ6JzNqnSz8o6iTvwVzACAAAAAAeiA5pqVIQQ9s6UY/P8v5Jjkl3I7iFNeLDYehikrINrsFbAAgAAAAAFjBTzTpNxDEkA0vSRj0jCED9KDRlboMVyilKyDz5YR4AAM2AH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWwAIAAAAAA9/YU9eI3D7QbXKIw/3/gzWJ6MZrCYhG0j1wNKgRQp5wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAAJbW4AAAAAAAAAAAAJbXgAyAAAAAAAAAAA", - "subType": "06" - } - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - } - } - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDate": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedDate": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "25j9sQXZCihCmHKvTHgaBsAVZFcGPn7JjHdrCGlwyyw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FA74j21GUEJb1DJBOpR9nVnjaDZnd8yAQNuaW9Qi26g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kJv//KVkbrobIBf+QeWC5jxn20mx/P0R1N6aCSMgKM8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zB+Whi9IUUGxfLEe+lGuIzLX4LFbIhaIAm5lRk65QTc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ybO1QU3CgvhO8JgRXH+HxKszWcpl5aGDYYVa75fHa1g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X3Y3eSAbbMg//JgiHHiFpYOpV61t8kkDexI+CQyitH4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SlNHXyqVFGDPrX/2ppwog6l4pwj3PKda2TkZbqgfSfA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "McjV8xwTF3xI7863DYOBdyvIv6UpzThl6v9vBRk05bI=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-Update.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-Update.json deleted file mode 100644 index 6bab6499f..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Date-Update.json +++ /dev/null @@ -1,516 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Date. Update.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDate": { - "$date": { - "$numberLong": "0" - } - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDate": { - "$date": { - "$numberLong": "1" - } - } - } - } - }, - { - "name": "updateOne", - "arguments": { - "filter": { - "encryptedDate": { - "$gt": { - "$date": { - "$numberLong": "0" - } - } - } - }, - "update": { - "$set": { - "encryptedDate": { - "$date": { - "$numberLong": "2" - } - } - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDate": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDate": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command_name": "update", - "command": { - "update": "default", - "ordered": true, - "updates": [ - { - "q": { - "encryptedDate": { - "$gt": { - "$binary": { - "base64": "DXUFAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABWQAIAAAAAB99ZW/7KwXKzl5M3XQsAJ3JbEef90IoxFYBArNiYzlgQVzACAAAAAAYO/qaw0+92HAryxOUG7iK6hnIy3OaUA9jIqtHdvcq8YFbAAgAAAAAHrUYj8A0hVgc6VklpDiljOnykrUSfEsjm56XO/bsfKdAAMzAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzQAfQAAAAVkACAAAAAAV22FGF7ZDwK/EYiGNMlm/QuT3saQdyJM/Fn+ZyQug1oFcwAgAAAAACo7GwCvbcs5UHQMgds9/1QMklEVdjZigpuOFGrDmmxtBWwAIAAAAADQbYYPxlCMMGe2MulbiurApFLoeJSMvTeDU3pyEA2jNwADNQB9AAAABWQAIAAAAADFspsMG7yHjKppyllon1KqAsTrHaZ6JzNqnSz8o6iTvwVzACAAAAAAeiA5pqVIQQ9s6UY/P8v5Jjkl3I7iFNeLDYehikrINrsFbAAgAAAAAFjBTzTpNxDEkA0vSRj0jCED9KDRlboMVyilKyDz5YR4AAM2AH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWwAIAAAAAA9/YU9eI3D7QbXKIw/3/gzWJ6MZrCYhG0j1wNKgRQp5wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAAJbW4AAAAAAAAAAAAJbXgAyAAAAAAAAAAA", - "subType": "06" - } - } - } - }, - "u": { - "$set": { - "encryptedDate": { - "$$type": "binData" - } - } - } - } - ], - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDate", - "bsonType": "date", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$date": { - "$numberLong": "0" - } - }, - "max": { - "$date": { - "$numberLong": "200" - } - } - } - } - ] - } - } - }, - "$db": "default" - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDate": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedDate": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "hyDcE6QQjPrYJaIS/n7evEZFYcm31Tj89CpEYGF45cI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "F08nMDWDZc+DbWM7XCEJNNCEYyinRmrvGP7EWhmp4is=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cXH4688amcDc8kZOJq4UP8cE3R58Zl7e+Qo/1jyspps=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uURBxvTp3FBCVkd+LPqyuY7d6rMW6SGIJQEPY/wtkZI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jG3hax1L3RBp9t38vUt53FsBxgr/+Si/vVISpAylYpE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kwtIW8MhH9Ky5xNjBx8gFA/SHh2YVphie7g5FGBzals=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FHflwFuEMu4xX0ZApHi+pdlBH+oevAtXckCUb5Wv0xU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ty4cnzJdAlbQKnh7px3GEYjBnvO+jIOaKjoTRDtmh3M=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-Aggregate.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-Aggregate.json deleted file mode 100644 index d1a82c216..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-Aggregate.json +++ /dev/null @@ -1,1902 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Decimal. Aggregate.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalNoPrecision": { - "$gt": { - "$numberDecimal": "0" - } - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1" - } - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "default", - "pipeline": [ - { - "$match": { - "encryptedDecimalNoPrecision": { - "$gt": { - "$binary": { - "base64": "DR1jAAADcGF5bG9hZACxYgAABGcAnWIAAAMwAH0AAAAFZAAgAAAAAJu2KgiI8vM+kz9qD3ZQzFQY5qbgYqCqHG5R4jAlnlwXBXMAIAAAAAAAUXxFXsz764T79sGCdhxvNd5b6E/9p61FonsHyEIhogVsACAAAAAAt19RL3Oo5ni5L8kcvgOJYLgVYyXJExwP8pkuzLG7f/kAAzEAfQAAAAVkACAAAAAAPQPvL0ARjujSv2Rkm8r7spVsgeC1K3FWcskGGZ3OdDIFcwAgAAAAACgNn660GmefR8jLqzgR1u5O+Uocx9GyEHiBqVGko5FZBWwAIAAAAADflr+fsnZngm6KRWYgHa9JzK+bXogWl9evBU9sQUHPHQADMgB9AAAABWQAIAAAAAD2Zi6kcxmaD2mY3VWrP+wYJMPg6cSBIYPapxaFQxYFdQVzACAAAAAAM/cV36BLBY3xFBXsXJY8M9EHHOc/qrmdc2CJmj3M89gFbAAgAAAAAOpydOrKxx6m2gquSDV2Vv3w10GocmNCFeOo/fRhRH9JAAMzAH0AAAAFZAAgAAAAAOaNqI9srQ/mI9gwbk+VkizGBBH/PPWOVusgnfPk3tY1BXMAIAAAAAAc96O/pwKCmHCagT6T/QV/wz4vqO+R22GsZ1dse2Vg6QVsACAAAAAAgzIak+Q3UFLTHXPmJ+MuEklFtR3eLtvM+jdKkmGCV/YAAzQAfQAAAAVkACAAAAAA0XlQgy/Yu97EQOjronl9b3dcR1DFn3deuVhtTLbJZHkFcwAgAAAAACoMnpVl6EFJak8A+t5N4RFnQhkQEBnNAx8wDqmq5U/dBWwAIAAAAACR26FJif673qpwF1J1FEkQGJ1Ywcr/ZW6JQ7meGqzt1QADNQB9AAAABWQAIAAAAAAOtpNexRxfv0yRFvZO9DhlkpU4mDuAb8ykdLnE5Vf1VAVzACAAAAAAeblFKm/30orP16uQpZslvsoS8s0xfNPIBlw3VkHeekYFbAAgAAAAAPEoHj87sYE+nBut52/LPvleWQBzB/uaJFnosxp4NRO2AAM2AH0AAAAFZAAgAAAAAIr8xAFm1zPmrvW4Vy5Ct0W8FxMmyPmFzdWVzesBhAJFBXMAIAAAAABYeeXjJEzTHwxab6pUiCRiZjxgtN59a1y8Szy3hfkg+gVsACAAAAAAJuoY4rF8mbI+nKb+5XbZShJ8191o/e8ZCRHE0O4Ey8MAAzcAfQAAAAVkACAAAAAAl+ibLk0/+EwoqeC8S8cGgAtjtpQWGEZDsybMPnrrkwEFcwAgAAAAAHPPBudWgQ+HUorLDpJMqhS9VBF2VF5aLcxgrM1s+yU7BWwAIAAAAAAcCcBR2Vyv5pAFbaOU97yovuOi1+ATDnLLcAUqHecXcAADOAB9AAAABWQAIAAAAACR9erwLTb+tcWFZgJ2MEfM0PKI9uuwIjDTHADRFgD+SQVzACAAAAAAcOop8TXsGUVQoKhzUllMYWxL93xCOkwtIpV8Q6hiSYYFbAAgAAAAAKXKmh4V8veYwob1H03Q3p3PN8SRAaQwDT34KlNVUjiDAAM5AH0AAAAFZAAgAAAAALv0vCPgh7QpmM8Ug6ad5ioZJCh7pLMdT8FYyQioBQ6KBXMAIAAAAADsCPyIG8t6ApQkRk1fX/sfc1kpuWCWP8gAEpnYoBSHrQVsACAAAAAAJe/r67N6d8uTiogvfoR9rEXbIDjyLb9EVdqkayFFGaYAAzEwAH0AAAAFZAAgAAAAAIW4AxJgYoM0pcNTwk1RSbyjZGIqgKL1hcTJmNrnZmoPBXMAIAAAAAAZpfx3EFO0vY0f1eHnE0PazgqeNDTaj+pPJMUNW8lFrAVsACAAAAAAP+Um2vwW6Bj6vuz9DKz6+6aWkoKoEmFNoiz/xXm7lOsAAzExAH0AAAAFZAAgAAAAAKliO6L9zgeuufjj174hvmQGNRbmYYs9yAirL7OxwEW3BXMAIAAAAAAqU7vs3DWUQ95Eq8OejwWnD0GuXd+ASi/uD6S0l8MM1QVsACAAAAAAb9legYzsfctBPpHyl7YWpPmLr5QiNZFND/50N1vv2MUAAzEyAH0AAAAFZAAgAAAAAOGQcCBkk+j/Kzjt/Cs6g3BZPJG81wIHBS8JewHGpgk+BXMAIAAAAABjrxZXWCkdzrExwCgyHaafuPSQ4V4x2k9kUCAqUaYKDQVsACAAAAAADBU6KefT0v8zSmseaMNmQxKjJar72y7MojLFhkEHqrUAAzEzAH0AAAAFZAAgAAAAAPmCNEt4t97waOSd5hNi2fNCdWEkmcFJ37LI9k4Az4/5BXMAIAAAAABX7DuDPNg+duvELf3NbLWkPMFw2HGLgWGHyVWcPvSNCAVsACAAAAAAS7El1FtZ5STh8Q1FguvieyYX9b2DF1DFVsb9hzxXYRsAAzE0AH0AAAAFZAAgAAAAAD4vtVUYRNB+FD9yoQ2FVJH3nMeJeKbi6eZfth638YqbBXMAIAAAAAANCuUB4OdmuD6LaDK2f3vaqfgYYvg40wDXOBbcFjTqLwVsACAAAAAA9hqC2VoJBjwR7hcQ45xO8ZVojwC83jiRacCaDj6Px2gAAzE1AH0AAAAFZAAgAAAAAJPIRzjmTjbdIvshG6UslbEOd797ZSIdjGAhGWxVQvK1BXMAIAAAAABgmJ0Jh8WLs9IYs/a7DBjDWd8J3thW/AGJK7zDnMeYOAVsACAAAAAAi9zAsyAuou2oiCUHGc6QefLUkACa9IgeBhGu9W/r0X8AAzE2AH0AAAAFZAAgAAAAAABQyKQPoW8wGPIqnsTv69+DzIdRkohRhOhDmyVHkw9WBXMAIAAAAAAqWA2X4tB/h3O1Xlawtz6ndI6WaTwgU1QYflL35opu5gVsACAAAAAAWI/Gj5aZMwDIxztqmVL0g5LBcI8EdKEc2UA28pnekQoAAzE3AH0AAAAFZAAgAAAAACB7NOyGQ1Id3MYnxtBXqyZ5Ul/lHH6p1b10U63DfT6bBXMAIAAAAADpOryIcndxztkHSfLN3Kzq29sD8djS0PspDSqERMqokQVsACAAAAAADatsMW4ezgnyi1PiP7xk+gA4AFIN/fb5uJqfVkjg4UoAAzE4AH0AAAAFZAAgAAAAAKVfXLfs8XA14CRTB56oZwV+bFJN5BHraTXbqEXZDmTkBXMAIAAAAAASRWTsfGOpqdffiOodoqIgBzG/yzFyjR5CfUsIUIWGpgVsACAAAAAAkgCHbCwyX640/0Ni8+MoYxeHUiC+FSU4Mn9jTLYtgZgAAzE5AH0AAAAFZAAgAAAAAH/aZr4EuS0/noQR9rcF8vwoaxnxrwgOsSJ0ys8PkHhGBXMAIAAAAACd7ObGQW7qfddcvyxRTkPuvq/PHu7+6I5dxwS1Lzy5XAVsACAAAAAA3q0eKdV7KeU3pc+CtfypKR7BPxwaf30yu0j9FXeOOboAAzIwAH0AAAAFZAAgAAAAAKvlcpFFNq0oA+urq3w6d80PK1HHHw0H0yVWvU9aHijXBXMAIAAAAADWnAHQ5Fhlcjawki7kWzdqjM2f6IdGJblojrYElWjsZgVsACAAAAAAO0wvY66l24gx8nRxyVGC0QcTztIi81Kx3ndRhuZr6W4AAzIxAH0AAAAFZAAgAAAAAH/2aMezEOddrq+dNOkDrdqf13h2ttOnexZsJxG1G6PNBXMAIAAAAABNtgnibjC4VKy5poYjvdsBBnVvDTF/4mmEAxsXVgZVKgVsACAAAAAAqvadzJFLqQbs8WxgZ2D2X+XnaPSDMLCVVgWxx5jnLcYAAzIyAH0AAAAFZAAgAAAAAF2wZoDL6/V59QqO8vdRZWDpXpkV4h4KOCSn5e7x7nmzBXMAIAAAAADLZBu7LCYjbThaVUqMK14H/elrVOYIKJQCx4C9Yjw37gVsACAAAAAAEh6Vs81jLU204aGpL90fmYTm5i5R8/RT1uIbg6VU3HwAAzIzAH0AAAAFZAAgAAAAAH27yYaLn9zh2CpvaoomUPercSfJRUmBY6XFqmhcXi9QBXMAIAAAAAAUwumVlIYIs9JhDhSj0R0+59psCMsFk94E62VxkPt42QVsACAAAAAAT5x2hCCd2bpmpnyWaxas8nSxTc8e4C9DfKaqr0ABEysAAzI0AH0AAAAFZAAgAAAAALMg2kNAO4AFFs/mW3In04yFeN4AP6Vo0klyUoT06RquBXMAIAAAAAAgGWJbeIdwlpqXCyVIYSs0dt54Rfc8JF4b8uYc+YUj0AVsACAAAAAAWHeWxIkyvXTOWvfZzqtPXjfGaWWKjGSIQENTU3zBCrsAAzI1AH0AAAAFZAAgAAAAALas/i1T2DFCEmrrLEi7O2ngJZyFHialOoedVXS+OjenBXMAIAAAAAA1kK0QxY4REcGxHeMkgumyF7iwlsRFtw9MlbSSoQY7uAVsACAAAAAAUNlpMJZs1p4HfsD4Q4WZ4TBEi6Oc2fX34rzyynqWCdwAAzI2AH0AAAAFZAAgAAAAAP1TejmWg1CEuNSMt6NUgeQ5lT+oBoeyF7d2l5xQrbXWBXMAIAAAAABPX0kj6obggdJShmqtVfueKHplH4ZrXusiwrRDHMOKeQVsACAAAAAAIYOsNwC3DA7fLcOzqdr0bOFdHCfmK8tLwPoaE9uKOosAAzI3AH0AAAAFZAAgAAAAAMrKn+QPa/NxYezNhlOX9nyEkN1kE/gW7EuZkVqYl0b8BXMAIAAAAABUoZMSPUywRGfX2EEencJEKH5x/P9ySUVrhStAwgR/LgVsACAAAAAAMgZFH6lQIIDrgHnFeslv3ld20ynwQjQJt3cAp4GgrFkAAzI4AH0AAAAFZAAgAAAAAMmD1+a+oVbiUZd1HuZqdgtdVsVKwuWAn3/M1B6QGBM3BXMAIAAAAACLyytOYuZ9WEsIrrtJbXUx4QgipbaAbmlJvSZVkGi0CAVsACAAAAAA4v1lSp5H9BB+HYJ4bH43tC8aeuPZMf78Ng1JOhJh190AAzI5AH0AAAAFZAAgAAAAAOVKV7IuFwmYP1qVv8h0NvJmfPICu8yQhzjG7oJdTLDoBXMAIAAAAABL70XLfQLKRsw1deJ2MUvxSWKxpF/Ez73jqtbLvqbuogVsACAAAAAAvfgzIorXxE91dDt4nQxYfntTsx0M8Gzdsao5naQqcRUAAzMwAH0AAAAFZAAgAAAAAKS/1RSAQma+xV9rz04IcdzmavtrBDjOKPM+Z2NEyYfPBXMAIAAAAAAOJDWGORDgfRv8+w5nunh41wXb2hCA0MRzwnLnQtIqPgVsACAAAAAAf42C1+T7xdHEFF83+c2mF5S8PuuL22ogXXELnRAZ4boAAzMxAH0AAAAFZAAgAAAAAFeq8o82uNY1X8cH6OhdTzHNBUnCChsEDs5tm0kPBz3qBXMAIAAAAABaxMBbsaeEj/EDtr8nZfrhhhirBRPJwVamDo5WwbgvTQVsACAAAAAAMbH453A+BYAaDOTo5kdhV1VdND1avNwvshEG/4MIJjQAAzMyAH0AAAAFZAAgAAAAAI8IKIfDrohHh2cjspJHCovqroSr5N3QyVtNzFvT5+FzBXMAIAAAAABXHXteKG0DoOMmECKp6ro1MZNQvXGzqTDdZ0DUc8QfFAVsACAAAAAA/w5s++XYmO+9TWTbtGc3n3ndV4T9JUribIbF4jmDLSMAAzMzAH0AAAAFZAAgAAAAAJkHvm15kIu1OtAiaByj5ieWqzxiu/epK6c/9+KYIrB0BXMAIAAAAACzg5TcyANk0nes/wCJudd1BwlkWWF6zw3nGclq5v3SJQVsACAAAAAAvruXHTT3irPJLyWpI1j/Xwf2FeIE/IV+6Z49pqRzISoAAzM0AH0AAAAFZAAgAAAAAAYSOvEWWuSg1Aym7EssNLR+xsY7e9BcwsX4JKlnSHJcBXMAIAAAAABT48eY3PXVDOjw7JpNjOe1j2JyI3LjDnQoqZ8Je5B2KgVsACAAAAAAU2815RR57TQ9uDg0XjWjBkAKvf8yssxDMzrM4+FqP6AAAzM1AH0AAAAFZAAgAAAAAGQxC9L1e9DfO5XZvX1yvc3hTLtQEdKO9FPMkyg0Y9ZABXMAIAAAAADtmcMNJwdWLxQEArMGZQyzpnu+Z5yMmPAkvgq4eAKwNQVsACAAAAAAJ88zt4Y/Hoqh+zrf6KCOiUwHbOzCxSfp6k/qsZaYGEgAAzM2AH0AAAAFZAAgAAAAADLHK2LNCNRO0pv8n4fAsxwtUqCNnVK8rRgNiQfXpHSdBXMAIAAAAACf16EBIHRKD3SzjRW+LMOl+47QXA3CJhMzlcqyFRW22AVsACAAAAAAMGz4fAOa0EoVv90fUffwLjBrQhHATf+NdlgCR65vujAAAzM3AH0AAAAFZAAgAAAAAHiZJiXKNF8bbukQGsdYkEi95I+FSBHy1I5/hK2uEZruBXMAIAAAAADE+lZBa8HDUJPN+bF6xI9x4N7GF9pj3vBR7y0BcfFhBAVsACAAAAAAGIEN6sfqq30nyxW4dxDgXr/jz5HmvA9T1jx/pKCn4zgAAzM4AH0AAAAFZAAgAAAAAI1oa2OIw5TvhT14tYCGmhanUoYcCZtNbrVbeoMldHNZBXMAIAAAAAAx2nS0Ipblf2XOgBiUOuJFBupBhe7nb6QPLZlA4aMPCgVsACAAAAAA9xu828hugIgo0E3de9dZD+gTpVUGlwtDba+tw/WcbUoAAzM5AH0AAAAFZAAgAAAAABgTWS3Yap7Q59hii/uPPimHWXsr+DUmsqfwt/X73qsOBXMAIAAAAACKK05liW5KrmEAvtpCB1WUltruzUylDDpjea//UlWoOAVsACAAAAAAcgN4P/wakJ5aJK5c1bvJBqpVGND221dli2YicPFfuAYAAzQwAH0AAAAFZAAgAAAAABOAnBPXDp6i9TISQXvcNKwGDLepZTu3cKrB4vKnSCjBBXMAIAAAAADjjzZO7UowAAvpwyG8BNOVqLCccMFk3aDK4unUeft5ywVsACAAAAAA4zkCd4k9gvfXoD1C7vwTjNcdVJwEARh8h/cxZ4PNMfgAAzQxAH0AAAAFZAAgAAAAAHN8hyvT1lYrAsdiV5GBdd5jhtrAYE/KnSjw2Ka9hjz9BXMAIAAAAAD794JK7EeXBs+D7yOVK7nWF8SbZ/7U8gZ7nnT9JFNwTAVsACAAAAAAg8Wt1HO3NhByq2ggux2a4Lo6Gryr24rEFIqh2acrwWMAAzQyAH0AAAAFZAAgAAAAAO93bPrq8bsnp1AtNd9ETnXIz0lH/2HYN/vuw9wA3fyFBXMAIAAAAABHlls5fbaF2oAGqptC481XQ4eYxInTC29aElfmVZgDUgVsACAAAAAANoQXEWpXJpgrSNK/cKi/m7oYhuSRlp1IZBF0bqTEATcAAzQzAH0AAAAFZAAgAAAAAL1YsAZm1SA0ztU6ySIrQgCCA74V6rr0/4iIygCcaJL6BXMAIAAAAADTXWTHWovGmUR1Zg9l/Aqq9H5mOCJQQrb/Dfae7e3wKAVsACAAAAAA5dunyJK6/SVfDD0t9QlNBcFqoZnf9legRjHaLSKAoQMAAzQ0AH0AAAAFZAAgAAAAAEoFAeHk0RZ9kD+cJRD3j7PcE5gzWKnyBrF1I/MDNp5mBXMAIAAAAACgHtc2hMBRSZjKw8RAdDHK+Pi1HeyjiBuAslGVNcW5tAVsACAAAAAAXzBLfq+GxRtX4Wa9fazA49DBLG6AjZm2XODStJKH8D0AAzQ1AH0AAAAFZAAgAAAAAAW+7DmSN/LX+/0uBVJDHIc2dhxAGz4+ehyyz8fAnNGoBXMAIAAAAAA6Ilw42EvvfLJ3Eq8Afd+FjPoPcQutZO6ltmCLEr8kxQVsACAAAAAAbbZalyo07BbFjPFlYmbmv0z023eT9eLkHqeVUnfUAUAAAzQ2AH0AAAAFZAAgAAAAANBdV7M7kuYO3EMoQItAbXv4t2cIhfaT9V6+s4cg9djlBXMAIAAAAABvz4MIvZWxxrcJCL5qxLfFhXiUYB1OLHdKEjco94SgDgVsACAAAAAAK2GVGvyPIKolF/ECcmfmkVcf1/IZNcaTv96N92yGrkEAAzQ3AH0AAAAFZAAgAAAAAMoAoiAn1kc79j5oPZtlMWHMhhgwNhLUnvqkqIFvcH1NBXMAIAAAAADcJTW7WiCyW0Z9YDUYwppXhLj4Ac1povpJvcAq+i48MQVsACAAAAAAIGxGDzoeB3PTmudl4+j6piQB++e33EEzuzAiXcqGxvUAAzQ4AH0AAAAFZAAgAAAAACI3j5QP7dWHpcT6WO/OhsWwRJNASBYqIBDNzW8IorEyBXMAIAAAAABxUpBSjXwCKDdGP9hYU+RvyR+96kChfvyyRC4jZmztqAVsACAAAAAAvBCHguWswb4X0xdcAryCvZgQuthXzt7597bJ5VxAMdgAAzQ5AH0AAAAFZAAgAAAAAKsbycEuQSeNrF8Qnxqw3x3og8JmQabwGqnDbqzFRVrrBXMAIAAAAACno/3ef2JZJS93SVVzmOZSN+jjJHT8s0XYq2M46d2sLAVsACAAAAAAAt5zLJG+/j4K8rnkFtAn8IvdUVNefe6utJ3rdzgwudIAAzUwAH0AAAAFZAAgAAAAAPXIcoO8TiULqlxzb74NFg+I8kWX5uXIDUPnh2DobIoMBXMAIAAAAADR6/drkdTpnr9g1XNvKDwtBRBdKn7c2c4ZNUVK5CThdQVsACAAAAAAJqOA1c6KVog3F4Hb/GfDb3jCxXDRTqpXWSbMH4ePIJsAAzUxAH0AAAAFZAAgAAAAAEa03ZOJmfHT6/nVadvIw71jVxEuIloyvxXraYEW7u7pBXMAIAAAAADzRlBJK75FLiKjz3djqcgjCLo/e3yntI3MnPS48OORhgVsACAAAAAAnQhx4Rnyj081XrLRLD5NLpWmRWCsd0M9Hl7Jl19R0h8AAzUyAH0AAAAFZAAgAAAAAKx8NLSZUU04pSSGmHa5fh2oLHsEN5mmNMNHL95/tuC9BXMAIAAAAAA59hcXVaN3MNdHoo11OcH1aPRzHCwpVjO9mGfMz4xh3QVsACAAAAAAYIPdjV2XbPj7dBeHPwnwhVU7zMuJ+xtMUW5mIOYtmdAAAzUzAH0AAAAFZAAgAAAAAHNKAUxUqBFNS9Ea9NgCZoXMWgwhP4x0/OvoaPRWMquXBXMAIAAAAABUZ551mnP4ZjX+PXU9ttomzuOpo427MVynpkyq+nsYCQVsACAAAAAALnVK5p2tTTeZEh1zYt4iqKIQT9Z0si//Hy1L85oF+5IAAzU0AH0AAAAFZAAgAAAAALfGXDlyDVcGaqtyHkLT0qpuRhJQLgCxtznazhFtuyn/BXMAIAAAAABipxlXDq14C62pXhwAeen5+syA+/C6bN4rtZYcO4zKwAVsACAAAAAAXUf0pzUq0NhLYagWDap4uEiwq5rLpcx29rWbt1NYMsMAAzU1AH0AAAAFZAAgAAAAANoEr8sheJjg4UCfBkuUzarU9NFoy1xwbXjs5ifVDeA9BXMAIAAAAABPoyTf6M+xeZVGES4aNzVlq7LgjqZXJ/QunjYVusGUEAVsACAAAAAA1hA2gMeZZPUNytk9K+lB1RCqWRudRr7GtadJlExJf8oAAzU2AH0AAAAFZAAgAAAAAKvDiK+xjlBe1uQ3SZTNQl2lClIIvpP/5CHwY6Kb3WlgBXMAIAAAAAANnxImq5MFbWaRBHdJp+yD09bVlcFtiFDYsy1eDZj+iQVsACAAAAAAWtsyO+FxMPSIezwsV1TJD8ZrXAdRnQM6DJ+f+1V3qEkAAzU3AH0AAAAFZAAgAAAAAF49IlFH9RmSUSvUQpEPUedEksrQUcjsOv44nMkwXhjzBXMAIAAAAADJtWGbk0bZzmk20obz+mNsp86UCu/nLLlbg7ppxYn7PgVsACAAAAAA3k0Tj/XgPQtcYijH8cIlQoe/VXf15q1nrZNmg7yWYEgAAzU4AH0AAAAFZAAgAAAAAOuSJyuvz50lp3BzXlFKnq62QkN2quNU1Gq1IDsnFoJCBXMAIAAAAAAqavH1d93XV3IzshWlMnzznucadBF0ND092/2ApI1AcAVsACAAAAAAzUrK4kpoKCmcpdZlZNI13fddjdoAseVe67jaX1LobIIAAzU5AH0AAAAFZAAgAAAAALtgC4Whb4ZdkCiI30zY6fwlsxSa7lEaOAU3SfUXr02XBXMAIAAAAACgdZ6U1ZVgUaZZwbIaCdlANpCw6TZV0bwg3DS1NC/mnAVsACAAAAAAzI49hdpp0PbO7S2KexISxC16sE73EUAEyuqUFAC/J48AAzYwAH0AAAAFZAAgAAAAAF6PfplcGp6vek1ThwenMHVkbZgrc/dHgdsgx1VdPqZ5BXMAIAAAAACha3qhWkqmuwJSEXPozDO8y1ZdRLyzt9Crt2vjGnT7AAVsACAAAAAA7nvcU59+LwxGupSF21jAeAE0x7JE94tjRkJfgM1yKU8AAzYxAH0AAAAFZAAgAAAAAKoLEhLvLjKc7lhOJfx+VrGJCx9tXlOSa9bxQzGR6rfbBXMAIAAAAAAIDK5wNnjRMBzET7x/KAMExL/zi1IumJM92XTgXfoPoAVsACAAAAAAFkUYWFwNr815dEdFqp+TiIozDcq5IBNVkyMoDjharDQAAzYyAH0AAAAFZAAgAAAAADoQv6lutRmh5scQFvIW6K5JBquLxszuygM1tzBiGknIBXMAIAAAAADAD+JjW7FoBQ76/rsECmmcL76bmyfXpUU/awqIsZdO+wVsACAAAAAAPFHdLw3jssmEXsgtvl/RBNaUCRA1kgSwsofG364VOvQAAzYzAH0AAAAFZAAgAAAAAJNHUGAgn56KekghO19d11nai3lAh0JAlWfeP+6w4lJBBXMAIAAAAAD9XGJlvz59msJvA6St9fKW9CG4JoHV61rlWWnkdBRLzwVsACAAAAAAxwP/X/InJJHmrjznvahIMgj6pQR30B62UtHCthSjrP0AAzY0AH0AAAAFZAAgAAAAAHgYoMGjEE6fAlAhICv0+doHcVX8CmMVxyq7+jlyGrvmBXMAIAAAAAC/5MQZgTHuIr/O5Z3mXPvqrom5JTQ8IeSpQGhO9sB+8gVsACAAAAAAuPSXVmJUAUpTQg/A9Bu1hYczZF58KEhVofakygbsvJQAAzY1AH0AAAAFZAAgAAAAANpIljbxHOM7pydY877gpRQvYY2TGK7igqgGsavqGPBABXMAIAAAAAAqHyEu9gpurPOulApPnr0x9wrygY/7mXe9rAC+tPK80wVsACAAAAAA7gkPzNsS3gCxdFBWbSW9tkBjoR5ib+saDvpGSB3A3ogAAzY2AH0AAAAFZAAgAAAAAGR+gEaZTeGNgG9BuM1bX2R9ed4FCxBA9F9QvdQDAjZwBXMAIAAAAABSkrYFQ6pf8MZ1flgmeIRkxaSh/Eep4Btdx4QYnGGnwAVsACAAAAAApRovMiV00hm/pEcT4XBsyPNw0eo8RLAX/fuabjdU+uwAAzY3AH0AAAAFZAAgAAAAAFNprhQ3ZwIcYbuzLolAT5n/vc14P9kUUQComDu6eFyKBXMAIAAAAAAcx9z9pk32YbPV/sfPZl9ALIEVsqoLXgqWLVK/tP+heAVsACAAAAAA/qxvuvJbAHwwhfrPVpmCFzNvg2cU/NXaWgqgYUZpgXwAAzY4AH0AAAAFZAAgAAAAADgyPqQdqQrgfmJjRFAILTHzXbdw5kpKyfeoEcy6YYG/BXMAIAAAAAAE+3XsBQ8VAxAkN81au+f3FDeCD/s7KoZD+fnM1MJSSAVsACAAAAAAhRnjrXecwV0yeCWKJ5J/x12Xx4qVJahsCEVHB/1U2rcAAzY5AH0AAAAFZAAgAAAAAI0CT7JNngTCTUSei1Arw7eHWCD0jumv2rb7imjWIlWABXMAIAAAAABSP8t6ya0SyCphXMwnru6ZUDXWElN0NfBvEOhDvW9bJQVsACAAAAAAGWeGmBNDRaMtvm7Rv+8TJ2sJ4WNXKcp3tqpv5Se9Ut4AAzcwAH0AAAAFZAAgAAAAAD/FIrGYFDjyYmVb7oTMVwweWP7A6F9LnyIuNO4MjBnXBXMAIAAAAACIZgJCQRZu7NhuNMyOqCn1tf+DfU1qm10TPCfj5JYV3wVsACAAAAAA5hmY4ptuNxULGf87SUFXQWGAONsL9U29duh8xqsHtxoAAzcxAH0AAAAFZAAgAAAAAHIkVuNDkSS1cHIThKc/O0r2/ubaABTOi8Q1r/dvBAsEBXMAIAAAAADdHYqchEiJLM340c3Q4vJABmmth3+MKzwLYlsG6GS7sQVsACAAAAAADa+KP/pdTiG22l+ZWd30P1iHjnBF4zSNRdFm0oEK82kAAzcyAH0AAAAFZAAgAAAAAJmoDILNhC6kn3masElfnjIjP1VjsjRavGk1gSUIjh1NBXMAIAAAAAD97Ilvp3XF8T6MmVVcxMPcdL80RgQ09UoC6PnoOvZ1IQVsACAAAAAA2RK3Xng6v8kpvfVW9tkVXjpE+BSnx9/+Fw85Evs+kUEAAzczAH0AAAAFZAAgAAAAAI5bm3YO0Xgf0VT+qjVTTfvckecM3Cwqj7DTKZXf8/NXBXMAIAAAAAD/m+h8fBhWaHm6Ykuz0WX1xL4Eme3ErLObyEVJf8NCywVsACAAAAAAfb1VZZCqs2ivYbRzX4p5CtaCkKW+g20Pr57FWXzEZi8AAzc0AH0AAAAFZAAgAAAAANqo4+p6qdtCzcB4BX1wQ6llU7eFBnuu4MtZwp4B6mDlBXMAIAAAAAAGiz+VaukMZ+6IH4jtn4KWWdKK4/W+O+gRioQDrfzpMgVsACAAAAAAG4YYkTp80EKo59mlHExDodRQFR7njhR5dmISwUJ6ukAAAzc1AH0AAAAFZAAgAAAAAPrFXmHP2Y4YAm7b/aqsdn/DPoDkv7B8egWkfe23XsM1BXMAIAAAAAAGhwpKAr7skeqHm3oseSbO7qKNhmYsuUrECBxJ5k+D2AVsACAAAAAAAqPQi9luYAu3GrFCEsVjd9z2zIDcp6SPTR2w6KQEr+IAAzc2AH0AAAAFZAAgAAAAABzjYxwAjXxXc0Uxv18rH8I3my0Aguow0kTwKyxbrm+cBXMAIAAAAADVbqJVr6IdokuhXkEtXF0C2gINLiAjMVN20lE20Vmp2QVsACAAAAAAD7K1Fx4gFaaizkIUrf+EGXQeG7QX1jadhGc6Ji471H8AAzc3AH0AAAAFZAAgAAAAAFMm2feF2fFCm/UC6AfIyepX/xJDSmnnolQIBnHcPmb5BXMAIAAAAABLI11kFrQoaNVZFmq/38aRNImPOjdJh0Lo6irI8M/AaAVsACAAAAAAOWul0oVqJ9CejD2RqphhTC98DJeRQy5EwbNerU2+4l8AAzc4AH0AAAAFZAAgAAAAAJvXB3KyNiNtQko4SSzo/9b2qmM2zU9CQTTDfLSBWMgRBXMAIAAAAAAvjuVP7KsLRDeqVqRziTKpBrjVyqKiIbO9Gw8Wl2wFTAVsACAAAAAADlE+oc1ins+paNcaOZJhBlKlObDJ4VQORWjFYocM4LgAAzc5AH0AAAAFZAAgAAAAAPGdcxDiid8z8XYnfdDivNMYVPgBKdGOUw6UStU+48CdBXMAIAAAAAARj6g1Ap0eEfuCZ4X2TsEw+Djrhto3fA5nLwPaY0vCTgVsACAAAAAAoHqiwGOUkBu8SX5U1yHho+UIFdSN2MdQN5s6bQ0EsJYAAzgwAH0AAAAFZAAgAAAAAP5rGPrYGt3aKob5f/ldP0qrW7bmWvqnKY4QwdDWz400BXMAIAAAAADTQkW2ymaaf/bhteOOGmSrIR97bAnJx+yN3yMj1bTeewVsACAAAAAADyQnHGH2gF4w4L8axUsSTf6Ubk7L5/eoFOJk12MtZAoAAzgxAH0AAAAFZAAgAAAAAAlz6wJze5UkIxKpJOZFGCOf3v2KByWyI6NB6JM9wNcBBXMAIAAAAABUC7P/neUIHHoZtq0jFVBHY75tSFYr1Y5S16YN5XxC1QVsACAAAAAAgvxRbXDisNnLY3pfsjDdnFLtkvYUC4lhA68eBXc7KAwAAzgyAH0AAAAFZAAgAAAAAFJ8AtHcjia/9Y5pLEc3qVgH5xKiXw12G9Kn2A1EY8McBXMAIAAAAAAxe7Bdw7eUSBk/oAawa7uicTEDgXLymRNhBy1LAxhDvwVsACAAAAAAxKPaIBKVx3jTA+R/el7P7AZ7efrmTGjJs3Hj/YdMddwAAzgzAH0AAAAFZAAgAAAAAO8uwQUaKFb6vqR3Sv3Wn4QAonC2exOC9lGG1juqP5DtBXMAIAAAAABZf1KyJgQg8/Rf5c02DgDK2aQu0rNCOvaL60ohDHyY+gVsACAAAAAAqyEjfKC8lYoIfoXYHUqHZPoaA6EK5BAZy5dxXZmay4kAAzg0AH0AAAAFZAAgAAAAAE8YtqyRsGCeiR6hhiyisR/hccmK4nZqIMzO4lUBmEFzBXMAIAAAAAC1UYOSKqAeG1UJiKjWFVskRhuFKpj9Ezy+lICZvFlN5AVsACAAAAAA6Ct9nNMKyRazn1OKnRKagm746CGu+jyhbL1qJnZxGi0AAzg1AH0AAAAFZAAgAAAAAPhCrMausDx1QUIEqp9rUdRKyM6a9AAx7jQ3ILIu8wNIBXMAIAAAAACmH8lotGCiF2q9VQxhsS+7LAZv79VUAsOUALaGxE/EpAVsACAAAAAAnc1xCKfdvbUEc8F7XZqlNn1C+hZTtC0I9I3LL06iaNkAAzg2AH0AAAAFZAAgAAAAAOBi/GAYFcstMSJPgp3VkMiuuUUCrZytvqYaU8dwm8v2BXMAIAAAAACEZSZVyD3pKzGlbdwlYmWQhHHTV5SnNLknl2Gw8IaUTQVsACAAAAAAfsLZsEDcWSuNsIo/TD1ReyQW75HPMgmuKZuWFOLKRLoAAzg3AH0AAAAFZAAgAAAAAIQuup+YGfH3mflzWopN8J1X8o8a0d9CSGIvrA5HOzraBXMAIAAAAADYvNLURXsC2ITMqK14LABQBI+hZZ5wNf24JMcKLW+84AVsACAAAAAACzfjbTBH7IwDU91OqLAz94RFkoqBOkzKAqQb55gT4/MAAzg4AH0AAAAFZAAgAAAAAKsh0ADyOnVocFrOrf6MpTrNvAj8iaiE923DPryu124gBXMAIAAAAADg24a8NVE1GyScc6tmnTbmu5ulzO+896fE92lN08MeswVsACAAAAAAaPxcOIxnU7But88/yadOuDJDMcCywwrRitaxMODT4msAAzg5AH0AAAAFZAAgAAAAAKkVC2Y6HtRmv72tDnPUSjJBvse7SxLqnr09/Uuj9sVVBXMAIAAAAABYNFUkH7ylPMN+Bc3HWX1e0flGYNbtJNCY9SltJCW/UAVsACAAAAAAZYK/f9H4OeihmpiFMH7Wm7uLvs2s92zNA8wyrNZTsuMAAzkwAH0AAAAFZAAgAAAAADDggcwcb/Yn1Kk39sOHsv7BO/MfP3m/AJzjGH506Wf9BXMAIAAAAAAYZIsdjICS0+BDyRUPnrSAZfPrwtuMaEDEn0/ijLNQmAVsACAAAAAAGPnYVvo2ulO9z4LGd/69NAklfIcZqZvFX2KK0s+FcTUAAzkxAH0AAAAFZAAgAAAAAEWY7dEUOJBgjOoWVht1wLehsWAzB3rSOBtLgTuM2HC8BXMAIAAAAAAAoswiHRROurjwUW8u8D5EUT+67yvrgpB/j6PzBDAfVwVsACAAAAAA6NhRTYFL/Sz4tao7vpPjLNgAJ0FX6P/IyMW65qT6YsMAAzkyAH0AAAAFZAAgAAAAAPZaapeAUUFPA7JTCMOWHJa9lnPFh0/gXfAPjA1ezm4ZBXMAIAAAAACmJvLY2nivw7/b3DOKH/X7bBXjJwoowqb1GtEFO3OYgAVsACAAAAAA/JcUoyKacCB1NfmH8vYqC1f7rd13KShrQqV2r9QBP44AAzkzAH0AAAAFZAAgAAAAAK00u6jadxCZAiA+fTsPVDsnW5p5LCr4+kZZZOTDuZlfBXMAIAAAAAAote4zTEYMDgaaQbAdN8Dzv93ljPLdGjJzvnRn3KXgtQVsACAAAAAAxXd9Mh6R3mnJy8m7UfqMKi6oD5DlZpkaOz6bEjMOdiwAAzk0AH0AAAAFZAAgAAAAAFbgabdyymiEVYYwtJSWa7lfl/oYuj/SukzJeDOR6wPVBXMAIAAAAADAFGFjS1vPbN6mQEhkDYTD6V2V23Ys9gUEUMGNvMPkaAVsACAAAAAAL/D5Sze/ZoEanZLK0IeEkhgVkxEjMWVCfmJaD3a8uNIAAzk1AH0AAAAFZAAgAAAAABNMR6UBv2E627CqLtQ/eDYx7OEwQ7JrR4mSHFa1N8tLBXMAIAAAAAAxH4gucI4UmNVB7625C6hFSVCuIpJO3lusJlPuL8H5EQVsACAAAAAAVLHNg0OUVqZ7WGOP53BkTap9FOw9dr1P4J8HxqFqU04AAzk2AH0AAAAFZAAgAAAAAG8cd6WBneNunlqrQ2EmNf35W7OGObGq9WL4ePX+LUDmBXMAIAAAAAAjJ2+sX87NSis9hBsgb1QprVRnO7Bf+GObCGoUqyPE4wVsACAAAAAAs9c9SM49/pWmyUQKslpt3RTMBNSRppfNO0JBvUqHPg0AAzk3AH0AAAAFZAAgAAAAAFWOUGkUpy8yf6gB3dio/aOfRKh7XuhvsUj48iESFJrGBXMAIAAAAAAY7sCDMcrUXvNuL6dO0m11WyijzXZvPIcOKob6IpC4PQVsACAAAAAAJOP+EHz6awDb1qK2bZQ3kTV7wsj5Daj/IGAWh4g7omAAAzk4AH0AAAAFZAAgAAAAAGUrIdKxOihwNmo6B+aG+Ag1qa0+iqdksHOjQj+Oy9bZBXMAIAAAAABwa5dbI2KmzBDNBTQBEkjZv4sPaeRkRNejcjdVymRFKQVsACAAAAAA4ml/nm0gJNTcJ4vuD+T2Qfq2fQZlibJp/j6MOGDrbHMAAzk5AH0AAAAFZAAgAAAAAOx89xV/hRk64/CkM9N2EMK6aldII0c8smdcsZ46NbP8BXMAIAAAAADBF6tfQ+7q9kTuLyuyrSnDgmrdmrXkdhl980i1KHuGHgVsACAAAAAACUqiFqHZdGbwAA+hN0YUE5zFg+H+dabIB4dj5/75W/YAAzEwMAB9AAAABWQAIAAAAADJDdC9aEFl4Y8J/awHbnXGHjfP+VXQilPHJg7ewaJI7AVzACAAAAAAE+tqRl6EcBMXvbr4GDiNIYObTsYpa1n6BJk9EjIJVicFbAAgAAAAAJVc+HYYqa0m1Hq6OiRX8c0iRnJYOt6AJAJoG0sG3GMSAAMxMDEAfQAAAAVkACAAAAAA3F9rjEKhpoHuTULVGgfUsGGwJs3bISrXkFP1v6KoQLgFcwAgAAAAAIBf0tXw96Z/Ds0XSIHX/zk3MzUR/7WZR/J6FpxRWChtBWwAIAAAAABWrjGlvKYuTS2s8L9rYy8Hf0juFGJfwQmxVIjkTmFIGQADMTAyAH0AAAAFZAAgAAAAAOYIYoWkX7dGuyKfi3XssUlc7u/gWzqrR9KMkikKVdmSBXMAIAAAAABVF2OYjRTGi9Tw8XCAwZWLpX35Yl271TlNWp6N/nROhAVsACAAAAAA0nWwYzXQ1+EkDvnGq+SMlq20z+j32Su+i/A95SggPb4AAzEwMwB9AAAABWQAIAAAAACMtPm12YtdEAvqu6Eji1yuRXnu1RJP6h0l7pH3lSH4MwVzACAAAAAAENyCFfyUAh1veQBGx+cxiB7Sasrj41jzCGflZkB5cRMFbAAgAAAAAKdI2LMqISr/T5vuJPg6ZRBm5fVi2aQCc4ra3A4+AjbDAAMxMDQAfQAAAAVkACAAAAAAvlI4lDcs6GB1cnm/Tzo014CXWqidCdyE5t2lknWQd4QFcwAgAAAAAD60SpNc4O2KT7J0llKdSpcX1/Xxs97N715a1HsTFkmBBWwAIAAAAABuuRkJWAH1CynggBt1/5sPh9PoGiqTlS24D/OE2uHXLQADMTA1AH0AAAAFZAAgAAAAAKl8zcHJRDjSjJeV/WvMxulW1zrTFtaeBy/aKKhadc6UBXMAIAAAAADBdWQl5SBIvtZZLIHszePwkO14W1mQ0izUk2Ov21cPNAVsACAAAAAAHErCYycpqiIcCZHdmPL1hi+ovLQk4TAvENpfLdTRamQAAzEwNgB9AAAABWQAIAAAAABb6LXDWqCp1beQgQjj8I3sRTtFhlrmiBi+h/+ikmrvugVzACAAAAAA9stpgTecT7uTyaGNs3K9Bp0A7R0QaIAOfscyMXHBPX8FbAAgAAAAAHUt+McyXrJ1H8SwnHNVO181Ki8vDAM1f7XI26mg95ZDAAMxMDcAfQAAAAVkACAAAAAA97NTT+81PhDhgptNtp4epzA0tP4iNb9j1AWkiiiKGM8FcwAgAAAAAKPbHg7ise16vxmdPCzksA/2Mn/qST0L9Xe8vnQugVkcBWwAIAAAAABB0EMXfvju4JU/mUH/OvxWbPEl9NJkcEp4iCbkXI41fAADMTA4AH0AAAAFZAAgAAAAAMqpayM2XotEFmm0gwQd9rIzApy0X+7HfOhNk6VU7F5lBXMAIAAAAACJR9+q5T9qFHXFNgGbZnPubG8rkO6cwWhzITQTmd6VgwVsACAAAAAAOZLQ6o7e4mVfDzbpQioa4d3RoTvqwgnbmc5Qh2wsZuoAAzEwOQB9AAAABWQAIAAAAADQnslvt6Hm2kJPmqsTVYQHE/wWeZ4bE1XSkt7TKy0r1gVzACAAAAAA8URTA4ZMrhHPvlp53TH6FDCzS+0+61qHm5XK6UiOrKEFbAAgAAAAAHQbgTCdZcbdA0avaTmZXUKnIS7Nwf1tNrcXDCw+PdBRAAMxMTAAfQAAAAVkACAAAAAAhujlgFPFczsdCGXtQ/002Ck8YWQHHzvWvUHrkbjv4rwFcwAgAAAAALbV0lLGcSGfE7mDM3n/fgEvi+ifjl7WZ5b3aqjDNvx9BWwAIAAAAACbceTZy8E3QA1pHmPN5kTlOx3EO8kJM5PUjTVftw1VpgADMTExAH0AAAAFZAAgAAAAABm/6pF96j26Jm7z5KkY1y33zcAEXLx2n0DwC03bs/ixBXMAIAAAAAD01OMvTZI/mqMgxIhA5nLs068mW+GKl3OW3ilf2D8+LgVsACAAAAAAaLvJDrqBESTNZSdcXsd+8GXPl8ZkUsGpeYuyYVv/kygAAzExMgB9AAAABWQAIAAAAACfw9/te4GkHZAapC9sDMHHHZgmlTrccyJDPFciOMSOcwVzACAAAAAAIIC1ZpHObvmMwUfqDRPl4C1aeuHwujM1G/yJbvybMNAFbAAgAAAAAAs9x1SnVpMfNv5Bm1aXGwHmbbI9keWa9HRD35XuCBK5AAMxMTMAfQAAAAVkACAAAAAAkxHJRbnShpPOylLoDdNShfILeA1hChKFQY9qQyZ5VmsFcwAgAAAAAKidrY+rC3hTY+YWu2a7fuMH2RD/XaiTIBW1hrxNCQOJBWwAIAAAAACW0kkqMIzIFMn7g+R0MI8l15fr3k/w/mHtY5n6SYTEwAADMTE0AH0AAAAFZAAgAAAAAByuYl8dBvfaZ0LO/81JW4hYypeNmvLMaxsIdvqMPrWoBXMAIAAAAABNddwobOUJzm9HOUD8BMZJqkNCUCqstHZkC76FIdNg9AVsACAAAAAAQQOkIQtkyNavqCnhQbNg3HfqrJdsAGaoxSJePJl1qXsAAzExNQB9AAAABWQAIAAAAABxMy7X5hf7AXGDz3Y/POu1ZpkMlNcSvSP92NOO/Gs7wAVzACAAAAAAHJshWo2T5wU2zvqCyJzcJQKQaHFHpCpMc9oWBXkpUPoFbAAgAAAAAGeiJKzlUXAvL0gOlW+Hz1mSa2HsV4RGmyLmCHlzbAkoAAMxMTYAfQAAAAVkACAAAAAAlqbslixl7Zw3bRlibZbe/WmKw23k8uKeIzPKYEtbIy0FcwAgAAAAAHEKwpUxkxOfef5HYvulXPmdbzTivwdwrSYIHDeNRcpcBWwAIAAAAADuPckac21Hrg/h0kt5ShJwVEZ9rx6SOHd2+HDjqxEWTQADMTE3AH0AAAAFZAAgAAAAAMXrXx0saZ+5gORmwM2FLuZG6iuO2YS+1IGPoAtDKoKBBXMAIAAAAADIQsxCr8CfFKaBcx8kIeSywnGh7JHjKRJ9vJd9x79y7wVsACAAAAAAcvBV+SykDYhmRFyVYwFYB9oBKBSHr55Jdz2cXeowsUQAAzExOAB9AAAABWQAIAAAAAAm83FA9yDUpwkbKTihe7m53u+DivS9BU2b4vQMtCVQ2AVzACAAAAAAz3m1UB/AbZPa4QSKFDnUgHaT78+6iGOFAtouiBorEgEFbAAgAAAAAIgbpyYtJj5513Z5XYqviH/HXG/5+mqR52iBbfqMmDtZAAMxMTkAfQAAAAVkACAAAAAAJRzYK0PUwr9RPG2/7yID0WgcTJPB2Xjccp5LAPDYunkFcwAgAAAAAIIh24h3DrltAzNFhF+MEmPrZtzr1PhCofhChZqfCW+jBWwAIAAAAAAzRNXtL5o9VXMk5D5ylI0odPDJDSZZry1wfN+TedH70gADMTIwAH0AAAAFZAAgAAAAAHSaHWs/dnmI9sc7nB50VB2Bzs0kHapMHCQdyVEYY30TBXMAIAAAAACkV22lhEjWv/9/DubfHBAcwJggKI5mIbSK5L2nyqloqQVsACAAAAAAS19m7DccQxgryOsBJ3GsCs37yfQqNi1G+S6fCXpEhn4AAzEyMQB9AAAABWQAIAAAAAAC/I4TQRtCl12YZmdGz17X4GqSQgfwCPgRBwdHmdwu+QVzACAAAAAAx8f3z2ut/RAZhleari4vCEE+tNIn4ikjoUwzitfQ588FbAAgAAAAAJci0w1ZB8W2spJQ+kMpod6HSCtSR2jrabOH+B0fj3A4AAMxMjIAfQAAAAVkACAAAAAADGB5yU2XT0fse/MPWgvBvZikVxrl5pf3S5K1hceKWooFcwAgAAAAAIxTmlLHMjNaVDEfJbXvRez0SEPWFREBJCT6qTHsrljoBWwAIAAAAAAlswzAl81+0DteibwHD+CG5mZJrfHXa9NnEFRtXybzzwADMTIzAH0AAAAFZAAgAAAAABmO7QD9vxWMmFjIHz13lyOeV6vHT6mYCsWxF7hb/yOjBXMAIAAAAACT9lmgkiqzuWG24afuzYiCeK9gmJqacmxAruIukd0xEAVsACAAAAAAZa0/FI/GkZR7CtX18Xg9Tn9zfxkD0UoaSt+pIO5t1t4AAzEyNAB9AAAABWQAIAAAAAAfPUoy7QyZKhIIURso+mkP9qr1izbjETqF5s22GwjCjAVzACAAAAAAvLMsIDQ/go4VUxeh50UHmsvMvfx51cwyONnRD2odvC0FbAAgAAAAAKMb+1CodEalAFnDrEL1Ndt8ztamZ+9134m9Kp3GQgd+AAMxMjUAfQAAAAVkACAAAAAAE3ZqUar0Bq2zWbARE0bAv98jBlK9UJ73/xcwdMWWlSkFcwAgAAAAAK4M+MmC+9sFiFsumMyJZQKxWmmJiuG9H7IzKw083xxkBWwAIAAAAAAqkAONzhvMhkyL1D/6h7QQxEkdhC3p2WjXH+VGq5qCqQADMTI2AH0AAAAFZAAgAAAAAMo8FJiOq63cAmyk2O7eI7GcbQh/1j4RrMTqly3rexftBXMAIAAAAADjVmpd0WiRGTw/gAqEgGolt2EI7Csv14vKdmYoMD0aAgVsACAAAAAA07XQBzBUQMNw7F2/YxJjZNuPVpHTTgbLd1oGk77+bygAAzEyNwB9AAAABWQAIAAAAACu5IGaIx7A3Jvly/kzlCsSA4s3iJwuIl8jEdRH0k93NwVzACAAAAAA9NRUyxYE+t0Xyosyt6vIfMFW/vBoYg6sR+jBNs4JAxIFbAAgAAAAAAzyZ91dx+0oMlOVAjRGiMrPySikY/U9eMEB4WJb3uWtAAMxMjgAfQAAAAVkACAAAAAALkRy0GJInXYLA+cgjs6Myb0a+Gu9hgXhHvhLNoGWfckFcwAgAAAAANbALyt9zCSvwnLaWCd2/y2eoB7qkWTvv1Ldu8r40JPuBWwAIAAAAAD4Fl5bV5sz4isIE9bX+lmAp+aAKaZgVYVZeVfrItkCZAADMTI5AH0AAAAFZAAgAAAAAGoUK/DSWhT8LZhszSUqDbTrp8cSA7rdqmADKL+MILtTBXMAIAAAAABHnEE9bVa6lvhfhEMkkV2kzSSxH/sMW/FIJuw3CzWs6wVsACAAAAAAanavcBdqZxgRGKvEK95wTmeL1K1CeDSXZsXUAs81uOgAAzEzMAB9AAAABWQAIAAAAAC922ZDQE3h2fQKibGMZ9hV0WNlmrPYYSdtaSyYxsWYqgVzACAAAAAAagMovciKK6WVjIc2cCj8nK5O/gVOFFVeVAJpRp89tmQFbAAgAAAAAKcTFfPQzaFiAtSFhqbN02sCE1BKWJSrRfGN5L6oZwzkAAMxMzEAfQAAAAVkACAAAAAAtK+JqX3K/z2txjAU15DgX4y90DS2YLfIJFolCOkJJJwFcwAgAAAAAMnR5V7gfX7MNqqUdL5AkWlkhyFXaBRVNej+Rcn8lrQkBWwAIAAAAAA2cDNRXZuiC241TGRvdFyctJnrNcdbZOP9zHio81tkngADMTMyAH0AAAAFZAAgAAAAAAeGrIMK/bac6kPczxbvRYqKMkcpeI2FjdMpD91FDWIvBXMAIAAAAAAix62z1LeS8yvSXCl5gHSIomjyx76fF3S1lp9k900hygVsACAAAAAAiYwzf2m71aWFD5ajcXyW2JX2EzQOkBroTGMg29nLPYIAAzEzMwB9AAAABWQAIAAAAACphf298InM0Us4HT8o1W1MGw0D/02vd7Jh+U0h7qaFaQVzACAAAAAAFXtk7YpqsOJxsqGWSIL+YcBE96G3Zz9D31gPqDW94y8FbAAgAAAAAAOrS1KVA94rjB1jZ1pPocpCeBG+B14RzWoHqVDpp7JbAAMxMzQAfQAAAAVkACAAAAAATLDS2cuDVM3yDMuWNgk2iGKBTzPpfJMbvxVOSY39ZfcFcwAgAAAAAPT5wRi2cLHIUflXzm6EQB/m7xdThP80ir1VV/JBBqvxBWwAIAAAAAB9lEtZS0aXCFbCtSbhnis27S5IPcfWGygHW8AHn3QqzwADMTM1AH0AAAAFZAAgAAAAAJNjExiZVX7jfFGfYpQu16qxLN0YPqVU/5CQ/Y67YSinBXMAIAAAAABMpm2+6KrkRUlXzQoMPHrQmIO6dkQz66tYdfTeA3dKqQVsACAAAAAAFXobHiMLvNZuEPr8jtewCX2J93EZG3JNeyVg92fue6YAAzEzNgB9AAAABWQAIAAAAABlFkYtLCx901X6QVVMkSn6Z7k30UF4xHaA0OZJJ9bdyQVzACAAAAAATez+F9GHcGzTp7jjv4feboUNb8JCkIp4EqcPFisnq7MFbAAgAAAAACE7JvOpBgMoZ7kRd4QbxIhxukPTUxXpzhjnBHiR7XoRAAMxMzcAfQAAAAVkACAAAAAA8NJKN0IxZnruhswGQkiruv8Ih0EMwDcSZx/Xasup9dkFcwAgAAAAAKaJZRxzA+Igeydvuk6cSwUHXcrmT4PjhuPu//FslpdnBWwAIAAAAAD53Rok1Vq/PMAnXmarqoHJ0PEyYUBmVESa9hIpCv/G9QADMTM4AH0AAAAFZAAgAAAAABHxHdEClz7hbSSgE58+dWLlSMJnoPz+jFxp4bB1GmLQBXMAIAAAAAD3nSvT6aGD+A110J/NwEfp0nPutlmuB5B+wA3CC3noGAVsACAAAAAA3Apjd+TapONB7k5wBVwTWgn8t+Sq2oyyU5/+as109RcAAzEzOQB9AAAABWQAIAAAAAC/o8qW/ifk3KuJ01VFkyNLgQafxB5/bGs2G5VyyVafOwVzACAAAAAA1bMqAFGDHSl6BYNLbxApvkAv2K1/oafywiX0MDz1dGUFbAAgAAAAAHJXLlId3edFoniLD/9K2A5973MeP2Ro31flDyqm3l5QAAMxNDAAfQAAAAVkACAAAAAAY2V8I1bz3a1AxTtmED6UhdhA09huFkuuEX8R+d/WDPUFcwAgAAAAAPTVoNRiI76tcRKqd+JBBVyy4+YcKST42p0QX2BtmQ2VBWwAIAAAAACcxt9hg14WqPNiDv1MkqVljM2e2KJEv53lA17LhV6ZigADMTQxAH0AAAAFZAAgAAAAAO2kSsW0WGN9AOtK4xK2SHrGhWiaAbMEKT4iZkRpaDN/BXMAIAAAAABKGzQcPM8LT2dwOggxoWjv/1imYWabbG/G4kBw8OWaxAVsACAAAAAAC9hLK1dScQTAqg+YAG3ObdPzg2Xet57HmOFpGmyUR9UAAzE0MgB9AAAABWQAIAAAAAAiCwzNEEaH/mDam68IdDftnhthyUFdb+ZCNSBQ91WlHQVzACAAAAAA7tHyHcxCzmbJeFYZyPm4mEgkTGKOvwY4MX82OvH0Jn8FbAAgAAAAAAb5IAbZ1hXCNegQ+S+C9i/Z8y6sS8KeU04V6hXa2ml6AAMxNDMAfQAAAAVkACAAAAAAGuCHVNJSuoVkpPOnS5s89GuA+BLi2IPBUr2Bg1sWEPIFcwAgAAAAAEl1gncS5/xO7bQ/KQSstRV3rOT2SW6nV92ZANeG2SR6BWwAIAAAAAA9LOcKmhek8F2wAh8yvT/vjp2gaouuO+Hmv10lwAeWPAADMTQ0AH0AAAAFZAAgAAAAAMfxz7gEaoCdPvXrubDhCZUS0ARLZc1svgbXgMDlVBPgBXMAIAAAAAB6a5dDA3fuT5Vz2KvAcbUEFX/+B7Nw2p1QqbPoQ5TTuAVsACAAAAAAcf/y75UOuI62A6vWH7bYr/5Jz+nirZVYK/81trN6XOQAAzE0NQB9AAAABWQAIAAAAACnYsqF/VzmjIImC9+dqrHO1TM6lJ6fRwM0mM6Wf6paOwVzACAAAAAA5tgZzch8uDCR1ky3SllVaKVpxAlbrhvlNDTazZZRZOAFbAAgAAAAALeGiLJS4z2zhgVpxzyPdRYyACP9QzQBOob34YrIZumCAAMxNDYAfQAAAAVkACAAAAAAEC0sIVmadtW4YMuRXH7RpAhXclsd+3bmqGXCMeaT014FcwAgAAAAABPpXh0uzpsJJB+IRUNajmMB9WGwswfpw5T9xk3Xj6ANBWwAIAAAAAAmf+NYh9TZ/QRu3w/GQz66n7DtfbJijN3G7KzeL8lstAADMTQ3AH0AAAAFZAAgAAAAABaIB3n49Xm9cOafSrQsE0WCcYp8rMIO/qVwIlMF5YLRBXMAIAAAAAC9EyWJV3xOu9bzgdJ/yX+ko7qLf1u3AxNMataW2C9EzQVsACAAAAAAvVbDkLxXx2DcMLifIQ3K0IIJcLcAG9DUrNfI6aoUjNcAAzE0OAB9AAAABWQAIAAAAAA5rZItA/cocRnngYqcJ3nBXQ+l688aKz3EQyLbYYunPAVzACAAAAAAwKyA+L7TgxztPClLrIMk2JXR+w7c04N3ZOqPgjvrIvsFbAAgAAAAACzvZ33h6aWEe8hmo+1f6OXJ72FY5hvWaUuha64ZV3KFAAMxNDkAfQAAAAVkACAAAAAA3htn7oHJ0YYpIrs+Mzyh85Ys67HwAdv5LQl1mCdoMWkFcwAgAAAAAEHjCtNNLenHuSIYux6ezAHsXDaj2DlTF67ToDhDDe6HBWwAIAAAAAD+P4H0sk9jOd+7vOANt2/1Ectb+4ZRGPE8GkHWNXW3MgADMTUwAH0AAAAFZAAgAAAAAEnt18Km/nqggfIJWxzTr9r3hnXNaueG6XO9A5G11LnGBXMAIAAAAAD7QxzGMN/ard5TfFLecE6uusMmXG2+RBsBR+/NCQHUwAVsACAAAAAAQEZ1ZZ8GC8rdbg7s87OM5Gr9qkTXS9+P5DuAZxj5Gl4AAzE1MQB9AAAABWQAIAAAAAAVAKK/GoY8AACu/hyMpO4hdLq6JnEyWNzkyci9sbaD/wVzACAAAAAA2HmeqpMlvvBpV2zQTYIRmsc4MFlfHRwLof0ycJgMg/MFbAAgAAAAACdltCeWi5E/q1Li1eXLChpM2D9QQSGLBZ82NklQSc0oAAMxNTIAfQAAAAVkACAAAAAAhHyq1GQC/GiMwpYjcsfkNxolJ10ARKjIjfkW1Wipzi0FcwAgAAAAAD/uaGWxTDq87F8XZ6CrFI+RNa8yMqfSZdqK00Kj833BBWwAIAAAAAD6aEdOO0CsQGagioOCvANPCEHSpJ8BSixlPBq5ERhB7AADMTUzAH0AAAAFZAAgAAAAABAJJxHoZD+MQBWqm9UM9Dd3z5ZohIZGWRaRVRsMptKQBXMAIAAAAADrE/ca+gqj/SH4oao4wE4qn2ovoTydzcMbDbrfnUs3zAVsACAAAAAAeNCIQN6hVnGJinytQRFGlQ2ocoprXNqpia+BSxzl+uwAAzE1NAB9AAAABWQAIAAAAAAv01wz7VG9mTepjXQi6Zma+7b/OVBaKVkWNbgDLr1mFgVzACAAAAAA0I5sxz8r6wkCp5Tgvr+iL4p6MxSOq5d3e1kZG+0b7NkFbAAgAAAAAIA32v6oGkAOS96HexGouNTex+tLahtx9QF2dgGClk6WAAMxNTUAfQAAAAVkACAAAAAAWXecRwxSon68xaa9THXnRDw5ZfzARKnvvjTjtbae6T0FcwAgAAAAAPh0UfUMEo7eILCMv2tiJQe1bF9qtXq7GJtC6H5Va4fIBWwAIAAAAADqFr1ThRrTXNgIOrJWScO9mk86Ufi95IDu5gi4vP+HWQADMTU2AH0AAAAFZAAgAAAAAEY5WL8/LpX36iAB1wlQrMO/xHVjoO9BePVzbUlBYo+bBXMAIAAAAABoKcpadDXUARedDvTmzUzWPe1jTuvD0z9oIcZmKuiSXwVsACAAAAAAJuJbwuaMrAFoI+jU/IYr+k4RzAqITrOjAd3HWCpJHqEAAzE1NwB9AAAABWQAIAAAAADnJnWqsfx0xqNnqfFGCxIplVu8mXjaHTViJT9+y2RuTgVzACAAAAAAWAaSCwIXDwdYxWf2NZTly/iKVfG/KDjHUcA1BokN5sMFbAAgAAAAAJVxavipE0H4/JQvhagdytXBZ8qGooeXpkbPQ1RfYMVHAAMxNTgAfQAAAAVkACAAAAAAsPG7LaIpJvcwqcbtfFUpIjj+vpNj70Zjaw3eV9T+QYsFcwAgAAAAAJQ71zi0NlCyY8ZQs3IasJ4gB1PmWx57HpnlCf3+hmhqBWwAIAAAAACD58TO6d+71GaOoS+r73rAxliAO9GMs4Uc8JbOTmC0OwADMTU5AH0AAAAFZAAgAAAAAAGiSqKaQDakMi1W87rFAhkogfRAevnwQ41onWNUJKtuBXMAIAAAAAASgiDpXfGh7E47KkOD8MAcX8+BnDShlnU5JAGdnPdqOAVsACAAAAAAI+2TTQIgbFq4Yr3lkzGwhG/tqChP7hRAx2W0fNaH6jcAAzE2MAB9AAAABWQAIAAAAAB7L4EnhjKA5xJD3ORhH2wOA1BvpnQ+7IjRYi+jjVEaJAVzACAAAAAAuhBIm0nL3FJnVJId+7CKDASEo+l2E89Z9/5aWSITK4AFbAAgAAAAALtSICOzQDfV9d+gZuYxpEj6cCeHnKTT+2G3ceP2H65kAAMxNjEAfQAAAAVkACAAAAAAaROn1NaDZFOGEWw724dsXBAm6bgmL5i0cki6QZQNrOoFcwAgAAAAANVT8R6UvhrAlyqYlxtmnvkR4uYK/hlvyQmBu/LP6/3ZBWwAIAAAAAD+aHNMP/X+jcRHyUtrCNkk1KfMtoD3GTmShS8pWGLt+AADMTYyAH0AAAAFZAAgAAAAADqSR5e0/Th59LrauDA7OnGD1Xr3H3NokfVxzDWOFaN7BXMAIAAAAACt30faNwTWRbvmykDpiDYUOCwA6QDbBBYBFWS7rdOB4AVsACAAAAAAF7SvnjjRk5v2flFOKaBAEDvjXaL1cpjsQLtK2fv9zdQAAzE2MwB9AAAABWQAIAAAAADmtb1ZgpZjSeodPG/hIVlsnS8hoRRwRbrTVx89VwL62AVzACAAAAAAi38e1g6sEyVfSDkzZbaZXGxKI/zKNbMasOl2LYoWrq8FbAAgAAAAAALACk0KcCDN/Kv8WuazY8ORtUGkOZ5Dsm0ys1oOppp/AAMxNjQAfQAAAAVkACAAAAAAf/f7AWVgBxoKjr7YsEQ4w/fqSvuQWV2HMiA3rQ7ur0sFcwAgAAAAADkkeJozP6FFhUdRIN74H4UhIHue+eVbOs1NvbdWYFQrBWwAIAAAAAB55FlHAkmTzAYj/TWrGkRJw2EhrVWUnZXDoMYjyfB/ZwADMTY1AH0AAAAFZAAgAAAAAI2WEOymtuFpdKi4ctanPLnlQud+yMKKb8p/nfKmIy56BXMAIAAAAADVKrJmhjr1rfF3p+T+tl7UFd1B7+BfJRk0e7a4im7ozgVsACAAAAAA5E7Ti3PnFiBQoCcb/DN7V1uM3Xd6VKiexPKntssFL7kAAzE2NgB9AAAABWQAIAAAAAAuHU9Qd79hjyvKOujGanSGDIQlxzsql8JytTZhEnPw+AVzACAAAAAAjF2gV/4+sOHVgDd/oR5wDi9zL7NGpGD+NsEpGXy/a4QFbAAgAAAAAJzMoyojYV6Ed/LpVN5zge93Odv3U7JgP7wxeRaJZGTdAAMxNjcAfQAAAAVkACAAAAAA7dQDkt3iyWYCT94d7yqUtPPwp4qkC0ddu+HFdHgVKEkFcwAgAAAAANuYvtvZBTEq4Rm9+5eb7VuFopowkrAuv86PGP8Q8/QvBWwAIAAAAACeqXoAOQOE4j0zRMlkVd8plaW0RX1npsFvB38Xmzv7sAADMTY4AH0AAAAFZAAgAAAAAAwnZSDhL4tNGYxlHPhKYB8s28dY5ScSwiKZm3UhT8U3BXMAIAAAAABDoY6dhivufTURQExyC9Gx3ocpl09bgbbQLChj3qVGbgVsACAAAAAAF+1nS7O0v85s3CCy+9HkdeoEfm2C6ZiNbPMMnSfsMHUAAzE2OQB9AAAABWQAIAAAAAC2VuRdaC4ZJmLdNOvD6R2tnvkyARteqXouJmI46V306QVzACAAAAAAMn1Z6B35wFTX9mEYAPM+IiJ5hauEwfD0CyIvBrxHg7IFbAAgAAAAAOG6DvDZkT9B/xZWmjao2AevN7MMbs3Oh9YJeSd/hZ+hAAMxNzAAfQAAAAVkACAAAAAAVerb7qVNy457rNOHOgDSKyWl5ojun7iWrv1uHPXrIZQFcwAgAAAAAIDcYS9j5z+gx0xdJj09L7876r/vjvKTi/d3bXDE3PhyBWwAIAAAAADuhVLqb1Bkrx8aNymS+bx2cL8GvLFNH4SAi690DUgnWQADMTcxAH0AAAAFZAAgAAAAAH/E44yLxKCJjuSmU9A8SEhbmkDOx1PqqtYcZtgOzJdrBXMAIAAAAABgLh9v2HjBbogrRoQ82LS6KjZQnzjxyJH4PH+F3jupSAVsACAAAAAAIlO46ehXp4TqpDV0t6op++KO+uWBFh8iFORZjmx2IjkAAzE3MgB9AAAABWQAIAAAAAAlNUdDL+f/SSQ5074mrq0JNh7CTXwTbbhsQyDwWeDVMwVzACAAAAAANIH2IlSNG0kUw4qz0budjcWn8mNR9cJlYUqPYdonucAFbAAgAAAAAJMrOUOyiu5Y3sV76zwEFct8L7+i8WGlQI2+8z2W2kzaAAMxNzMAfQAAAAVkACAAAAAASZ+CvUDtlk/R4HAQ3a+PHrKeY/8ifAfh0oXYFqliu80FcwAgAAAAAJelpzPgM65OZFt/mvGGpwibclQ49wH+1gbUGzd9OindBWwAIAAAAAD9qeDchteEpVXWcycmD9kl9449C1dOw0r60TBm5jK+cQADMTc0AH0AAAAFZAAgAAAAAN9fkoUVbvFV2vMNMAkak4gYfEnzwKI3eDM3pnDK5q3lBXMAIAAAAACnDkgVNVNUlbQ9RhR6Aot2nVy+U4km6+GHPkLr631jEAVsACAAAAAANzg/BnkvkmvOr8nS4omF+q9EG/4oisB+ul4YHi938hwAAzE3NQB9AAAABWQAIAAAAAASyK3b1nmNCMptVEGOjwoxYLLS9fYWm/Zxilqea0jpEQVzACAAAAAADDHsGrbqlKGEpxlvfyqOJKQJjwJrzsrB7k3HG0AUJbkFbAAgAAAAAKwx3S4XfDZh4+LuI9jf7XgUh5qiefNv87JD4qvVRfPSAAMxNzYAfQAAAAVkACAAAAAAlSP9iK31GlcG9MKGbLmq+VXMslURr+As736rrVNXcsUFcwAgAAAAAAvbj0zfq9zzi8XReheKFbCB+h9IsOLgXPPpI5vrEJNZBWwAIAAAAABXvoZhaQE7ogWjeBjceVkp03N20cKYP3TA8vuNsgpfAgADMTc3AH0AAAAFZAAgAAAAAOJNORH8Bev97gVU7y6bznOxJ+E6Qoykur1QP76hG1/7BXMAIAAAAAC+C1PtOOrSZgzBAGhr+dPe/kR0JUw9GTwLVNr61xC1aAVsACAAAAAAeA/L8MQIXkamaObtMPLpoDoi5FypA5WAPtMeMrgi0eQAAzE3OAB9AAAABWQAIAAAAAAKcHzLUomavInN6upPkyWhAqYQACP/vdVCIYpiy6U6HgVzACAAAAAATsR4KItY6R2+U7Gg6sJdaEcf58gjd1OulyWovIqfxKcFbAAgAAAAAFbm10ko67ahboAejQdAV0U2uA5OhZYdb8XUFJ8OL46LAAMxNzkAfQAAAAVkACAAAAAAqTOLiMpCdR59tLZzzIPqJvbCNvz2XQL9ust0qYaehtcFcwAgAAAAAArefox/3k5xGOeiw2m6NUdzuGxmPwcu5IFcj+jMwHgHBWwAIAAAAADLZGFJ7MQd5JXMgMXjqZO5LDLxcFClcXPlnRMWRn+1oAADMTgwAH0AAAAFZAAgAAAAAIPSqSeVzSRgNVNmrPYHmUMgykCY27NbdDUNhE5kx/SgBXMAIAAAAAAhX90nNfxyXmZe/+btZ7q6xMX4PFyj0paM1ccJ/5IUUQVsACAAAAAA419oHmD2W0SYoOMwhrhrp8jf68fg9hTkaRdCuVd3CN0AAzE4MQB9AAAABWQAIAAAAACLn5DxiqAosHGXIAY96FwFKjeqrzXWf3VJIQMwx1fl4gVzACAAAAAAindvU27nveutopdvuHmzdENBbeGFtI3Qcsr07jxmvm8FbAAgAAAAAPvl9pBStQvP4OGkN5v0MghUY6djm9n7XdKKfrW0l1sMAAMxODIAfQAAAAVkACAAAAAA7i2S6rHRSPBwZEn59yxaS7HiYBOmObIkeyCcFU42kf8FcwAgAAAAAGb3RSEyBmgarkTvyLWtOLJcPwCKbCRkESG4RZjVmY4iBWwAIAAAAADB2/wo5CSHR4ANtifY6ZRXNTO5+O8qP82DfAiAeanpZwADMTgzAH0AAAAFZAAgAAAAAFz+M+H/Z94mdPW5oP51B4HWptp1rxcMWAjnlHvWJDWrBXMAIAAAAACBFEOQyL7ZHu4Cq33QvXkmKuH5ibG/Md3RaED9CtG5HwVsACAAAAAAfggtJTprQ/yZzj7y5z9KvXsdeXMWP0yUXMMJqpOwI88AAzE4NAB9AAAABWQAIAAAAAAE7c2x3Z3aM1XGfLNk/XQ9jCazNRbGhVm7H8c2NjS5ywVzACAAAAAARJ9h8fdcwA19velF3L/Wcvi2rCzewlKZ2nA0p8bT9uwFbAAgAAAAAJtWe6b4wK2Hae2dZm/OEpYQnvoZjz4Sz5IgJC2wInecAAMxODUAfQAAAAVkACAAAAAAVoRt9B9dNVvIMGN+ea5TzRzQC+lqSZ8dd/170zU5o9cFcwAgAAAAAEwM95XZin5mv2yhCI8+ugtKuvRVmNgzzIQN0yi1+9aIBWwAIAAAAAAMGBq72n00rox3uqhxSB98mkenTGCdbbUF1gXrgottzgADMTg2AH0AAAAFZAAgAAAAAKRDkjyWv/etlYT4GyoXrmBED2FgZHnhc+l9Wsl06cH2BXMAIAAAAABohlpm3K850Vndf3NmNE0hHqDlNbSR8/IvMidQ3LnIZAVsACAAAAAAW42nGHa6q2MCAaaPVwaIDfr8QLyQwjKq23onZJYsqVsAAzE4NwB9AAAABWQAIAAAAAC3DFh5oklLCNLY90bgWm68dFXz65JpAZSp1K99MBTPAQVzACAAAAAAQgZecmxEUZVHoptEQClDwAf8smI3WynQ/i+JBP0g+kQFbAAgAAAAAEUSQGVnAPISD6voD0DiBUqyWKgt2rta0tjmoe+LNt6IAAMxODgAfQAAAAVkACAAAAAAQ5WKvWSB503qeNlOI2Tpjd5blheNr6OBO8pfJfPNstcFcwAgAAAAAKwHgQLSDJ5NwLBQbY5OnblQIsVDpGV7q3RCbFLD1U4/BWwAIAAAAACQ5nED99LnpbqXZuUOUjnO2HTphEAFBjLD4OZeDEYybgADMTg5AH0AAAAFZAAgAAAAAGfhFY3RGRm5ZgWRQef1tXxHBq5Y6fXaLAR4yJhrTBplBXMAIAAAAACKEF0ApLoB6lP2UqTFsTQYNc9OdDrs/vziPGzttGVLKQVsACAAAAAArOO6FyfNRyBi0sPT5iye7M8d16MTLcwRfodZq4uCYKEAAzE5MAB9AAAABWQAIAAAAAAIM73gPcgzgotYHLeMa2zAU4mFsr7CbILUZWfnuKSwagVzACAAAAAAJCSu98uV8xv88f2BIOWzt6p+6EjQStMBdkGPUkgN79cFbAAgAAAAAMGqPGMPxXbmYbVfSa/japvUljht1zZT33TY7ZjAiuPfAAMxOTEAfQAAAAVkACAAAAAAkWmHCUsiMy1pwZTHxVPBzPTrWFBUDqHNrVqcyyt7nO8FcwAgAAAAAMv2CebFRG/br7USELR98sIdgE9OQCRBGV5JZCO+uPMgBWwAIAAAAABt7qSmn3gxJu7aswsbUiwvO+G6lXj/Xhx+J/zQyZxzLAADMTkyAH0AAAAFZAAgAAAAAGInUYv0lP/rK7McM8taEHXRefk8Q2AunrvWqdfSV7UaBXMAIAAAAACE+WPxJ3gan7iRTbIxXXx+bKVcaf8kP4JD8DcwU0aL7wVsACAAAAAAUC4eTprX4DUZn2X+UXYU6QjtiXk+u57yoOPBbPQUmDkAAzE5MwB9AAAABWQAIAAAAACmHlg2ud3cplXlTsNTpvNnY6Qm1Fce0m899COamoDjaQVzACAAAAAArtJQeJIlepBWRU2aYar7+YGYVQ7dfDc1oxgTmA8r9q0FbAAgAAAAAOk45vg5VqZHAFCO3i0Z52SZi5RADf8NXwf68T5yad/DAAMxOTQAfQAAAAVkACAAAAAApzcWSAbZWV/Rq+ylRNqqlJqNVR4fhXrz4633/MQOQgcFcwAgAAAAAN/jz/bsEleiuCl+li83EWlG6UMHA8CyaOMRKCkXkSCPBWwAIAAAAAC3Sd+Qg+uFDKpGZHbrQgokXHQ1az1aFl4YK343OB6hcQAAEmNtAAAAAAAAAAAAABBwYXlsb2FkSWQAAAAAABBmaXJzdE9wZXJhdG9yAAEAAAASc3AAAQAAAAAAAAAQdGYAAQAAABNtbgD/////Y46NN8CHrb4J7f/fE214AP////9jjo03wIetvgnt/18A", - "subType": "06" - } - } - } - } - } - ], - "cursor": {}, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "aggregate" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": { - "$numberInt": "0" - }, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "rbf3AeBEv4wWFAKknqDxRW5cLNkFvbIs6iJjc6LShQY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "n+XAuFnP8Dov9TnhGFxNx0K/MnVM9WbJ7RouEu0ndO0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yRXojuVdn5GQtD97qYlaCL6cOLmZ7Cvcb3wFjkLUIdM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DuIkdRPITRs55I4SZmgomAHCIsDQmXRhW8+MOznkzSk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SsBk+Et1lTbU+QRPx+xyJ/jMkmfG+QCvQEpip2YYrzA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "crCIzOd8KhHvvUlX7M1v9bhvU4pLdTc+X2SuqoKU5Ek=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YOWdCw4UrqnxkAaVjqmC4sKQDMVMHEpFGnlxpxdaU6E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "M3SShp81Ff8tQ632qKbv9MUcN6wjDaBReI0VXNu6Xh4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gzHlSPxpM0hT75kQvWFzGlOxKvDoiKQZOr19V6l2zXI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "s3JnppOGYw9SL2Q1kMAZs948v2F5PrpXjGei/HioDWs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cG6+3Gk/zEH68P/uuuwiAUVCuyJwa1LeV+t29FlPPAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dupdvR3AyJtM+g9NDKiaLVOtGca387JQp8w+V03m7Ig=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JqEQc5svj2jTvZ6LLA5ivE+kTb/0aRemSEmxk4G7Zrg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "szcXXXKnob+p3SoM4yED2R920LeJ7cVsclPMFTe4CeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "o1QoGVXmuBdHwHm7aCtGMlMVKrjFdYvJXpoq6uhIAZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Jfm5wPlqqLCJRGQIqRq2NGmpn7s0Vrih2H3YAOoI2YU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zMHLb8ARbsYo8Ld05bqnGFf1Usha6EGb8QKwdSAyps0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yQdtq9lh5pugL7/i0Bj/PuZUUBUIzf+7wj1rl5y736w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wGWVZdO7qIuyDg/BqDgqjgoQ02h5YYgwXQB1oCin2NE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "by9HMLj6NTEpgztZ5HSN6GxImkXPcaFINYDzgZY33X8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tWo0vbasi7bXmn/MsOx13VC1IsWtpx/nYp0uj4iMzdA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tQQpndUYd5O87lOtrGjH3wl9VsOK0ray7RMasL90sBM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cQjXEDCMsOpKLLf+vlTgIHA+cbSJdzqhbSX9Wvh95aA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7yMpU48IxK9SzP2cx3VnTownGEwFmeFofuuFT97SuuY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kSOx1kz0CmBgzKQHZlo65ZUY1DIv9A99JRm+Us2y6Ew=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ubQpdPBe6/xvtr+AcXdfYLSvYCR4ot0tivehkCsupb4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xal+iCJ6FTefRQToyoNksc9NCZShyn04NDGi4IYrcoM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "d7jU4iOK50xHxlkSifcxlZFCM46TSgQzoYivxG3HNLY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tJvl2nsBLBVzL3pp6sKWCL4UXeh3q/roYBJjSb74ve0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OIUCaKRvIx9t1w6Hxlz1IcQTdPNCfdRNwnnTm10W+X0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A9tvzsiElotOUVIB4CqfQp9mAwqvTM35YkmAR170aHA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lI8gpK7hpb7c9x4RQugsxMnQay5LZJmwslZdvMx/dcE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dNCzh40U0XvdKnSDi3HRQOWQftEsDVqc4uUvsVFGoq8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IP+iwEBWBwVVZIdpaMu8k5+soFCz+TZkYn3drKZ9grE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pnqyh6e0y5svHkJDShlN9CHV0WvMBE4QbtJpQw5ZCXc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "elEl42tbVDoRTLjAhZUFEtXiut4b3PVhg/1ZLZSQdtE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vHuu2FxwclMHqyE6JBYbTYgbEkB0dqb/JuaxsvfwsmY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xTf7NCe3Gf8QpE78HR5OknlLTKfs9J+RN9UZpH6fnso=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XiWSasRnJAulGR6+LCVD3mwRObXylqYWR9jvpywq12c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MZMxEQ5ikx0PG1YFIExv0UnTZogsvgeOEZTpzvBDn4w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yZMyMZBDrWbAhvnic7vvIYhmO9m5H2iuv0c8KNZrBzY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xxM14hTPY5j0vvcK2C7YAEjzdsfUTFHozHC0hEo1bxI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+01rqR1xVwkpGXcstbk1ItJqFVjH6Q8MGxEN3Cm9Y1A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xOpLV0Z2VTRJ3iWtnWZcsyjXubTIkYWo31cO+HV1o1k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BWUOLqgLBqc5NwxVlSV5H3KFQPXbCp7mdo+jF+8cJqY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fuQb1S6xZDGlrEbK+kI23aL53PP1PVNwqICnZNt9Yzg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfscnoibFttahLdPVC4Ee+47ewGFKpDSU7M6HX19bKE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rpSW2awybNVeKtat91VFxqbINoTfNhPfQAu+d73Xtf8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9M/CP9ccOIIj2LLFmE0GFDO0Ban2wsNalEXfM6+h+1s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WrEMG49l1ye4MhXs5ZS9tz8P6h+hDvthIg/2wW9ne1Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ImNhbfeyfH8qIEeA5ic0s3dAQBdzzTBS+CPsNih9vZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dWP33YDSn04UKJN2ogh2Rui0iW/0q2y18OCDRVcfyoo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lYv0isAtfGh6H9tdp3cp2eHU7q2J+uk7QrgcxtK3w7Y=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VGMoamB/+7zTOYcY/pqJc96xlv2PdW4hwsIAEIslTDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yNeBWMF7BnD9wVwz2PgJsvWr77QiVvvWUvJF0+fqBug=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfpvObJ+tJBXSvqeN7vlOfmhYign635lciYAJIjUtY8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dsen4NqjzVGjpjufiTMs3+gqeD09EbnuogPgxrJECwg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pxCWVM3sn19NsFEpgHbgLa+PmYlhN3mMiP0Wk8kJhYw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q11KNvJszjYIB9n9HcC+N4uz11a3eRj1L3BH9scKMDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A1PmkgcEToWh1JiVWE6mI5jUu7poxWWuCUt/cgRUUDc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qJo3Hu4PJeanL7XEaWXO/n3YsodhZyd+MJOOmB9Kpd8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BkBKLO8URFscfRY9Bav/1+L9mLohDgNr/MkZtGiraIs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rZq5WA3Hx3xthOyHAJXK//f8pE2qbz7YKu3TIMp9GFY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X07a/Lm80p5xd4RFs1dNmw+90tmPDPdGiAKVZkxd4zY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6YrBn2ofIw1b5ooakrLOwF41BWrps8OO0H9WH4/rtlE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0l86Ag5OszXpa78SlOUV3K9nff5iC1p0mRXtLg9M1s4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Hn6yuxFHodeyu7ISlhYrbSf9pTiH4TDEvbYLWjTwFO0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zdf4y2etKBuIpkEU1zMwoCkCsdisfXZCh8QPamm+drY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rOQ9oMdiK5xxGH+jPzOvwVqdGGnF3+HkJXxn81s6hp4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "61aKKsE3+BJHHWYvs3xSIBvlRmKswmaOo5rygQJguUg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KuDb/GIzqDM8wv7m7m8AECiWJbae5EKKtJRugZx7kR0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Q+t8t2TmNUiCIorVr9F3AlVnX+Mpt2ZYvN+s8UGict8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tJRZIpKxUgHyL83kW8cvfjkxN3z6WoNnUg+SQw+LK+k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pnUsYjip8SvW0+m9mR5WWTkpK+p6uwJ6yBUAlBnFKMk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PArHlz+yPRYDycAP/PgnI/AkP8Wgmfg++Vf4UG1Bf0E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wnIh53Q3jeK8jEBe1n8kJLa89/H0BxO26ZU8SRIAs9Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4F8U59gzBLGhq58PEWQk2nch+R0Va7eTUoxMneReUIA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ihKagIW3uT1dm22ROr/g5QaCpxZVj2+Fs/YSdM2Noco=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EJtUOOwjkrPUi9mavYAi+Gom9Y2DuFll7aDwo4mq0M0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dIkr8dbaVRQFskAVT6B286BbcBBt1pZPEOcTZqk4ZcI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "aYVAcZYkH/Tieoa1XOjE/zCy5AJcVTHjS0NG2QB7muA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sBidL6y8TenseetpioIAAtn0lK/7C8MoW4JXpVYi3z8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0Dd2klU/t4R86c2WJcJDAd57k/N7OjvYSO5Vf8KH8sw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "I3jZ92WEVmZmgaIkLbuWhBxl7EM6bEjiEttgBJunArA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "aGHoQMlgJoGvArjfIbc3nnkoc8SWBxcrN7hSmjMRzos=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "bpiWPnF/KVBQr5F6MEwc5ZZayzIRvQOLDAm4ntwOi8g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tI7QVKbE6avWgDD9h4QKyFlnTxFCwd2iLySKakxNR/I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XGsge0CnoaXgE3rcpKm8AEeku5QVfokS3kcI+JKV1lk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JQxlryW2Q5WOwfrjAnaZxDvC83Dg6sjRVP5zegf2WiM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YFuHKJOfoqp1iGVxoFjx7bLYgVdsN4GuUFxEgO9HJ5s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Z6vUdiCR18ylKomf08uxcQHeRtmyav7/Ecvzz4av3k4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SPGo1Ib5AiP/tSllL7Z5PAypvnKdwJLzt8imfIMSEJQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "m94Nh6PFFQFLIib9Cu5LAKavhXnagSHG6F5EF8lD96I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pfEkQI98mB+gm1+JbmVurPAODMFPJ4E8DnqfVyUWbSo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DNj3OVRLbr43s0vd+rgWghOL3FqeO/60npdojC8Ry/M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kAYIQrjHVu49W8FTxyxJeiLVRWWjC9fPcBn+Hx1F+Ss=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "aCSO7UVOpoQvu/iridarxkxV1SVxU1i9HVSYXUAeXk4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Gh6hTP/yj1IKlXQ+Q69KTfMlGZjEcXoRLGbQHNFo/1s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/gDgIFQ4tAlJk3GN48IS5Qa5IPmErwGk8CHxAbp6gs0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PICyimwPjxpusyKxNssOOwUotAUbygpyEtORsVGXT8g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4lu+cBHyAUvuxC6JUNyHLzHsCogGSWFFnUCkDwfQdgI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pSndkmoNUJwXjgkbkgOrT5f9nSvuoMEZOkwAN9ElRaE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tyW+D4i26QihNM5MuBM+wnt5AdWGSJaJ4X5ydc9iWTU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9Syjr8RoxUgPKr+O5rsCu07AvcebA4P8IVKyS1NVLWc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "67tPfDYnK2tmrioI51fOBG0ygajcV0pLo5+Zm/rEW7U=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "y0EiPRxYTuS1eVTIaPQUQBBxwkyxNckbePvKgChwd0M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "NWd+2veAaeXQgR3vCvzlI4R1WW67D5YsVLdoXfdb8qg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PY5RQqKQsL2GqBBSPNOEVpojNFRX/NijCghIpxD6CZk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lcvwTyEjFlssCJtdjRpdN6oY+C7bxZY+WA+QAqzj9zg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWE7XRNylvTwO/9Fv56dNqUaQWMmESNS/GNIwgBaEI0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ijwlrUeS8nRYqK1F8kiCYF0mNDolEZS+/lJO1Lg93C8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8KzV+qYGYuIjoNj8eEpnTuHrMYuhzphl80rS6wrODuU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wDyTLjSEFF895hSQsHvmoEQVS6KIkZOtq1c9dVogm9I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SGrtPuMYCjUrfKF0Pq/thdaQzmGBMUvlwN3ORIu9tHU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KySHON3hIoUk4xWcwTqk6IL0kgjzjxgMBObVIkCGvk4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hBIdS9j0XJPeT4ot73ngELkpUoSixvRBvdOL9z48jY8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Tx6um0q9HjS5ZvlFhvukpI6ORnyrXMWVW1OoxvgqII0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zFKlyfX5H81+d4A4J3FKn4T5JfG+OWtR06ddyX4Mxas=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cGgCDuPV7MeMMYEDpgOupqyNP4BQ4H7rBnd2QygumgM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IPaUoy98v11EoglTpJ4kBlEawoZ8y7BPwzjLYBpkvHQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Pfo4Am6tOWAyZNn8G9W5HWWGC3ZWmX0igI/RRB870Ro=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fnTSjd7bC1Udoq6iM7UDnHAC/lsIXSHp/Gy332qw+/I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fApBgVRrTDyEumkeWs5p3ag9KB48SbU4Si0dl7Ns9rc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QxudfBItgoCnUj5NXVnSmWH3HK76YtKkMmzn4lyyUYY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sSOvwhKa29Wq94bZ5jGIiJQGbG1uBrKSBfOYBz/oZeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FdaMgwwJ0NKsqmPZLC5oE+/0D74Dfpvig3LaI5yW5Fs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sRWBy12IERN43BSZIrnBfC9+zFBUdvjTlkqIH81NGt4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/4tIRpxKhoOwnXAiFn1Z7Xmric4USOIfKvTYQXk3QTc=", - "subType": "00" - } - } - ] - }, - { - "_id": { - "$numberInt": "1" - }, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RGTjNVEsNJb+DG7DpPOam8rQWD5HZAMpRyiTQaw7tk8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "I93Md7QNPGmEEGYU1+VVCqBPBEvXdqHPtTJtMOn06Yk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "GecBFQ1PemlECWZWCl7f74vmsL6eB6mzQ9n6tK6FYfs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QpjhZl+O1ORifgtCZuWAdcP6OKL7IZ2cA46v8FJcV28=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RlQWwhU+uVv0a+9IB5cUkEfvHBvOw3B1Sx6WfPWMqes=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ubb81XTC7U+4tcNzf1oYvOY6gR5hC2Izqx54f4GuJ0E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6M4Q5NMQ9TqNnjzGOxIkiUIY8TEL0I3XD1QnhefQUqU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BtInzk9t2FFMCEY6AQ7zN8jwrrZEs2irSv6q0Q4NaIw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6vxXfETu9cuBIpRBo3jUUU04mJIH/aAhLX8K6VI5Xv0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wXPCdS+q23zi1bkPnaVG2j0PsVtxdeSLJ//h6J1x8RU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KY3KkfBAsN2l80wbpj41G0gwBR5KmmFnZcagg7D3ENk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tI8NFAxXCX4VOnY5X73K6KI/Yspd3aR94KV39MhJlAw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "nFxH0UC3mATKA6Vboz+QX/hAjj19kF/SH6H5Cne7qC0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q8hYqIYaIi7nOdG/7qQZYnz8Bsacfi66M1nVku4SH08=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4saA92R4arp4anvD9xFtze+sNcQqTEhPHyl1h70A8NE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DbIziOBRRyeQS6RtBR09E37LV+CTKrEjGoRMLSpG6eE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Fv80Plp/7w2gnVqrwawLd6qhJ10G4NCDm3re67cNq4Y=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "T/T2oiQCBBES4YN7EodzPRdabZSFlYIClHBym+bQUZE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ZQgHD3l46Ujqtbnj1VbbeM29C9wJzOhz+yZ/7XdSrxk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ltlFKzWvyZvHxDFOYDd/XXJ6kUiJj0ln2HTCEz2o4Z4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "flW8A7bltC1u8bzx0WJtxosGJdOVsJFfbx33jxnpFGg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SXO+92QbMKwUSG2t27ciunV1c3VvFkUuDmSczpRe008=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+KioGs1GM+xRBzFE67ePTWj04KMSE5/Y6qUF7nJ5kvU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L3xNVbh6YH+RzqABN+5Jgb7T234Efpn766DmUvxIxgg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hPF+60mBYPjh21dEmPlBhKgyc9S2qLtTkypYvnqP2Fc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EletRsETy2HcjaPIm2c8CkT7ch/P3pJJDC8hasepcSU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "r5bMXUaNKqLPxZ+TG9HYTG4aSDgcpim27rN8rQFkM0w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0Q7Erdr8+/S0wUEDDIqlS5XjBVWvhZY65K0uUDb6+Ns=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xEcnhXy35hbXNVBPOOt3TUHbxvKfQ48KjA9b6/rbMqQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "T8bEpiQNgsEudXvyKE9SZlSvbpV/LUaslsdqgSFltyo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hIoiaF2YjnxDbODfhFEB+JGZ5nf8suD3Shck5bwQ3N0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qnA6qzejeRJ0rsZaZ0zOvKAaXyxt5lpscKQNYFZNl4k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "anAKCL2DN/le2VaP0n2ucYSEH/DaaEH/8Sa4OqTZsRA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JCZlBJaFm618oWYSnT9Jr1MtwFVw4BZjOzO+5yWgR90=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yxyk4n9762WzcDVGnTn4jCqUnSMIVCrLDIjCX1QVj34=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fDI6fdKvDJwim5/CQwWZEzcrXE3LHgy7FTtffcC7tXE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Vex+gcz5T+WkzsVZQrkqUR2ryyZbnaOGuWpYvjN0zCw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8TLEXz+Gbbp6llHpZXVjLsdlYY9f6hrKpHVpyfDe0RY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7fTyt5BrunypS65TfOzFW2E2qdIuT4SLeDeGlbQoJCs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8fKGrkqN0/KuSjyXgDBmRauDKrSa//JBKRWHEB9xBf4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "s4codmG7uN4ss6P357jL21lazEe90M9GOK5WrOknSV0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RkSpua8XF+NUdxVDU90EbLUTTyZFX3tt3atBTroFaRk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "LnTCuCDyAHK5B9KXzjtwGmWB+qergQk2OCjnIx9MI2A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cBFh0virAX4pVXf/udIGI2951i0+0aZAdJcBVGtYnT4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "G54X6myQXWZ5fw/G31en3QbdgfXzL9+hFTtJpnWMqDI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EdsiiuezcsFJFnYIyGjCOhnqMj1BOwTB5EFxN+ERUkg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dVH9MXLtk0WTwGQ3xmrhOqfropMUkDW3o6paNPGl3NU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sB3HqXKWY3pKbuEH8BTbfNIGfbY+7/ZbOc3XC+JRNNI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WHyDk62Xhqbo4/iie2aLIM4x2uuAjv6102dJSHI58oM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pNUFuHpeNRDUZ/NrtII2c6sNc9eGR1lIUlIyXKERA+0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UPa+pdCqnN0bfAptdzldQOSd01gidrDKy8KhWrpSKAI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "l+7dOAlo+HUffMqFYXL6pgUFeTbwOM9CjKQLxEoLtc4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SRnDXV/rN6C8xwMutv9E1luv3DOUio3VkgPr8Cpm7Ew=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QcH6gl+gX7xZ7OWhUNQMbndJy0Piz49pDo6RsnLkVSA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "t+uL4DnfsI/Zll/KXWW1cOKX3Hu8WIkm3pt9efCVSAQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "myutHDctku/+Uug/nD8gRbYvmx/IovtoAAC2/fz2oHA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6C+cjD0e0nSCP6cPqQYbNG7SlOd6Mfvi8hyfm7Ng+D8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zg01JSoOj9oBKT0S1ldJucXzY5AKgreS+h2xJreWTOs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7qQ80/FjodHl1m1py/Oii0/9C/xWbLdhaRXQ+kkCP10=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YwWMNH07vL6c5Nhg+MRnVByhzUunu8y0VLM9z/XvR5U=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Dle8bU98+fudAbc14SToZFkwvV3tcYVsjDug0NWljpc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "J+eKL1vPJmlzltvhI6Li5Fz/TJmi3Ng+ehRTcs46API=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zB3XzfFygLwC3WHkj0up+VbEd25KKoce1vOpG/5bwK4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vnVnmOnL+z2pqwE+A6cVKS0Iwy4F4/2IiElJca9bUQM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+lG5r/Fpqry3BtFuvY67+RntmHAMDoLVOSGc6ZoXPb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L5MXQertqc6uj7ADe8aWKbd1sYHPCE7P1VYVg9Zc3VI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "imKONuZgopt0bhM3GMX2WVPwQYMTobuUUEdhcLfHs4c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "eOkU1J1uVbiVFWBerbXsSIVcF2nqiicTkFy4x7kFHB8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gI0uDhXeoH/UatDQKEf4qo8FHzWZDhb/wuWTqbq/ID4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cOkd5Aa3btYhtojE/smsF/PJnULqQ4NNqTkU6KXTFmo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "AWNJMs1MTe294oFipp8Y6P0CjpkZ4qCZoClQF3XcHq8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6gJtlzXOFhGYrVbTuRMmvMlDTwXdNtR9aGBlHZPwIMw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "LEmwVGA/xsEG7UrcOoYLFu6KCXgijzFznenknuDacm8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "mIRFPTXRrGaPtp/Ydij2jgkRe4uoUvAKxW2d8b9zYL0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "B+Uv2u48WALOO0L311z+eryjYQzKJVMfdHMZPhOAFmY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "INXXp0wDyVCq+NtfIrrC2ciETmyW/dWB/48/u4yLEZ4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "se7DGo8XrlrQDLEcco1tZrQt9kDe+0RTyl2bw/quG4w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vr0m2+Zk9lbN6UgWCyn8xJWJOokU3IDYab5U5q1+CgQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XI+eJ8Gy2JktG1gICgoj1qpsfy1tKmH0kglWbaQH6DA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A+UCuNnuAUqnQzspA6TVqUPRmtZmpSex5HFw7THRxs0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xaH2Ehfljd19uo0Fvb3iwkdaiWEVQd2YPoitgEPkhSM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "S/iZBJGcc8+qZxyMtab65MMBoSglybwk3x58Nb86gnY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "w14ZE5qqY5YgkS4Zcs9YNbrQbY1XfGOOHNn9bOYnFVQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0MhGd/jEF1vjkKGp+ZMn9SjLK54jkp9W4Hg+Sp/oxaI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "92QZ73e/NRTYgCm4aifaKth6aAsKnLLccBc0zx/qUTY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WOjzemCgFJOiGIp81RSVh/tFlzSTj9eFWcBnsiv2Ycs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DrsP9CmfKPjw5yLL8bnSeAxfNzAwlb+Z8OqCiKgBY7o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lMogqg8veBv6mri3/drMe9afJiKMvevkmGcw9BedfLo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "TxqwNcY8Tg2MPpNdkPBwvfpuTttSYRHU26DGECKYQ9o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "l0u1b4b4vYACWIwfnB7PZac4oDEgjQZCzHruNPTgAIY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "iVSGQ+cCfhbWIrY/v/WBORK92elu9gfRKyGhr6r/k00=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yK1forG50diEXte8ECzjfpHeYsPyuQ/dgxbxn/nzY5k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gIfTLCD3VwnOwkC0zPXWTqaITxX6ZplA69PO2a6zolc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "O/Zxlgh3WqpzJ7+Sd8XWMVID4/GXJUUWaSqfgDUi3b0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ZQ6yv368zwahUqSUYH/StL0Qgz/TwS1CzlMjVDvCciI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "m2rPEYkjwyiKdonMrKlcF7hya4lFOAUwEePJ3SgrNx8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Mq0yl5iVKlq71bT/dT/fXOWf2n90bTnXFnOdGDN0JOc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6qDGMXipPLC2O6EAAMjO2F9xx4rdqZso4IkPpH2304U=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jvQHRQQa2RIszE2LX2Hv2LbRhYawJ6qmtRt8HZzFQXg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ovJXQrkZlpeHRciKyE/WWNm5O389gRgzx1W+Dw596X4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "a4kgRNvYctGYqyQv9qScL/WkljTYVylJ9pE9KDULlxU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qV4Q48vPiCJMTjljotzYKI/zfExWpkKOSHGcAjGyDig=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jtI7zbBF+QW/aYYTkn90zzyHLXLgmy7l1bzgMb2oqic=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q0KmJl9txPdn962UNvnfe6UFhdk9YaFZuTm33F+csso=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ULNdEqeZJgtmNOhN/Y9INzsE9AnxWYwOMn+pIbRXIFs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "R4oz9+wkdjpKe5tE1jpG7IURAnfvS5fLP4LrD5cZfTE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qG5Z7VhwSu/HT/YFTgDzyAAzJKq51xPw2HeEV5btYC4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OM/1DmIIZ5Qyhtq8TGkHTBEMVKjAnKRZMRXYtTG8ctc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2R5vZbljLXnDFA99YfGuRB7pAdPJVKsT25zLNMC0fUk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OMbavF2EmdAz1fHkLV3ctFEUDfriKhoT2gidwHZ9z1o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MWT4Zrw3/vVvTYMa1Is5Pjr3wEwnBfnEAPPUAHKQhNU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tBkRPfG9yxfKocQx5pAJX0oEHKPL0Tgtr+0UYe09InE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lqxpnDR/H0YgH7RcfKoNoaaRhe1SIazIeMbQ1fu9y3Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "utT1UdR22PWOTrOkZauztX613lAplV4eh/ejTRb7ZSk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "S+Y2yFyKi/a6FXhih4yGo29X8I8OT6/zwEoX6NMKT4o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QSjVppg29x6oS5yBg8OFjrFt0tuTpWCuKxfIy0k8YnE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "y3r6/Xsfvsl3HksXlVYkJgHUqpQGfICxg3x9f8Zw1qM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BSltHzEwDjFN4du9rDHAPvl22atlcTioEtt+gC5L1tk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0arGXjSN0006UnXbrWsGqhvBair569DeFDUME3Df3rA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "s/DumaMad08S+PBUUcrS+v42K0z8HgcdiQtrFAEu2Qs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EzJ8Y8N0OQBTlnvrK82PdevDNZZO4E6CNgYVu8Cj6Ks=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VA4vr8jBPI5QdiPrULzzZjBMIUbG3V7Slg5zm0bFcKc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YAOvEB2ZLtq9LQiFViBHWaxxWVVonC2rNYj9tN9s3L0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hgaHMo9aAGS+nBwvqnTjZO+YkiQPY1c1XcIYeaYKHyI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YvaoLt3ZpH0atB0tNzwMjpoxRYJXl0DqSjisMJiGVBE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EMmW6CptFsiLoPOi5/uAJQ2FmeLg6mCpuVLLrRWk7Mc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1jQsNMarSnarlYmXEuoFokeBMg/090qUD9wqo1Zn8Gs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hupXNKhRpJxpyDAAP1TgJ5JMZh9lhbMk6s7D7dMS3C8=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-Correctness.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-Correctness.json deleted file mode 100644 index 4316a31c3..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-Correctness.json +++ /dev/null @@ -1,1158 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "Find with $gt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalNoPrecision": { - "$gt": { - "$numberDecimal": "0.0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $gte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalNoPrecision": { - "$gte": { - "$numberDecimal": "0.0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - }, - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $gt with no results", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalNoPrecision": { - "$gt": { - "$numberDecimal": "1.0" - } - } - } - }, - "result": [] - } - ] - }, - { - "description": "Find with $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalNoPrecision": { - "$lt": { - "$numberDecimal": "1.0" - } - } - } - }, - "result": [ - { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - ] - } - ] - }, - { - "description": "Find with $lte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalNoPrecision": { - "$lte": { - "$numberDecimal": "1.0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - }, - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $gt and $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalNoPrecision": { - "$gt": { - "$numberDecimal": "0.0" - }, - "$lt": { - "$numberDecimal": "2.0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with equality", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - }, - "result": [ - { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - ] - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $in", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalNoPrecision": { - "$in": [ - { - "$numberDecimal": "0.0" - } - ] - } - } - }, - "result": [ - { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalNoPrecision": { - "$gte": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - }, - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gt with no results", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalNoPrecision": { - "$gt": { - "$numberDecimal": "1.0" - } - } - } - } - ] - }, - "result": [] - } - ] - }, - { - "description": "Aggregate with $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalNoPrecision": { - "$lt": { - "$numberDecimal": "1.0" - } - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $lte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalNoPrecision": { - "$lte": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - }, - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gt and $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalNoPrecision": { - "$gt": { - "$numberDecimal": "0.0" - }, - "$lt": { - "$numberDecimal": "2.0" - } - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with equality", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - ] - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $in", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalNoPrecision": { - "$in": [ - { - "$numberDecimal": "0.0" - } - ] - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0.0" - } - } - ] - } - ] - }, - { - "description": "Wrong type: Insert Int", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberInt": "0" - } - } - }, - "result": { - "errorContains": "cannot encrypt element" - } - } - ] - }, - { - "description": "Wrong type: Find Int", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalNoPrecision": { - "$gte": { - "$numberInt": "0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": { - "errorContains": "field type is not supported" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-Delete.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-Delete.json deleted file mode 100644 index 19cae3c64..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-Delete.json +++ /dev/null @@ -1,1116 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Decimal. Delete.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1" - } - } - } - }, - { - "name": "deleteOne", - "arguments": { - "filter": { - "encryptedDecimalNoPrecision": { - "$gt": { - "$numberDecimal": "0" - } - } - } - }, - "result": { - "deletedCount": 1 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "delete": "default", - "deletes": [ - { - "q": { - "encryptedDecimalNoPrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - }, - "limit": 1 - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "delete" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": { - "$numberInt": "0" - }, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "rbf3AeBEv4wWFAKknqDxRW5cLNkFvbIs6iJjc6LShQY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "n+XAuFnP8Dov9TnhGFxNx0K/MnVM9WbJ7RouEu0ndO0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yRXojuVdn5GQtD97qYlaCL6cOLmZ7Cvcb3wFjkLUIdM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DuIkdRPITRs55I4SZmgomAHCIsDQmXRhW8+MOznkzSk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SsBk+Et1lTbU+QRPx+xyJ/jMkmfG+QCvQEpip2YYrzA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "crCIzOd8KhHvvUlX7M1v9bhvU4pLdTc+X2SuqoKU5Ek=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YOWdCw4UrqnxkAaVjqmC4sKQDMVMHEpFGnlxpxdaU6E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "M3SShp81Ff8tQ632qKbv9MUcN6wjDaBReI0VXNu6Xh4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gzHlSPxpM0hT75kQvWFzGlOxKvDoiKQZOr19V6l2zXI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "s3JnppOGYw9SL2Q1kMAZs948v2F5PrpXjGei/HioDWs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cG6+3Gk/zEH68P/uuuwiAUVCuyJwa1LeV+t29FlPPAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dupdvR3AyJtM+g9NDKiaLVOtGca387JQp8w+V03m7Ig=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JqEQc5svj2jTvZ6LLA5ivE+kTb/0aRemSEmxk4G7Zrg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "szcXXXKnob+p3SoM4yED2R920LeJ7cVsclPMFTe4CeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "o1QoGVXmuBdHwHm7aCtGMlMVKrjFdYvJXpoq6uhIAZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Jfm5wPlqqLCJRGQIqRq2NGmpn7s0Vrih2H3YAOoI2YU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zMHLb8ARbsYo8Ld05bqnGFf1Usha6EGb8QKwdSAyps0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yQdtq9lh5pugL7/i0Bj/PuZUUBUIzf+7wj1rl5y736w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wGWVZdO7qIuyDg/BqDgqjgoQ02h5YYgwXQB1oCin2NE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "by9HMLj6NTEpgztZ5HSN6GxImkXPcaFINYDzgZY33X8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tWo0vbasi7bXmn/MsOx13VC1IsWtpx/nYp0uj4iMzdA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tQQpndUYd5O87lOtrGjH3wl9VsOK0ray7RMasL90sBM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cQjXEDCMsOpKLLf+vlTgIHA+cbSJdzqhbSX9Wvh95aA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7yMpU48IxK9SzP2cx3VnTownGEwFmeFofuuFT97SuuY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kSOx1kz0CmBgzKQHZlo65ZUY1DIv9A99JRm+Us2y6Ew=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ubQpdPBe6/xvtr+AcXdfYLSvYCR4ot0tivehkCsupb4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xal+iCJ6FTefRQToyoNksc9NCZShyn04NDGi4IYrcoM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "d7jU4iOK50xHxlkSifcxlZFCM46TSgQzoYivxG3HNLY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tJvl2nsBLBVzL3pp6sKWCL4UXeh3q/roYBJjSb74ve0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OIUCaKRvIx9t1w6Hxlz1IcQTdPNCfdRNwnnTm10W+X0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A9tvzsiElotOUVIB4CqfQp9mAwqvTM35YkmAR170aHA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lI8gpK7hpb7c9x4RQugsxMnQay5LZJmwslZdvMx/dcE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dNCzh40U0XvdKnSDi3HRQOWQftEsDVqc4uUvsVFGoq8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IP+iwEBWBwVVZIdpaMu8k5+soFCz+TZkYn3drKZ9grE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pnqyh6e0y5svHkJDShlN9CHV0WvMBE4QbtJpQw5ZCXc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "elEl42tbVDoRTLjAhZUFEtXiut4b3PVhg/1ZLZSQdtE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vHuu2FxwclMHqyE6JBYbTYgbEkB0dqb/JuaxsvfwsmY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xTf7NCe3Gf8QpE78HR5OknlLTKfs9J+RN9UZpH6fnso=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XiWSasRnJAulGR6+LCVD3mwRObXylqYWR9jvpywq12c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MZMxEQ5ikx0PG1YFIExv0UnTZogsvgeOEZTpzvBDn4w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yZMyMZBDrWbAhvnic7vvIYhmO9m5H2iuv0c8KNZrBzY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xxM14hTPY5j0vvcK2C7YAEjzdsfUTFHozHC0hEo1bxI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+01rqR1xVwkpGXcstbk1ItJqFVjH6Q8MGxEN3Cm9Y1A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xOpLV0Z2VTRJ3iWtnWZcsyjXubTIkYWo31cO+HV1o1k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BWUOLqgLBqc5NwxVlSV5H3KFQPXbCp7mdo+jF+8cJqY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fuQb1S6xZDGlrEbK+kI23aL53PP1PVNwqICnZNt9Yzg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfscnoibFttahLdPVC4Ee+47ewGFKpDSU7M6HX19bKE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rpSW2awybNVeKtat91VFxqbINoTfNhPfQAu+d73Xtf8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9M/CP9ccOIIj2LLFmE0GFDO0Ban2wsNalEXfM6+h+1s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WrEMG49l1ye4MhXs5ZS9tz8P6h+hDvthIg/2wW9ne1Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ImNhbfeyfH8qIEeA5ic0s3dAQBdzzTBS+CPsNih9vZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dWP33YDSn04UKJN2ogh2Rui0iW/0q2y18OCDRVcfyoo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lYv0isAtfGh6H9tdp3cp2eHU7q2J+uk7QrgcxtK3w7Y=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VGMoamB/+7zTOYcY/pqJc96xlv2PdW4hwsIAEIslTDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yNeBWMF7BnD9wVwz2PgJsvWr77QiVvvWUvJF0+fqBug=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfpvObJ+tJBXSvqeN7vlOfmhYign635lciYAJIjUtY8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dsen4NqjzVGjpjufiTMs3+gqeD09EbnuogPgxrJECwg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pxCWVM3sn19NsFEpgHbgLa+PmYlhN3mMiP0Wk8kJhYw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q11KNvJszjYIB9n9HcC+N4uz11a3eRj1L3BH9scKMDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A1PmkgcEToWh1JiVWE6mI5jUu7poxWWuCUt/cgRUUDc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qJo3Hu4PJeanL7XEaWXO/n3YsodhZyd+MJOOmB9Kpd8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BkBKLO8URFscfRY9Bav/1+L9mLohDgNr/MkZtGiraIs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rZq5WA3Hx3xthOyHAJXK//f8pE2qbz7YKu3TIMp9GFY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X07a/Lm80p5xd4RFs1dNmw+90tmPDPdGiAKVZkxd4zY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6YrBn2ofIw1b5ooakrLOwF41BWrps8OO0H9WH4/rtlE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0l86Ag5OszXpa78SlOUV3K9nff5iC1p0mRXtLg9M1s4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Hn6yuxFHodeyu7ISlhYrbSf9pTiH4TDEvbYLWjTwFO0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zdf4y2etKBuIpkEU1zMwoCkCsdisfXZCh8QPamm+drY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rOQ9oMdiK5xxGH+jPzOvwVqdGGnF3+HkJXxn81s6hp4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "61aKKsE3+BJHHWYvs3xSIBvlRmKswmaOo5rygQJguUg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KuDb/GIzqDM8wv7m7m8AECiWJbae5EKKtJRugZx7kR0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Q+t8t2TmNUiCIorVr9F3AlVnX+Mpt2ZYvN+s8UGict8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tJRZIpKxUgHyL83kW8cvfjkxN3z6WoNnUg+SQw+LK+k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pnUsYjip8SvW0+m9mR5WWTkpK+p6uwJ6yBUAlBnFKMk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PArHlz+yPRYDycAP/PgnI/AkP8Wgmfg++Vf4UG1Bf0E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wnIh53Q3jeK8jEBe1n8kJLa89/H0BxO26ZU8SRIAs9Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4F8U59gzBLGhq58PEWQk2nch+R0Va7eTUoxMneReUIA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ihKagIW3uT1dm22ROr/g5QaCpxZVj2+Fs/YSdM2Noco=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EJtUOOwjkrPUi9mavYAi+Gom9Y2DuFll7aDwo4mq0M0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dIkr8dbaVRQFskAVT6B286BbcBBt1pZPEOcTZqk4ZcI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "aYVAcZYkH/Tieoa1XOjE/zCy5AJcVTHjS0NG2QB7muA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sBidL6y8TenseetpioIAAtn0lK/7C8MoW4JXpVYi3z8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0Dd2klU/t4R86c2WJcJDAd57k/N7OjvYSO5Vf8KH8sw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "I3jZ92WEVmZmgaIkLbuWhBxl7EM6bEjiEttgBJunArA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "aGHoQMlgJoGvArjfIbc3nnkoc8SWBxcrN7hSmjMRzos=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "bpiWPnF/KVBQr5F6MEwc5ZZayzIRvQOLDAm4ntwOi8g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tI7QVKbE6avWgDD9h4QKyFlnTxFCwd2iLySKakxNR/I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XGsge0CnoaXgE3rcpKm8AEeku5QVfokS3kcI+JKV1lk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JQxlryW2Q5WOwfrjAnaZxDvC83Dg6sjRVP5zegf2WiM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YFuHKJOfoqp1iGVxoFjx7bLYgVdsN4GuUFxEgO9HJ5s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Z6vUdiCR18ylKomf08uxcQHeRtmyav7/Ecvzz4av3k4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SPGo1Ib5AiP/tSllL7Z5PAypvnKdwJLzt8imfIMSEJQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "m94Nh6PFFQFLIib9Cu5LAKavhXnagSHG6F5EF8lD96I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pfEkQI98mB+gm1+JbmVurPAODMFPJ4E8DnqfVyUWbSo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DNj3OVRLbr43s0vd+rgWghOL3FqeO/60npdojC8Ry/M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kAYIQrjHVu49W8FTxyxJeiLVRWWjC9fPcBn+Hx1F+Ss=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "aCSO7UVOpoQvu/iridarxkxV1SVxU1i9HVSYXUAeXk4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Gh6hTP/yj1IKlXQ+Q69KTfMlGZjEcXoRLGbQHNFo/1s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/gDgIFQ4tAlJk3GN48IS5Qa5IPmErwGk8CHxAbp6gs0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PICyimwPjxpusyKxNssOOwUotAUbygpyEtORsVGXT8g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4lu+cBHyAUvuxC6JUNyHLzHsCogGSWFFnUCkDwfQdgI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pSndkmoNUJwXjgkbkgOrT5f9nSvuoMEZOkwAN9ElRaE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tyW+D4i26QihNM5MuBM+wnt5AdWGSJaJ4X5ydc9iWTU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9Syjr8RoxUgPKr+O5rsCu07AvcebA4P8IVKyS1NVLWc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "67tPfDYnK2tmrioI51fOBG0ygajcV0pLo5+Zm/rEW7U=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "y0EiPRxYTuS1eVTIaPQUQBBxwkyxNckbePvKgChwd0M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "NWd+2veAaeXQgR3vCvzlI4R1WW67D5YsVLdoXfdb8qg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PY5RQqKQsL2GqBBSPNOEVpojNFRX/NijCghIpxD6CZk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lcvwTyEjFlssCJtdjRpdN6oY+C7bxZY+WA+QAqzj9zg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWE7XRNylvTwO/9Fv56dNqUaQWMmESNS/GNIwgBaEI0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ijwlrUeS8nRYqK1F8kiCYF0mNDolEZS+/lJO1Lg93C8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8KzV+qYGYuIjoNj8eEpnTuHrMYuhzphl80rS6wrODuU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wDyTLjSEFF895hSQsHvmoEQVS6KIkZOtq1c9dVogm9I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SGrtPuMYCjUrfKF0Pq/thdaQzmGBMUvlwN3ORIu9tHU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KySHON3hIoUk4xWcwTqk6IL0kgjzjxgMBObVIkCGvk4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hBIdS9j0XJPeT4ot73ngELkpUoSixvRBvdOL9z48jY8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Tx6um0q9HjS5ZvlFhvukpI6ORnyrXMWVW1OoxvgqII0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zFKlyfX5H81+d4A4J3FKn4T5JfG+OWtR06ddyX4Mxas=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cGgCDuPV7MeMMYEDpgOupqyNP4BQ4H7rBnd2QygumgM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IPaUoy98v11EoglTpJ4kBlEawoZ8y7BPwzjLYBpkvHQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Pfo4Am6tOWAyZNn8G9W5HWWGC3ZWmX0igI/RRB870Ro=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fnTSjd7bC1Udoq6iM7UDnHAC/lsIXSHp/Gy332qw+/I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fApBgVRrTDyEumkeWs5p3ag9KB48SbU4Si0dl7Ns9rc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QxudfBItgoCnUj5NXVnSmWH3HK76YtKkMmzn4lyyUYY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sSOvwhKa29Wq94bZ5jGIiJQGbG1uBrKSBfOYBz/oZeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FdaMgwwJ0NKsqmPZLC5oE+/0D74Dfpvig3LaI5yW5Fs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sRWBy12IERN43BSZIrnBfC9+zFBUdvjTlkqIH81NGt4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/4tIRpxKhoOwnXAiFn1Z7Xmric4USOIfKvTYQXk3QTc=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-FindOneAndUpdate.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-FindOneAndUpdate.json deleted file mode 100644 index 4ab3b63ea..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-FindOneAndUpdate.json +++ /dev/null @@ -1,1906 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Decimal. FindOneAndUpdate.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1" - } - } - } - }, - { - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "encryptedDecimalNoPrecision": { - "$gt": { - "$numberDecimal": "0" - } - } - }, - "update": { - "$set": { - "encryptedDecimalNoPrecision": { - "$numberDecimal": "2" - } - } - }, - "returnDocument": "Before" - }, - "result": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "default", - "query": { - "encryptedDecimalNoPrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - }, - "update": { - "$set": { - "encryptedDecimalNoPrecision": { - "$$type": "binData" - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "findAndModify" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": { - "$numberInt": "0" - }, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "rbf3AeBEv4wWFAKknqDxRW5cLNkFvbIs6iJjc6LShQY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "n+XAuFnP8Dov9TnhGFxNx0K/MnVM9WbJ7RouEu0ndO0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yRXojuVdn5GQtD97qYlaCL6cOLmZ7Cvcb3wFjkLUIdM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DuIkdRPITRs55I4SZmgomAHCIsDQmXRhW8+MOznkzSk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SsBk+Et1lTbU+QRPx+xyJ/jMkmfG+QCvQEpip2YYrzA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "crCIzOd8KhHvvUlX7M1v9bhvU4pLdTc+X2SuqoKU5Ek=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YOWdCw4UrqnxkAaVjqmC4sKQDMVMHEpFGnlxpxdaU6E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "M3SShp81Ff8tQ632qKbv9MUcN6wjDaBReI0VXNu6Xh4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gzHlSPxpM0hT75kQvWFzGlOxKvDoiKQZOr19V6l2zXI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "s3JnppOGYw9SL2Q1kMAZs948v2F5PrpXjGei/HioDWs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cG6+3Gk/zEH68P/uuuwiAUVCuyJwa1LeV+t29FlPPAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dupdvR3AyJtM+g9NDKiaLVOtGca387JQp8w+V03m7Ig=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JqEQc5svj2jTvZ6LLA5ivE+kTb/0aRemSEmxk4G7Zrg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "szcXXXKnob+p3SoM4yED2R920LeJ7cVsclPMFTe4CeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "o1QoGVXmuBdHwHm7aCtGMlMVKrjFdYvJXpoq6uhIAZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Jfm5wPlqqLCJRGQIqRq2NGmpn7s0Vrih2H3YAOoI2YU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zMHLb8ARbsYo8Ld05bqnGFf1Usha6EGb8QKwdSAyps0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yQdtq9lh5pugL7/i0Bj/PuZUUBUIzf+7wj1rl5y736w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wGWVZdO7qIuyDg/BqDgqjgoQ02h5YYgwXQB1oCin2NE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "by9HMLj6NTEpgztZ5HSN6GxImkXPcaFINYDzgZY33X8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tWo0vbasi7bXmn/MsOx13VC1IsWtpx/nYp0uj4iMzdA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tQQpndUYd5O87lOtrGjH3wl9VsOK0ray7RMasL90sBM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cQjXEDCMsOpKLLf+vlTgIHA+cbSJdzqhbSX9Wvh95aA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7yMpU48IxK9SzP2cx3VnTownGEwFmeFofuuFT97SuuY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kSOx1kz0CmBgzKQHZlo65ZUY1DIv9A99JRm+Us2y6Ew=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ubQpdPBe6/xvtr+AcXdfYLSvYCR4ot0tivehkCsupb4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xal+iCJ6FTefRQToyoNksc9NCZShyn04NDGi4IYrcoM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "d7jU4iOK50xHxlkSifcxlZFCM46TSgQzoYivxG3HNLY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tJvl2nsBLBVzL3pp6sKWCL4UXeh3q/roYBJjSb74ve0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OIUCaKRvIx9t1w6Hxlz1IcQTdPNCfdRNwnnTm10W+X0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A9tvzsiElotOUVIB4CqfQp9mAwqvTM35YkmAR170aHA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lI8gpK7hpb7c9x4RQugsxMnQay5LZJmwslZdvMx/dcE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dNCzh40U0XvdKnSDi3HRQOWQftEsDVqc4uUvsVFGoq8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IP+iwEBWBwVVZIdpaMu8k5+soFCz+TZkYn3drKZ9grE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pnqyh6e0y5svHkJDShlN9CHV0WvMBE4QbtJpQw5ZCXc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "elEl42tbVDoRTLjAhZUFEtXiut4b3PVhg/1ZLZSQdtE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vHuu2FxwclMHqyE6JBYbTYgbEkB0dqb/JuaxsvfwsmY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xTf7NCe3Gf8QpE78HR5OknlLTKfs9J+RN9UZpH6fnso=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XiWSasRnJAulGR6+LCVD3mwRObXylqYWR9jvpywq12c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MZMxEQ5ikx0PG1YFIExv0UnTZogsvgeOEZTpzvBDn4w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yZMyMZBDrWbAhvnic7vvIYhmO9m5H2iuv0c8KNZrBzY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xxM14hTPY5j0vvcK2C7YAEjzdsfUTFHozHC0hEo1bxI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+01rqR1xVwkpGXcstbk1ItJqFVjH6Q8MGxEN3Cm9Y1A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xOpLV0Z2VTRJ3iWtnWZcsyjXubTIkYWo31cO+HV1o1k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BWUOLqgLBqc5NwxVlSV5H3KFQPXbCp7mdo+jF+8cJqY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fuQb1S6xZDGlrEbK+kI23aL53PP1PVNwqICnZNt9Yzg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfscnoibFttahLdPVC4Ee+47ewGFKpDSU7M6HX19bKE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rpSW2awybNVeKtat91VFxqbINoTfNhPfQAu+d73Xtf8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9M/CP9ccOIIj2LLFmE0GFDO0Ban2wsNalEXfM6+h+1s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WrEMG49l1ye4MhXs5ZS9tz8P6h+hDvthIg/2wW9ne1Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ImNhbfeyfH8qIEeA5ic0s3dAQBdzzTBS+CPsNih9vZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dWP33YDSn04UKJN2ogh2Rui0iW/0q2y18OCDRVcfyoo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lYv0isAtfGh6H9tdp3cp2eHU7q2J+uk7QrgcxtK3w7Y=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VGMoamB/+7zTOYcY/pqJc96xlv2PdW4hwsIAEIslTDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yNeBWMF7BnD9wVwz2PgJsvWr77QiVvvWUvJF0+fqBug=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfpvObJ+tJBXSvqeN7vlOfmhYign635lciYAJIjUtY8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dsen4NqjzVGjpjufiTMs3+gqeD09EbnuogPgxrJECwg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pxCWVM3sn19NsFEpgHbgLa+PmYlhN3mMiP0Wk8kJhYw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q11KNvJszjYIB9n9HcC+N4uz11a3eRj1L3BH9scKMDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A1PmkgcEToWh1JiVWE6mI5jUu7poxWWuCUt/cgRUUDc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qJo3Hu4PJeanL7XEaWXO/n3YsodhZyd+MJOOmB9Kpd8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BkBKLO8URFscfRY9Bav/1+L9mLohDgNr/MkZtGiraIs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rZq5WA3Hx3xthOyHAJXK//f8pE2qbz7YKu3TIMp9GFY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X07a/Lm80p5xd4RFs1dNmw+90tmPDPdGiAKVZkxd4zY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6YrBn2ofIw1b5ooakrLOwF41BWrps8OO0H9WH4/rtlE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0l86Ag5OszXpa78SlOUV3K9nff5iC1p0mRXtLg9M1s4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Hn6yuxFHodeyu7ISlhYrbSf9pTiH4TDEvbYLWjTwFO0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zdf4y2etKBuIpkEU1zMwoCkCsdisfXZCh8QPamm+drY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rOQ9oMdiK5xxGH+jPzOvwVqdGGnF3+HkJXxn81s6hp4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "61aKKsE3+BJHHWYvs3xSIBvlRmKswmaOo5rygQJguUg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KuDb/GIzqDM8wv7m7m8AECiWJbae5EKKtJRugZx7kR0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Q+t8t2TmNUiCIorVr9F3AlVnX+Mpt2ZYvN+s8UGict8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tJRZIpKxUgHyL83kW8cvfjkxN3z6WoNnUg+SQw+LK+k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pnUsYjip8SvW0+m9mR5WWTkpK+p6uwJ6yBUAlBnFKMk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PArHlz+yPRYDycAP/PgnI/AkP8Wgmfg++Vf4UG1Bf0E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wnIh53Q3jeK8jEBe1n8kJLa89/H0BxO26ZU8SRIAs9Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4F8U59gzBLGhq58PEWQk2nch+R0Va7eTUoxMneReUIA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ihKagIW3uT1dm22ROr/g5QaCpxZVj2+Fs/YSdM2Noco=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EJtUOOwjkrPUi9mavYAi+Gom9Y2DuFll7aDwo4mq0M0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dIkr8dbaVRQFskAVT6B286BbcBBt1pZPEOcTZqk4ZcI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "aYVAcZYkH/Tieoa1XOjE/zCy5AJcVTHjS0NG2QB7muA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sBidL6y8TenseetpioIAAtn0lK/7C8MoW4JXpVYi3z8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0Dd2klU/t4R86c2WJcJDAd57k/N7OjvYSO5Vf8KH8sw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "I3jZ92WEVmZmgaIkLbuWhBxl7EM6bEjiEttgBJunArA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "aGHoQMlgJoGvArjfIbc3nnkoc8SWBxcrN7hSmjMRzos=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "bpiWPnF/KVBQr5F6MEwc5ZZayzIRvQOLDAm4ntwOi8g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tI7QVKbE6avWgDD9h4QKyFlnTxFCwd2iLySKakxNR/I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XGsge0CnoaXgE3rcpKm8AEeku5QVfokS3kcI+JKV1lk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JQxlryW2Q5WOwfrjAnaZxDvC83Dg6sjRVP5zegf2WiM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YFuHKJOfoqp1iGVxoFjx7bLYgVdsN4GuUFxEgO9HJ5s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Z6vUdiCR18ylKomf08uxcQHeRtmyav7/Ecvzz4av3k4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SPGo1Ib5AiP/tSllL7Z5PAypvnKdwJLzt8imfIMSEJQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "m94Nh6PFFQFLIib9Cu5LAKavhXnagSHG6F5EF8lD96I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pfEkQI98mB+gm1+JbmVurPAODMFPJ4E8DnqfVyUWbSo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DNj3OVRLbr43s0vd+rgWghOL3FqeO/60npdojC8Ry/M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kAYIQrjHVu49W8FTxyxJeiLVRWWjC9fPcBn+Hx1F+Ss=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "aCSO7UVOpoQvu/iridarxkxV1SVxU1i9HVSYXUAeXk4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Gh6hTP/yj1IKlXQ+Q69KTfMlGZjEcXoRLGbQHNFo/1s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/gDgIFQ4tAlJk3GN48IS5Qa5IPmErwGk8CHxAbp6gs0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PICyimwPjxpusyKxNssOOwUotAUbygpyEtORsVGXT8g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4lu+cBHyAUvuxC6JUNyHLzHsCogGSWFFnUCkDwfQdgI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pSndkmoNUJwXjgkbkgOrT5f9nSvuoMEZOkwAN9ElRaE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tyW+D4i26QihNM5MuBM+wnt5AdWGSJaJ4X5ydc9iWTU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9Syjr8RoxUgPKr+O5rsCu07AvcebA4P8IVKyS1NVLWc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "67tPfDYnK2tmrioI51fOBG0ygajcV0pLo5+Zm/rEW7U=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "y0EiPRxYTuS1eVTIaPQUQBBxwkyxNckbePvKgChwd0M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "NWd+2veAaeXQgR3vCvzlI4R1WW67D5YsVLdoXfdb8qg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PY5RQqKQsL2GqBBSPNOEVpojNFRX/NijCghIpxD6CZk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lcvwTyEjFlssCJtdjRpdN6oY+C7bxZY+WA+QAqzj9zg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWE7XRNylvTwO/9Fv56dNqUaQWMmESNS/GNIwgBaEI0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ijwlrUeS8nRYqK1F8kiCYF0mNDolEZS+/lJO1Lg93C8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8KzV+qYGYuIjoNj8eEpnTuHrMYuhzphl80rS6wrODuU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wDyTLjSEFF895hSQsHvmoEQVS6KIkZOtq1c9dVogm9I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SGrtPuMYCjUrfKF0Pq/thdaQzmGBMUvlwN3ORIu9tHU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KySHON3hIoUk4xWcwTqk6IL0kgjzjxgMBObVIkCGvk4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hBIdS9j0XJPeT4ot73ngELkpUoSixvRBvdOL9z48jY8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Tx6um0q9HjS5ZvlFhvukpI6ORnyrXMWVW1OoxvgqII0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zFKlyfX5H81+d4A4J3FKn4T5JfG+OWtR06ddyX4Mxas=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cGgCDuPV7MeMMYEDpgOupqyNP4BQ4H7rBnd2QygumgM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IPaUoy98v11EoglTpJ4kBlEawoZ8y7BPwzjLYBpkvHQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Pfo4Am6tOWAyZNn8G9W5HWWGC3ZWmX0igI/RRB870Ro=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fnTSjd7bC1Udoq6iM7UDnHAC/lsIXSHp/Gy332qw+/I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fApBgVRrTDyEumkeWs5p3ag9KB48SbU4Si0dl7Ns9rc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QxudfBItgoCnUj5NXVnSmWH3HK76YtKkMmzn4lyyUYY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sSOvwhKa29Wq94bZ5jGIiJQGbG1uBrKSBfOYBz/oZeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FdaMgwwJ0NKsqmPZLC5oE+/0D74Dfpvig3LaI5yW5Fs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sRWBy12IERN43BSZIrnBfC9+zFBUdvjTlkqIH81NGt4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/4tIRpxKhoOwnXAiFn1Z7Xmric4USOIfKvTYQXk3QTc=", - "subType": "00" - } - } - ] - }, - { - "_id": { - "$numberInt": "1" - }, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "Mr/laWHUijZT5VT3x2a7crb7wgd/UXOGz8jr8BVqBpM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wXVD/HSbBljko0jJcaxJ1nrzs2+pchLQqYR3vywS8SU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VDCpBYsJIxTfcI6Zgf7FTmKMxUffQv+Ys8zt5dlK76I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zYDslUwOUVNwTYkETfjceH/PU3bac9X3UuQyYJ19qK0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rAOmHSz18Jx107xpbv9fYcPOmh/KPAqge0PAtuhIRnc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BFOB1OGVUen7VsOuS0g8Ti7oDsTt2Yj/k/7ta8YAdGM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2fckE5SPs0GU+akDkUEM6mm0EtcV3WDE/sQsnTtodlk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "mi9+aNjuwIvaMpSHENvKzKRAmX9cYguo2mXLvOoftHQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "K6TWn4VcWWkz/gkUkLmbtwkG7SNeABICmLDnoYJFlLU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Z+2/cEtGU0Fq7QJFNGA/0y4aWAsw0ncG6X0LYRqwS3c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rrSIf+lgcNZFbbUkS9BmE045jRWBpcBJXHzfMVEFuzE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KlHL3Kyje1/LMIfgbCqw1SolxffJvvgsYBV5y77wxuA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hzJ1YBoETmYeCh352dBmG8d8Wse/bUcqojTWpWQlgsc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lSdcllDXx8MA+s0GULjDA1lQkcV0L8/aHtZ6dM2pZ2c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "HGr7JLTTA7ksAnlmjSIwwdBVvgr3fv46/FTdiCPYpos=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "mMr25v1VwOEVZ8xaNUTHJCcsYqV+kwK6RzGYilxPtJ4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "129hJbziPJzNo0IoTU3bECdge0FtaPW8dm4dyNVNwYU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "doiLJ96qoo+v7NqIAZLq6BI5axV8Id8gT5vyJ1ZZ0PM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cW/Lcul3xYmfyvI/0x/+ybN78aQmBK1XIGs1EEU09N8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1aVIwzu9N5EJV9yEES+/g6hOTH7cA2NTcLIc59cu0wU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kw5tyl7Ew0r1wFyrN1mB9FiVW2hK2BxxxUuJDNWjyjQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ADAY2YBrm6RJBDY/eLLcfNxmSJku+mefz74gH66oyco=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8gkqB1LojzPrstpFG7RHYmWxXpIlPDTqWnNsXH7XDRU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "TESfVQMDQjfTZmHmUeYUE2XrokJ6CcrsKx/GmypGjOw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qFM+HFVQ539S0Ouynd1fBHoemFxtU9PRxE5+Dq7Ljy4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jPiFgUZteSmOg4wf3bsEKCZzcnxmMoILsgp/GaZD+dM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YaWUgJhYgPNN7TkFK16H8SsQS226JguaVhOIQxZwQNQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x90/Qk3AgyaFsvWf2KUCu5XF3j76WFSjt/GrnG01060=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ZGWybWL/xlEdMYRFCZDUoz10sywTf7U/7wufsb78lH0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8l4ganN66jIcdxfHAdYLaym/mdzUUQ8TViw3MDRySPc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "c8p5XEGTqxqvRGVlR+nkxw9uUdoqDqTB0jlYQ361qMA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1ZGFLlpQBcU3zIUg8MmgWwFKVz/SaA7eSYFrfe3Hb70=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "34529174M77rHr3Ftn9r8jU4a5ztYtyVhMn1wryZSkU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YkQ4pxFWzc49MS0vZM6S8mNo4wAwo21rePBeF3C+9mI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MhOf4mYY00KKVhptOcXf0bXB7WfuuM801MRJg4vXPgc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7pbbD8ihNIYIBJ3tAUPGzHpFPpIeCTAk5L88qCB0/9w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "C9Q5PoNJTQo6pmNzXEEXUEqH22//UUWY1gqILcIywec=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "AqGVk1QjDNDLYWGRBX/nv9QdGR2SEgXZEhF0EWBAiSE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/sGI3VCbJUKATULJmhTayPOeVW+5MjWSvVCqS77sRbU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yOtbL0ih7gsuoxVtRrACMz+4N5uo7jIR7zzmtih2Beo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uA6dkb2Iyg9Su8UNDvZzkPx33kPZtWr/CCuEY+XgzUM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1DoSFPdHIplqZk+DyWAmEPckWwXw/GdB25NLmzeEZhk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OfDVS0T3ZuIXI/LNbTp6C9UbPIWLKiMy6Wx+9tqNl+g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "3PZjHXbmG6GtPz+iapKtQ3yY4PoFFgjIy+fV2xQv1YU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kaoLN0BoBWsmqE7kKkJQejATmLShd8qffcAmlhsxsGY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vpiw9KgQdegGmp7IJnSGX2miujRLU0xzs0ITTqbPW7c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "NuXFf7xGUefYjIUTuMxNUTCfVHrF8oL0AT7dPv5Plk4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8Tz53LxtfEBJ9eR+d2690kwNsqPV6XyKo2PlqZCbUrc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "e6zsOmHSyV8tyQtSX6BSwui6wK9v1xG3giY/IILJQ2w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2fedFMCxa2DzmIpfbDKGXhQg0PPwbUv6vIWdwwlvhms=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yEJKMFnWXTC8tJUfzCInzQRByNEPjHxpw4L4m8No91Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YbFuWwOiFuQyOzIJXDbOkCWC2DyrG+248TBuVCa1pXU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "w7IkwGdrguwDrar5+w0Z3va5wXyZ4VXJkDMISyRjPGo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YmJUoILTRJPhyIyWyXJTsQ6KSZHHbEpwPVup6Ldm/Ko=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FvMjcwVZJmfh6FP/yBg2wgskK+KHD8YVUY6WtrE8xbg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "h4HCtD4HyYz0nci49IVAa10Z4NJD/FHnRMV4sRX6qro=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "nC7BpXCmym+a0Is2kReM9cYN2M1Eh5rVo8fjms14Oiw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1qtVWaeVo649ZZZtN8gXbwLgMWGLhz8beODbvru0I7Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Ej+mC0QFyMNIiSjR939S+iGBm7dm+1xObu5IcF/OpbU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UQ8LbUG3cMegbr9yKfKanAPQE1EfPkFciVDrNqZ5GHY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4iI3mXIDjnX+ralk1HhJY43mZx2uTJM7hsv9MQzTX7E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0WQCcs3rvsasgohERHHCaBM4Iy6yomS4qJ5To3/yYiw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qDCTVPoue1/DOAGNAlUstdA9Sid8MgEY4e5EzHcVHRk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9F9Mus0UnlzHb8E8ImxgXtz6SU98YXD0JqswOKw/Bzs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pctHpHKVBBcsahQ6TNh6/1V1ZrqOtKSAPtATV6BJqh0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vfR3C/4cPkVdxtNaqtF/v635ONbhTf5WbwJM6s4EXNE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ejP43xUBIex6szDcqExAFpx1IE/Ksi5ywJ84GKDFRrs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jbP4AWYd3S2f3ejmMG7dS5IbrFol48UUoT+ve3JLN6U=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CiDifI7958sUjNqJUBQULeyF7x0Up3loPWvYKw9uAuw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "e2dQFsiHqd2BFHNhlSxocjd+cPs4wkcUW/CnCz4KNuM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PJFckVmzBipqaEqsuP2mkjhJE4qhw36NhfQ9DcOHyEU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "S3MeuJhET/B8VcfZYDR9fvX0nscDj416jdDekhmK11s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CGVHZRXpuNtQviDB2Kj03Q8uvs4w3RwTgV847R7GwPw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yUGgmgyLrxbEpDVy89XN3c2cmFpZXWWmuJ/35zVZ+Jw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "inb6Q97mL1a9onfNTT8v9wsoi/fz7KXKq3p8j90AU9c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CCyYx/4npq9xGO1lsCo8ZJhFO9/tN7DB+/DTE778rYg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "LNnYw4fwbiAZu0kBdAHPEm/OFnreS+oArdB5O/l/I98=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "P006SxmUS/RjiQJVYPdMFnNo3827GIEmSzagggkg05Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "oyvwY+WsnYV6UHuPki1o0ILJ2jN4uyXf9yaUNtZJyBA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "36Lk3RHWh1wmtCWC/Yj6jNIo17U5y6SofAgQjzjVxD8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vOOo8FqeHnuO9mqOYjIb4vgwIwVyXZ5Y+bY5d9tGFUM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "bJiDJjwQRNxqxlGjRm5lLziFhcfTDCnQ/qU1V85qcRg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2Qgrm1n0wUELAQnpkEiIHB856yv76q8jLbpiucetcm0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "5ciPOYxTK0WDwwYyfs7yiVymwtYQXDELLxmM4JLl4/o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "31dC2WUSIOKQc4jwT6PikfeYTwi80mTlh7P31T5KNQU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YluTV2Mu53EGCKLcWfHZb0BM/IPW2xJdG3vYlDMEsM4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dh/8lGo2Ek6KukSwutH6Q35iy8TgV0FN0SJqe0ZVHN8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EVw6HpIs3BKen2qY2gz4y5dw1JpXilfh07msZfQqJpc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FYolLla9L8EZMROEdWetozroU40Dnmwwx2jIMrr7c1A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8M6k4QIutSIj6CM41vvkQtuFsaGrjoR9SZJVSLbfGKQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9LM0VoddDNHway442MqY+Z7vohB2UHau/cddshhzf40=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "66i8Ytco4Yq/FMl6pIRZazz3CZlu8fO2OI6Pne0pvHU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2a/HgX+MjZxjXtSvHgF1yEpHMJBkl8Caee8XrJtn0WM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "frhBM662c4ZVG7mWP8K/HhRjd01lydW/cPcHnDjifqc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6k1T7Q1t668PBqv6fwpVnT1HWh7Am5LtbKvwPJKcpGU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UlJ5Edfusp8S/Pyhw6KTglIejmbr1HO0zUeHn/qFETA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jsxsB+1ECB3assUdoC333do9tYH+LglHmVSJHy4N8Hg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2nzIQxGYF7j3bGsIesECEOqhObKs/9ywknPHeJ3yges=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xJYKtuWrX90JrJVoYtnwP7Ce59XQGFYoalxpNfBXEH0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "NLI5lriBTleGCELcHBtNnmnvwSRkHHaLOX4cKboMgTw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hUOQV0RmE5aJdJww1AR9rirJG4zOYPo+6cCkgn/BGvQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "h4G2Of76AgxcUziBwCyH+ayMOpdBWzg4yFrTfehSC2c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VuamM75RzGfQpj2/Y1jSVuQLrhy6OAwlZxjuQLB/9Ss=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kn9+hLq7hvw02xr9vrplOCDXKBTuFhfbX7d5v/l85Pg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fAiGqKyLZpGngBYFbtYUYt8LUrJ49vYafiboifTDjxs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BxRILymgfVJCczqjUIWXcfrfSgrrYkxTM5VTg0HkZLY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CrFY/PzfPU2zsFkGLu/dI6mEeizZzCR+uYgjZBAHro0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "AEbrIuwvXLTtYgMjOqnGQ8y8axUn5Ukrn7UZRSyfQVw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ouWeVH3PEFg+dKWlXc6BmqirJOaVWjJbMzZbCsce4dA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+hd6xFB+EG+kVP7WH4uMd1CLaWMnt5xJRaY/Guuga9Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zmpGalfAOL3gmcUMJYcLYIRT/2VDO/1Dw4KdYZoNcng=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2PbHAoM/46J2UIZ/vyksKzmVVfxA7YUyIxWeL/N/vBk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7fD9x+zk5MVFesb59Klqiwwmve7P5ON/5COURXj5smE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tlrNQ4jaq051iaWonuv1sSrYhKkL1LtNZuHsvATha3s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fBodm28iClNpvlRyVq0dOdXQ08S7/N3aDwid+PdWvRo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "O+/nnRqT3Zv7yMMGug8GhKHaWy6u7BfRGtZoj0sdN1c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "5AZZ/RTMY4Photnm/cpXZr/HnFRi3eljacMsipkJLHA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "oFVyo/kgoMxBIk2VE52ySSimeyU+Gr0EfCwapXnTpKA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Z8v59DfcnviA0mzvnUk+URVO0UuqAWvtarEgJva/n1c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "P64GOntZ+zBJEHkigoh9FSxSO+rJTqR20z5aiGQ9an4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xMbSuDPfWuO/Dm7wuVl06GnzG9uzTlJJX9vFy7boGlY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kXPB19mRClxdH2UsHwlttS6lLU2uHvzuZgZz7kC45jU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "NDVjVYXAw4k0w4tFzvs7QDq39aaU3HQor4I2XMKKnCk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uKw/+ErVfpTO1dGUfd3T/eWfZW3nUxXCdBGdjvHtZ88=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "av0uxEzWkizYWm0QUM/MN1hLibnxPvCWJKwjOV4yVQY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ERwUC47dvgOBzIsEESMIioLYbFOxOe8PtJTnmDkKuHM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2gseKlG5Le12fS/vj4eaED4lturF16kAgJ1TpW3HxEE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7Cvg0Y3j/5i2F1TeXxlMmU7xwif5dCmwkZAOrVC5K2Y=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-InsertFind.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-InsertFind.json deleted file mode 100644 index 5a2adf690..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-InsertFind.json +++ /dev/null @@ -1,1893 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Decimal. Insert and Find.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalNoPrecision": { - "$gt": { - "$numberDecimal": "0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1" - } - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "encryptedDecimalNoPrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": { - "$numberInt": "0" - }, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "rbf3AeBEv4wWFAKknqDxRW5cLNkFvbIs6iJjc6LShQY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "n+XAuFnP8Dov9TnhGFxNx0K/MnVM9WbJ7RouEu0ndO0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yRXojuVdn5GQtD97qYlaCL6cOLmZ7Cvcb3wFjkLUIdM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DuIkdRPITRs55I4SZmgomAHCIsDQmXRhW8+MOznkzSk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SsBk+Et1lTbU+QRPx+xyJ/jMkmfG+QCvQEpip2YYrzA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "crCIzOd8KhHvvUlX7M1v9bhvU4pLdTc+X2SuqoKU5Ek=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YOWdCw4UrqnxkAaVjqmC4sKQDMVMHEpFGnlxpxdaU6E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "M3SShp81Ff8tQ632qKbv9MUcN6wjDaBReI0VXNu6Xh4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gzHlSPxpM0hT75kQvWFzGlOxKvDoiKQZOr19V6l2zXI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "s3JnppOGYw9SL2Q1kMAZs948v2F5PrpXjGei/HioDWs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cG6+3Gk/zEH68P/uuuwiAUVCuyJwa1LeV+t29FlPPAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dupdvR3AyJtM+g9NDKiaLVOtGca387JQp8w+V03m7Ig=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JqEQc5svj2jTvZ6LLA5ivE+kTb/0aRemSEmxk4G7Zrg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "szcXXXKnob+p3SoM4yED2R920LeJ7cVsclPMFTe4CeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "o1QoGVXmuBdHwHm7aCtGMlMVKrjFdYvJXpoq6uhIAZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Jfm5wPlqqLCJRGQIqRq2NGmpn7s0Vrih2H3YAOoI2YU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zMHLb8ARbsYo8Ld05bqnGFf1Usha6EGb8QKwdSAyps0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yQdtq9lh5pugL7/i0Bj/PuZUUBUIzf+7wj1rl5y736w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wGWVZdO7qIuyDg/BqDgqjgoQ02h5YYgwXQB1oCin2NE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "by9HMLj6NTEpgztZ5HSN6GxImkXPcaFINYDzgZY33X8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tWo0vbasi7bXmn/MsOx13VC1IsWtpx/nYp0uj4iMzdA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tQQpndUYd5O87lOtrGjH3wl9VsOK0ray7RMasL90sBM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cQjXEDCMsOpKLLf+vlTgIHA+cbSJdzqhbSX9Wvh95aA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7yMpU48IxK9SzP2cx3VnTownGEwFmeFofuuFT97SuuY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kSOx1kz0CmBgzKQHZlo65ZUY1DIv9A99JRm+Us2y6Ew=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ubQpdPBe6/xvtr+AcXdfYLSvYCR4ot0tivehkCsupb4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xal+iCJ6FTefRQToyoNksc9NCZShyn04NDGi4IYrcoM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "d7jU4iOK50xHxlkSifcxlZFCM46TSgQzoYivxG3HNLY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tJvl2nsBLBVzL3pp6sKWCL4UXeh3q/roYBJjSb74ve0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OIUCaKRvIx9t1w6Hxlz1IcQTdPNCfdRNwnnTm10W+X0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A9tvzsiElotOUVIB4CqfQp9mAwqvTM35YkmAR170aHA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lI8gpK7hpb7c9x4RQugsxMnQay5LZJmwslZdvMx/dcE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dNCzh40U0XvdKnSDi3HRQOWQftEsDVqc4uUvsVFGoq8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IP+iwEBWBwVVZIdpaMu8k5+soFCz+TZkYn3drKZ9grE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pnqyh6e0y5svHkJDShlN9CHV0WvMBE4QbtJpQw5ZCXc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "elEl42tbVDoRTLjAhZUFEtXiut4b3PVhg/1ZLZSQdtE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vHuu2FxwclMHqyE6JBYbTYgbEkB0dqb/JuaxsvfwsmY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xTf7NCe3Gf8QpE78HR5OknlLTKfs9J+RN9UZpH6fnso=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XiWSasRnJAulGR6+LCVD3mwRObXylqYWR9jvpywq12c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MZMxEQ5ikx0PG1YFIExv0UnTZogsvgeOEZTpzvBDn4w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yZMyMZBDrWbAhvnic7vvIYhmO9m5H2iuv0c8KNZrBzY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xxM14hTPY5j0vvcK2C7YAEjzdsfUTFHozHC0hEo1bxI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+01rqR1xVwkpGXcstbk1ItJqFVjH6Q8MGxEN3Cm9Y1A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xOpLV0Z2VTRJ3iWtnWZcsyjXubTIkYWo31cO+HV1o1k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BWUOLqgLBqc5NwxVlSV5H3KFQPXbCp7mdo+jF+8cJqY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fuQb1S6xZDGlrEbK+kI23aL53PP1PVNwqICnZNt9Yzg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfscnoibFttahLdPVC4Ee+47ewGFKpDSU7M6HX19bKE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rpSW2awybNVeKtat91VFxqbINoTfNhPfQAu+d73Xtf8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9M/CP9ccOIIj2LLFmE0GFDO0Ban2wsNalEXfM6+h+1s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WrEMG49l1ye4MhXs5ZS9tz8P6h+hDvthIg/2wW9ne1Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ImNhbfeyfH8qIEeA5ic0s3dAQBdzzTBS+CPsNih9vZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dWP33YDSn04UKJN2ogh2Rui0iW/0q2y18OCDRVcfyoo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lYv0isAtfGh6H9tdp3cp2eHU7q2J+uk7QrgcxtK3w7Y=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VGMoamB/+7zTOYcY/pqJc96xlv2PdW4hwsIAEIslTDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yNeBWMF7BnD9wVwz2PgJsvWr77QiVvvWUvJF0+fqBug=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfpvObJ+tJBXSvqeN7vlOfmhYign635lciYAJIjUtY8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dsen4NqjzVGjpjufiTMs3+gqeD09EbnuogPgxrJECwg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pxCWVM3sn19NsFEpgHbgLa+PmYlhN3mMiP0Wk8kJhYw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q11KNvJszjYIB9n9HcC+N4uz11a3eRj1L3BH9scKMDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A1PmkgcEToWh1JiVWE6mI5jUu7poxWWuCUt/cgRUUDc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qJo3Hu4PJeanL7XEaWXO/n3YsodhZyd+MJOOmB9Kpd8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BkBKLO8URFscfRY9Bav/1+L9mLohDgNr/MkZtGiraIs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rZq5WA3Hx3xthOyHAJXK//f8pE2qbz7YKu3TIMp9GFY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X07a/Lm80p5xd4RFs1dNmw+90tmPDPdGiAKVZkxd4zY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6YrBn2ofIw1b5ooakrLOwF41BWrps8OO0H9WH4/rtlE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0l86Ag5OszXpa78SlOUV3K9nff5iC1p0mRXtLg9M1s4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Hn6yuxFHodeyu7ISlhYrbSf9pTiH4TDEvbYLWjTwFO0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zdf4y2etKBuIpkEU1zMwoCkCsdisfXZCh8QPamm+drY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rOQ9oMdiK5xxGH+jPzOvwVqdGGnF3+HkJXxn81s6hp4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "61aKKsE3+BJHHWYvs3xSIBvlRmKswmaOo5rygQJguUg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KuDb/GIzqDM8wv7m7m8AECiWJbae5EKKtJRugZx7kR0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Q+t8t2TmNUiCIorVr9F3AlVnX+Mpt2ZYvN+s8UGict8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tJRZIpKxUgHyL83kW8cvfjkxN3z6WoNnUg+SQw+LK+k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pnUsYjip8SvW0+m9mR5WWTkpK+p6uwJ6yBUAlBnFKMk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PArHlz+yPRYDycAP/PgnI/AkP8Wgmfg++Vf4UG1Bf0E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wnIh53Q3jeK8jEBe1n8kJLa89/H0BxO26ZU8SRIAs9Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4F8U59gzBLGhq58PEWQk2nch+R0Va7eTUoxMneReUIA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ihKagIW3uT1dm22ROr/g5QaCpxZVj2+Fs/YSdM2Noco=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EJtUOOwjkrPUi9mavYAi+Gom9Y2DuFll7aDwo4mq0M0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dIkr8dbaVRQFskAVT6B286BbcBBt1pZPEOcTZqk4ZcI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "aYVAcZYkH/Tieoa1XOjE/zCy5AJcVTHjS0NG2QB7muA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sBidL6y8TenseetpioIAAtn0lK/7C8MoW4JXpVYi3z8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0Dd2klU/t4R86c2WJcJDAd57k/N7OjvYSO5Vf8KH8sw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "I3jZ92WEVmZmgaIkLbuWhBxl7EM6bEjiEttgBJunArA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "aGHoQMlgJoGvArjfIbc3nnkoc8SWBxcrN7hSmjMRzos=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "bpiWPnF/KVBQr5F6MEwc5ZZayzIRvQOLDAm4ntwOi8g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tI7QVKbE6avWgDD9h4QKyFlnTxFCwd2iLySKakxNR/I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XGsge0CnoaXgE3rcpKm8AEeku5QVfokS3kcI+JKV1lk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JQxlryW2Q5WOwfrjAnaZxDvC83Dg6sjRVP5zegf2WiM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YFuHKJOfoqp1iGVxoFjx7bLYgVdsN4GuUFxEgO9HJ5s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Z6vUdiCR18ylKomf08uxcQHeRtmyav7/Ecvzz4av3k4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SPGo1Ib5AiP/tSllL7Z5PAypvnKdwJLzt8imfIMSEJQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "m94Nh6PFFQFLIib9Cu5LAKavhXnagSHG6F5EF8lD96I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pfEkQI98mB+gm1+JbmVurPAODMFPJ4E8DnqfVyUWbSo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DNj3OVRLbr43s0vd+rgWghOL3FqeO/60npdojC8Ry/M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kAYIQrjHVu49W8FTxyxJeiLVRWWjC9fPcBn+Hx1F+Ss=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "aCSO7UVOpoQvu/iridarxkxV1SVxU1i9HVSYXUAeXk4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Gh6hTP/yj1IKlXQ+Q69KTfMlGZjEcXoRLGbQHNFo/1s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/gDgIFQ4tAlJk3GN48IS5Qa5IPmErwGk8CHxAbp6gs0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PICyimwPjxpusyKxNssOOwUotAUbygpyEtORsVGXT8g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4lu+cBHyAUvuxC6JUNyHLzHsCogGSWFFnUCkDwfQdgI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pSndkmoNUJwXjgkbkgOrT5f9nSvuoMEZOkwAN9ElRaE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tyW+D4i26QihNM5MuBM+wnt5AdWGSJaJ4X5ydc9iWTU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9Syjr8RoxUgPKr+O5rsCu07AvcebA4P8IVKyS1NVLWc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "67tPfDYnK2tmrioI51fOBG0ygajcV0pLo5+Zm/rEW7U=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "y0EiPRxYTuS1eVTIaPQUQBBxwkyxNckbePvKgChwd0M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "NWd+2veAaeXQgR3vCvzlI4R1WW67D5YsVLdoXfdb8qg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PY5RQqKQsL2GqBBSPNOEVpojNFRX/NijCghIpxD6CZk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lcvwTyEjFlssCJtdjRpdN6oY+C7bxZY+WA+QAqzj9zg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWE7XRNylvTwO/9Fv56dNqUaQWMmESNS/GNIwgBaEI0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ijwlrUeS8nRYqK1F8kiCYF0mNDolEZS+/lJO1Lg93C8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8KzV+qYGYuIjoNj8eEpnTuHrMYuhzphl80rS6wrODuU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wDyTLjSEFF895hSQsHvmoEQVS6KIkZOtq1c9dVogm9I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SGrtPuMYCjUrfKF0Pq/thdaQzmGBMUvlwN3ORIu9tHU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KySHON3hIoUk4xWcwTqk6IL0kgjzjxgMBObVIkCGvk4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hBIdS9j0XJPeT4ot73ngELkpUoSixvRBvdOL9z48jY8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Tx6um0q9HjS5ZvlFhvukpI6ORnyrXMWVW1OoxvgqII0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zFKlyfX5H81+d4A4J3FKn4T5JfG+OWtR06ddyX4Mxas=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cGgCDuPV7MeMMYEDpgOupqyNP4BQ4H7rBnd2QygumgM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IPaUoy98v11EoglTpJ4kBlEawoZ8y7BPwzjLYBpkvHQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Pfo4Am6tOWAyZNn8G9W5HWWGC3ZWmX0igI/RRB870Ro=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fnTSjd7bC1Udoq6iM7UDnHAC/lsIXSHp/Gy332qw+/I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fApBgVRrTDyEumkeWs5p3ag9KB48SbU4Si0dl7Ns9rc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QxudfBItgoCnUj5NXVnSmWH3HK76YtKkMmzn4lyyUYY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sSOvwhKa29Wq94bZ5jGIiJQGbG1uBrKSBfOYBz/oZeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FdaMgwwJ0NKsqmPZLC5oE+/0D74Dfpvig3LaI5yW5Fs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sRWBy12IERN43BSZIrnBfC9+zFBUdvjTlkqIH81NGt4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/4tIRpxKhoOwnXAiFn1Z7Xmric4USOIfKvTYQXk3QTc=", - "subType": "00" - } - } - ] - }, - { - "_id": { - "$numberInt": "1" - }, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RGTjNVEsNJb+DG7DpPOam8rQWD5HZAMpRyiTQaw7tk8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "I93Md7QNPGmEEGYU1+VVCqBPBEvXdqHPtTJtMOn06Yk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "GecBFQ1PemlECWZWCl7f74vmsL6eB6mzQ9n6tK6FYfs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QpjhZl+O1ORifgtCZuWAdcP6OKL7IZ2cA46v8FJcV28=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RlQWwhU+uVv0a+9IB5cUkEfvHBvOw3B1Sx6WfPWMqes=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ubb81XTC7U+4tcNzf1oYvOY6gR5hC2Izqx54f4GuJ0E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6M4Q5NMQ9TqNnjzGOxIkiUIY8TEL0I3XD1QnhefQUqU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BtInzk9t2FFMCEY6AQ7zN8jwrrZEs2irSv6q0Q4NaIw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6vxXfETu9cuBIpRBo3jUUU04mJIH/aAhLX8K6VI5Xv0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wXPCdS+q23zi1bkPnaVG2j0PsVtxdeSLJ//h6J1x8RU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KY3KkfBAsN2l80wbpj41G0gwBR5KmmFnZcagg7D3ENk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tI8NFAxXCX4VOnY5X73K6KI/Yspd3aR94KV39MhJlAw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "nFxH0UC3mATKA6Vboz+QX/hAjj19kF/SH6H5Cne7qC0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q8hYqIYaIi7nOdG/7qQZYnz8Bsacfi66M1nVku4SH08=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4saA92R4arp4anvD9xFtze+sNcQqTEhPHyl1h70A8NE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DbIziOBRRyeQS6RtBR09E37LV+CTKrEjGoRMLSpG6eE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Fv80Plp/7w2gnVqrwawLd6qhJ10G4NCDm3re67cNq4Y=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "T/T2oiQCBBES4YN7EodzPRdabZSFlYIClHBym+bQUZE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ZQgHD3l46Ujqtbnj1VbbeM29C9wJzOhz+yZ/7XdSrxk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ltlFKzWvyZvHxDFOYDd/XXJ6kUiJj0ln2HTCEz2o4Z4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "flW8A7bltC1u8bzx0WJtxosGJdOVsJFfbx33jxnpFGg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SXO+92QbMKwUSG2t27ciunV1c3VvFkUuDmSczpRe008=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+KioGs1GM+xRBzFE67ePTWj04KMSE5/Y6qUF7nJ5kvU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L3xNVbh6YH+RzqABN+5Jgb7T234Efpn766DmUvxIxgg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hPF+60mBYPjh21dEmPlBhKgyc9S2qLtTkypYvnqP2Fc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EletRsETy2HcjaPIm2c8CkT7ch/P3pJJDC8hasepcSU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "r5bMXUaNKqLPxZ+TG9HYTG4aSDgcpim27rN8rQFkM0w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0Q7Erdr8+/S0wUEDDIqlS5XjBVWvhZY65K0uUDb6+Ns=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xEcnhXy35hbXNVBPOOt3TUHbxvKfQ48KjA9b6/rbMqQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "T8bEpiQNgsEudXvyKE9SZlSvbpV/LUaslsdqgSFltyo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hIoiaF2YjnxDbODfhFEB+JGZ5nf8suD3Shck5bwQ3N0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qnA6qzejeRJ0rsZaZ0zOvKAaXyxt5lpscKQNYFZNl4k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "anAKCL2DN/le2VaP0n2ucYSEH/DaaEH/8Sa4OqTZsRA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JCZlBJaFm618oWYSnT9Jr1MtwFVw4BZjOzO+5yWgR90=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yxyk4n9762WzcDVGnTn4jCqUnSMIVCrLDIjCX1QVj34=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fDI6fdKvDJwim5/CQwWZEzcrXE3LHgy7FTtffcC7tXE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Vex+gcz5T+WkzsVZQrkqUR2ryyZbnaOGuWpYvjN0zCw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8TLEXz+Gbbp6llHpZXVjLsdlYY9f6hrKpHVpyfDe0RY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7fTyt5BrunypS65TfOzFW2E2qdIuT4SLeDeGlbQoJCs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8fKGrkqN0/KuSjyXgDBmRauDKrSa//JBKRWHEB9xBf4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "s4codmG7uN4ss6P357jL21lazEe90M9GOK5WrOknSV0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RkSpua8XF+NUdxVDU90EbLUTTyZFX3tt3atBTroFaRk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "LnTCuCDyAHK5B9KXzjtwGmWB+qergQk2OCjnIx9MI2A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cBFh0virAX4pVXf/udIGI2951i0+0aZAdJcBVGtYnT4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "G54X6myQXWZ5fw/G31en3QbdgfXzL9+hFTtJpnWMqDI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EdsiiuezcsFJFnYIyGjCOhnqMj1BOwTB5EFxN+ERUkg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dVH9MXLtk0WTwGQ3xmrhOqfropMUkDW3o6paNPGl3NU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sB3HqXKWY3pKbuEH8BTbfNIGfbY+7/ZbOc3XC+JRNNI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WHyDk62Xhqbo4/iie2aLIM4x2uuAjv6102dJSHI58oM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pNUFuHpeNRDUZ/NrtII2c6sNc9eGR1lIUlIyXKERA+0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UPa+pdCqnN0bfAptdzldQOSd01gidrDKy8KhWrpSKAI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "l+7dOAlo+HUffMqFYXL6pgUFeTbwOM9CjKQLxEoLtc4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SRnDXV/rN6C8xwMutv9E1luv3DOUio3VkgPr8Cpm7Ew=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QcH6gl+gX7xZ7OWhUNQMbndJy0Piz49pDo6RsnLkVSA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "t+uL4DnfsI/Zll/KXWW1cOKX3Hu8WIkm3pt9efCVSAQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "myutHDctku/+Uug/nD8gRbYvmx/IovtoAAC2/fz2oHA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6C+cjD0e0nSCP6cPqQYbNG7SlOd6Mfvi8hyfm7Ng+D8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zg01JSoOj9oBKT0S1ldJucXzY5AKgreS+h2xJreWTOs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7qQ80/FjodHl1m1py/Oii0/9C/xWbLdhaRXQ+kkCP10=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YwWMNH07vL6c5Nhg+MRnVByhzUunu8y0VLM9z/XvR5U=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Dle8bU98+fudAbc14SToZFkwvV3tcYVsjDug0NWljpc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "J+eKL1vPJmlzltvhI6Li5Fz/TJmi3Ng+ehRTcs46API=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zB3XzfFygLwC3WHkj0up+VbEd25KKoce1vOpG/5bwK4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vnVnmOnL+z2pqwE+A6cVKS0Iwy4F4/2IiElJca9bUQM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+lG5r/Fpqry3BtFuvY67+RntmHAMDoLVOSGc6ZoXPb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L5MXQertqc6uj7ADe8aWKbd1sYHPCE7P1VYVg9Zc3VI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "imKONuZgopt0bhM3GMX2WVPwQYMTobuUUEdhcLfHs4c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "eOkU1J1uVbiVFWBerbXsSIVcF2nqiicTkFy4x7kFHB8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gI0uDhXeoH/UatDQKEf4qo8FHzWZDhb/wuWTqbq/ID4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cOkd5Aa3btYhtojE/smsF/PJnULqQ4NNqTkU6KXTFmo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "AWNJMs1MTe294oFipp8Y6P0CjpkZ4qCZoClQF3XcHq8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6gJtlzXOFhGYrVbTuRMmvMlDTwXdNtR9aGBlHZPwIMw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "LEmwVGA/xsEG7UrcOoYLFu6KCXgijzFznenknuDacm8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "mIRFPTXRrGaPtp/Ydij2jgkRe4uoUvAKxW2d8b9zYL0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "B+Uv2u48WALOO0L311z+eryjYQzKJVMfdHMZPhOAFmY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "INXXp0wDyVCq+NtfIrrC2ciETmyW/dWB/48/u4yLEZ4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "se7DGo8XrlrQDLEcco1tZrQt9kDe+0RTyl2bw/quG4w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vr0m2+Zk9lbN6UgWCyn8xJWJOokU3IDYab5U5q1+CgQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XI+eJ8Gy2JktG1gICgoj1qpsfy1tKmH0kglWbaQH6DA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A+UCuNnuAUqnQzspA6TVqUPRmtZmpSex5HFw7THRxs0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xaH2Ehfljd19uo0Fvb3iwkdaiWEVQd2YPoitgEPkhSM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "S/iZBJGcc8+qZxyMtab65MMBoSglybwk3x58Nb86gnY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "w14ZE5qqY5YgkS4Zcs9YNbrQbY1XfGOOHNn9bOYnFVQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0MhGd/jEF1vjkKGp+ZMn9SjLK54jkp9W4Hg+Sp/oxaI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "92QZ73e/NRTYgCm4aifaKth6aAsKnLLccBc0zx/qUTY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WOjzemCgFJOiGIp81RSVh/tFlzSTj9eFWcBnsiv2Ycs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DrsP9CmfKPjw5yLL8bnSeAxfNzAwlb+Z8OqCiKgBY7o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lMogqg8veBv6mri3/drMe9afJiKMvevkmGcw9BedfLo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "TxqwNcY8Tg2MPpNdkPBwvfpuTttSYRHU26DGECKYQ9o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "l0u1b4b4vYACWIwfnB7PZac4oDEgjQZCzHruNPTgAIY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "iVSGQ+cCfhbWIrY/v/WBORK92elu9gfRKyGhr6r/k00=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yK1forG50diEXte8ECzjfpHeYsPyuQ/dgxbxn/nzY5k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gIfTLCD3VwnOwkC0zPXWTqaITxX6ZplA69PO2a6zolc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "O/Zxlgh3WqpzJ7+Sd8XWMVID4/GXJUUWaSqfgDUi3b0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ZQ6yv368zwahUqSUYH/StL0Qgz/TwS1CzlMjVDvCciI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "m2rPEYkjwyiKdonMrKlcF7hya4lFOAUwEePJ3SgrNx8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Mq0yl5iVKlq71bT/dT/fXOWf2n90bTnXFnOdGDN0JOc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6qDGMXipPLC2O6EAAMjO2F9xx4rdqZso4IkPpH2304U=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jvQHRQQa2RIszE2LX2Hv2LbRhYawJ6qmtRt8HZzFQXg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ovJXQrkZlpeHRciKyE/WWNm5O389gRgzx1W+Dw596X4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "a4kgRNvYctGYqyQv9qScL/WkljTYVylJ9pE9KDULlxU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qV4Q48vPiCJMTjljotzYKI/zfExWpkKOSHGcAjGyDig=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jtI7zbBF+QW/aYYTkn90zzyHLXLgmy7l1bzgMb2oqic=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q0KmJl9txPdn962UNvnfe6UFhdk9YaFZuTm33F+csso=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ULNdEqeZJgtmNOhN/Y9INzsE9AnxWYwOMn+pIbRXIFs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "R4oz9+wkdjpKe5tE1jpG7IURAnfvS5fLP4LrD5cZfTE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qG5Z7VhwSu/HT/YFTgDzyAAzJKq51xPw2HeEV5btYC4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OM/1DmIIZ5Qyhtq8TGkHTBEMVKjAnKRZMRXYtTG8ctc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2R5vZbljLXnDFA99YfGuRB7pAdPJVKsT25zLNMC0fUk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OMbavF2EmdAz1fHkLV3ctFEUDfriKhoT2gidwHZ9z1o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MWT4Zrw3/vVvTYMa1Is5Pjr3wEwnBfnEAPPUAHKQhNU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tBkRPfG9yxfKocQx5pAJX0oEHKPL0Tgtr+0UYe09InE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lqxpnDR/H0YgH7RcfKoNoaaRhe1SIazIeMbQ1fu9y3Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "utT1UdR22PWOTrOkZauztX613lAplV4eh/ejTRb7ZSk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "S+Y2yFyKi/a6FXhih4yGo29X8I8OT6/zwEoX6NMKT4o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QSjVppg29x6oS5yBg8OFjrFt0tuTpWCuKxfIy0k8YnE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "y3r6/Xsfvsl3HksXlVYkJgHUqpQGfICxg3x9f8Zw1qM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BSltHzEwDjFN4du9rDHAPvl22atlcTioEtt+gC5L1tk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0arGXjSN0006UnXbrWsGqhvBair569DeFDUME3Df3rA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "s/DumaMad08S+PBUUcrS+v42K0z8HgcdiQtrFAEu2Qs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EzJ8Y8N0OQBTlnvrK82PdevDNZZO4E6CNgYVu8Cj6Ks=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VA4vr8jBPI5QdiPrULzzZjBMIUbG3V7Slg5zm0bFcKc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YAOvEB2ZLtq9LQiFViBHWaxxWVVonC2rNYj9tN9s3L0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hgaHMo9aAGS+nBwvqnTjZO+YkiQPY1c1XcIYeaYKHyI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YvaoLt3ZpH0atB0tNzwMjpoxRYJXl0DqSjisMJiGVBE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EMmW6CptFsiLoPOi5/uAJQ2FmeLg6mCpuVLLrRWk7Mc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1jQsNMarSnarlYmXEuoFokeBMg/090qUD9wqo1Zn8Gs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hupXNKhRpJxpyDAAP1TgJ5JMZh9lhbMk6s7D7dMS3C8=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-Update.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-Update.json deleted file mode 100644 index b840d3834..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Decimal-Update.json +++ /dev/null @@ -1,1910 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Decimal. Update.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$numberDecimal": "1" - } - } - } - }, - { - "name": "updateOne", - "arguments": { - "filter": { - "encryptedDecimalNoPrecision": { - "$gt": { - "$numberDecimal": "0" - } - } - }, - "update": { - "$set": { - "encryptedDecimalNoPrecision": { - "$numberDecimal": "2" - } - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command_name": "update", - "command": { - "update": "default", - "ordered": true, - "updates": [ - { - "q": { - "encryptedDecimalNoPrecision": { - "$gt": { - "$binary": { - "base64": "DR1jAAADcGF5bG9hZACxYgAABGcAnWIAAAMwAH0AAAAFZAAgAAAAAJu2KgiI8vM+kz9qD3ZQzFQY5qbgYqCqHG5R4jAlnlwXBXMAIAAAAAAAUXxFXsz764T79sGCdhxvNd5b6E/9p61FonsHyEIhogVsACAAAAAAt19RL3Oo5ni5L8kcvgOJYLgVYyXJExwP8pkuzLG7f/kAAzEAfQAAAAVkACAAAAAAPQPvL0ARjujSv2Rkm8r7spVsgeC1K3FWcskGGZ3OdDIFcwAgAAAAACgNn660GmefR8jLqzgR1u5O+Uocx9GyEHiBqVGko5FZBWwAIAAAAADflr+fsnZngm6KRWYgHa9JzK+bXogWl9evBU9sQUHPHQADMgB9AAAABWQAIAAAAAD2Zi6kcxmaD2mY3VWrP+wYJMPg6cSBIYPapxaFQxYFdQVzACAAAAAAM/cV36BLBY3xFBXsXJY8M9EHHOc/qrmdc2CJmj3M89gFbAAgAAAAAOpydOrKxx6m2gquSDV2Vv3w10GocmNCFeOo/fRhRH9JAAMzAH0AAAAFZAAgAAAAAOaNqI9srQ/mI9gwbk+VkizGBBH/PPWOVusgnfPk3tY1BXMAIAAAAAAc96O/pwKCmHCagT6T/QV/wz4vqO+R22GsZ1dse2Vg6QVsACAAAAAAgzIak+Q3UFLTHXPmJ+MuEklFtR3eLtvM+jdKkmGCV/YAAzQAfQAAAAVkACAAAAAA0XlQgy/Yu97EQOjronl9b3dcR1DFn3deuVhtTLbJZHkFcwAgAAAAACoMnpVl6EFJak8A+t5N4RFnQhkQEBnNAx8wDqmq5U/dBWwAIAAAAACR26FJif673qpwF1J1FEkQGJ1Ywcr/ZW6JQ7meGqzt1QADNQB9AAAABWQAIAAAAAAOtpNexRxfv0yRFvZO9DhlkpU4mDuAb8ykdLnE5Vf1VAVzACAAAAAAeblFKm/30orP16uQpZslvsoS8s0xfNPIBlw3VkHeekYFbAAgAAAAAPEoHj87sYE+nBut52/LPvleWQBzB/uaJFnosxp4NRO2AAM2AH0AAAAFZAAgAAAAAIr8xAFm1zPmrvW4Vy5Ct0W8FxMmyPmFzdWVzesBhAJFBXMAIAAAAABYeeXjJEzTHwxab6pUiCRiZjxgtN59a1y8Szy3hfkg+gVsACAAAAAAJuoY4rF8mbI+nKb+5XbZShJ8191o/e8ZCRHE0O4Ey8MAAzcAfQAAAAVkACAAAAAAl+ibLk0/+EwoqeC8S8cGgAtjtpQWGEZDsybMPnrrkwEFcwAgAAAAAHPPBudWgQ+HUorLDpJMqhS9VBF2VF5aLcxgrM1s+yU7BWwAIAAAAAAcCcBR2Vyv5pAFbaOU97yovuOi1+ATDnLLcAUqHecXcAADOAB9AAAABWQAIAAAAACR9erwLTb+tcWFZgJ2MEfM0PKI9uuwIjDTHADRFgD+SQVzACAAAAAAcOop8TXsGUVQoKhzUllMYWxL93xCOkwtIpV8Q6hiSYYFbAAgAAAAAKXKmh4V8veYwob1H03Q3p3PN8SRAaQwDT34KlNVUjiDAAM5AH0AAAAFZAAgAAAAALv0vCPgh7QpmM8Ug6ad5ioZJCh7pLMdT8FYyQioBQ6KBXMAIAAAAADsCPyIG8t6ApQkRk1fX/sfc1kpuWCWP8gAEpnYoBSHrQVsACAAAAAAJe/r67N6d8uTiogvfoR9rEXbIDjyLb9EVdqkayFFGaYAAzEwAH0AAAAFZAAgAAAAAIW4AxJgYoM0pcNTwk1RSbyjZGIqgKL1hcTJmNrnZmoPBXMAIAAAAAAZpfx3EFO0vY0f1eHnE0PazgqeNDTaj+pPJMUNW8lFrAVsACAAAAAAP+Um2vwW6Bj6vuz9DKz6+6aWkoKoEmFNoiz/xXm7lOsAAzExAH0AAAAFZAAgAAAAAKliO6L9zgeuufjj174hvmQGNRbmYYs9yAirL7OxwEW3BXMAIAAAAAAqU7vs3DWUQ95Eq8OejwWnD0GuXd+ASi/uD6S0l8MM1QVsACAAAAAAb9legYzsfctBPpHyl7YWpPmLr5QiNZFND/50N1vv2MUAAzEyAH0AAAAFZAAgAAAAAOGQcCBkk+j/Kzjt/Cs6g3BZPJG81wIHBS8JewHGpgk+BXMAIAAAAABjrxZXWCkdzrExwCgyHaafuPSQ4V4x2k9kUCAqUaYKDQVsACAAAAAADBU6KefT0v8zSmseaMNmQxKjJar72y7MojLFhkEHqrUAAzEzAH0AAAAFZAAgAAAAAPmCNEt4t97waOSd5hNi2fNCdWEkmcFJ37LI9k4Az4/5BXMAIAAAAABX7DuDPNg+duvELf3NbLWkPMFw2HGLgWGHyVWcPvSNCAVsACAAAAAAS7El1FtZ5STh8Q1FguvieyYX9b2DF1DFVsb9hzxXYRsAAzE0AH0AAAAFZAAgAAAAAD4vtVUYRNB+FD9yoQ2FVJH3nMeJeKbi6eZfth638YqbBXMAIAAAAAANCuUB4OdmuD6LaDK2f3vaqfgYYvg40wDXOBbcFjTqLwVsACAAAAAA9hqC2VoJBjwR7hcQ45xO8ZVojwC83jiRacCaDj6Px2gAAzE1AH0AAAAFZAAgAAAAAJPIRzjmTjbdIvshG6UslbEOd797ZSIdjGAhGWxVQvK1BXMAIAAAAABgmJ0Jh8WLs9IYs/a7DBjDWd8J3thW/AGJK7zDnMeYOAVsACAAAAAAi9zAsyAuou2oiCUHGc6QefLUkACa9IgeBhGu9W/r0X8AAzE2AH0AAAAFZAAgAAAAAABQyKQPoW8wGPIqnsTv69+DzIdRkohRhOhDmyVHkw9WBXMAIAAAAAAqWA2X4tB/h3O1Xlawtz6ndI6WaTwgU1QYflL35opu5gVsACAAAAAAWI/Gj5aZMwDIxztqmVL0g5LBcI8EdKEc2UA28pnekQoAAzE3AH0AAAAFZAAgAAAAACB7NOyGQ1Id3MYnxtBXqyZ5Ul/lHH6p1b10U63DfT6bBXMAIAAAAADpOryIcndxztkHSfLN3Kzq29sD8djS0PspDSqERMqokQVsACAAAAAADatsMW4ezgnyi1PiP7xk+gA4AFIN/fb5uJqfVkjg4UoAAzE4AH0AAAAFZAAgAAAAAKVfXLfs8XA14CRTB56oZwV+bFJN5BHraTXbqEXZDmTkBXMAIAAAAAASRWTsfGOpqdffiOodoqIgBzG/yzFyjR5CfUsIUIWGpgVsACAAAAAAkgCHbCwyX640/0Ni8+MoYxeHUiC+FSU4Mn9jTLYtgZgAAzE5AH0AAAAFZAAgAAAAAH/aZr4EuS0/noQR9rcF8vwoaxnxrwgOsSJ0ys8PkHhGBXMAIAAAAACd7ObGQW7qfddcvyxRTkPuvq/PHu7+6I5dxwS1Lzy5XAVsACAAAAAA3q0eKdV7KeU3pc+CtfypKR7BPxwaf30yu0j9FXeOOboAAzIwAH0AAAAFZAAgAAAAAKvlcpFFNq0oA+urq3w6d80PK1HHHw0H0yVWvU9aHijXBXMAIAAAAADWnAHQ5Fhlcjawki7kWzdqjM2f6IdGJblojrYElWjsZgVsACAAAAAAO0wvY66l24gx8nRxyVGC0QcTztIi81Kx3ndRhuZr6W4AAzIxAH0AAAAFZAAgAAAAAH/2aMezEOddrq+dNOkDrdqf13h2ttOnexZsJxG1G6PNBXMAIAAAAABNtgnibjC4VKy5poYjvdsBBnVvDTF/4mmEAxsXVgZVKgVsACAAAAAAqvadzJFLqQbs8WxgZ2D2X+XnaPSDMLCVVgWxx5jnLcYAAzIyAH0AAAAFZAAgAAAAAF2wZoDL6/V59QqO8vdRZWDpXpkV4h4KOCSn5e7x7nmzBXMAIAAAAADLZBu7LCYjbThaVUqMK14H/elrVOYIKJQCx4C9Yjw37gVsACAAAAAAEh6Vs81jLU204aGpL90fmYTm5i5R8/RT1uIbg6VU3HwAAzIzAH0AAAAFZAAgAAAAAH27yYaLn9zh2CpvaoomUPercSfJRUmBY6XFqmhcXi9QBXMAIAAAAAAUwumVlIYIs9JhDhSj0R0+59psCMsFk94E62VxkPt42QVsACAAAAAAT5x2hCCd2bpmpnyWaxas8nSxTc8e4C9DfKaqr0ABEysAAzI0AH0AAAAFZAAgAAAAALMg2kNAO4AFFs/mW3In04yFeN4AP6Vo0klyUoT06RquBXMAIAAAAAAgGWJbeIdwlpqXCyVIYSs0dt54Rfc8JF4b8uYc+YUj0AVsACAAAAAAWHeWxIkyvXTOWvfZzqtPXjfGaWWKjGSIQENTU3zBCrsAAzI1AH0AAAAFZAAgAAAAALas/i1T2DFCEmrrLEi7O2ngJZyFHialOoedVXS+OjenBXMAIAAAAAA1kK0QxY4REcGxHeMkgumyF7iwlsRFtw9MlbSSoQY7uAVsACAAAAAAUNlpMJZs1p4HfsD4Q4WZ4TBEi6Oc2fX34rzyynqWCdwAAzI2AH0AAAAFZAAgAAAAAP1TejmWg1CEuNSMt6NUgeQ5lT+oBoeyF7d2l5xQrbXWBXMAIAAAAABPX0kj6obggdJShmqtVfueKHplH4ZrXusiwrRDHMOKeQVsACAAAAAAIYOsNwC3DA7fLcOzqdr0bOFdHCfmK8tLwPoaE9uKOosAAzI3AH0AAAAFZAAgAAAAAMrKn+QPa/NxYezNhlOX9nyEkN1kE/gW7EuZkVqYl0b8BXMAIAAAAABUoZMSPUywRGfX2EEencJEKH5x/P9ySUVrhStAwgR/LgVsACAAAAAAMgZFH6lQIIDrgHnFeslv3ld20ynwQjQJt3cAp4GgrFkAAzI4AH0AAAAFZAAgAAAAAMmD1+a+oVbiUZd1HuZqdgtdVsVKwuWAn3/M1B6QGBM3BXMAIAAAAACLyytOYuZ9WEsIrrtJbXUx4QgipbaAbmlJvSZVkGi0CAVsACAAAAAA4v1lSp5H9BB+HYJ4bH43tC8aeuPZMf78Ng1JOhJh190AAzI5AH0AAAAFZAAgAAAAAOVKV7IuFwmYP1qVv8h0NvJmfPICu8yQhzjG7oJdTLDoBXMAIAAAAABL70XLfQLKRsw1deJ2MUvxSWKxpF/Ez73jqtbLvqbuogVsACAAAAAAvfgzIorXxE91dDt4nQxYfntTsx0M8Gzdsao5naQqcRUAAzMwAH0AAAAFZAAgAAAAAKS/1RSAQma+xV9rz04IcdzmavtrBDjOKPM+Z2NEyYfPBXMAIAAAAAAOJDWGORDgfRv8+w5nunh41wXb2hCA0MRzwnLnQtIqPgVsACAAAAAAf42C1+T7xdHEFF83+c2mF5S8PuuL22ogXXELnRAZ4boAAzMxAH0AAAAFZAAgAAAAAFeq8o82uNY1X8cH6OhdTzHNBUnCChsEDs5tm0kPBz3qBXMAIAAAAABaxMBbsaeEj/EDtr8nZfrhhhirBRPJwVamDo5WwbgvTQVsACAAAAAAMbH453A+BYAaDOTo5kdhV1VdND1avNwvshEG/4MIJjQAAzMyAH0AAAAFZAAgAAAAAI8IKIfDrohHh2cjspJHCovqroSr5N3QyVtNzFvT5+FzBXMAIAAAAABXHXteKG0DoOMmECKp6ro1MZNQvXGzqTDdZ0DUc8QfFAVsACAAAAAA/w5s++XYmO+9TWTbtGc3n3ndV4T9JUribIbF4jmDLSMAAzMzAH0AAAAFZAAgAAAAAJkHvm15kIu1OtAiaByj5ieWqzxiu/epK6c/9+KYIrB0BXMAIAAAAACzg5TcyANk0nes/wCJudd1BwlkWWF6zw3nGclq5v3SJQVsACAAAAAAvruXHTT3irPJLyWpI1j/Xwf2FeIE/IV+6Z49pqRzISoAAzM0AH0AAAAFZAAgAAAAAAYSOvEWWuSg1Aym7EssNLR+xsY7e9BcwsX4JKlnSHJcBXMAIAAAAABT48eY3PXVDOjw7JpNjOe1j2JyI3LjDnQoqZ8Je5B2KgVsACAAAAAAU2815RR57TQ9uDg0XjWjBkAKvf8yssxDMzrM4+FqP6AAAzM1AH0AAAAFZAAgAAAAAGQxC9L1e9DfO5XZvX1yvc3hTLtQEdKO9FPMkyg0Y9ZABXMAIAAAAADtmcMNJwdWLxQEArMGZQyzpnu+Z5yMmPAkvgq4eAKwNQVsACAAAAAAJ88zt4Y/Hoqh+zrf6KCOiUwHbOzCxSfp6k/qsZaYGEgAAzM2AH0AAAAFZAAgAAAAADLHK2LNCNRO0pv8n4fAsxwtUqCNnVK8rRgNiQfXpHSdBXMAIAAAAACf16EBIHRKD3SzjRW+LMOl+47QXA3CJhMzlcqyFRW22AVsACAAAAAAMGz4fAOa0EoVv90fUffwLjBrQhHATf+NdlgCR65vujAAAzM3AH0AAAAFZAAgAAAAAHiZJiXKNF8bbukQGsdYkEi95I+FSBHy1I5/hK2uEZruBXMAIAAAAADE+lZBa8HDUJPN+bF6xI9x4N7GF9pj3vBR7y0BcfFhBAVsACAAAAAAGIEN6sfqq30nyxW4dxDgXr/jz5HmvA9T1jx/pKCn4zgAAzM4AH0AAAAFZAAgAAAAAI1oa2OIw5TvhT14tYCGmhanUoYcCZtNbrVbeoMldHNZBXMAIAAAAAAx2nS0Ipblf2XOgBiUOuJFBupBhe7nb6QPLZlA4aMPCgVsACAAAAAA9xu828hugIgo0E3de9dZD+gTpVUGlwtDba+tw/WcbUoAAzM5AH0AAAAFZAAgAAAAABgTWS3Yap7Q59hii/uPPimHWXsr+DUmsqfwt/X73qsOBXMAIAAAAACKK05liW5KrmEAvtpCB1WUltruzUylDDpjea//UlWoOAVsACAAAAAAcgN4P/wakJ5aJK5c1bvJBqpVGND221dli2YicPFfuAYAAzQwAH0AAAAFZAAgAAAAABOAnBPXDp6i9TISQXvcNKwGDLepZTu3cKrB4vKnSCjBBXMAIAAAAADjjzZO7UowAAvpwyG8BNOVqLCccMFk3aDK4unUeft5ywVsACAAAAAA4zkCd4k9gvfXoD1C7vwTjNcdVJwEARh8h/cxZ4PNMfgAAzQxAH0AAAAFZAAgAAAAAHN8hyvT1lYrAsdiV5GBdd5jhtrAYE/KnSjw2Ka9hjz9BXMAIAAAAAD794JK7EeXBs+D7yOVK7nWF8SbZ/7U8gZ7nnT9JFNwTAVsACAAAAAAg8Wt1HO3NhByq2ggux2a4Lo6Gryr24rEFIqh2acrwWMAAzQyAH0AAAAFZAAgAAAAAO93bPrq8bsnp1AtNd9ETnXIz0lH/2HYN/vuw9wA3fyFBXMAIAAAAABHlls5fbaF2oAGqptC481XQ4eYxInTC29aElfmVZgDUgVsACAAAAAANoQXEWpXJpgrSNK/cKi/m7oYhuSRlp1IZBF0bqTEATcAAzQzAH0AAAAFZAAgAAAAAL1YsAZm1SA0ztU6ySIrQgCCA74V6rr0/4iIygCcaJL6BXMAIAAAAADTXWTHWovGmUR1Zg9l/Aqq9H5mOCJQQrb/Dfae7e3wKAVsACAAAAAA5dunyJK6/SVfDD0t9QlNBcFqoZnf9legRjHaLSKAoQMAAzQ0AH0AAAAFZAAgAAAAAEoFAeHk0RZ9kD+cJRD3j7PcE5gzWKnyBrF1I/MDNp5mBXMAIAAAAACgHtc2hMBRSZjKw8RAdDHK+Pi1HeyjiBuAslGVNcW5tAVsACAAAAAAXzBLfq+GxRtX4Wa9fazA49DBLG6AjZm2XODStJKH8D0AAzQ1AH0AAAAFZAAgAAAAAAW+7DmSN/LX+/0uBVJDHIc2dhxAGz4+ehyyz8fAnNGoBXMAIAAAAAA6Ilw42EvvfLJ3Eq8Afd+FjPoPcQutZO6ltmCLEr8kxQVsACAAAAAAbbZalyo07BbFjPFlYmbmv0z023eT9eLkHqeVUnfUAUAAAzQ2AH0AAAAFZAAgAAAAANBdV7M7kuYO3EMoQItAbXv4t2cIhfaT9V6+s4cg9djlBXMAIAAAAABvz4MIvZWxxrcJCL5qxLfFhXiUYB1OLHdKEjco94SgDgVsACAAAAAAK2GVGvyPIKolF/ECcmfmkVcf1/IZNcaTv96N92yGrkEAAzQ3AH0AAAAFZAAgAAAAAMoAoiAn1kc79j5oPZtlMWHMhhgwNhLUnvqkqIFvcH1NBXMAIAAAAADcJTW7WiCyW0Z9YDUYwppXhLj4Ac1povpJvcAq+i48MQVsACAAAAAAIGxGDzoeB3PTmudl4+j6piQB++e33EEzuzAiXcqGxvUAAzQ4AH0AAAAFZAAgAAAAACI3j5QP7dWHpcT6WO/OhsWwRJNASBYqIBDNzW8IorEyBXMAIAAAAABxUpBSjXwCKDdGP9hYU+RvyR+96kChfvyyRC4jZmztqAVsACAAAAAAvBCHguWswb4X0xdcAryCvZgQuthXzt7597bJ5VxAMdgAAzQ5AH0AAAAFZAAgAAAAAKsbycEuQSeNrF8Qnxqw3x3og8JmQabwGqnDbqzFRVrrBXMAIAAAAACno/3ef2JZJS93SVVzmOZSN+jjJHT8s0XYq2M46d2sLAVsACAAAAAAAt5zLJG+/j4K8rnkFtAn8IvdUVNefe6utJ3rdzgwudIAAzUwAH0AAAAFZAAgAAAAAPXIcoO8TiULqlxzb74NFg+I8kWX5uXIDUPnh2DobIoMBXMAIAAAAADR6/drkdTpnr9g1XNvKDwtBRBdKn7c2c4ZNUVK5CThdQVsACAAAAAAJqOA1c6KVog3F4Hb/GfDb3jCxXDRTqpXWSbMH4ePIJsAAzUxAH0AAAAFZAAgAAAAAEa03ZOJmfHT6/nVadvIw71jVxEuIloyvxXraYEW7u7pBXMAIAAAAADzRlBJK75FLiKjz3djqcgjCLo/e3yntI3MnPS48OORhgVsACAAAAAAnQhx4Rnyj081XrLRLD5NLpWmRWCsd0M9Hl7Jl19R0h8AAzUyAH0AAAAFZAAgAAAAAKx8NLSZUU04pSSGmHa5fh2oLHsEN5mmNMNHL95/tuC9BXMAIAAAAAA59hcXVaN3MNdHoo11OcH1aPRzHCwpVjO9mGfMz4xh3QVsACAAAAAAYIPdjV2XbPj7dBeHPwnwhVU7zMuJ+xtMUW5mIOYtmdAAAzUzAH0AAAAFZAAgAAAAAHNKAUxUqBFNS9Ea9NgCZoXMWgwhP4x0/OvoaPRWMquXBXMAIAAAAABUZ551mnP4ZjX+PXU9ttomzuOpo427MVynpkyq+nsYCQVsACAAAAAALnVK5p2tTTeZEh1zYt4iqKIQT9Z0si//Hy1L85oF+5IAAzU0AH0AAAAFZAAgAAAAALfGXDlyDVcGaqtyHkLT0qpuRhJQLgCxtznazhFtuyn/BXMAIAAAAABipxlXDq14C62pXhwAeen5+syA+/C6bN4rtZYcO4zKwAVsACAAAAAAXUf0pzUq0NhLYagWDap4uEiwq5rLpcx29rWbt1NYMsMAAzU1AH0AAAAFZAAgAAAAANoEr8sheJjg4UCfBkuUzarU9NFoy1xwbXjs5ifVDeA9BXMAIAAAAABPoyTf6M+xeZVGES4aNzVlq7LgjqZXJ/QunjYVusGUEAVsACAAAAAA1hA2gMeZZPUNytk9K+lB1RCqWRudRr7GtadJlExJf8oAAzU2AH0AAAAFZAAgAAAAAKvDiK+xjlBe1uQ3SZTNQl2lClIIvpP/5CHwY6Kb3WlgBXMAIAAAAAANnxImq5MFbWaRBHdJp+yD09bVlcFtiFDYsy1eDZj+iQVsACAAAAAAWtsyO+FxMPSIezwsV1TJD8ZrXAdRnQM6DJ+f+1V3qEkAAzU3AH0AAAAFZAAgAAAAAF49IlFH9RmSUSvUQpEPUedEksrQUcjsOv44nMkwXhjzBXMAIAAAAADJtWGbk0bZzmk20obz+mNsp86UCu/nLLlbg7ppxYn7PgVsACAAAAAA3k0Tj/XgPQtcYijH8cIlQoe/VXf15q1nrZNmg7yWYEgAAzU4AH0AAAAFZAAgAAAAAOuSJyuvz50lp3BzXlFKnq62QkN2quNU1Gq1IDsnFoJCBXMAIAAAAAAqavH1d93XV3IzshWlMnzznucadBF0ND092/2ApI1AcAVsACAAAAAAzUrK4kpoKCmcpdZlZNI13fddjdoAseVe67jaX1LobIIAAzU5AH0AAAAFZAAgAAAAALtgC4Whb4ZdkCiI30zY6fwlsxSa7lEaOAU3SfUXr02XBXMAIAAAAACgdZ6U1ZVgUaZZwbIaCdlANpCw6TZV0bwg3DS1NC/mnAVsACAAAAAAzI49hdpp0PbO7S2KexISxC16sE73EUAEyuqUFAC/J48AAzYwAH0AAAAFZAAgAAAAAF6PfplcGp6vek1ThwenMHVkbZgrc/dHgdsgx1VdPqZ5BXMAIAAAAACha3qhWkqmuwJSEXPozDO8y1ZdRLyzt9Crt2vjGnT7AAVsACAAAAAA7nvcU59+LwxGupSF21jAeAE0x7JE94tjRkJfgM1yKU8AAzYxAH0AAAAFZAAgAAAAAKoLEhLvLjKc7lhOJfx+VrGJCx9tXlOSa9bxQzGR6rfbBXMAIAAAAAAIDK5wNnjRMBzET7x/KAMExL/zi1IumJM92XTgXfoPoAVsACAAAAAAFkUYWFwNr815dEdFqp+TiIozDcq5IBNVkyMoDjharDQAAzYyAH0AAAAFZAAgAAAAADoQv6lutRmh5scQFvIW6K5JBquLxszuygM1tzBiGknIBXMAIAAAAADAD+JjW7FoBQ76/rsECmmcL76bmyfXpUU/awqIsZdO+wVsACAAAAAAPFHdLw3jssmEXsgtvl/RBNaUCRA1kgSwsofG364VOvQAAzYzAH0AAAAFZAAgAAAAAJNHUGAgn56KekghO19d11nai3lAh0JAlWfeP+6w4lJBBXMAIAAAAAD9XGJlvz59msJvA6St9fKW9CG4JoHV61rlWWnkdBRLzwVsACAAAAAAxwP/X/InJJHmrjznvahIMgj6pQR30B62UtHCthSjrP0AAzY0AH0AAAAFZAAgAAAAAHgYoMGjEE6fAlAhICv0+doHcVX8CmMVxyq7+jlyGrvmBXMAIAAAAAC/5MQZgTHuIr/O5Z3mXPvqrom5JTQ8IeSpQGhO9sB+8gVsACAAAAAAuPSXVmJUAUpTQg/A9Bu1hYczZF58KEhVofakygbsvJQAAzY1AH0AAAAFZAAgAAAAANpIljbxHOM7pydY877gpRQvYY2TGK7igqgGsavqGPBABXMAIAAAAAAqHyEu9gpurPOulApPnr0x9wrygY/7mXe9rAC+tPK80wVsACAAAAAA7gkPzNsS3gCxdFBWbSW9tkBjoR5ib+saDvpGSB3A3ogAAzY2AH0AAAAFZAAgAAAAAGR+gEaZTeGNgG9BuM1bX2R9ed4FCxBA9F9QvdQDAjZwBXMAIAAAAABSkrYFQ6pf8MZ1flgmeIRkxaSh/Eep4Btdx4QYnGGnwAVsACAAAAAApRovMiV00hm/pEcT4XBsyPNw0eo8RLAX/fuabjdU+uwAAzY3AH0AAAAFZAAgAAAAAFNprhQ3ZwIcYbuzLolAT5n/vc14P9kUUQComDu6eFyKBXMAIAAAAAAcx9z9pk32YbPV/sfPZl9ALIEVsqoLXgqWLVK/tP+heAVsACAAAAAA/qxvuvJbAHwwhfrPVpmCFzNvg2cU/NXaWgqgYUZpgXwAAzY4AH0AAAAFZAAgAAAAADgyPqQdqQrgfmJjRFAILTHzXbdw5kpKyfeoEcy6YYG/BXMAIAAAAAAE+3XsBQ8VAxAkN81au+f3FDeCD/s7KoZD+fnM1MJSSAVsACAAAAAAhRnjrXecwV0yeCWKJ5J/x12Xx4qVJahsCEVHB/1U2rcAAzY5AH0AAAAFZAAgAAAAAI0CT7JNngTCTUSei1Arw7eHWCD0jumv2rb7imjWIlWABXMAIAAAAABSP8t6ya0SyCphXMwnru6ZUDXWElN0NfBvEOhDvW9bJQVsACAAAAAAGWeGmBNDRaMtvm7Rv+8TJ2sJ4WNXKcp3tqpv5Se9Ut4AAzcwAH0AAAAFZAAgAAAAAD/FIrGYFDjyYmVb7oTMVwweWP7A6F9LnyIuNO4MjBnXBXMAIAAAAACIZgJCQRZu7NhuNMyOqCn1tf+DfU1qm10TPCfj5JYV3wVsACAAAAAA5hmY4ptuNxULGf87SUFXQWGAONsL9U29duh8xqsHtxoAAzcxAH0AAAAFZAAgAAAAAHIkVuNDkSS1cHIThKc/O0r2/ubaABTOi8Q1r/dvBAsEBXMAIAAAAADdHYqchEiJLM340c3Q4vJABmmth3+MKzwLYlsG6GS7sQVsACAAAAAADa+KP/pdTiG22l+ZWd30P1iHjnBF4zSNRdFm0oEK82kAAzcyAH0AAAAFZAAgAAAAAJmoDILNhC6kn3masElfnjIjP1VjsjRavGk1gSUIjh1NBXMAIAAAAAD97Ilvp3XF8T6MmVVcxMPcdL80RgQ09UoC6PnoOvZ1IQVsACAAAAAA2RK3Xng6v8kpvfVW9tkVXjpE+BSnx9/+Fw85Evs+kUEAAzczAH0AAAAFZAAgAAAAAI5bm3YO0Xgf0VT+qjVTTfvckecM3Cwqj7DTKZXf8/NXBXMAIAAAAAD/m+h8fBhWaHm6Ykuz0WX1xL4Eme3ErLObyEVJf8NCywVsACAAAAAAfb1VZZCqs2ivYbRzX4p5CtaCkKW+g20Pr57FWXzEZi8AAzc0AH0AAAAFZAAgAAAAANqo4+p6qdtCzcB4BX1wQ6llU7eFBnuu4MtZwp4B6mDlBXMAIAAAAAAGiz+VaukMZ+6IH4jtn4KWWdKK4/W+O+gRioQDrfzpMgVsACAAAAAAG4YYkTp80EKo59mlHExDodRQFR7njhR5dmISwUJ6ukAAAzc1AH0AAAAFZAAgAAAAAPrFXmHP2Y4YAm7b/aqsdn/DPoDkv7B8egWkfe23XsM1BXMAIAAAAAAGhwpKAr7skeqHm3oseSbO7qKNhmYsuUrECBxJ5k+D2AVsACAAAAAAAqPQi9luYAu3GrFCEsVjd9z2zIDcp6SPTR2w6KQEr+IAAzc2AH0AAAAFZAAgAAAAABzjYxwAjXxXc0Uxv18rH8I3my0Aguow0kTwKyxbrm+cBXMAIAAAAADVbqJVr6IdokuhXkEtXF0C2gINLiAjMVN20lE20Vmp2QVsACAAAAAAD7K1Fx4gFaaizkIUrf+EGXQeG7QX1jadhGc6Ji471H8AAzc3AH0AAAAFZAAgAAAAAFMm2feF2fFCm/UC6AfIyepX/xJDSmnnolQIBnHcPmb5BXMAIAAAAABLI11kFrQoaNVZFmq/38aRNImPOjdJh0Lo6irI8M/AaAVsACAAAAAAOWul0oVqJ9CejD2RqphhTC98DJeRQy5EwbNerU2+4l8AAzc4AH0AAAAFZAAgAAAAAJvXB3KyNiNtQko4SSzo/9b2qmM2zU9CQTTDfLSBWMgRBXMAIAAAAAAvjuVP7KsLRDeqVqRziTKpBrjVyqKiIbO9Gw8Wl2wFTAVsACAAAAAADlE+oc1ins+paNcaOZJhBlKlObDJ4VQORWjFYocM4LgAAzc5AH0AAAAFZAAgAAAAAPGdcxDiid8z8XYnfdDivNMYVPgBKdGOUw6UStU+48CdBXMAIAAAAAARj6g1Ap0eEfuCZ4X2TsEw+Djrhto3fA5nLwPaY0vCTgVsACAAAAAAoHqiwGOUkBu8SX5U1yHho+UIFdSN2MdQN5s6bQ0EsJYAAzgwAH0AAAAFZAAgAAAAAP5rGPrYGt3aKob5f/ldP0qrW7bmWvqnKY4QwdDWz400BXMAIAAAAADTQkW2ymaaf/bhteOOGmSrIR97bAnJx+yN3yMj1bTeewVsACAAAAAADyQnHGH2gF4w4L8axUsSTf6Ubk7L5/eoFOJk12MtZAoAAzgxAH0AAAAFZAAgAAAAAAlz6wJze5UkIxKpJOZFGCOf3v2KByWyI6NB6JM9wNcBBXMAIAAAAABUC7P/neUIHHoZtq0jFVBHY75tSFYr1Y5S16YN5XxC1QVsACAAAAAAgvxRbXDisNnLY3pfsjDdnFLtkvYUC4lhA68eBXc7KAwAAzgyAH0AAAAFZAAgAAAAAFJ8AtHcjia/9Y5pLEc3qVgH5xKiXw12G9Kn2A1EY8McBXMAIAAAAAAxe7Bdw7eUSBk/oAawa7uicTEDgXLymRNhBy1LAxhDvwVsACAAAAAAxKPaIBKVx3jTA+R/el7P7AZ7efrmTGjJs3Hj/YdMddwAAzgzAH0AAAAFZAAgAAAAAO8uwQUaKFb6vqR3Sv3Wn4QAonC2exOC9lGG1juqP5DtBXMAIAAAAABZf1KyJgQg8/Rf5c02DgDK2aQu0rNCOvaL60ohDHyY+gVsACAAAAAAqyEjfKC8lYoIfoXYHUqHZPoaA6EK5BAZy5dxXZmay4kAAzg0AH0AAAAFZAAgAAAAAE8YtqyRsGCeiR6hhiyisR/hccmK4nZqIMzO4lUBmEFzBXMAIAAAAAC1UYOSKqAeG1UJiKjWFVskRhuFKpj9Ezy+lICZvFlN5AVsACAAAAAA6Ct9nNMKyRazn1OKnRKagm746CGu+jyhbL1qJnZxGi0AAzg1AH0AAAAFZAAgAAAAAPhCrMausDx1QUIEqp9rUdRKyM6a9AAx7jQ3ILIu8wNIBXMAIAAAAACmH8lotGCiF2q9VQxhsS+7LAZv79VUAsOUALaGxE/EpAVsACAAAAAAnc1xCKfdvbUEc8F7XZqlNn1C+hZTtC0I9I3LL06iaNkAAzg2AH0AAAAFZAAgAAAAAOBi/GAYFcstMSJPgp3VkMiuuUUCrZytvqYaU8dwm8v2BXMAIAAAAACEZSZVyD3pKzGlbdwlYmWQhHHTV5SnNLknl2Gw8IaUTQVsACAAAAAAfsLZsEDcWSuNsIo/TD1ReyQW75HPMgmuKZuWFOLKRLoAAzg3AH0AAAAFZAAgAAAAAIQuup+YGfH3mflzWopN8J1X8o8a0d9CSGIvrA5HOzraBXMAIAAAAADYvNLURXsC2ITMqK14LABQBI+hZZ5wNf24JMcKLW+84AVsACAAAAAACzfjbTBH7IwDU91OqLAz94RFkoqBOkzKAqQb55gT4/MAAzg4AH0AAAAFZAAgAAAAAKsh0ADyOnVocFrOrf6MpTrNvAj8iaiE923DPryu124gBXMAIAAAAADg24a8NVE1GyScc6tmnTbmu5ulzO+896fE92lN08MeswVsACAAAAAAaPxcOIxnU7But88/yadOuDJDMcCywwrRitaxMODT4msAAzg5AH0AAAAFZAAgAAAAAKkVC2Y6HtRmv72tDnPUSjJBvse7SxLqnr09/Uuj9sVVBXMAIAAAAABYNFUkH7ylPMN+Bc3HWX1e0flGYNbtJNCY9SltJCW/UAVsACAAAAAAZYK/f9H4OeihmpiFMH7Wm7uLvs2s92zNA8wyrNZTsuMAAzkwAH0AAAAFZAAgAAAAADDggcwcb/Yn1Kk39sOHsv7BO/MfP3m/AJzjGH506Wf9BXMAIAAAAAAYZIsdjICS0+BDyRUPnrSAZfPrwtuMaEDEn0/ijLNQmAVsACAAAAAAGPnYVvo2ulO9z4LGd/69NAklfIcZqZvFX2KK0s+FcTUAAzkxAH0AAAAFZAAgAAAAAEWY7dEUOJBgjOoWVht1wLehsWAzB3rSOBtLgTuM2HC8BXMAIAAAAAAAoswiHRROurjwUW8u8D5EUT+67yvrgpB/j6PzBDAfVwVsACAAAAAA6NhRTYFL/Sz4tao7vpPjLNgAJ0FX6P/IyMW65qT6YsMAAzkyAH0AAAAFZAAgAAAAAPZaapeAUUFPA7JTCMOWHJa9lnPFh0/gXfAPjA1ezm4ZBXMAIAAAAACmJvLY2nivw7/b3DOKH/X7bBXjJwoowqb1GtEFO3OYgAVsACAAAAAA/JcUoyKacCB1NfmH8vYqC1f7rd13KShrQqV2r9QBP44AAzkzAH0AAAAFZAAgAAAAAK00u6jadxCZAiA+fTsPVDsnW5p5LCr4+kZZZOTDuZlfBXMAIAAAAAAote4zTEYMDgaaQbAdN8Dzv93ljPLdGjJzvnRn3KXgtQVsACAAAAAAxXd9Mh6R3mnJy8m7UfqMKi6oD5DlZpkaOz6bEjMOdiwAAzk0AH0AAAAFZAAgAAAAAFbgabdyymiEVYYwtJSWa7lfl/oYuj/SukzJeDOR6wPVBXMAIAAAAADAFGFjS1vPbN6mQEhkDYTD6V2V23Ys9gUEUMGNvMPkaAVsACAAAAAAL/D5Sze/ZoEanZLK0IeEkhgVkxEjMWVCfmJaD3a8uNIAAzk1AH0AAAAFZAAgAAAAABNMR6UBv2E627CqLtQ/eDYx7OEwQ7JrR4mSHFa1N8tLBXMAIAAAAAAxH4gucI4UmNVB7625C6hFSVCuIpJO3lusJlPuL8H5EQVsACAAAAAAVLHNg0OUVqZ7WGOP53BkTap9FOw9dr1P4J8HxqFqU04AAzk2AH0AAAAFZAAgAAAAAG8cd6WBneNunlqrQ2EmNf35W7OGObGq9WL4ePX+LUDmBXMAIAAAAAAjJ2+sX87NSis9hBsgb1QprVRnO7Bf+GObCGoUqyPE4wVsACAAAAAAs9c9SM49/pWmyUQKslpt3RTMBNSRppfNO0JBvUqHPg0AAzk3AH0AAAAFZAAgAAAAAFWOUGkUpy8yf6gB3dio/aOfRKh7XuhvsUj48iESFJrGBXMAIAAAAAAY7sCDMcrUXvNuL6dO0m11WyijzXZvPIcOKob6IpC4PQVsACAAAAAAJOP+EHz6awDb1qK2bZQ3kTV7wsj5Daj/IGAWh4g7omAAAzk4AH0AAAAFZAAgAAAAAGUrIdKxOihwNmo6B+aG+Ag1qa0+iqdksHOjQj+Oy9bZBXMAIAAAAABwa5dbI2KmzBDNBTQBEkjZv4sPaeRkRNejcjdVymRFKQVsACAAAAAA4ml/nm0gJNTcJ4vuD+T2Qfq2fQZlibJp/j6MOGDrbHMAAzk5AH0AAAAFZAAgAAAAAOx89xV/hRk64/CkM9N2EMK6aldII0c8smdcsZ46NbP8BXMAIAAAAADBF6tfQ+7q9kTuLyuyrSnDgmrdmrXkdhl980i1KHuGHgVsACAAAAAACUqiFqHZdGbwAA+hN0YUE5zFg+H+dabIB4dj5/75W/YAAzEwMAB9AAAABWQAIAAAAADJDdC9aEFl4Y8J/awHbnXGHjfP+VXQilPHJg7ewaJI7AVzACAAAAAAE+tqRl6EcBMXvbr4GDiNIYObTsYpa1n6BJk9EjIJVicFbAAgAAAAAJVc+HYYqa0m1Hq6OiRX8c0iRnJYOt6AJAJoG0sG3GMSAAMxMDEAfQAAAAVkACAAAAAA3F9rjEKhpoHuTULVGgfUsGGwJs3bISrXkFP1v6KoQLgFcwAgAAAAAIBf0tXw96Z/Ds0XSIHX/zk3MzUR/7WZR/J6FpxRWChtBWwAIAAAAABWrjGlvKYuTS2s8L9rYy8Hf0juFGJfwQmxVIjkTmFIGQADMTAyAH0AAAAFZAAgAAAAAOYIYoWkX7dGuyKfi3XssUlc7u/gWzqrR9KMkikKVdmSBXMAIAAAAABVF2OYjRTGi9Tw8XCAwZWLpX35Yl271TlNWp6N/nROhAVsACAAAAAA0nWwYzXQ1+EkDvnGq+SMlq20z+j32Su+i/A95SggPb4AAzEwMwB9AAAABWQAIAAAAACMtPm12YtdEAvqu6Eji1yuRXnu1RJP6h0l7pH3lSH4MwVzACAAAAAAENyCFfyUAh1veQBGx+cxiB7Sasrj41jzCGflZkB5cRMFbAAgAAAAAKdI2LMqISr/T5vuJPg6ZRBm5fVi2aQCc4ra3A4+AjbDAAMxMDQAfQAAAAVkACAAAAAAvlI4lDcs6GB1cnm/Tzo014CXWqidCdyE5t2lknWQd4QFcwAgAAAAAD60SpNc4O2KT7J0llKdSpcX1/Xxs97N715a1HsTFkmBBWwAIAAAAABuuRkJWAH1CynggBt1/5sPh9PoGiqTlS24D/OE2uHXLQADMTA1AH0AAAAFZAAgAAAAAKl8zcHJRDjSjJeV/WvMxulW1zrTFtaeBy/aKKhadc6UBXMAIAAAAADBdWQl5SBIvtZZLIHszePwkO14W1mQ0izUk2Ov21cPNAVsACAAAAAAHErCYycpqiIcCZHdmPL1hi+ovLQk4TAvENpfLdTRamQAAzEwNgB9AAAABWQAIAAAAABb6LXDWqCp1beQgQjj8I3sRTtFhlrmiBi+h/+ikmrvugVzACAAAAAA9stpgTecT7uTyaGNs3K9Bp0A7R0QaIAOfscyMXHBPX8FbAAgAAAAAHUt+McyXrJ1H8SwnHNVO181Ki8vDAM1f7XI26mg95ZDAAMxMDcAfQAAAAVkACAAAAAA97NTT+81PhDhgptNtp4epzA0tP4iNb9j1AWkiiiKGM8FcwAgAAAAAKPbHg7ise16vxmdPCzksA/2Mn/qST0L9Xe8vnQugVkcBWwAIAAAAABB0EMXfvju4JU/mUH/OvxWbPEl9NJkcEp4iCbkXI41fAADMTA4AH0AAAAFZAAgAAAAAMqpayM2XotEFmm0gwQd9rIzApy0X+7HfOhNk6VU7F5lBXMAIAAAAACJR9+q5T9qFHXFNgGbZnPubG8rkO6cwWhzITQTmd6VgwVsACAAAAAAOZLQ6o7e4mVfDzbpQioa4d3RoTvqwgnbmc5Qh2wsZuoAAzEwOQB9AAAABWQAIAAAAADQnslvt6Hm2kJPmqsTVYQHE/wWeZ4bE1XSkt7TKy0r1gVzACAAAAAA8URTA4ZMrhHPvlp53TH6FDCzS+0+61qHm5XK6UiOrKEFbAAgAAAAAHQbgTCdZcbdA0avaTmZXUKnIS7Nwf1tNrcXDCw+PdBRAAMxMTAAfQAAAAVkACAAAAAAhujlgFPFczsdCGXtQ/002Ck8YWQHHzvWvUHrkbjv4rwFcwAgAAAAALbV0lLGcSGfE7mDM3n/fgEvi+ifjl7WZ5b3aqjDNvx9BWwAIAAAAACbceTZy8E3QA1pHmPN5kTlOx3EO8kJM5PUjTVftw1VpgADMTExAH0AAAAFZAAgAAAAABm/6pF96j26Jm7z5KkY1y33zcAEXLx2n0DwC03bs/ixBXMAIAAAAAD01OMvTZI/mqMgxIhA5nLs068mW+GKl3OW3ilf2D8+LgVsACAAAAAAaLvJDrqBESTNZSdcXsd+8GXPl8ZkUsGpeYuyYVv/kygAAzExMgB9AAAABWQAIAAAAACfw9/te4GkHZAapC9sDMHHHZgmlTrccyJDPFciOMSOcwVzACAAAAAAIIC1ZpHObvmMwUfqDRPl4C1aeuHwujM1G/yJbvybMNAFbAAgAAAAAAs9x1SnVpMfNv5Bm1aXGwHmbbI9keWa9HRD35XuCBK5AAMxMTMAfQAAAAVkACAAAAAAkxHJRbnShpPOylLoDdNShfILeA1hChKFQY9qQyZ5VmsFcwAgAAAAAKidrY+rC3hTY+YWu2a7fuMH2RD/XaiTIBW1hrxNCQOJBWwAIAAAAACW0kkqMIzIFMn7g+R0MI8l15fr3k/w/mHtY5n6SYTEwAADMTE0AH0AAAAFZAAgAAAAAByuYl8dBvfaZ0LO/81JW4hYypeNmvLMaxsIdvqMPrWoBXMAIAAAAABNddwobOUJzm9HOUD8BMZJqkNCUCqstHZkC76FIdNg9AVsACAAAAAAQQOkIQtkyNavqCnhQbNg3HfqrJdsAGaoxSJePJl1qXsAAzExNQB9AAAABWQAIAAAAABxMy7X5hf7AXGDz3Y/POu1ZpkMlNcSvSP92NOO/Gs7wAVzACAAAAAAHJshWo2T5wU2zvqCyJzcJQKQaHFHpCpMc9oWBXkpUPoFbAAgAAAAAGeiJKzlUXAvL0gOlW+Hz1mSa2HsV4RGmyLmCHlzbAkoAAMxMTYAfQAAAAVkACAAAAAAlqbslixl7Zw3bRlibZbe/WmKw23k8uKeIzPKYEtbIy0FcwAgAAAAAHEKwpUxkxOfef5HYvulXPmdbzTivwdwrSYIHDeNRcpcBWwAIAAAAADuPckac21Hrg/h0kt5ShJwVEZ9rx6SOHd2+HDjqxEWTQADMTE3AH0AAAAFZAAgAAAAAMXrXx0saZ+5gORmwM2FLuZG6iuO2YS+1IGPoAtDKoKBBXMAIAAAAADIQsxCr8CfFKaBcx8kIeSywnGh7JHjKRJ9vJd9x79y7wVsACAAAAAAcvBV+SykDYhmRFyVYwFYB9oBKBSHr55Jdz2cXeowsUQAAzExOAB9AAAABWQAIAAAAAAm83FA9yDUpwkbKTihe7m53u+DivS9BU2b4vQMtCVQ2AVzACAAAAAAz3m1UB/AbZPa4QSKFDnUgHaT78+6iGOFAtouiBorEgEFbAAgAAAAAIgbpyYtJj5513Z5XYqviH/HXG/5+mqR52iBbfqMmDtZAAMxMTkAfQAAAAVkACAAAAAAJRzYK0PUwr9RPG2/7yID0WgcTJPB2Xjccp5LAPDYunkFcwAgAAAAAIIh24h3DrltAzNFhF+MEmPrZtzr1PhCofhChZqfCW+jBWwAIAAAAAAzRNXtL5o9VXMk5D5ylI0odPDJDSZZry1wfN+TedH70gADMTIwAH0AAAAFZAAgAAAAAHSaHWs/dnmI9sc7nB50VB2Bzs0kHapMHCQdyVEYY30TBXMAIAAAAACkV22lhEjWv/9/DubfHBAcwJggKI5mIbSK5L2nyqloqQVsACAAAAAAS19m7DccQxgryOsBJ3GsCs37yfQqNi1G+S6fCXpEhn4AAzEyMQB9AAAABWQAIAAAAAAC/I4TQRtCl12YZmdGz17X4GqSQgfwCPgRBwdHmdwu+QVzACAAAAAAx8f3z2ut/RAZhleari4vCEE+tNIn4ikjoUwzitfQ588FbAAgAAAAAJci0w1ZB8W2spJQ+kMpod6HSCtSR2jrabOH+B0fj3A4AAMxMjIAfQAAAAVkACAAAAAADGB5yU2XT0fse/MPWgvBvZikVxrl5pf3S5K1hceKWooFcwAgAAAAAIxTmlLHMjNaVDEfJbXvRez0SEPWFREBJCT6qTHsrljoBWwAIAAAAAAlswzAl81+0DteibwHD+CG5mZJrfHXa9NnEFRtXybzzwADMTIzAH0AAAAFZAAgAAAAABmO7QD9vxWMmFjIHz13lyOeV6vHT6mYCsWxF7hb/yOjBXMAIAAAAACT9lmgkiqzuWG24afuzYiCeK9gmJqacmxAruIukd0xEAVsACAAAAAAZa0/FI/GkZR7CtX18Xg9Tn9zfxkD0UoaSt+pIO5t1t4AAzEyNAB9AAAABWQAIAAAAAAfPUoy7QyZKhIIURso+mkP9qr1izbjETqF5s22GwjCjAVzACAAAAAAvLMsIDQ/go4VUxeh50UHmsvMvfx51cwyONnRD2odvC0FbAAgAAAAAKMb+1CodEalAFnDrEL1Ndt8ztamZ+9134m9Kp3GQgd+AAMxMjUAfQAAAAVkACAAAAAAE3ZqUar0Bq2zWbARE0bAv98jBlK9UJ73/xcwdMWWlSkFcwAgAAAAAK4M+MmC+9sFiFsumMyJZQKxWmmJiuG9H7IzKw083xxkBWwAIAAAAAAqkAONzhvMhkyL1D/6h7QQxEkdhC3p2WjXH+VGq5qCqQADMTI2AH0AAAAFZAAgAAAAAMo8FJiOq63cAmyk2O7eI7GcbQh/1j4RrMTqly3rexftBXMAIAAAAADjVmpd0WiRGTw/gAqEgGolt2EI7Csv14vKdmYoMD0aAgVsACAAAAAA07XQBzBUQMNw7F2/YxJjZNuPVpHTTgbLd1oGk77+bygAAzEyNwB9AAAABWQAIAAAAACu5IGaIx7A3Jvly/kzlCsSA4s3iJwuIl8jEdRH0k93NwVzACAAAAAA9NRUyxYE+t0Xyosyt6vIfMFW/vBoYg6sR+jBNs4JAxIFbAAgAAAAAAzyZ91dx+0oMlOVAjRGiMrPySikY/U9eMEB4WJb3uWtAAMxMjgAfQAAAAVkACAAAAAALkRy0GJInXYLA+cgjs6Myb0a+Gu9hgXhHvhLNoGWfckFcwAgAAAAANbALyt9zCSvwnLaWCd2/y2eoB7qkWTvv1Ldu8r40JPuBWwAIAAAAAD4Fl5bV5sz4isIE9bX+lmAp+aAKaZgVYVZeVfrItkCZAADMTI5AH0AAAAFZAAgAAAAAGoUK/DSWhT8LZhszSUqDbTrp8cSA7rdqmADKL+MILtTBXMAIAAAAABHnEE9bVa6lvhfhEMkkV2kzSSxH/sMW/FIJuw3CzWs6wVsACAAAAAAanavcBdqZxgRGKvEK95wTmeL1K1CeDSXZsXUAs81uOgAAzEzMAB9AAAABWQAIAAAAAC922ZDQE3h2fQKibGMZ9hV0WNlmrPYYSdtaSyYxsWYqgVzACAAAAAAagMovciKK6WVjIc2cCj8nK5O/gVOFFVeVAJpRp89tmQFbAAgAAAAAKcTFfPQzaFiAtSFhqbN02sCE1BKWJSrRfGN5L6oZwzkAAMxMzEAfQAAAAVkACAAAAAAtK+JqX3K/z2txjAU15DgX4y90DS2YLfIJFolCOkJJJwFcwAgAAAAAMnR5V7gfX7MNqqUdL5AkWlkhyFXaBRVNej+Rcn8lrQkBWwAIAAAAAA2cDNRXZuiC241TGRvdFyctJnrNcdbZOP9zHio81tkngADMTMyAH0AAAAFZAAgAAAAAAeGrIMK/bac6kPczxbvRYqKMkcpeI2FjdMpD91FDWIvBXMAIAAAAAAix62z1LeS8yvSXCl5gHSIomjyx76fF3S1lp9k900hygVsACAAAAAAiYwzf2m71aWFD5ajcXyW2JX2EzQOkBroTGMg29nLPYIAAzEzMwB9AAAABWQAIAAAAACphf298InM0Us4HT8o1W1MGw0D/02vd7Jh+U0h7qaFaQVzACAAAAAAFXtk7YpqsOJxsqGWSIL+YcBE96G3Zz9D31gPqDW94y8FbAAgAAAAAAOrS1KVA94rjB1jZ1pPocpCeBG+B14RzWoHqVDpp7JbAAMxMzQAfQAAAAVkACAAAAAATLDS2cuDVM3yDMuWNgk2iGKBTzPpfJMbvxVOSY39ZfcFcwAgAAAAAPT5wRi2cLHIUflXzm6EQB/m7xdThP80ir1VV/JBBqvxBWwAIAAAAAB9lEtZS0aXCFbCtSbhnis27S5IPcfWGygHW8AHn3QqzwADMTM1AH0AAAAFZAAgAAAAAJNjExiZVX7jfFGfYpQu16qxLN0YPqVU/5CQ/Y67YSinBXMAIAAAAABMpm2+6KrkRUlXzQoMPHrQmIO6dkQz66tYdfTeA3dKqQVsACAAAAAAFXobHiMLvNZuEPr8jtewCX2J93EZG3JNeyVg92fue6YAAzEzNgB9AAAABWQAIAAAAABlFkYtLCx901X6QVVMkSn6Z7k30UF4xHaA0OZJJ9bdyQVzACAAAAAATez+F9GHcGzTp7jjv4feboUNb8JCkIp4EqcPFisnq7MFbAAgAAAAACE7JvOpBgMoZ7kRd4QbxIhxukPTUxXpzhjnBHiR7XoRAAMxMzcAfQAAAAVkACAAAAAA8NJKN0IxZnruhswGQkiruv8Ih0EMwDcSZx/Xasup9dkFcwAgAAAAAKaJZRxzA+Igeydvuk6cSwUHXcrmT4PjhuPu//FslpdnBWwAIAAAAAD53Rok1Vq/PMAnXmarqoHJ0PEyYUBmVESa9hIpCv/G9QADMTM4AH0AAAAFZAAgAAAAABHxHdEClz7hbSSgE58+dWLlSMJnoPz+jFxp4bB1GmLQBXMAIAAAAAD3nSvT6aGD+A110J/NwEfp0nPutlmuB5B+wA3CC3noGAVsACAAAAAA3Apjd+TapONB7k5wBVwTWgn8t+Sq2oyyU5/+as109RcAAzEzOQB9AAAABWQAIAAAAAC/o8qW/ifk3KuJ01VFkyNLgQafxB5/bGs2G5VyyVafOwVzACAAAAAA1bMqAFGDHSl6BYNLbxApvkAv2K1/oafywiX0MDz1dGUFbAAgAAAAAHJXLlId3edFoniLD/9K2A5973MeP2Ro31flDyqm3l5QAAMxNDAAfQAAAAVkACAAAAAAY2V8I1bz3a1AxTtmED6UhdhA09huFkuuEX8R+d/WDPUFcwAgAAAAAPTVoNRiI76tcRKqd+JBBVyy4+YcKST42p0QX2BtmQ2VBWwAIAAAAACcxt9hg14WqPNiDv1MkqVljM2e2KJEv53lA17LhV6ZigADMTQxAH0AAAAFZAAgAAAAAO2kSsW0WGN9AOtK4xK2SHrGhWiaAbMEKT4iZkRpaDN/BXMAIAAAAABKGzQcPM8LT2dwOggxoWjv/1imYWabbG/G4kBw8OWaxAVsACAAAAAAC9hLK1dScQTAqg+YAG3ObdPzg2Xet57HmOFpGmyUR9UAAzE0MgB9AAAABWQAIAAAAAAiCwzNEEaH/mDam68IdDftnhthyUFdb+ZCNSBQ91WlHQVzACAAAAAA7tHyHcxCzmbJeFYZyPm4mEgkTGKOvwY4MX82OvH0Jn8FbAAgAAAAAAb5IAbZ1hXCNegQ+S+C9i/Z8y6sS8KeU04V6hXa2ml6AAMxNDMAfQAAAAVkACAAAAAAGuCHVNJSuoVkpPOnS5s89GuA+BLi2IPBUr2Bg1sWEPIFcwAgAAAAAEl1gncS5/xO7bQ/KQSstRV3rOT2SW6nV92ZANeG2SR6BWwAIAAAAAA9LOcKmhek8F2wAh8yvT/vjp2gaouuO+Hmv10lwAeWPAADMTQ0AH0AAAAFZAAgAAAAAMfxz7gEaoCdPvXrubDhCZUS0ARLZc1svgbXgMDlVBPgBXMAIAAAAAB6a5dDA3fuT5Vz2KvAcbUEFX/+B7Nw2p1QqbPoQ5TTuAVsACAAAAAAcf/y75UOuI62A6vWH7bYr/5Jz+nirZVYK/81trN6XOQAAzE0NQB9AAAABWQAIAAAAACnYsqF/VzmjIImC9+dqrHO1TM6lJ6fRwM0mM6Wf6paOwVzACAAAAAA5tgZzch8uDCR1ky3SllVaKVpxAlbrhvlNDTazZZRZOAFbAAgAAAAALeGiLJS4z2zhgVpxzyPdRYyACP9QzQBOob34YrIZumCAAMxNDYAfQAAAAVkACAAAAAAEC0sIVmadtW4YMuRXH7RpAhXclsd+3bmqGXCMeaT014FcwAgAAAAABPpXh0uzpsJJB+IRUNajmMB9WGwswfpw5T9xk3Xj6ANBWwAIAAAAAAmf+NYh9TZ/QRu3w/GQz66n7DtfbJijN3G7KzeL8lstAADMTQ3AH0AAAAFZAAgAAAAABaIB3n49Xm9cOafSrQsE0WCcYp8rMIO/qVwIlMF5YLRBXMAIAAAAAC9EyWJV3xOu9bzgdJ/yX+ko7qLf1u3AxNMataW2C9EzQVsACAAAAAAvVbDkLxXx2DcMLifIQ3K0IIJcLcAG9DUrNfI6aoUjNcAAzE0OAB9AAAABWQAIAAAAAA5rZItA/cocRnngYqcJ3nBXQ+l688aKz3EQyLbYYunPAVzACAAAAAAwKyA+L7TgxztPClLrIMk2JXR+w7c04N3ZOqPgjvrIvsFbAAgAAAAACzvZ33h6aWEe8hmo+1f6OXJ72FY5hvWaUuha64ZV3KFAAMxNDkAfQAAAAVkACAAAAAA3htn7oHJ0YYpIrs+Mzyh85Ys67HwAdv5LQl1mCdoMWkFcwAgAAAAAEHjCtNNLenHuSIYux6ezAHsXDaj2DlTF67ToDhDDe6HBWwAIAAAAAD+P4H0sk9jOd+7vOANt2/1Ectb+4ZRGPE8GkHWNXW3MgADMTUwAH0AAAAFZAAgAAAAAEnt18Km/nqggfIJWxzTr9r3hnXNaueG6XO9A5G11LnGBXMAIAAAAAD7QxzGMN/ard5TfFLecE6uusMmXG2+RBsBR+/NCQHUwAVsACAAAAAAQEZ1ZZ8GC8rdbg7s87OM5Gr9qkTXS9+P5DuAZxj5Gl4AAzE1MQB9AAAABWQAIAAAAAAVAKK/GoY8AACu/hyMpO4hdLq6JnEyWNzkyci9sbaD/wVzACAAAAAA2HmeqpMlvvBpV2zQTYIRmsc4MFlfHRwLof0ycJgMg/MFbAAgAAAAACdltCeWi5E/q1Li1eXLChpM2D9QQSGLBZ82NklQSc0oAAMxNTIAfQAAAAVkACAAAAAAhHyq1GQC/GiMwpYjcsfkNxolJ10ARKjIjfkW1Wipzi0FcwAgAAAAAD/uaGWxTDq87F8XZ6CrFI+RNa8yMqfSZdqK00Kj833BBWwAIAAAAAD6aEdOO0CsQGagioOCvANPCEHSpJ8BSixlPBq5ERhB7AADMTUzAH0AAAAFZAAgAAAAABAJJxHoZD+MQBWqm9UM9Dd3z5ZohIZGWRaRVRsMptKQBXMAIAAAAADrE/ca+gqj/SH4oao4wE4qn2ovoTydzcMbDbrfnUs3zAVsACAAAAAAeNCIQN6hVnGJinytQRFGlQ2ocoprXNqpia+BSxzl+uwAAzE1NAB9AAAABWQAIAAAAAAv01wz7VG9mTepjXQi6Zma+7b/OVBaKVkWNbgDLr1mFgVzACAAAAAA0I5sxz8r6wkCp5Tgvr+iL4p6MxSOq5d3e1kZG+0b7NkFbAAgAAAAAIA32v6oGkAOS96HexGouNTex+tLahtx9QF2dgGClk6WAAMxNTUAfQAAAAVkACAAAAAAWXecRwxSon68xaa9THXnRDw5ZfzARKnvvjTjtbae6T0FcwAgAAAAAPh0UfUMEo7eILCMv2tiJQe1bF9qtXq7GJtC6H5Va4fIBWwAIAAAAADqFr1ThRrTXNgIOrJWScO9mk86Ufi95IDu5gi4vP+HWQADMTU2AH0AAAAFZAAgAAAAAEY5WL8/LpX36iAB1wlQrMO/xHVjoO9BePVzbUlBYo+bBXMAIAAAAABoKcpadDXUARedDvTmzUzWPe1jTuvD0z9oIcZmKuiSXwVsACAAAAAAJuJbwuaMrAFoI+jU/IYr+k4RzAqITrOjAd3HWCpJHqEAAzE1NwB9AAAABWQAIAAAAADnJnWqsfx0xqNnqfFGCxIplVu8mXjaHTViJT9+y2RuTgVzACAAAAAAWAaSCwIXDwdYxWf2NZTly/iKVfG/KDjHUcA1BokN5sMFbAAgAAAAAJVxavipE0H4/JQvhagdytXBZ8qGooeXpkbPQ1RfYMVHAAMxNTgAfQAAAAVkACAAAAAAsPG7LaIpJvcwqcbtfFUpIjj+vpNj70Zjaw3eV9T+QYsFcwAgAAAAAJQ71zi0NlCyY8ZQs3IasJ4gB1PmWx57HpnlCf3+hmhqBWwAIAAAAACD58TO6d+71GaOoS+r73rAxliAO9GMs4Uc8JbOTmC0OwADMTU5AH0AAAAFZAAgAAAAAAGiSqKaQDakMi1W87rFAhkogfRAevnwQ41onWNUJKtuBXMAIAAAAAASgiDpXfGh7E47KkOD8MAcX8+BnDShlnU5JAGdnPdqOAVsACAAAAAAI+2TTQIgbFq4Yr3lkzGwhG/tqChP7hRAx2W0fNaH6jcAAzE2MAB9AAAABWQAIAAAAAB7L4EnhjKA5xJD3ORhH2wOA1BvpnQ+7IjRYi+jjVEaJAVzACAAAAAAuhBIm0nL3FJnVJId+7CKDASEo+l2E89Z9/5aWSITK4AFbAAgAAAAALtSICOzQDfV9d+gZuYxpEj6cCeHnKTT+2G3ceP2H65kAAMxNjEAfQAAAAVkACAAAAAAaROn1NaDZFOGEWw724dsXBAm6bgmL5i0cki6QZQNrOoFcwAgAAAAANVT8R6UvhrAlyqYlxtmnvkR4uYK/hlvyQmBu/LP6/3ZBWwAIAAAAAD+aHNMP/X+jcRHyUtrCNkk1KfMtoD3GTmShS8pWGLt+AADMTYyAH0AAAAFZAAgAAAAADqSR5e0/Th59LrauDA7OnGD1Xr3H3NokfVxzDWOFaN7BXMAIAAAAACt30faNwTWRbvmykDpiDYUOCwA6QDbBBYBFWS7rdOB4AVsACAAAAAAF7SvnjjRk5v2flFOKaBAEDvjXaL1cpjsQLtK2fv9zdQAAzE2MwB9AAAABWQAIAAAAADmtb1ZgpZjSeodPG/hIVlsnS8hoRRwRbrTVx89VwL62AVzACAAAAAAi38e1g6sEyVfSDkzZbaZXGxKI/zKNbMasOl2LYoWrq8FbAAgAAAAAALACk0KcCDN/Kv8WuazY8ORtUGkOZ5Dsm0ys1oOppp/AAMxNjQAfQAAAAVkACAAAAAAf/f7AWVgBxoKjr7YsEQ4w/fqSvuQWV2HMiA3rQ7ur0sFcwAgAAAAADkkeJozP6FFhUdRIN74H4UhIHue+eVbOs1NvbdWYFQrBWwAIAAAAAB55FlHAkmTzAYj/TWrGkRJw2EhrVWUnZXDoMYjyfB/ZwADMTY1AH0AAAAFZAAgAAAAAI2WEOymtuFpdKi4ctanPLnlQud+yMKKb8p/nfKmIy56BXMAIAAAAADVKrJmhjr1rfF3p+T+tl7UFd1B7+BfJRk0e7a4im7ozgVsACAAAAAA5E7Ti3PnFiBQoCcb/DN7V1uM3Xd6VKiexPKntssFL7kAAzE2NgB9AAAABWQAIAAAAAAuHU9Qd79hjyvKOujGanSGDIQlxzsql8JytTZhEnPw+AVzACAAAAAAjF2gV/4+sOHVgDd/oR5wDi9zL7NGpGD+NsEpGXy/a4QFbAAgAAAAAJzMoyojYV6Ed/LpVN5zge93Odv3U7JgP7wxeRaJZGTdAAMxNjcAfQAAAAVkACAAAAAA7dQDkt3iyWYCT94d7yqUtPPwp4qkC0ddu+HFdHgVKEkFcwAgAAAAANuYvtvZBTEq4Rm9+5eb7VuFopowkrAuv86PGP8Q8/QvBWwAIAAAAACeqXoAOQOE4j0zRMlkVd8plaW0RX1npsFvB38Xmzv7sAADMTY4AH0AAAAFZAAgAAAAAAwnZSDhL4tNGYxlHPhKYB8s28dY5ScSwiKZm3UhT8U3BXMAIAAAAABDoY6dhivufTURQExyC9Gx3ocpl09bgbbQLChj3qVGbgVsACAAAAAAF+1nS7O0v85s3CCy+9HkdeoEfm2C6ZiNbPMMnSfsMHUAAzE2OQB9AAAABWQAIAAAAAC2VuRdaC4ZJmLdNOvD6R2tnvkyARteqXouJmI46V306QVzACAAAAAAMn1Z6B35wFTX9mEYAPM+IiJ5hauEwfD0CyIvBrxHg7IFbAAgAAAAAOG6DvDZkT9B/xZWmjao2AevN7MMbs3Oh9YJeSd/hZ+hAAMxNzAAfQAAAAVkACAAAAAAVerb7qVNy457rNOHOgDSKyWl5ojun7iWrv1uHPXrIZQFcwAgAAAAAIDcYS9j5z+gx0xdJj09L7876r/vjvKTi/d3bXDE3PhyBWwAIAAAAADuhVLqb1Bkrx8aNymS+bx2cL8GvLFNH4SAi690DUgnWQADMTcxAH0AAAAFZAAgAAAAAH/E44yLxKCJjuSmU9A8SEhbmkDOx1PqqtYcZtgOzJdrBXMAIAAAAABgLh9v2HjBbogrRoQ82LS6KjZQnzjxyJH4PH+F3jupSAVsACAAAAAAIlO46ehXp4TqpDV0t6op++KO+uWBFh8iFORZjmx2IjkAAzE3MgB9AAAABWQAIAAAAAAlNUdDL+f/SSQ5074mrq0JNh7CTXwTbbhsQyDwWeDVMwVzACAAAAAANIH2IlSNG0kUw4qz0budjcWn8mNR9cJlYUqPYdonucAFbAAgAAAAAJMrOUOyiu5Y3sV76zwEFct8L7+i8WGlQI2+8z2W2kzaAAMxNzMAfQAAAAVkACAAAAAASZ+CvUDtlk/R4HAQ3a+PHrKeY/8ifAfh0oXYFqliu80FcwAgAAAAAJelpzPgM65OZFt/mvGGpwibclQ49wH+1gbUGzd9OindBWwAIAAAAAD9qeDchteEpVXWcycmD9kl9449C1dOw0r60TBm5jK+cQADMTc0AH0AAAAFZAAgAAAAAN9fkoUVbvFV2vMNMAkak4gYfEnzwKI3eDM3pnDK5q3lBXMAIAAAAACnDkgVNVNUlbQ9RhR6Aot2nVy+U4km6+GHPkLr631jEAVsACAAAAAANzg/BnkvkmvOr8nS4omF+q9EG/4oisB+ul4YHi938hwAAzE3NQB9AAAABWQAIAAAAAASyK3b1nmNCMptVEGOjwoxYLLS9fYWm/Zxilqea0jpEQVzACAAAAAADDHsGrbqlKGEpxlvfyqOJKQJjwJrzsrB7k3HG0AUJbkFbAAgAAAAAKwx3S4XfDZh4+LuI9jf7XgUh5qiefNv87JD4qvVRfPSAAMxNzYAfQAAAAVkACAAAAAAlSP9iK31GlcG9MKGbLmq+VXMslURr+As736rrVNXcsUFcwAgAAAAAAvbj0zfq9zzi8XReheKFbCB+h9IsOLgXPPpI5vrEJNZBWwAIAAAAABXvoZhaQE7ogWjeBjceVkp03N20cKYP3TA8vuNsgpfAgADMTc3AH0AAAAFZAAgAAAAAOJNORH8Bev97gVU7y6bznOxJ+E6Qoykur1QP76hG1/7BXMAIAAAAAC+C1PtOOrSZgzBAGhr+dPe/kR0JUw9GTwLVNr61xC1aAVsACAAAAAAeA/L8MQIXkamaObtMPLpoDoi5FypA5WAPtMeMrgi0eQAAzE3OAB9AAAABWQAIAAAAAAKcHzLUomavInN6upPkyWhAqYQACP/vdVCIYpiy6U6HgVzACAAAAAATsR4KItY6R2+U7Gg6sJdaEcf58gjd1OulyWovIqfxKcFbAAgAAAAAFbm10ko67ahboAejQdAV0U2uA5OhZYdb8XUFJ8OL46LAAMxNzkAfQAAAAVkACAAAAAAqTOLiMpCdR59tLZzzIPqJvbCNvz2XQL9ust0qYaehtcFcwAgAAAAAArefox/3k5xGOeiw2m6NUdzuGxmPwcu5IFcj+jMwHgHBWwAIAAAAADLZGFJ7MQd5JXMgMXjqZO5LDLxcFClcXPlnRMWRn+1oAADMTgwAH0AAAAFZAAgAAAAAIPSqSeVzSRgNVNmrPYHmUMgykCY27NbdDUNhE5kx/SgBXMAIAAAAAAhX90nNfxyXmZe/+btZ7q6xMX4PFyj0paM1ccJ/5IUUQVsACAAAAAA419oHmD2W0SYoOMwhrhrp8jf68fg9hTkaRdCuVd3CN0AAzE4MQB9AAAABWQAIAAAAACLn5DxiqAosHGXIAY96FwFKjeqrzXWf3VJIQMwx1fl4gVzACAAAAAAindvU27nveutopdvuHmzdENBbeGFtI3Qcsr07jxmvm8FbAAgAAAAAPvl9pBStQvP4OGkN5v0MghUY6djm9n7XdKKfrW0l1sMAAMxODIAfQAAAAVkACAAAAAA7i2S6rHRSPBwZEn59yxaS7HiYBOmObIkeyCcFU42kf8FcwAgAAAAAGb3RSEyBmgarkTvyLWtOLJcPwCKbCRkESG4RZjVmY4iBWwAIAAAAADB2/wo5CSHR4ANtifY6ZRXNTO5+O8qP82DfAiAeanpZwADMTgzAH0AAAAFZAAgAAAAAFz+M+H/Z94mdPW5oP51B4HWptp1rxcMWAjnlHvWJDWrBXMAIAAAAACBFEOQyL7ZHu4Cq33QvXkmKuH5ibG/Md3RaED9CtG5HwVsACAAAAAAfggtJTprQ/yZzj7y5z9KvXsdeXMWP0yUXMMJqpOwI88AAzE4NAB9AAAABWQAIAAAAAAE7c2x3Z3aM1XGfLNk/XQ9jCazNRbGhVm7H8c2NjS5ywVzACAAAAAARJ9h8fdcwA19velF3L/Wcvi2rCzewlKZ2nA0p8bT9uwFbAAgAAAAAJtWe6b4wK2Hae2dZm/OEpYQnvoZjz4Sz5IgJC2wInecAAMxODUAfQAAAAVkACAAAAAAVoRt9B9dNVvIMGN+ea5TzRzQC+lqSZ8dd/170zU5o9cFcwAgAAAAAEwM95XZin5mv2yhCI8+ugtKuvRVmNgzzIQN0yi1+9aIBWwAIAAAAAAMGBq72n00rox3uqhxSB98mkenTGCdbbUF1gXrgottzgADMTg2AH0AAAAFZAAgAAAAAKRDkjyWv/etlYT4GyoXrmBED2FgZHnhc+l9Wsl06cH2BXMAIAAAAABohlpm3K850Vndf3NmNE0hHqDlNbSR8/IvMidQ3LnIZAVsACAAAAAAW42nGHa6q2MCAaaPVwaIDfr8QLyQwjKq23onZJYsqVsAAzE4NwB9AAAABWQAIAAAAAC3DFh5oklLCNLY90bgWm68dFXz65JpAZSp1K99MBTPAQVzACAAAAAAQgZecmxEUZVHoptEQClDwAf8smI3WynQ/i+JBP0g+kQFbAAgAAAAAEUSQGVnAPISD6voD0DiBUqyWKgt2rta0tjmoe+LNt6IAAMxODgAfQAAAAVkACAAAAAAQ5WKvWSB503qeNlOI2Tpjd5blheNr6OBO8pfJfPNstcFcwAgAAAAAKwHgQLSDJ5NwLBQbY5OnblQIsVDpGV7q3RCbFLD1U4/BWwAIAAAAACQ5nED99LnpbqXZuUOUjnO2HTphEAFBjLD4OZeDEYybgADMTg5AH0AAAAFZAAgAAAAAGfhFY3RGRm5ZgWRQef1tXxHBq5Y6fXaLAR4yJhrTBplBXMAIAAAAACKEF0ApLoB6lP2UqTFsTQYNc9OdDrs/vziPGzttGVLKQVsACAAAAAArOO6FyfNRyBi0sPT5iye7M8d16MTLcwRfodZq4uCYKEAAzE5MAB9AAAABWQAIAAAAAAIM73gPcgzgotYHLeMa2zAU4mFsr7CbILUZWfnuKSwagVzACAAAAAAJCSu98uV8xv88f2BIOWzt6p+6EjQStMBdkGPUkgN79cFbAAgAAAAAMGqPGMPxXbmYbVfSa/japvUljht1zZT33TY7ZjAiuPfAAMxOTEAfQAAAAVkACAAAAAAkWmHCUsiMy1pwZTHxVPBzPTrWFBUDqHNrVqcyyt7nO8FcwAgAAAAAMv2CebFRG/br7USELR98sIdgE9OQCRBGV5JZCO+uPMgBWwAIAAAAABt7qSmn3gxJu7aswsbUiwvO+G6lXj/Xhx+J/zQyZxzLAADMTkyAH0AAAAFZAAgAAAAAGInUYv0lP/rK7McM8taEHXRefk8Q2AunrvWqdfSV7UaBXMAIAAAAACE+WPxJ3gan7iRTbIxXXx+bKVcaf8kP4JD8DcwU0aL7wVsACAAAAAAUC4eTprX4DUZn2X+UXYU6QjtiXk+u57yoOPBbPQUmDkAAzE5MwB9AAAABWQAIAAAAACmHlg2ud3cplXlTsNTpvNnY6Qm1Fce0m899COamoDjaQVzACAAAAAArtJQeJIlepBWRU2aYar7+YGYVQ7dfDc1oxgTmA8r9q0FbAAgAAAAAOk45vg5VqZHAFCO3i0Z52SZi5RADf8NXwf68T5yad/DAAMxOTQAfQAAAAVkACAAAAAApzcWSAbZWV/Rq+ylRNqqlJqNVR4fhXrz4633/MQOQgcFcwAgAAAAAN/jz/bsEleiuCl+li83EWlG6UMHA8CyaOMRKCkXkSCPBWwAIAAAAAC3Sd+Qg+uFDKpGZHbrQgokXHQ1az1aFl4YK343OB6hcQAAEmNtAAAAAAAAAAAAABBwYXlsb2FkSWQAAAAAABBmaXJzdE9wZXJhdG9yAAEAAAASc3AAAQAAAAAAAAAQdGYAAQAAABNtbgD/////Y46NN8CHrb4J7f/fE214AP////9jjo03wIetvgnt/18A", - "subType": "06" - } - } - } - }, - "u": { - "$set": { - "encryptedDecimalNoPrecision": { - "$$type": "binData" - } - } - } - } - ], - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalNoPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - }, - "$db": "default" - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": { - "$numberInt": "0" - }, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "rbf3AeBEv4wWFAKknqDxRW5cLNkFvbIs6iJjc6LShQY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "n+XAuFnP8Dov9TnhGFxNx0K/MnVM9WbJ7RouEu0ndO0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yRXojuVdn5GQtD97qYlaCL6cOLmZ7Cvcb3wFjkLUIdM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DuIkdRPITRs55I4SZmgomAHCIsDQmXRhW8+MOznkzSk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SsBk+Et1lTbU+QRPx+xyJ/jMkmfG+QCvQEpip2YYrzA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "crCIzOd8KhHvvUlX7M1v9bhvU4pLdTc+X2SuqoKU5Ek=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YOWdCw4UrqnxkAaVjqmC4sKQDMVMHEpFGnlxpxdaU6E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "M3SShp81Ff8tQ632qKbv9MUcN6wjDaBReI0VXNu6Xh4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gzHlSPxpM0hT75kQvWFzGlOxKvDoiKQZOr19V6l2zXI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "s3JnppOGYw9SL2Q1kMAZs948v2F5PrpXjGei/HioDWs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cG6+3Gk/zEH68P/uuuwiAUVCuyJwa1LeV+t29FlPPAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dupdvR3AyJtM+g9NDKiaLVOtGca387JQp8w+V03m7Ig=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JqEQc5svj2jTvZ6LLA5ivE+kTb/0aRemSEmxk4G7Zrg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "szcXXXKnob+p3SoM4yED2R920LeJ7cVsclPMFTe4CeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "o1QoGVXmuBdHwHm7aCtGMlMVKrjFdYvJXpoq6uhIAZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Jfm5wPlqqLCJRGQIqRq2NGmpn7s0Vrih2H3YAOoI2YU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zMHLb8ARbsYo8Ld05bqnGFf1Usha6EGb8QKwdSAyps0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yQdtq9lh5pugL7/i0Bj/PuZUUBUIzf+7wj1rl5y736w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wGWVZdO7qIuyDg/BqDgqjgoQ02h5YYgwXQB1oCin2NE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "by9HMLj6NTEpgztZ5HSN6GxImkXPcaFINYDzgZY33X8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tWo0vbasi7bXmn/MsOx13VC1IsWtpx/nYp0uj4iMzdA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tQQpndUYd5O87lOtrGjH3wl9VsOK0ray7RMasL90sBM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cQjXEDCMsOpKLLf+vlTgIHA+cbSJdzqhbSX9Wvh95aA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7yMpU48IxK9SzP2cx3VnTownGEwFmeFofuuFT97SuuY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kSOx1kz0CmBgzKQHZlo65ZUY1DIv9A99JRm+Us2y6Ew=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ubQpdPBe6/xvtr+AcXdfYLSvYCR4ot0tivehkCsupb4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xal+iCJ6FTefRQToyoNksc9NCZShyn04NDGi4IYrcoM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "d7jU4iOK50xHxlkSifcxlZFCM46TSgQzoYivxG3HNLY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tJvl2nsBLBVzL3pp6sKWCL4UXeh3q/roYBJjSb74ve0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OIUCaKRvIx9t1w6Hxlz1IcQTdPNCfdRNwnnTm10W+X0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A9tvzsiElotOUVIB4CqfQp9mAwqvTM35YkmAR170aHA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lI8gpK7hpb7c9x4RQugsxMnQay5LZJmwslZdvMx/dcE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dNCzh40U0XvdKnSDi3HRQOWQftEsDVqc4uUvsVFGoq8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IP+iwEBWBwVVZIdpaMu8k5+soFCz+TZkYn3drKZ9grE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pnqyh6e0y5svHkJDShlN9CHV0WvMBE4QbtJpQw5ZCXc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "elEl42tbVDoRTLjAhZUFEtXiut4b3PVhg/1ZLZSQdtE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vHuu2FxwclMHqyE6JBYbTYgbEkB0dqb/JuaxsvfwsmY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xTf7NCe3Gf8QpE78HR5OknlLTKfs9J+RN9UZpH6fnso=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XiWSasRnJAulGR6+LCVD3mwRObXylqYWR9jvpywq12c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MZMxEQ5ikx0PG1YFIExv0UnTZogsvgeOEZTpzvBDn4w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yZMyMZBDrWbAhvnic7vvIYhmO9m5H2iuv0c8KNZrBzY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xxM14hTPY5j0vvcK2C7YAEjzdsfUTFHozHC0hEo1bxI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+01rqR1xVwkpGXcstbk1ItJqFVjH6Q8MGxEN3Cm9Y1A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xOpLV0Z2VTRJ3iWtnWZcsyjXubTIkYWo31cO+HV1o1k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BWUOLqgLBqc5NwxVlSV5H3KFQPXbCp7mdo+jF+8cJqY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fuQb1S6xZDGlrEbK+kI23aL53PP1PVNwqICnZNt9Yzg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfscnoibFttahLdPVC4Ee+47ewGFKpDSU7M6HX19bKE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rpSW2awybNVeKtat91VFxqbINoTfNhPfQAu+d73Xtf8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9M/CP9ccOIIj2LLFmE0GFDO0Ban2wsNalEXfM6+h+1s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WrEMG49l1ye4MhXs5ZS9tz8P6h+hDvthIg/2wW9ne1Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ImNhbfeyfH8qIEeA5ic0s3dAQBdzzTBS+CPsNih9vZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dWP33YDSn04UKJN2ogh2Rui0iW/0q2y18OCDRVcfyoo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lYv0isAtfGh6H9tdp3cp2eHU7q2J+uk7QrgcxtK3w7Y=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VGMoamB/+7zTOYcY/pqJc96xlv2PdW4hwsIAEIslTDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yNeBWMF7BnD9wVwz2PgJsvWr77QiVvvWUvJF0+fqBug=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfpvObJ+tJBXSvqeN7vlOfmhYign635lciYAJIjUtY8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dsen4NqjzVGjpjufiTMs3+gqeD09EbnuogPgxrJECwg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pxCWVM3sn19NsFEpgHbgLa+PmYlhN3mMiP0Wk8kJhYw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q11KNvJszjYIB9n9HcC+N4uz11a3eRj1L3BH9scKMDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A1PmkgcEToWh1JiVWE6mI5jUu7poxWWuCUt/cgRUUDc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qJo3Hu4PJeanL7XEaWXO/n3YsodhZyd+MJOOmB9Kpd8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BkBKLO8URFscfRY9Bav/1+L9mLohDgNr/MkZtGiraIs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rZq5WA3Hx3xthOyHAJXK//f8pE2qbz7YKu3TIMp9GFY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X07a/Lm80p5xd4RFs1dNmw+90tmPDPdGiAKVZkxd4zY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6YrBn2ofIw1b5ooakrLOwF41BWrps8OO0H9WH4/rtlE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0l86Ag5OszXpa78SlOUV3K9nff5iC1p0mRXtLg9M1s4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Hn6yuxFHodeyu7ISlhYrbSf9pTiH4TDEvbYLWjTwFO0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zdf4y2etKBuIpkEU1zMwoCkCsdisfXZCh8QPamm+drY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rOQ9oMdiK5xxGH+jPzOvwVqdGGnF3+HkJXxn81s6hp4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "61aKKsE3+BJHHWYvs3xSIBvlRmKswmaOo5rygQJguUg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KuDb/GIzqDM8wv7m7m8AECiWJbae5EKKtJRugZx7kR0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Q+t8t2TmNUiCIorVr9F3AlVnX+Mpt2ZYvN+s8UGict8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tJRZIpKxUgHyL83kW8cvfjkxN3z6WoNnUg+SQw+LK+k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pnUsYjip8SvW0+m9mR5WWTkpK+p6uwJ6yBUAlBnFKMk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PArHlz+yPRYDycAP/PgnI/AkP8Wgmfg++Vf4UG1Bf0E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wnIh53Q3jeK8jEBe1n8kJLa89/H0BxO26ZU8SRIAs9Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4F8U59gzBLGhq58PEWQk2nch+R0Va7eTUoxMneReUIA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ihKagIW3uT1dm22ROr/g5QaCpxZVj2+Fs/YSdM2Noco=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EJtUOOwjkrPUi9mavYAi+Gom9Y2DuFll7aDwo4mq0M0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dIkr8dbaVRQFskAVT6B286BbcBBt1pZPEOcTZqk4ZcI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "aYVAcZYkH/Tieoa1XOjE/zCy5AJcVTHjS0NG2QB7muA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sBidL6y8TenseetpioIAAtn0lK/7C8MoW4JXpVYi3z8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0Dd2klU/t4R86c2WJcJDAd57k/N7OjvYSO5Vf8KH8sw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "I3jZ92WEVmZmgaIkLbuWhBxl7EM6bEjiEttgBJunArA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "aGHoQMlgJoGvArjfIbc3nnkoc8SWBxcrN7hSmjMRzos=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "bpiWPnF/KVBQr5F6MEwc5ZZayzIRvQOLDAm4ntwOi8g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tI7QVKbE6avWgDD9h4QKyFlnTxFCwd2iLySKakxNR/I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XGsge0CnoaXgE3rcpKm8AEeku5QVfokS3kcI+JKV1lk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JQxlryW2Q5WOwfrjAnaZxDvC83Dg6sjRVP5zegf2WiM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YFuHKJOfoqp1iGVxoFjx7bLYgVdsN4GuUFxEgO9HJ5s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Z6vUdiCR18ylKomf08uxcQHeRtmyav7/Ecvzz4av3k4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SPGo1Ib5AiP/tSllL7Z5PAypvnKdwJLzt8imfIMSEJQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "m94Nh6PFFQFLIib9Cu5LAKavhXnagSHG6F5EF8lD96I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pfEkQI98mB+gm1+JbmVurPAODMFPJ4E8DnqfVyUWbSo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DNj3OVRLbr43s0vd+rgWghOL3FqeO/60npdojC8Ry/M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kAYIQrjHVu49W8FTxyxJeiLVRWWjC9fPcBn+Hx1F+Ss=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "aCSO7UVOpoQvu/iridarxkxV1SVxU1i9HVSYXUAeXk4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Gh6hTP/yj1IKlXQ+Q69KTfMlGZjEcXoRLGbQHNFo/1s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/gDgIFQ4tAlJk3GN48IS5Qa5IPmErwGk8CHxAbp6gs0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PICyimwPjxpusyKxNssOOwUotAUbygpyEtORsVGXT8g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4lu+cBHyAUvuxC6JUNyHLzHsCogGSWFFnUCkDwfQdgI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pSndkmoNUJwXjgkbkgOrT5f9nSvuoMEZOkwAN9ElRaE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tyW+D4i26QihNM5MuBM+wnt5AdWGSJaJ4X5ydc9iWTU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9Syjr8RoxUgPKr+O5rsCu07AvcebA4P8IVKyS1NVLWc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "67tPfDYnK2tmrioI51fOBG0ygajcV0pLo5+Zm/rEW7U=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "y0EiPRxYTuS1eVTIaPQUQBBxwkyxNckbePvKgChwd0M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "NWd+2veAaeXQgR3vCvzlI4R1WW67D5YsVLdoXfdb8qg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PY5RQqKQsL2GqBBSPNOEVpojNFRX/NijCghIpxD6CZk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lcvwTyEjFlssCJtdjRpdN6oY+C7bxZY+WA+QAqzj9zg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWE7XRNylvTwO/9Fv56dNqUaQWMmESNS/GNIwgBaEI0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ijwlrUeS8nRYqK1F8kiCYF0mNDolEZS+/lJO1Lg93C8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8KzV+qYGYuIjoNj8eEpnTuHrMYuhzphl80rS6wrODuU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wDyTLjSEFF895hSQsHvmoEQVS6KIkZOtq1c9dVogm9I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SGrtPuMYCjUrfKF0Pq/thdaQzmGBMUvlwN3ORIu9tHU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KySHON3hIoUk4xWcwTqk6IL0kgjzjxgMBObVIkCGvk4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hBIdS9j0XJPeT4ot73ngELkpUoSixvRBvdOL9z48jY8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Tx6um0q9HjS5ZvlFhvukpI6ORnyrXMWVW1OoxvgqII0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zFKlyfX5H81+d4A4J3FKn4T5JfG+OWtR06ddyX4Mxas=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cGgCDuPV7MeMMYEDpgOupqyNP4BQ4H7rBnd2QygumgM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IPaUoy98v11EoglTpJ4kBlEawoZ8y7BPwzjLYBpkvHQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Pfo4Am6tOWAyZNn8G9W5HWWGC3ZWmX0igI/RRB870Ro=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fnTSjd7bC1Udoq6iM7UDnHAC/lsIXSHp/Gy332qw+/I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fApBgVRrTDyEumkeWs5p3ag9KB48SbU4Si0dl7Ns9rc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QxudfBItgoCnUj5NXVnSmWH3HK76YtKkMmzn4lyyUYY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sSOvwhKa29Wq94bZ5jGIiJQGbG1uBrKSBfOYBz/oZeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FdaMgwwJ0NKsqmPZLC5oE+/0D74Dfpvig3LaI5yW5Fs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "sRWBy12IERN43BSZIrnBfC9+zFBUdvjTlkqIH81NGt4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/4tIRpxKhoOwnXAiFn1Z7Xmric4USOIfKvTYQXk3QTc=", - "subType": "00" - } - } - ] - }, - { - "_id": { - "$numberInt": "1" - }, - "encryptedDecimalNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "Mr/laWHUijZT5VT3x2a7crb7wgd/UXOGz8jr8BVqBpM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wXVD/HSbBljko0jJcaxJ1nrzs2+pchLQqYR3vywS8SU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VDCpBYsJIxTfcI6Zgf7FTmKMxUffQv+Ys8zt5dlK76I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zYDslUwOUVNwTYkETfjceH/PU3bac9X3UuQyYJ19qK0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rAOmHSz18Jx107xpbv9fYcPOmh/KPAqge0PAtuhIRnc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BFOB1OGVUen7VsOuS0g8Ti7oDsTt2Yj/k/7ta8YAdGM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2fckE5SPs0GU+akDkUEM6mm0EtcV3WDE/sQsnTtodlk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "mi9+aNjuwIvaMpSHENvKzKRAmX9cYguo2mXLvOoftHQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "K6TWn4VcWWkz/gkUkLmbtwkG7SNeABICmLDnoYJFlLU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Z+2/cEtGU0Fq7QJFNGA/0y4aWAsw0ncG6X0LYRqwS3c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rrSIf+lgcNZFbbUkS9BmE045jRWBpcBJXHzfMVEFuzE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KlHL3Kyje1/LMIfgbCqw1SolxffJvvgsYBV5y77wxuA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hzJ1YBoETmYeCh352dBmG8d8Wse/bUcqojTWpWQlgsc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lSdcllDXx8MA+s0GULjDA1lQkcV0L8/aHtZ6dM2pZ2c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "HGr7JLTTA7ksAnlmjSIwwdBVvgr3fv46/FTdiCPYpos=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "mMr25v1VwOEVZ8xaNUTHJCcsYqV+kwK6RzGYilxPtJ4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "129hJbziPJzNo0IoTU3bECdge0FtaPW8dm4dyNVNwYU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "doiLJ96qoo+v7NqIAZLq6BI5axV8Id8gT5vyJ1ZZ0PM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cW/Lcul3xYmfyvI/0x/+ybN78aQmBK1XIGs1EEU09N8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1aVIwzu9N5EJV9yEES+/g6hOTH7cA2NTcLIc59cu0wU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kw5tyl7Ew0r1wFyrN1mB9FiVW2hK2BxxxUuJDNWjyjQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ADAY2YBrm6RJBDY/eLLcfNxmSJku+mefz74gH66oyco=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8gkqB1LojzPrstpFG7RHYmWxXpIlPDTqWnNsXH7XDRU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "TESfVQMDQjfTZmHmUeYUE2XrokJ6CcrsKx/GmypGjOw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qFM+HFVQ539S0Ouynd1fBHoemFxtU9PRxE5+Dq7Ljy4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jPiFgUZteSmOg4wf3bsEKCZzcnxmMoILsgp/GaZD+dM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YaWUgJhYgPNN7TkFK16H8SsQS226JguaVhOIQxZwQNQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x90/Qk3AgyaFsvWf2KUCu5XF3j76WFSjt/GrnG01060=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ZGWybWL/xlEdMYRFCZDUoz10sywTf7U/7wufsb78lH0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8l4ganN66jIcdxfHAdYLaym/mdzUUQ8TViw3MDRySPc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "c8p5XEGTqxqvRGVlR+nkxw9uUdoqDqTB0jlYQ361qMA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1ZGFLlpQBcU3zIUg8MmgWwFKVz/SaA7eSYFrfe3Hb70=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "34529174M77rHr3Ftn9r8jU4a5ztYtyVhMn1wryZSkU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YkQ4pxFWzc49MS0vZM6S8mNo4wAwo21rePBeF3C+9mI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MhOf4mYY00KKVhptOcXf0bXB7WfuuM801MRJg4vXPgc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7pbbD8ihNIYIBJ3tAUPGzHpFPpIeCTAk5L88qCB0/9w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "C9Q5PoNJTQo6pmNzXEEXUEqH22//UUWY1gqILcIywec=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "AqGVk1QjDNDLYWGRBX/nv9QdGR2SEgXZEhF0EWBAiSE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/sGI3VCbJUKATULJmhTayPOeVW+5MjWSvVCqS77sRbU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yOtbL0ih7gsuoxVtRrACMz+4N5uo7jIR7zzmtih2Beo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uA6dkb2Iyg9Su8UNDvZzkPx33kPZtWr/CCuEY+XgzUM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1DoSFPdHIplqZk+DyWAmEPckWwXw/GdB25NLmzeEZhk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OfDVS0T3ZuIXI/LNbTp6C9UbPIWLKiMy6Wx+9tqNl+g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "3PZjHXbmG6GtPz+iapKtQ3yY4PoFFgjIy+fV2xQv1YU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kaoLN0BoBWsmqE7kKkJQejATmLShd8qffcAmlhsxsGY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vpiw9KgQdegGmp7IJnSGX2miujRLU0xzs0ITTqbPW7c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "NuXFf7xGUefYjIUTuMxNUTCfVHrF8oL0AT7dPv5Plk4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8Tz53LxtfEBJ9eR+d2690kwNsqPV6XyKo2PlqZCbUrc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "e6zsOmHSyV8tyQtSX6BSwui6wK9v1xG3giY/IILJQ2w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2fedFMCxa2DzmIpfbDKGXhQg0PPwbUv6vIWdwwlvhms=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yEJKMFnWXTC8tJUfzCInzQRByNEPjHxpw4L4m8No91Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YbFuWwOiFuQyOzIJXDbOkCWC2DyrG+248TBuVCa1pXU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "w7IkwGdrguwDrar5+w0Z3va5wXyZ4VXJkDMISyRjPGo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YmJUoILTRJPhyIyWyXJTsQ6KSZHHbEpwPVup6Ldm/Ko=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FvMjcwVZJmfh6FP/yBg2wgskK+KHD8YVUY6WtrE8xbg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "h4HCtD4HyYz0nci49IVAa10Z4NJD/FHnRMV4sRX6qro=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "nC7BpXCmym+a0Is2kReM9cYN2M1Eh5rVo8fjms14Oiw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1qtVWaeVo649ZZZtN8gXbwLgMWGLhz8beODbvru0I7Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Ej+mC0QFyMNIiSjR939S+iGBm7dm+1xObu5IcF/OpbU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UQ8LbUG3cMegbr9yKfKanAPQE1EfPkFciVDrNqZ5GHY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4iI3mXIDjnX+ralk1HhJY43mZx2uTJM7hsv9MQzTX7E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0WQCcs3rvsasgohERHHCaBM4Iy6yomS4qJ5To3/yYiw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qDCTVPoue1/DOAGNAlUstdA9Sid8MgEY4e5EzHcVHRk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9F9Mus0UnlzHb8E8ImxgXtz6SU98YXD0JqswOKw/Bzs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pctHpHKVBBcsahQ6TNh6/1V1ZrqOtKSAPtATV6BJqh0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vfR3C/4cPkVdxtNaqtF/v635ONbhTf5WbwJM6s4EXNE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ejP43xUBIex6szDcqExAFpx1IE/Ksi5ywJ84GKDFRrs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jbP4AWYd3S2f3ejmMG7dS5IbrFol48UUoT+ve3JLN6U=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CiDifI7958sUjNqJUBQULeyF7x0Up3loPWvYKw9uAuw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "e2dQFsiHqd2BFHNhlSxocjd+cPs4wkcUW/CnCz4KNuM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PJFckVmzBipqaEqsuP2mkjhJE4qhw36NhfQ9DcOHyEU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "S3MeuJhET/B8VcfZYDR9fvX0nscDj416jdDekhmK11s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CGVHZRXpuNtQviDB2Kj03Q8uvs4w3RwTgV847R7GwPw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yUGgmgyLrxbEpDVy89XN3c2cmFpZXWWmuJ/35zVZ+Jw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "inb6Q97mL1a9onfNTT8v9wsoi/fz7KXKq3p8j90AU9c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CCyYx/4npq9xGO1lsCo8ZJhFO9/tN7DB+/DTE778rYg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "LNnYw4fwbiAZu0kBdAHPEm/OFnreS+oArdB5O/l/I98=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "P006SxmUS/RjiQJVYPdMFnNo3827GIEmSzagggkg05Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "oyvwY+WsnYV6UHuPki1o0ILJ2jN4uyXf9yaUNtZJyBA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "36Lk3RHWh1wmtCWC/Yj6jNIo17U5y6SofAgQjzjVxD8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vOOo8FqeHnuO9mqOYjIb4vgwIwVyXZ5Y+bY5d9tGFUM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "bJiDJjwQRNxqxlGjRm5lLziFhcfTDCnQ/qU1V85qcRg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2Qgrm1n0wUELAQnpkEiIHB856yv76q8jLbpiucetcm0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "5ciPOYxTK0WDwwYyfs7yiVymwtYQXDELLxmM4JLl4/o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "31dC2WUSIOKQc4jwT6PikfeYTwi80mTlh7P31T5KNQU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YluTV2Mu53EGCKLcWfHZb0BM/IPW2xJdG3vYlDMEsM4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dh/8lGo2Ek6KukSwutH6Q35iy8TgV0FN0SJqe0ZVHN8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EVw6HpIs3BKen2qY2gz4y5dw1JpXilfh07msZfQqJpc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FYolLla9L8EZMROEdWetozroU40Dnmwwx2jIMrr7c1A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "8M6k4QIutSIj6CM41vvkQtuFsaGrjoR9SZJVSLbfGKQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9LM0VoddDNHway442MqY+Z7vohB2UHau/cddshhzf40=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "66i8Ytco4Yq/FMl6pIRZazz3CZlu8fO2OI6Pne0pvHU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2a/HgX+MjZxjXtSvHgF1yEpHMJBkl8Caee8XrJtn0WM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "frhBM662c4ZVG7mWP8K/HhRjd01lydW/cPcHnDjifqc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6k1T7Q1t668PBqv6fwpVnT1HWh7Am5LtbKvwPJKcpGU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UlJ5Edfusp8S/Pyhw6KTglIejmbr1HO0zUeHn/qFETA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jsxsB+1ECB3assUdoC333do9tYH+LglHmVSJHy4N8Hg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2nzIQxGYF7j3bGsIesECEOqhObKs/9ywknPHeJ3yges=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xJYKtuWrX90JrJVoYtnwP7Ce59XQGFYoalxpNfBXEH0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "NLI5lriBTleGCELcHBtNnmnvwSRkHHaLOX4cKboMgTw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hUOQV0RmE5aJdJww1AR9rirJG4zOYPo+6cCkgn/BGvQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "h4G2Of76AgxcUziBwCyH+ayMOpdBWzg4yFrTfehSC2c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VuamM75RzGfQpj2/Y1jSVuQLrhy6OAwlZxjuQLB/9Ss=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kn9+hLq7hvw02xr9vrplOCDXKBTuFhfbX7d5v/l85Pg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fAiGqKyLZpGngBYFbtYUYt8LUrJ49vYafiboifTDjxs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BxRILymgfVJCczqjUIWXcfrfSgrrYkxTM5VTg0HkZLY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CrFY/PzfPU2zsFkGLu/dI6mEeizZzCR+uYgjZBAHro0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "AEbrIuwvXLTtYgMjOqnGQ8y8axUn5Ukrn7UZRSyfQVw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ouWeVH3PEFg+dKWlXc6BmqirJOaVWjJbMzZbCsce4dA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+hd6xFB+EG+kVP7WH4uMd1CLaWMnt5xJRaY/Guuga9Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zmpGalfAOL3gmcUMJYcLYIRT/2VDO/1Dw4KdYZoNcng=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2PbHAoM/46J2UIZ/vyksKzmVVfxA7YUyIxWeL/N/vBk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7fD9x+zk5MVFesb59Klqiwwmve7P5ON/5COURXj5smE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tlrNQ4jaq051iaWonuv1sSrYhKkL1LtNZuHsvATha3s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fBodm28iClNpvlRyVq0dOdXQ08S7/N3aDwid+PdWvRo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "O+/nnRqT3Zv7yMMGug8GhKHaWy6u7BfRGtZoj0sdN1c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "5AZZ/RTMY4Photnm/cpXZr/HnFRi3eljacMsipkJLHA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "oFVyo/kgoMxBIk2VE52ySSimeyU+Gr0EfCwapXnTpKA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Z8v59DfcnviA0mzvnUk+URVO0UuqAWvtarEgJva/n1c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "P64GOntZ+zBJEHkigoh9FSxSO+rJTqR20z5aiGQ9an4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xMbSuDPfWuO/Dm7wuVl06GnzG9uzTlJJX9vFy7boGlY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kXPB19mRClxdH2UsHwlttS6lLU2uHvzuZgZz7kC45jU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "NDVjVYXAw4k0w4tFzvs7QDq39aaU3HQor4I2XMKKnCk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uKw/+ErVfpTO1dGUfd3T/eWfZW3nUxXCdBGdjvHtZ88=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "av0uxEzWkizYWm0QUM/MN1hLibnxPvCWJKwjOV4yVQY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ERwUC47dvgOBzIsEESMIioLYbFOxOe8PtJTnmDkKuHM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2gseKlG5Le12fS/vj4eaED4lturF16kAgJ1TpW3HxEE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7Cvg0Y3j/5i2F1TeXxlMmU7xwif5dCmwkZAOrVC5K2Y=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-Aggregate.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-Aggregate.json deleted file mode 100644 index 271f57b12..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-Aggregate.json +++ /dev/null @@ -1,584 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range DecimalPrecision. Aggregate.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalPrecision": { - "$gt": { - "$numberDecimal": "0" - } - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1" - } - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDecimalPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "default", - "pipeline": [ - { - "$match": { - "encryptedDecimalPrecision": { - "$gt": { - "$binary": { - "base64": "DRYKAAADcGF5bG9hZACiCQAABGcAjgkAAAMwAH0AAAAFZAAgAAAAAHdJ2Vnb4MMzqVYVssjSdDy8XU4GVzMTfGifGETgQ2mYBXMAIAAAAAD7cFfKJGIXo6PjyeX2ria02CckW7dWFDoY/3FyBdm1NQVsACAAAAAAhEPSNv4M023A3hzNFuy83+hIKuZ2mKRY954N++aEOBUAAzEAfQAAAAVkACAAAAAAlmvfDrZoydUet4eCVMq7z6a58Ea+1HLJOWxN5lNcrWEFcwAgAAAAAEBo5AWZyC41b9ayjWNQSL4iYEAIwR/JG+ssN8bdoK9RBWwAIAAAAACEndE0SLxFSElOrNnqeX0EPmgDio3udZjVREy4JLS3sQADMgB9AAAABWQAIAAAAABbiLaoxAA6rinMJw1hC8ZUiq6UU1AQaPFn/py/Y06WuQVzACAAAAAAhtDasFkvYE7SCNu1je/hxdE9TJtAvvH3NtdEbKzNbCUFbAAgAAAAAIGepU1RSCF8sWODHEpKglsoqw3VBBH4a/URGxgGzbq2AAMzAH0AAAAFZAAgAAAAALORWwSr+tYNxcil2KIGSbNhTHvcPbdj+rLVQNx21S/KBXMAIAAAAAD6diZBkPEJ1cQy06LAxdbNK8Nlxbb44fH4Wk3Y3260nQVsACAAAAAA1eYAZBFHlDiaDAljWi8blGQ2nvvZa5AO5doeo0SFZsgAAzQAfQAAAAVkACAAAAAAG5XMK96PjClNlUvg82j4pMY1YxsznZfj4uNweD394FoFcwAgAAAAAKHgQLdGJHkrfFg9nB93Ac+3VgBw6aU44MTkKIQ91dZoBWwAIAAAAAAPxXmi+SDJ+40A0KdwfRczexlZQrHjIA+D3oUB0EY9tAADNQB9AAAABWQAIAAAAAA6M++b9I0YFemmWBAWAE3glu2Ah3Ta1FBxAQEIWS0toAVzACAAAAAANXYTqPf1Y6X3Ns6YQIX0C3FKCyWUo+Kk+fNcQvc0WSoFbAAgAAAAAA+uJUw1ICYgyeygSRe206VTWVtUnhdci3iHbyP5YtEVAAM2AH0AAAAFZAAgAAAAAKl8bV1riH/uyJ+X0HHd3+18k2cJl2dQFXCdoagutFcaBXMAIAAAAABm8F2Ew9f0VOABdcF+lP0Bi+zWvEUPniWgrxPq/Sx3uwVsACAAAAAAJfFErjZ6BPhsw5LjJLqNtKDLJ4zV0eIZppQpd9b0wZoAAzcAfQAAAAVkACAAAAAAsYZD8JEP6kYsPncFnNZwJxhu4YtUTKPNcjHtv67H+rYFcwAgAAAAAI4LqZcRkvbs/2F62Flu0pixNcor4WmBD0DHGaf039wLBWwAIAAAAAD4wUR3xd9lKltcqqo8LYvdMQWzCRobkV/ppKB/yn5dUgADOAB9AAAABWQAIAAAAAC0vdAi+dmoIXvZ5LqUqvyKV9/tHqSI2SWiSJO5pTnA2wVzACAAAAAAS2qvf9fvfVUH5WtsVxjxmskpGjYTQV34LwvQQw1y9wIFbAAgAAAAAE0+FKuK7HxbypvCeEJzMTcjOWE0ScYOlTBMUNlIv55hAAM5AH0AAAAFZAAgAAAAAH31lb/srBcrOXkzddCwAnclsR5/3QijEVgECs2JjOWBBXMAIAAAAABg7+prDT73YcCvLE5QbuIrqGcjLc5pQD2Miq0d29yrxgVsACAAAAAAetRiPwDSFWBzpWSWkOKWM6fKStRJ8SyObnpc79ux8p0AAzEwAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzExAH0AAAAFZAAgAAAAAFdthRhe2Q8CvxGIhjTJZv0Lk97GkHciTPxZ/mckLoNaBXMAIAAAAAAqOxsAr23LOVB0DIHbPf9UDJJRFXY2YoKbjhRqw5psbQVsACAAAAAA0G2GD8ZQjDBntjLpW4rqwKRS6HiUjL03g1N6chANozcAAzEyAH0AAAAFZAAgAAAAAMWymwwbvIeMqmnKWWifUqoCxOsdpnonM2qdLPyjqJO/BXMAIAAAAAB6IDmmpUhBD2zpRj8/y/kmOSXcjuIU14sNh6GKSsg2uwVsACAAAAAAWMFPNOk3EMSQDS9JGPSMIQP0oNGVugxXKKUrIPPlhHgAAzEzAH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzE0AH0AAAAFZAAgAAAAAJaRYmo8zqI2BEUzdSwp4tVRpPmVWsfydkYN3UHh6TMuBXMAIAAAAAAeD6mDnQeLlbC9i0sVgE8+RH6y+e94OJQ0tJ0PvblVSgVsACAAAAAAWp4jvretbDEsqEMzP/WLTnwOiJwCtfrCiB6m8k+yEMoAAzE1AH0AAAAFZAAgAAAAAAZZ538coNPwyRjhEwr5P8Xw32oWOJF+R+nfCGgy2qO3BXMAIAAAAACOPLnJlKwGNPDBReRKnHfteq0wFb3ezhrc7BVXs8RUHwVsACAAAAAA+lGesNk3+SyB/60rSvdQ2aN2vfJPR7llJVhufGTNhHkAAzE2AH0AAAAFZAAgAAAAAFH9l9GGA1I52atJV5jNUf1lx8jBjoEoVoME97v5GFJiBXMAIAAAAAC1qH3Kd78Dr9NGbw7y9D/XYBwv5h1LLO8la5OU7g8UkQVsACAAAAAArZ6atJCYrVfHB8dSNPOFf6nnDADBMJcIEj8ljPvxHp8AAzE3AH0AAAAFZAAgAAAAADtbVEI2tdkrowEMdkacD2w0Y3T3Ofi7PH6HmA6sP0c/BXMAIAAAAADuBSROnZHA+NgUPH8d0LnWFiDsM2bY8bzjC1+elSsIygVsACAAAAAAR0G2m+uANoWknkr/NerFcG+fECVxNIs0cqbY1t/U/0MAAzE4AH0AAAAFZAAgAAAAAAh3WpeMVlikPFYj9hLj+fmIqVt6omCSF75W3TPExyWpBXMAIAAAAAAsQkRmwqeVj2gGE03orb6PtrIzDt6dDU3hgSQi8E2wKgVsACAAAAAA3GHaRE2RAcaBRd8VzmYzWeBD2Gmy91eTK1k8YdWObZcAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHBuAAIAAAAQdGYAAQAAABNtbgAAAAAAAAAAAAAAAAAAAD4wE214ANAHAAAAAAAAAAAAAAAAPjAA", - "subType": "06" - } - } - } - } - } - ], - "cursor": {}, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "aggregate" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": { - "$numberInt": "0" - }, - "encryptedDecimalPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "Dri0CXmL78L2DOgk9w0DwxHOMGMzih7m6l59vgy+WWo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "b7d8mRzD1kI1tdc7uNL+YAUonJ6pODLsRLkArfEKSkM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Xg8C1/A0KJaXOw4i+26Rv03/CydaaunOzXh0CIT+gn8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UoKUDw2wJYToUCcFaIs03YQSTksYR0MIOTJllwODqKc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "c/5cwAT0C5jber2xlJnWD3a5tVDy0nRtr5HG02hoFOY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wSUrRXavAGaajNeqC5mEUH1K67oYl5Wy9RNIzKjwLAM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6vrp4wWDtHEgHWR99I70WVDzevg1Fk/Pw5U8gUDa0OU=", - "subType": "00" - } - } - ] - }, - { - "_id": { - "$numberInt": "1" - }, - "encryptedDecimalPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "mVZb+Ra0EYjQ4Zrh9X//E2T8MRj7NMqm5GUJXhRrBEI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FA74j21GUEJb1DJBOpR9nVnjaDZnd8yAQNuaW9Qi26g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kJv//KVkbrobIBf+QeWC5jxn20mx/P0R1N6aCSMgKM8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zB+Whi9IUUGxfLEe+lGuIzLX4LFbIhaIAm5lRk65QTc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ybO1QU3CgvhO8JgRXH+HxKszWcpl5aGDYYVa75fHa1g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X3Y3eSAbbMg//JgiHHiFpYOpV61t8kkDexI+CQyitH4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SlNHXyqVFGDPrX/2ppwog6l4pwj3PKda2TkZbqgfSfA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "McjV8xwTF3xI7863DYOBdyvIv6UpzThl6v9vBRk05bI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MgwakFvPyBlwqFTbhWUF79URJQWFoJTGotlEVSPPUsQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DyBERpMSD5lEM5Nhpcn4WGgxgn/mkUVJp+PYSLX5jsE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "I43iazc0xj1WVbYB/V+uTL/tughN1bBlxh1iypBnNsA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wjOBa/ATMuOywFmuPgC0GF/oeLqu0Z7eK5udzkTPbis=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gRQVwiR+m+0Vg8ZDXqrQQcVnTyobwCXNaA4BCJVXtMc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WUZ6huwx0ZbLb0R00uiC9FOJzsUocUN8qE5+YRenkvQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7s79aKEuPgQcS/YPOOVcYNZvHIo7FFsWtFCrnDKXefA=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-Correctness.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-Correctness.json deleted file mode 100644 index 895444588..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-Correctness.json +++ /dev/null @@ -1,1650 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "Find with $gt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$gt": { - "$numberDecimal": "0.0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $gte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$gte": { - "$numberDecimal": "0.0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - }, - { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $gt with no results", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$gt": { - "$numberDecimal": "1.0" - } - } - } - }, - "result": [] - } - ] - }, - { - "description": "Find with $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$lt": { - "$numberDecimal": "1.0" - } - } - } - }, - "result": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - ] - } - ] - }, - { - "description": "Find with $lte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$lte": { - "$numberDecimal": "1.0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - }, - { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $lt below min", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$lt": { - "$numberDecimal": "0.0" - } - } - } - }, - "result": { - "errorContains": "must be greater than the range minimum" - } - } - ] - }, - { - "description": "Find with $gt above max", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$gt": { - "$numberDecimal": "200.0" - } - } - } - }, - "result": { - "errorContains": "must be less than the range max" - } - } - ] - }, - { - "description": "Find with $gt and $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$gt": { - "$numberDecimal": "0.0" - }, - "$lt": { - "$numberDecimal": "2.0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with equality", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - }, - "result": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - ] - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with full range", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$gte": { - "$numberDecimal": "0.0" - }, - "$lte": { - "$numberDecimal": "200.0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - }, - { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $in", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$in": [ - { - "$numberDecimal": "0.0" - } - ] - } - } - }, - "result": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - ] - } - ] - }, - { - "description": "Insert out of range", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "-1" - } - } - }, - "result": { - "errorContains": "value must be greater than or equal to the minimum value" - } - } - ] - }, - { - "description": "Insert min and max", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 200, - "encryptedDecimalPrecision": { - "$numberDecimal": "200.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - }, - { - "_id": 200, - "encryptedDecimalPrecision": { - "$numberDecimal": "200.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalPrecision": { - "$gte": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - }, - { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gt with no results", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalPrecision": { - "$gt": { - "$numberDecimal": "1.0" - } - } - } - } - ] - }, - "result": [] - } - ] - }, - { - "description": "Aggregate with $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalPrecision": { - "$lt": { - "$numberDecimal": "1.0" - } - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $lte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalPrecision": { - "$lte": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - }, - { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $lt below min", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalPrecision": { - "$lt": { - "$numberDecimal": "0.0" - } - } - } - } - ] - }, - "result": { - "errorContains": "must be greater than the range minimum" - } - } - ] - }, - { - "description": "Aggregate with $gt above max", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalPrecision": { - "$gt": { - "$numberDecimal": "200.0" - } - } - } - } - ] - }, - "result": { - "errorContains": "must be less than the range max" - } - } - ] - }, - { - "description": "Aggregate with $gt and $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalPrecision": { - "$gt": { - "$numberDecimal": "0.0" - }, - "$lt": { - "$numberDecimal": "2.0" - } - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with equality", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - ] - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with full range", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalPrecision": { - "$gte": { - "$numberDecimal": "0.0" - }, - "$lte": { - "$numberDecimal": "200.0" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - }, - { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $in", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDecimalPrecision": { - "$in": [ - { - "$numberDecimal": "0.0" - } - ] - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0.0" - } - } - ] - } - ] - }, - { - "description": "Wrong type: Insert Int", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberInt": "0" - } - } - }, - "result": { - "errorContains": "cannot encrypt element" - } - } - ] - }, - { - "description": "Wrong type: Find Int", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$gte": { - "$numberInt": "0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": { - "errorContains": "field type is not supported" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-Delete.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-Delete.json deleted file mode 100644 index 7b3d5d822..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-Delete.json +++ /dev/null @@ -1,476 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range DecimalPrecision. Delete.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1" - } - } - } - }, - { - "name": "deleteOne", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$gt": { - "$numberDecimal": "0" - } - } - } - }, - "result": { - "deletedCount": 1 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDecimalPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "delete": "default", - "deletes": [ - { - "q": { - "encryptedDecimalPrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - }, - "limit": 1 - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "delete" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": { - "$numberInt": "0" - }, - "encryptedDecimalPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "Dri0CXmL78L2DOgk9w0DwxHOMGMzih7m6l59vgy+WWo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "b7d8mRzD1kI1tdc7uNL+YAUonJ6pODLsRLkArfEKSkM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Xg8C1/A0KJaXOw4i+26Rv03/CydaaunOzXh0CIT+gn8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UoKUDw2wJYToUCcFaIs03YQSTksYR0MIOTJllwODqKc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "c/5cwAT0C5jber2xlJnWD3a5tVDy0nRtr5HG02hoFOY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wSUrRXavAGaajNeqC5mEUH1K67oYl5Wy9RNIzKjwLAM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6vrp4wWDtHEgHWR99I70WVDzevg1Fk/Pw5U8gUDa0OU=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-FindOneAndUpdate.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-FindOneAndUpdate.json deleted file mode 100644 index af371f7b3..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-FindOneAndUpdate.json +++ /dev/null @@ -1,588 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range DecimalPrecision. FindOneAndUpdate.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1" - } - } - } - }, - { - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$gt": { - "$numberDecimal": "0" - } - } - }, - "update": { - "$set": { - "encryptedDecimalPrecision": { - "$numberDecimal": "2" - } - } - }, - "returnDocument": "Before" - }, - "result": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDecimalPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "default", - "query": { - "encryptedDecimalPrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - }, - "update": { - "$set": { - "encryptedDecimalPrecision": { - "$$type": "binData" - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "findAndModify" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": { - "$numberInt": "0" - }, - "encryptedDecimalPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "Dri0CXmL78L2DOgk9w0DwxHOMGMzih7m6l59vgy+WWo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "b7d8mRzD1kI1tdc7uNL+YAUonJ6pODLsRLkArfEKSkM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Xg8C1/A0KJaXOw4i+26Rv03/CydaaunOzXh0CIT+gn8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UoKUDw2wJYToUCcFaIs03YQSTksYR0MIOTJllwODqKc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "c/5cwAT0C5jber2xlJnWD3a5tVDy0nRtr5HG02hoFOY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wSUrRXavAGaajNeqC5mEUH1K67oYl5Wy9RNIzKjwLAM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6vrp4wWDtHEgHWR99I70WVDzevg1Fk/Pw5U8gUDa0OU=", - "subType": "00" - } - } - ] - }, - { - "_id": { - "$numberInt": "1" - }, - "encryptedDecimalPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "V6knyt7Zq2CG3++l75UtBx2m32iGAPjHiAe439Bf02w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "F08nMDWDZc+DbWM7XCEJNNCEYyinRmrvGP7EWhmp4is=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cXH4688amcDc8kZOJq4UP8cE3R58Zl7e+Qo/1jyspps=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uURBxvTp3FBCVkd+LPqyuY7d6rMW6SGIJQEPY/wtkZI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jG3hax1L3RBp9t38vUt53FsBxgr/+Si/vVISpAylYpE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kwtIW8MhH9Ky5xNjBx8gFA/SHh2YVphie7g5FGBzals=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FHflwFuEMu4xX0ZApHi+pdlBH+oevAtXckCUb5Wv0xU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0OKSXELxPP85SBVwDGf3LtMEQCJ8TTkFUl/+6jlkdb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "25j9sQXZCihCmHKvTHgaBsAVZFcGPn7JjHdrCGlwyyw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uEw0lpQtBppR3vqV9j9+NQRSBF1BzZukb8c9IhyWvxc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zVhZ7Q59O087ji49oMJvBIgeir2oqvUpnh4p53GcTow=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dowrzKs+qJhRMZyKDbhjXbuX43FbmUKOaw9I8YlOZDw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ep5B6cska6THLIF7Mn3tn3RvV9EiwLSt0eZM/CLRUDc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "URNp/YmmDh5wIZUfAzzgPyJeMNiVx9PMsz52DZRujGY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wlM4IAQhhKQEzoVqS8b1Ddd50GB95OFb9LnzOwyjCP4=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-InsertFind.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-InsertFind.json deleted file mode 100644 index bbe81f87a..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-InsertFind.json +++ /dev/null @@ -1,571 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range DecimalPrecision. Insert and Find.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$gt": { - "$numberDecimal": "0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1" - } - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDecimalPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "encryptedDecimalPrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "Dri0CXmL78L2DOgk9w0DwxHOMGMzih7m6l59vgy+WWo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "b7d8mRzD1kI1tdc7uNL+YAUonJ6pODLsRLkArfEKSkM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Xg8C1/A0KJaXOw4i+26Rv03/CydaaunOzXh0CIT+gn8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UoKUDw2wJYToUCcFaIs03YQSTksYR0MIOTJllwODqKc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "c/5cwAT0C5jber2xlJnWD3a5tVDy0nRtr5HG02hoFOY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wSUrRXavAGaajNeqC5mEUH1K67oYl5Wy9RNIzKjwLAM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6vrp4wWDtHEgHWR99I70WVDzevg1Fk/Pw5U8gUDa0OU=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedDecimalPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "mVZb+Ra0EYjQ4Zrh9X//E2T8MRj7NMqm5GUJXhRrBEI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FA74j21GUEJb1DJBOpR9nVnjaDZnd8yAQNuaW9Qi26g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kJv//KVkbrobIBf+QeWC5jxn20mx/P0R1N6aCSMgKM8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zB+Whi9IUUGxfLEe+lGuIzLX4LFbIhaIAm5lRk65QTc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ybO1QU3CgvhO8JgRXH+HxKszWcpl5aGDYYVa75fHa1g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X3Y3eSAbbMg//JgiHHiFpYOpV61t8kkDexI+CQyitH4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SlNHXyqVFGDPrX/2ppwog6l4pwj3PKda2TkZbqgfSfA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "McjV8xwTF3xI7863DYOBdyvIv6UpzThl6v9vBRk05bI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MgwakFvPyBlwqFTbhWUF79URJQWFoJTGotlEVSPPUsQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DyBERpMSD5lEM5Nhpcn4WGgxgn/mkUVJp+PYSLX5jsE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "I43iazc0xj1WVbYB/V+uTL/tughN1bBlxh1iypBnNsA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wjOBa/ATMuOywFmuPgC0GF/oeLqu0Z7eK5udzkTPbis=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gRQVwiR+m+0Vg8ZDXqrQQcVnTyobwCXNaA4BCJVXtMc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WUZ6huwx0ZbLb0R00uiC9FOJzsUocUN8qE5+YRenkvQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7s79aKEuPgQcS/YPOOVcYNZvHIo7FFsWtFCrnDKXefA=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-Update.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-Update.json deleted file mode 100644 index 987bdf1aa..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DecimalPrecision-Update.json +++ /dev/null @@ -1,588 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range DecimalPrecision. Update.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDecimalPrecision": { - "$numberDecimal": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDecimalPrecision": { - "$numberDecimal": "1" - } - } - } - }, - { - "name": "updateOne", - "arguments": { - "filter": { - "encryptedDecimalPrecision": { - "$gt": { - "$numberDecimal": "0" - } - } - }, - "update": { - "$set": { - "encryptedDecimalPrecision": { - "$numberDecimal": "2" - } - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDecimalPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command_name": "update", - "command": { - "update": "default", - "ordered": true, - "updates": [ - { - "q": { - "encryptedDecimalPrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - }, - "u": { - "$set": { - "encryptedDecimalPrecision": { - "$$type": "binData" - } - } - } - } - ], - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDecimalPrecision", - "bsonType": "decimal", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDecimal": "0.0" - }, - "max": { - "$numberDecimal": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - }, - "$db": "default" - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDecimalPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "Dri0CXmL78L2DOgk9w0DwxHOMGMzih7m6l59vgy+WWo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "b7d8mRzD1kI1tdc7uNL+YAUonJ6pODLsRLkArfEKSkM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Xg8C1/A0KJaXOw4i+26Rv03/CydaaunOzXh0CIT+gn8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UoKUDw2wJYToUCcFaIs03YQSTksYR0MIOTJllwODqKc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "c/5cwAT0C5jber2xlJnWD3a5tVDy0nRtr5HG02hoFOY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wSUrRXavAGaajNeqC5mEUH1K67oYl5Wy9RNIzKjwLAM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6vrp4wWDtHEgHWR99I70WVDzevg1Fk/Pw5U8gUDa0OU=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedDecimalPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "V6knyt7Zq2CG3++l75UtBx2m32iGAPjHiAe439Bf02w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "F08nMDWDZc+DbWM7XCEJNNCEYyinRmrvGP7EWhmp4is=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cXH4688amcDc8kZOJq4UP8cE3R58Zl7e+Qo/1jyspps=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uURBxvTp3FBCVkd+LPqyuY7d6rMW6SGIJQEPY/wtkZI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jG3hax1L3RBp9t38vUt53FsBxgr/+Si/vVISpAylYpE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kwtIW8MhH9Ky5xNjBx8gFA/SHh2YVphie7g5FGBzals=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FHflwFuEMu4xX0ZApHi+pdlBH+oevAtXckCUb5Wv0xU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0OKSXELxPP85SBVwDGf3LtMEQCJ8TTkFUl/+6jlkdb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "25j9sQXZCihCmHKvTHgaBsAVZFcGPn7JjHdrCGlwyyw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uEw0lpQtBppR3vqV9j9+NQRSBF1BzZukb8c9IhyWvxc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zVhZ7Q59O087ji49oMJvBIgeir2oqvUpnh4p53GcTow=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dowrzKs+qJhRMZyKDbhjXbuX43FbmUKOaw9I8YlOZDw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ep5B6cska6THLIF7Mn3tn3RvV9EiwLSt0eZM/CLRUDc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "URNp/YmmDh5wIZUfAzzgPyJeMNiVx9PMsz52DZRujGY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wlM4IAQhhKQEzoVqS8b1Ddd50GB95OFb9LnzOwyjCP4=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Defaults.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Defaults.json deleted file mode 100644 index c2a119cb7..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Defaults.json +++ /dev/null @@ -1,381 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range applies defaults for trimFactor and sparsity", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$gt": { - "$numberInt": "0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedInt": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedInt": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "encryptedInt": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedInt": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - } - ] - }, - { - "_id": { - "$numberInt": "1" - }, - "encryptedInt": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "25j9sQXZCihCmHKvTHgaBsAVZFcGPn7JjHdrCGlwyyw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SlNHXyqVFGDPrX/2ppwog6l4pwj3PKda2TkZbqgfSfA=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-Aggregate.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-Aggregate.json deleted file mode 100644 index daa7f4e97..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-Aggregate.json +++ /dev/null @@ -1,1132 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Double. Aggregate.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoubleNoPrecision": { - "$gt": { - "$numberDouble": "0" - } - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1" - } - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "default", - "pipeline": [ - { - "$match": { - "encryptedDoubleNoPrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - } - } - ], - "cursor": {}, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "aggregate" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "6YrBn2ofIw1b5ooakrLOwF41BWrps8OO0H9WH4/rtlE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "n+XAuFnP8Dov9TnhGFxNx0K/MnVM9WbJ7RouEu0ndO0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yRXojuVdn5GQtD97qYlaCL6cOLmZ7Cvcb3wFjkLUIdM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DuIkdRPITRs55I4SZmgomAHCIsDQmXRhW8+MOznkzSk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SsBk+Et1lTbU+QRPx+xyJ/jMkmfG+QCvQEpip2YYrzA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "crCIzOd8KhHvvUlX7M1v9bhvU4pLdTc+X2SuqoKU5Ek=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YOWdCw4UrqnxkAaVjqmC4sKQDMVMHEpFGnlxpxdaU6E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "M3SShp81Ff8tQ632qKbv9MUcN6wjDaBReI0VXNu6Xh4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gzHlSPxpM0hT75kQvWFzGlOxKvDoiKQZOr19V6l2zXI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "s3JnppOGYw9SL2Q1kMAZs948v2F5PrpXjGei/HioDWs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cG6+3Gk/zEH68P/uuuwiAUVCuyJwa1LeV+t29FlPPAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dupdvR3AyJtM+g9NDKiaLVOtGca387JQp8w+V03m7Ig=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JqEQc5svj2jTvZ6LLA5ivE+kTb/0aRemSEmxk4G7Zrg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "szcXXXKnob+p3SoM4yED2R920LeJ7cVsclPMFTe4CeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "o1QoGVXmuBdHwHm7aCtGMlMVKrjFdYvJXpoq6uhIAZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Jfm5wPlqqLCJRGQIqRq2NGmpn7s0Vrih2H3YAOoI2YU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zMHLb8ARbsYo8Ld05bqnGFf1Usha6EGb8QKwdSAyps0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yQdtq9lh5pugL7/i0Bj/PuZUUBUIzf+7wj1rl5y736w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wGWVZdO7qIuyDg/BqDgqjgoQ02h5YYgwXQB1oCin2NE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "by9HMLj6NTEpgztZ5HSN6GxImkXPcaFINYDzgZY33X8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tWo0vbasi7bXmn/MsOx13VC1IsWtpx/nYp0uj4iMzdA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tQQpndUYd5O87lOtrGjH3wl9VsOK0ray7RMasL90sBM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cQjXEDCMsOpKLLf+vlTgIHA+cbSJdzqhbSX9Wvh95aA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7yMpU48IxK9SzP2cx3VnTownGEwFmeFofuuFT97SuuY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kSOx1kz0CmBgzKQHZlo65ZUY1DIv9A99JRm+Us2y6Ew=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ubQpdPBe6/xvtr+AcXdfYLSvYCR4ot0tivehkCsupb4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xal+iCJ6FTefRQToyoNksc9NCZShyn04NDGi4IYrcoM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "d7jU4iOK50xHxlkSifcxlZFCM46TSgQzoYivxG3HNLY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tJvl2nsBLBVzL3pp6sKWCL4UXeh3q/roYBJjSb74ve0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OIUCaKRvIx9t1w6Hxlz1IcQTdPNCfdRNwnnTm10W+X0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A9tvzsiElotOUVIB4CqfQp9mAwqvTM35YkmAR170aHA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lI8gpK7hpb7c9x4RQugsxMnQay5LZJmwslZdvMx/dcE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dNCzh40U0XvdKnSDi3HRQOWQftEsDVqc4uUvsVFGoq8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IP+iwEBWBwVVZIdpaMu8k5+soFCz+TZkYn3drKZ9grE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pnqyh6e0y5svHkJDShlN9CHV0WvMBE4QbtJpQw5ZCXc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "elEl42tbVDoRTLjAhZUFEtXiut4b3PVhg/1ZLZSQdtE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vHuu2FxwclMHqyE6JBYbTYgbEkB0dqb/JuaxsvfwsmY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xTf7NCe3Gf8QpE78HR5OknlLTKfs9J+RN9UZpH6fnso=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XiWSasRnJAulGR6+LCVD3mwRObXylqYWR9jvpywq12c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MZMxEQ5ikx0PG1YFIExv0UnTZogsvgeOEZTpzvBDn4w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yZMyMZBDrWbAhvnic7vvIYhmO9m5H2iuv0c8KNZrBzY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xxM14hTPY5j0vvcK2C7YAEjzdsfUTFHozHC0hEo1bxI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+01rqR1xVwkpGXcstbk1ItJqFVjH6Q8MGxEN3Cm9Y1A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xOpLV0Z2VTRJ3iWtnWZcsyjXubTIkYWo31cO+HV1o1k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BWUOLqgLBqc5NwxVlSV5H3KFQPXbCp7mdo+jF+8cJqY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fuQb1S6xZDGlrEbK+kI23aL53PP1PVNwqICnZNt9Yzg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfscnoibFttahLdPVC4Ee+47ewGFKpDSU7M6HX19bKE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rpSW2awybNVeKtat91VFxqbINoTfNhPfQAu+d73Xtf8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9M/CP9ccOIIj2LLFmE0GFDO0Ban2wsNalEXfM6+h+1s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WrEMG49l1ye4MhXs5ZS9tz8P6h+hDvthIg/2wW9ne1Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ImNhbfeyfH8qIEeA5ic0s3dAQBdzzTBS+CPsNih9vZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dWP33YDSn04UKJN2ogh2Rui0iW/0q2y18OCDRVcfyoo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lYv0isAtfGh6H9tdp3cp2eHU7q2J+uk7QrgcxtK3w7Y=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VGMoamB/+7zTOYcY/pqJc96xlv2PdW4hwsIAEIslTDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yNeBWMF7BnD9wVwz2PgJsvWr77QiVvvWUvJF0+fqBug=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfpvObJ+tJBXSvqeN7vlOfmhYign635lciYAJIjUtY8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dsen4NqjzVGjpjufiTMs3+gqeD09EbnuogPgxrJECwg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pxCWVM3sn19NsFEpgHbgLa+PmYlhN3mMiP0Wk8kJhYw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q11KNvJszjYIB9n9HcC+N4uz11a3eRj1L3BH9scKMDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A1PmkgcEToWh1JiVWE6mI5jUu7poxWWuCUt/cgRUUDc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qJo3Hu4PJeanL7XEaWXO/n3YsodhZyd+MJOOmB9Kpd8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BkBKLO8URFscfRY9Bav/1+L9mLohDgNr/MkZtGiraIs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rZq5WA3Hx3xthOyHAJXK//f8pE2qbz7YKu3TIMp9GFY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X07a/Lm80p5xd4RFs1dNmw+90tmPDPdGiAKVZkxd4zY=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "2FIZh/9N+NeJEQwxYIX5ikQT85xJzulBNReXk8PnG/s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "I93Md7QNPGmEEGYU1+VVCqBPBEvXdqHPtTJtMOn06Yk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "GecBFQ1PemlECWZWCl7f74vmsL6eB6mzQ9n6tK6FYfs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QpjhZl+O1ORifgtCZuWAdcP6OKL7IZ2cA46v8FJcV28=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FWXI/yZ1M+2fIboeMCDMlp+I2NwPQDtoM/wWselOPYw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uk26nvN/LdRLaBphiBgIZzT0sSpoO1z0RdDWRm/xrSA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hiiYSH1KZovAULc7rlmEU74wCjzDR+mm6ZnsgvFQjMw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hRzvMvWPX0sJme+wck67lwbKDFaWOa+Eyef+JSdc1s4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PSx5D+zqC9c295dguX4+EobT4IEzfffdfjzC8DWpB5Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QzfXQCVTjPQv2h21v95HYPq8uCsVJ2tPnjv79gAaM9M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XcGDO/dlTcEMLqwcm55UmOqK+KpBmbzZO1LIzX7GPaQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Lf+o4E7YB5ynzUPC6KTyW0lj6Cg9oLIu1Sdd1ODHctA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wAuVn02LAVo5Y+TUocvkoenFYWzpu38k0NmGZOsAjS4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yJGDtveLbbo/0HtCtiTSsvVI/0agg/U1bFaQ0yhK12o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KsEy0zgYcmkM+O/fWF9z3aJGIk22XCk+Aw96HB6JU68=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "p+AnMI5ZxdJMSIEJmXXya+FeH5yubmOdViwUO89j0Rc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/jLix56jzeywBtNuGw55lCXyebQoSIhbful0hOKxKDY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fvDvSPomtJsl1S3+8/tzFCE8scHIdJY5hB9CdTEsoFo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "oV5hOJzPXxfTuRdKIlF4uYEoMDuqH+G7/3qgndDr0PM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "3ALwcvLj3VOfgD6OqXAO13h1ZkOv46R6+Oy6SUKh53I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gxaB9FJj0IM+InhvAjwWaex3UIZ9SAnDiUd5WHSY/l0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "66NPvDygJzKJqddfNuDuNOpvGajjFRtvhkwfUkiYmXw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1dWcQIocRAcO9XnXYqbhl83jc0RgjQpsrWd8dC27trg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "npos0Uf1DT3ztSCjPVY9EImlRnTHB1KLrvmVSqBQ/8E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "TEI9qBx/tK1l1H0v1scMG8Srmtwo5VxWHADPBSlWrXk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "3wUN2ypQKoj+5ASkeIK9ycxhahVxyTmGopigoUAlyYs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "o/oksSnUS+nIq6ozWTbB5bJh+NoaPj8deAA23uxiWCk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KExYPruhA31e8xuSwvfUfDcyY/H2Va6taUd0k4yFgLc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/x+dNfxdd/lkx8Z8VZVfoYl7LPoaZ/iKEzZXBrAtIJc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DE4cmjFLPqZlmRomO0qQiruUBtzoCe8ZdNRcfNH92pU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "M6EKNcLPw/iojAChgYUSieaBYWcbsjKtB94SaHOr8vk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+qP49lDPeyhaduTvXJgtJEqHNEYANVu9Bg3Bxz7Td9w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ruMrC2VIS+VKbJwCFb3bfkaLTju9nE+yPONV9s0M0Vo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EbjDlSB5JKnDKff4d8hOmaOwJ7B9Q6NQFisLj+DPC+0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "C/yYOTB94edyqAbiQNu8/H7FoG3yRRjHDkMykz4+Mv0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CBxqrejG+qQQq2YTd6iP/06kiu2CxxzBFaZK3Ofb1CM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2ZOQ/fpho+AbDENWBZaln7wRoepIRdhyT648dr8O5cU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EghIgEPz01+myPgj8oid+PgncvobvC7vjvG3THEEQ0M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "92CysZYNF8riwAMhdrIPKxfODw9p07cKQy/Snn8XmVY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VO0LeTBQmsEf7sCHzTnZwUPNTqRZ49R8V5E9XnZ/5N4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "exs8BQMJq7U6ZXYgIizT7XN+X/hOmmn4YEuzev9zgSI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qHpS4k1I+gPniNp4CA8TY8lLN36vBYmgbKMFpbYMEqg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+7lWKCKAWFw6gPZdHE6E8KIfI14/fSvtWUmllb5WLi0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YiH/US0q6679hWblFDDKNqUjCgggoU8sUCssTIF1QbU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YgwkKElEubNfvXL9hJxzqQUQtHiXN/OCGxNL1MUZZlM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hZFST4INZTTuhvJlGJeMwlUAK270UCOTCDeBAnN4a7g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "24I1Zw35AuGnK3CqJhbCwYb0IPuu5sCRrM5iyeITOLc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vgD12JB4Q1S/kGPSQ1KOgp386KnG1GbM/5+60oRGcGw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+wNE+OL+CB9d4AUJdVxd56jUJCAXmmk9fapuB2TAc4g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uhQh1B2Pe4RkNw/kPEcgaLenuikKoRf1iyfZhpXdodc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "eu8gjAUIp8ybO204AgeOq5v1neI1yljqy5v3I6lo1lM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7QG6oVbASBAjrnCPxzzUNnuFSFNlKhbuBafkF8pr7Is=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PUS1xb2oHSDTdYltutoSSxBiJ1NjxH3l2kA4P1CZLEs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XPMh/JDC/O93gJJCwwgJDb8ssWZvRvezNmKmyn3nIfk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jWz+KGwMk/GOvFAK2rOxF3OjxeZAWfmUQ1HGJ7icw4A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "o7XbW68pc6flYigf3LW4WAGUWxpeqxaQLkHUhUR9RZ8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "nqR+g60+5U0okbqJadSqGgnC+j1JcP8rwMcfzOs2ACI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Hz43qVK95tSfbYFtaE/8fE97XMk1RiO8XpWjwZHB80o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "noZUWlZ8M6KXU5rkifyo8/duw5IL7/fXbJvT7bNmW9k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WONVHCuPSanXDRQQ/3tmyJ0Vq+Lu/4hRaMUf0g0kSuw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UEaj6vQRoIghE8Movd8AGXhtwIOXlP4cBsECIUvE5Y8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "D3n2YcO8+PB4C8brDo7kxKjF9Y844rVkdRMLTgsQkrw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "C+YA0G9KjxZVaWwOMuh/dcnHnHAlYnbFrRl0IEpmsY0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rUnmbmQanxrbFPYYrwyQ53x66OSt27yAvF+s48ezKDc=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-Correctness.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-Correctness.json deleted file mode 100644 index edb336743..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-Correctness.json +++ /dev/null @@ -1,1160 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "Find with $gt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoubleNoPrecision": { - "$gt": { - "$numberDouble": "0.0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $gte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoubleNoPrecision": { - "$gte": { - "$numberDouble": "0.0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - }, - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $gt with no results", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoubleNoPrecision": { - "$gt": { - "$numberDouble": "1.0" - } - } - } - }, - "result": [] - } - ] - }, - { - "description": "Find with $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoubleNoPrecision": { - "$lt": { - "$numberDouble": "1.0" - } - } - } - }, - "result": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - ] - } - ] - }, - { - "description": "Find with $lte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoubleNoPrecision": { - "$lte": { - "$numberDouble": "1.0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - }, - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $gt and $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoubleNoPrecision": { - "$gt": { - "$numberDouble": "0.0" - }, - "$lt": { - "$numberDouble": "2.0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with equality", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - }, - "result": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - ] - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $in", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoubleNoPrecision": { - "$in": [ - { - "$numberDouble": "0.0" - } - ] - } - } - }, - "result": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoubleNoPrecision": { - "$gte": { - "$numberDouble": "0.0" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - }, - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gt with no results", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoubleNoPrecision": { - "$gt": { - "$numberDouble": "1.0" - } - } - } - } - ] - }, - "result": [] - } - ] - }, - { - "description": "Aggregate with $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoubleNoPrecision": { - "$lt": { - "$numberDouble": "1.0" - } - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $lte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoubleNoPrecision": { - "$lte": { - "$numberDouble": "1.0" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - }, - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gt and $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoubleNoPrecision": { - "$gt": { - "$numberDouble": "0.0" - }, - "$lt": { - "$numberDouble": "2.0" - } - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with equality", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - ] - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $in", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoubleNoPrecision": { - "$in": [ - { - "$numberDouble": "0.0" - } - ] - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0.0" - } - } - ] - } - ] - }, - { - "description": "Wrong type: Insert Int", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberInt": "0" - } - } - }, - "result": { - "errorContains": "cannot encrypt element" - } - } - ] - }, - { - "description": "Wrong type: Find Int", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoubleNoPrecision": { - "$gte": { - "$numberInt": "0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": { - "errorContains": "field type is not supported" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-Delete.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-Delete.json deleted file mode 100644 index 4a9c1f27b..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-Delete.json +++ /dev/null @@ -1,732 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Double. Delete.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1" - } - } - } - }, - { - "name": "deleteOne", - "arguments": { - "filter": { - "encryptedDoubleNoPrecision": { - "$gt": { - "$numberDouble": "0" - } - } - } - }, - "result": { - "deletedCount": 1 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "delete": "default", - "deletes": [ - { - "q": { - "encryptedDoubleNoPrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - }, - "limit": 1 - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "delete" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "6YrBn2ofIw1b5ooakrLOwF41BWrps8OO0H9WH4/rtlE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "n+XAuFnP8Dov9TnhGFxNx0K/MnVM9WbJ7RouEu0ndO0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yRXojuVdn5GQtD97qYlaCL6cOLmZ7Cvcb3wFjkLUIdM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DuIkdRPITRs55I4SZmgomAHCIsDQmXRhW8+MOznkzSk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SsBk+Et1lTbU+QRPx+xyJ/jMkmfG+QCvQEpip2YYrzA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "crCIzOd8KhHvvUlX7M1v9bhvU4pLdTc+X2SuqoKU5Ek=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YOWdCw4UrqnxkAaVjqmC4sKQDMVMHEpFGnlxpxdaU6E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "M3SShp81Ff8tQ632qKbv9MUcN6wjDaBReI0VXNu6Xh4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gzHlSPxpM0hT75kQvWFzGlOxKvDoiKQZOr19V6l2zXI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "s3JnppOGYw9SL2Q1kMAZs948v2F5PrpXjGei/HioDWs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cG6+3Gk/zEH68P/uuuwiAUVCuyJwa1LeV+t29FlPPAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dupdvR3AyJtM+g9NDKiaLVOtGca387JQp8w+V03m7Ig=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JqEQc5svj2jTvZ6LLA5ivE+kTb/0aRemSEmxk4G7Zrg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "szcXXXKnob+p3SoM4yED2R920LeJ7cVsclPMFTe4CeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "o1QoGVXmuBdHwHm7aCtGMlMVKrjFdYvJXpoq6uhIAZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Jfm5wPlqqLCJRGQIqRq2NGmpn7s0Vrih2H3YAOoI2YU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zMHLb8ARbsYo8Ld05bqnGFf1Usha6EGb8QKwdSAyps0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yQdtq9lh5pugL7/i0Bj/PuZUUBUIzf+7wj1rl5y736w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wGWVZdO7qIuyDg/BqDgqjgoQ02h5YYgwXQB1oCin2NE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "by9HMLj6NTEpgztZ5HSN6GxImkXPcaFINYDzgZY33X8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tWo0vbasi7bXmn/MsOx13VC1IsWtpx/nYp0uj4iMzdA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tQQpndUYd5O87lOtrGjH3wl9VsOK0ray7RMasL90sBM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cQjXEDCMsOpKLLf+vlTgIHA+cbSJdzqhbSX9Wvh95aA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7yMpU48IxK9SzP2cx3VnTownGEwFmeFofuuFT97SuuY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kSOx1kz0CmBgzKQHZlo65ZUY1DIv9A99JRm+Us2y6Ew=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ubQpdPBe6/xvtr+AcXdfYLSvYCR4ot0tivehkCsupb4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xal+iCJ6FTefRQToyoNksc9NCZShyn04NDGi4IYrcoM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "d7jU4iOK50xHxlkSifcxlZFCM46TSgQzoYivxG3HNLY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tJvl2nsBLBVzL3pp6sKWCL4UXeh3q/roYBJjSb74ve0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OIUCaKRvIx9t1w6Hxlz1IcQTdPNCfdRNwnnTm10W+X0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A9tvzsiElotOUVIB4CqfQp9mAwqvTM35YkmAR170aHA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lI8gpK7hpb7c9x4RQugsxMnQay5LZJmwslZdvMx/dcE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dNCzh40U0XvdKnSDi3HRQOWQftEsDVqc4uUvsVFGoq8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IP+iwEBWBwVVZIdpaMu8k5+soFCz+TZkYn3drKZ9grE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pnqyh6e0y5svHkJDShlN9CHV0WvMBE4QbtJpQw5ZCXc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "elEl42tbVDoRTLjAhZUFEtXiut4b3PVhg/1ZLZSQdtE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vHuu2FxwclMHqyE6JBYbTYgbEkB0dqb/JuaxsvfwsmY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xTf7NCe3Gf8QpE78HR5OknlLTKfs9J+RN9UZpH6fnso=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XiWSasRnJAulGR6+LCVD3mwRObXylqYWR9jvpywq12c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MZMxEQ5ikx0PG1YFIExv0UnTZogsvgeOEZTpzvBDn4w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yZMyMZBDrWbAhvnic7vvIYhmO9m5H2iuv0c8KNZrBzY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xxM14hTPY5j0vvcK2C7YAEjzdsfUTFHozHC0hEo1bxI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+01rqR1xVwkpGXcstbk1ItJqFVjH6Q8MGxEN3Cm9Y1A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xOpLV0Z2VTRJ3iWtnWZcsyjXubTIkYWo31cO+HV1o1k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BWUOLqgLBqc5NwxVlSV5H3KFQPXbCp7mdo+jF+8cJqY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fuQb1S6xZDGlrEbK+kI23aL53PP1PVNwqICnZNt9Yzg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfscnoibFttahLdPVC4Ee+47ewGFKpDSU7M6HX19bKE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rpSW2awybNVeKtat91VFxqbINoTfNhPfQAu+d73Xtf8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9M/CP9ccOIIj2LLFmE0GFDO0Ban2wsNalEXfM6+h+1s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WrEMG49l1ye4MhXs5ZS9tz8P6h+hDvthIg/2wW9ne1Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ImNhbfeyfH8qIEeA5ic0s3dAQBdzzTBS+CPsNih9vZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dWP33YDSn04UKJN2ogh2Rui0iW/0q2y18OCDRVcfyoo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lYv0isAtfGh6H9tdp3cp2eHU7q2J+uk7QrgcxtK3w7Y=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VGMoamB/+7zTOYcY/pqJc96xlv2PdW4hwsIAEIslTDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yNeBWMF7BnD9wVwz2PgJsvWr77QiVvvWUvJF0+fqBug=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfpvObJ+tJBXSvqeN7vlOfmhYign635lciYAJIjUtY8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dsen4NqjzVGjpjufiTMs3+gqeD09EbnuogPgxrJECwg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pxCWVM3sn19NsFEpgHbgLa+PmYlhN3mMiP0Wk8kJhYw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q11KNvJszjYIB9n9HcC+N4uz11a3eRj1L3BH9scKMDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A1PmkgcEToWh1JiVWE6mI5jUu7poxWWuCUt/cgRUUDc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qJo3Hu4PJeanL7XEaWXO/n3YsodhZyd+MJOOmB9Kpd8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BkBKLO8URFscfRY9Bav/1+L9mLohDgNr/MkZtGiraIs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rZq5WA3Hx3xthOyHAJXK//f8pE2qbz7YKu3TIMp9GFY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X07a/Lm80p5xd4RFs1dNmw+90tmPDPdGiAKVZkxd4zY=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-FindOneAndUpdate.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-FindOneAndUpdate.json deleted file mode 100644 index d7860de83..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-FindOneAndUpdate.json +++ /dev/null @@ -1,1136 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Double. FindOneAndUpdate.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1" - } - } - } - }, - { - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "encryptedDoubleNoPrecision": { - "$gt": { - "$numberDouble": "0" - } - } - }, - "update": { - "$set": { - "encryptedDoubleNoPrecision": { - "$numberDouble": "2" - } - } - }, - "returnDocument": "Before" - }, - "result": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "default", - "query": { - "encryptedDoubleNoPrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - }, - "update": { - "$set": { - "encryptedDoubleNoPrecision": { - "$$type": "binData" - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "findAndModify" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "6YrBn2ofIw1b5ooakrLOwF41BWrps8OO0H9WH4/rtlE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "n+XAuFnP8Dov9TnhGFxNx0K/MnVM9WbJ7RouEu0ndO0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yRXojuVdn5GQtD97qYlaCL6cOLmZ7Cvcb3wFjkLUIdM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DuIkdRPITRs55I4SZmgomAHCIsDQmXRhW8+MOznkzSk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SsBk+Et1lTbU+QRPx+xyJ/jMkmfG+QCvQEpip2YYrzA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "crCIzOd8KhHvvUlX7M1v9bhvU4pLdTc+X2SuqoKU5Ek=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YOWdCw4UrqnxkAaVjqmC4sKQDMVMHEpFGnlxpxdaU6E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "M3SShp81Ff8tQ632qKbv9MUcN6wjDaBReI0VXNu6Xh4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gzHlSPxpM0hT75kQvWFzGlOxKvDoiKQZOr19V6l2zXI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "s3JnppOGYw9SL2Q1kMAZs948v2F5PrpXjGei/HioDWs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cG6+3Gk/zEH68P/uuuwiAUVCuyJwa1LeV+t29FlPPAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dupdvR3AyJtM+g9NDKiaLVOtGca387JQp8w+V03m7Ig=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JqEQc5svj2jTvZ6LLA5ivE+kTb/0aRemSEmxk4G7Zrg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "szcXXXKnob+p3SoM4yED2R920LeJ7cVsclPMFTe4CeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "o1QoGVXmuBdHwHm7aCtGMlMVKrjFdYvJXpoq6uhIAZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Jfm5wPlqqLCJRGQIqRq2NGmpn7s0Vrih2H3YAOoI2YU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zMHLb8ARbsYo8Ld05bqnGFf1Usha6EGb8QKwdSAyps0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yQdtq9lh5pugL7/i0Bj/PuZUUBUIzf+7wj1rl5y736w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wGWVZdO7qIuyDg/BqDgqjgoQ02h5YYgwXQB1oCin2NE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "by9HMLj6NTEpgztZ5HSN6GxImkXPcaFINYDzgZY33X8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tWo0vbasi7bXmn/MsOx13VC1IsWtpx/nYp0uj4iMzdA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tQQpndUYd5O87lOtrGjH3wl9VsOK0ray7RMasL90sBM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cQjXEDCMsOpKLLf+vlTgIHA+cbSJdzqhbSX9Wvh95aA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7yMpU48IxK9SzP2cx3VnTownGEwFmeFofuuFT97SuuY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kSOx1kz0CmBgzKQHZlo65ZUY1DIv9A99JRm+Us2y6Ew=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ubQpdPBe6/xvtr+AcXdfYLSvYCR4ot0tivehkCsupb4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xal+iCJ6FTefRQToyoNksc9NCZShyn04NDGi4IYrcoM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "d7jU4iOK50xHxlkSifcxlZFCM46TSgQzoYivxG3HNLY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tJvl2nsBLBVzL3pp6sKWCL4UXeh3q/roYBJjSb74ve0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OIUCaKRvIx9t1w6Hxlz1IcQTdPNCfdRNwnnTm10W+X0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A9tvzsiElotOUVIB4CqfQp9mAwqvTM35YkmAR170aHA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lI8gpK7hpb7c9x4RQugsxMnQay5LZJmwslZdvMx/dcE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dNCzh40U0XvdKnSDi3HRQOWQftEsDVqc4uUvsVFGoq8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IP+iwEBWBwVVZIdpaMu8k5+soFCz+TZkYn3drKZ9grE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pnqyh6e0y5svHkJDShlN9CHV0WvMBE4QbtJpQw5ZCXc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "elEl42tbVDoRTLjAhZUFEtXiut4b3PVhg/1ZLZSQdtE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vHuu2FxwclMHqyE6JBYbTYgbEkB0dqb/JuaxsvfwsmY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xTf7NCe3Gf8QpE78HR5OknlLTKfs9J+RN9UZpH6fnso=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XiWSasRnJAulGR6+LCVD3mwRObXylqYWR9jvpywq12c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MZMxEQ5ikx0PG1YFIExv0UnTZogsvgeOEZTpzvBDn4w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yZMyMZBDrWbAhvnic7vvIYhmO9m5H2iuv0c8KNZrBzY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xxM14hTPY5j0vvcK2C7YAEjzdsfUTFHozHC0hEo1bxI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+01rqR1xVwkpGXcstbk1ItJqFVjH6Q8MGxEN3Cm9Y1A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xOpLV0Z2VTRJ3iWtnWZcsyjXubTIkYWo31cO+HV1o1k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BWUOLqgLBqc5NwxVlSV5H3KFQPXbCp7mdo+jF+8cJqY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fuQb1S6xZDGlrEbK+kI23aL53PP1PVNwqICnZNt9Yzg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfscnoibFttahLdPVC4Ee+47ewGFKpDSU7M6HX19bKE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rpSW2awybNVeKtat91VFxqbINoTfNhPfQAu+d73Xtf8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9M/CP9ccOIIj2LLFmE0GFDO0Ban2wsNalEXfM6+h+1s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WrEMG49l1ye4MhXs5ZS9tz8P6h+hDvthIg/2wW9ne1Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ImNhbfeyfH8qIEeA5ic0s3dAQBdzzTBS+CPsNih9vZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dWP33YDSn04UKJN2ogh2Rui0iW/0q2y18OCDRVcfyoo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lYv0isAtfGh6H9tdp3cp2eHU7q2J+uk7QrgcxtK3w7Y=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VGMoamB/+7zTOYcY/pqJc96xlv2PdW4hwsIAEIslTDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yNeBWMF7BnD9wVwz2PgJsvWr77QiVvvWUvJF0+fqBug=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfpvObJ+tJBXSvqeN7vlOfmhYign635lciYAJIjUtY8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dsen4NqjzVGjpjufiTMs3+gqeD09EbnuogPgxrJECwg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pxCWVM3sn19NsFEpgHbgLa+PmYlhN3mMiP0Wk8kJhYw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q11KNvJszjYIB9n9HcC+N4uz11a3eRj1L3BH9scKMDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A1PmkgcEToWh1JiVWE6mI5jUu7poxWWuCUt/cgRUUDc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qJo3Hu4PJeanL7XEaWXO/n3YsodhZyd+MJOOmB9Kpd8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BkBKLO8URFscfRY9Bav/1+L9mLohDgNr/MkZtGiraIs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rZq5WA3Hx3xthOyHAJXK//f8pE2qbz7YKu3TIMp9GFY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X07a/Lm80p5xd4RFs1dNmw+90tmPDPdGiAKVZkxd4zY=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "HI88j1zrIsFoijIXKybr9mYubNV5uVeODyLHFH4Ueco=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wXVD/HSbBljko0jJcaxJ1nrzs2+pchLQqYR3vywS8SU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KhscCh+tt/pp8lxtKZQSPPUU94RvJYPKG/sjtzIa4Ws=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RISnuNrTTVNW5HnwCgQJ301pFw8DOcYrAMQIwVwjOkI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Ra5zukLh2boua0Bh74qA+mtIoixGXlsNsxiJqHtqdTI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "eqr0v+NNWXWszi9ni8qH58Q6gw5x737tJvH3lPaNHO4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "d42QupriWIwGrFAquXNFi0ehEuidIbHLFZtg1Sm2nN8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2azRVxaaTIJKcgY2FU012gcyP8Y05cRDpfUaMnCBaQU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "3nlgkM4K/AAcHesRYYdEu24UGetHodVnVfHzw4yxZBM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hqy91FNmAAac2zUaPO6eWFkx0/37rOWGrwXN+fzL0tU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "akX+fmscSDSF9pB5MPj56iaJPtohr0hfXNk/OPWsGv8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1ZvUb10Q7cN4cNLktd5yNjqgtawsYnkbeVBZV6WuY/I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "otCwtuKiY4hCyXvYzXvo10OcnzZppebo38KsAlq49QM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Mty8EscckeT/dhMfrPFyDbLnmMOcYRUQ3mLK4KTu6V8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tnvgLLkJINO7csREYu4dEVe1ICrBeu7OP+HdfoX3M2E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kOefsHgEVhkJ17UuP7Dxogy6sAQbzf1SFPKCj6XRlrQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "F+JQ79xavpaHdJzdhvwyHbzdZJLNHAymc/+67La3gao=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "NCZ9zp5rDRceENuSgAfTLEyKg0YgmXAhK0B8WSj7+Pw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wL1CJ7cYR5slx8mHq++uMdjDfkt9037lQTUztEMF56M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "txefkzTMITZE+XvvRFZ7QcgwDT/7m8jNmxRk4QBaoZI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jFunW3v1tSYMyZtQQD28eEy9qqDp4Kqo7gMN29N4bfQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QMO915KUiS3X3R1bU1YoafVM2s0NeHo3EjgTA9PnGwY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "nwdKJEXdilzvb7494vbuDJ+y6SrfJahza1dYIsHIWVI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vpWMX+T/VXXajFo0UbuYjtp0AEzBU0Y+lP+ih2EQ7mg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1lmzG0J1DhKDRhhq5y5Buygu4G8eV2X0t7kUY90EohM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SiKqpXqO0trwhFvBWK274hMklpCgMhNs/JY84yyn/NE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7cPGPYCKPTay+ZR9Gx6oOueduOgaFrSuAXmNDpDHXdI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4THEYvAkjs2Fh7FIe5LC45P4i4N0L7ob67UOVbhp6Nk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "B+UGsChLLZR7iqnt8yq91OgmTgwiUKTJhFxY4NT0O6c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X1uYwBCsCg1H+PnKdwtBqXlt0zKEURi8bOM940GcPfk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xYOgT5l7shlNXCwHlguovmDkcEnF8dXyYlTyYrgZ8GE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vFMTZqV8bh1+gcKzTkXweMddJlgdUnwX0DWzUUaMok4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4HI0y9FrtleZxZ7M6INdNhLelrQ2Rv/+ykWCBl+tMC8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jpJ0bBE474OUkn1vUiLWumIBtYmwc7J5+LQU/nyeLQc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jQTPeXZvdxY/DjtPfYfKUArIDsf0E9MVFy2O26sv1ec=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QLLto0ExR2ZYMGqlyaMZc/hXFFTlwmgtKbiVq/xJIeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yBJNviU1nchbGbhx6InXCVRXa90sEepz1EwbYuKXu2U=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jpEf0vHxrPu9gTJutNXSi2g/2Mc4WXFEN7yHonZEb7A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "E09kLFckMYwNuhggMxmPtwndyvIAx+Vl+b2CV6FP75s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "N+ue6/cLPb5NssmJCCeo18LlbKPz6r2z20AsnTKRvOo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yVQNZP8hhsvNGyDph2QP2qTNdXZTiIEVineKg+Qf33o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cSC9uI+9c5S8X+0G7amVyug1p0ZlgBsbEDYYyezBevQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1NpZGjoQzuQtekj80Rifxe9HbE08W07dfwxaFHaVn84=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "5Ghuq/8l11Ug9Uf/RTwf9On3OxOwIXUcb9soiy4J7/w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0LWKaEty6ywxLFhDaAqulqfMnYc+tgPfH4apyEeKg80=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OwSthmCBtt6NIAoAh7aCbj82Yr/+9t8U7WuBQhFT3AQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "iYiyg6/1isqbMdvFPIGucu3cNM4NAZNtJhHpGZ4eM+c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "waBgs8jWuGJPIF5zCRh6OmIyfK5GCBQgTMfmKSR2wyY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1Jdtbe2BKJXPU2G9ywOrlODZ/cNYEQlKzAW3aMe1Hy4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xaLEnNUS/2ySerBpb9dN/D31t+wYcKekwTfkwtni0Mc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "bIVBrOhOvr6cL55Tr24+B+CC9MiG7U6K54aAr2IXXuw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6Cdq5wroGu2TEFnekuT7LhOpd/K/+PcipIljcHU9QL4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "K5l64vI4S/pLviLW6Pl0U3iQkI3ge0xg4RAHcEsyKJo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "bzhuvZ0Ls22yIOX+Hz51eAHlSuDbWR/e0u4EhfdpHbc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Qv+fr6uD4o0bZRp69QJCFL6zvn3G82c7L+N1IFzj7H0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XAmISMbD3aEyQT+BQEphCKFNa0F0GDKFuhM9cGceKoQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4VLCokntMfm1AogpUnYGvhV7nllWSo3mS3hVESMy+hA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xiXNLj/CipEH63Vb5cidi8q9X47EF4f3HtJSOH7mfM8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4XlCYfYBjI9XA5zOSgTiEBYcZsdwyXL+f5XtH2xUIOc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "k6DfQy7ZYJIkEly2B5hjOZznL4NcgMkllZjJLb7yq7w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ZzM6gwWesa3lxbZVZthpPFs2s3GV0RZREE2zOMhBRBo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "US+jeMeeOd7J0wR0efJtq2/18lcO8YFvhT4O3DeaonQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "b6iSxiI1FM9SzxuG1bHqGA1i4+3GOi0/SPW00XB4L7o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kn3LsxAVkzIZKK9I6fi0Cctr0yjXOYgaQWMCoj4hLpM=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-InsertFind.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-InsertFind.json deleted file mode 100644 index 934af381f..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-InsertFind.json +++ /dev/null @@ -1,1123 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Double. Insert and Find.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoubleNoPrecision": { - "$gt": { - "$numberDouble": "0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1" - } - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "encryptedDoubleNoPrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "6YrBn2ofIw1b5ooakrLOwF41BWrps8OO0H9WH4/rtlE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "n+XAuFnP8Dov9TnhGFxNx0K/MnVM9WbJ7RouEu0ndO0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yRXojuVdn5GQtD97qYlaCL6cOLmZ7Cvcb3wFjkLUIdM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DuIkdRPITRs55I4SZmgomAHCIsDQmXRhW8+MOznkzSk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SsBk+Et1lTbU+QRPx+xyJ/jMkmfG+QCvQEpip2YYrzA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "crCIzOd8KhHvvUlX7M1v9bhvU4pLdTc+X2SuqoKU5Ek=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YOWdCw4UrqnxkAaVjqmC4sKQDMVMHEpFGnlxpxdaU6E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "M3SShp81Ff8tQ632qKbv9MUcN6wjDaBReI0VXNu6Xh4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gzHlSPxpM0hT75kQvWFzGlOxKvDoiKQZOr19V6l2zXI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "s3JnppOGYw9SL2Q1kMAZs948v2F5PrpXjGei/HioDWs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cG6+3Gk/zEH68P/uuuwiAUVCuyJwa1LeV+t29FlPPAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dupdvR3AyJtM+g9NDKiaLVOtGca387JQp8w+V03m7Ig=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JqEQc5svj2jTvZ6LLA5ivE+kTb/0aRemSEmxk4G7Zrg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "szcXXXKnob+p3SoM4yED2R920LeJ7cVsclPMFTe4CeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "o1QoGVXmuBdHwHm7aCtGMlMVKrjFdYvJXpoq6uhIAZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Jfm5wPlqqLCJRGQIqRq2NGmpn7s0Vrih2H3YAOoI2YU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zMHLb8ARbsYo8Ld05bqnGFf1Usha6EGb8QKwdSAyps0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yQdtq9lh5pugL7/i0Bj/PuZUUBUIzf+7wj1rl5y736w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wGWVZdO7qIuyDg/BqDgqjgoQ02h5YYgwXQB1oCin2NE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "by9HMLj6NTEpgztZ5HSN6GxImkXPcaFINYDzgZY33X8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tWo0vbasi7bXmn/MsOx13VC1IsWtpx/nYp0uj4iMzdA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tQQpndUYd5O87lOtrGjH3wl9VsOK0ray7RMasL90sBM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cQjXEDCMsOpKLLf+vlTgIHA+cbSJdzqhbSX9Wvh95aA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7yMpU48IxK9SzP2cx3VnTownGEwFmeFofuuFT97SuuY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kSOx1kz0CmBgzKQHZlo65ZUY1DIv9A99JRm+Us2y6Ew=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ubQpdPBe6/xvtr+AcXdfYLSvYCR4ot0tivehkCsupb4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xal+iCJ6FTefRQToyoNksc9NCZShyn04NDGi4IYrcoM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "d7jU4iOK50xHxlkSifcxlZFCM46TSgQzoYivxG3HNLY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tJvl2nsBLBVzL3pp6sKWCL4UXeh3q/roYBJjSb74ve0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OIUCaKRvIx9t1w6Hxlz1IcQTdPNCfdRNwnnTm10W+X0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A9tvzsiElotOUVIB4CqfQp9mAwqvTM35YkmAR170aHA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lI8gpK7hpb7c9x4RQugsxMnQay5LZJmwslZdvMx/dcE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dNCzh40U0XvdKnSDi3HRQOWQftEsDVqc4uUvsVFGoq8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IP+iwEBWBwVVZIdpaMu8k5+soFCz+TZkYn3drKZ9grE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pnqyh6e0y5svHkJDShlN9CHV0WvMBE4QbtJpQw5ZCXc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "elEl42tbVDoRTLjAhZUFEtXiut4b3PVhg/1ZLZSQdtE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vHuu2FxwclMHqyE6JBYbTYgbEkB0dqb/JuaxsvfwsmY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xTf7NCe3Gf8QpE78HR5OknlLTKfs9J+RN9UZpH6fnso=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XiWSasRnJAulGR6+LCVD3mwRObXylqYWR9jvpywq12c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MZMxEQ5ikx0PG1YFIExv0UnTZogsvgeOEZTpzvBDn4w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yZMyMZBDrWbAhvnic7vvIYhmO9m5H2iuv0c8KNZrBzY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xxM14hTPY5j0vvcK2C7YAEjzdsfUTFHozHC0hEo1bxI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+01rqR1xVwkpGXcstbk1ItJqFVjH6Q8MGxEN3Cm9Y1A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xOpLV0Z2VTRJ3iWtnWZcsyjXubTIkYWo31cO+HV1o1k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BWUOLqgLBqc5NwxVlSV5H3KFQPXbCp7mdo+jF+8cJqY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fuQb1S6xZDGlrEbK+kI23aL53PP1PVNwqICnZNt9Yzg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfscnoibFttahLdPVC4Ee+47ewGFKpDSU7M6HX19bKE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rpSW2awybNVeKtat91VFxqbINoTfNhPfQAu+d73Xtf8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9M/CP9ccOIIj2LLFmE0GFDO0Ban2wsNalEXfM6+h+1s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WrEMG49l1ye4MhXs5ZS9tz8P6h+hDvthIg/2wW9ne1Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ImNhbfeyfH8qIEeA5ic0s3dAQBdzzTBS+CPsNih9vZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dWP33YDSn04UKJN2ogh2Rui0iW/0q2y18OCDRVcfyoo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lYv0isAtfGh6H9tdp3cp2eHU7q2J+uk7QrgcxtK3w7Y=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VGMoamB/+7zTOYcY/pqJc96xlv2PdW4hwsIAEIslTDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yNeBWMF7BnD9wVwz2PgJsvWr77QiVvvWUvJF0+fqBug=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfpvObJ+tJBXSvqeN7vlOfmhYign635lciYAJIjUtY8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dsen4NqjzVGjpjufiTMs3+gqeD09EbnuogPgxrJECwg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pxCWVM3sn19NsFEpgHbgLa+PmYlhN3mMiP0Wk8kJhYw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q11KNvJszjYIB9n9HcC+N4uz11a3eRj1L3BH9scKMDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A1PmkgcEToWh1JiVWE6mI5jUu7poxWWuCUt/cgRUUDc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qJo3Hu4PJeanL7XEaWXO/n3YsodhZyd+MJOOmB9Kpd8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BkBKLO8URFscfRY9Bav/1+L9mLohDgNr/MkZtGiraIs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rZq5WA3Hx3xthOyHAJXK//f8pE2qbz7YKu3TIMp9GFY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X07a/Lm80p5xd4RFs1dNmw+90tmPDPdGiAKVZkxd4zY=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "2FIZh/9N+NeJEQwxYIX5ikQT85xJzulBNReXk8PnG/s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "I93Md7QNPGmEEGYU1+VVCqBPBEvXdqHPtTJtMOn06Yk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "GecBFQ1PemlECWZWCl7f74vmsL6eB6mzQ9n6tK6FYfs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QpjhZl+O1ORifgtCZuWAdcP6OKL7IZ2cA46v8FJcV28=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FWXI/yZ1M+2fIboeMCDMlp+I2NwPQDtoM/wWselOPYw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uk26nvN/LdRLaBphiBgIZzT0sSpoO1z0RdDWRm/xrSA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hiiYSH1KZovAULc7rlmEU74wCjzDR+mm6ZnsgvFQjMw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hRzvMvWPX0sJme+wck67lwbKDFaWOa+Eyef+JSdc1s4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PSx5D+zqC9c295dguX4+EobT4IEzfffdfjzC8DWpB5Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QzfXQCVTjPQv2h21v95HYPq8uCsVJ2tPnjv79gAaM9M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XcGDO/dlTcEMLqwcm55UmOqK+KpBmbzZO1LIzX7GPaQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Lf+o4E7YB5ynzUPC6KTyW0lj6Cg9oLIu1Sdd1ODHctA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wAuVn02LAVo5Y+TUocvkoenFYWzpu38k0NmGZOsAjS4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yJGDtveLbbo/0HtCtiTSsvVI/0agg/U1bFaQ0yhK12o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KsEy0zgYcmkM+O/fWF9z3aJGIk22XCk+Aw96HB6JU68=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "p+AnMI5ZxdJMSIEJmXXya+FeH5yubmOdViwUO89j0Rc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/jLix56jzeywBtNuGw55lCXyebQoSIhbful0hOKxKDY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fvDvSPomtJsl1S3+8/tzFCE8scHIdJY5hB9CdTEsoFo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "oV5hOJzPXxfTuRdKIlF4uYEoMDuqH+G7/3qgndDr0PM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "3ALwcvLj3VOfgD6OqXAO13h1ZkOv46R6+Oy6SUKh53I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gxaB9FJj0IM+InhvAjwWaex3UIZ9SAnDiUd5WHSY/l0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "66NPvDygJzKJqddfNuDuNOpvGajjFRtvhkwfUkiYmXw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1dWcQIocRAcO9XnXYqbhl83jc0RgjQpsrWd8dC27trg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "npos0Uf1DT3ztSCjPVY9EImlRnTHB1KLrvmVSqBQ/8E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "TEI9qBx/tK1l1H0v1scMG8Srmtwo5VxWHADPBSlWrXk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "3wUN2ypQKoj+5ASkeIK9ycxhahVxyTmGopigoUAlyYs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "o/oksSnUS+nIq6ozWTbB5bJh+NoaPj8deAA23uxiWCk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KExYPruhA31e8xuSwvfUfDcyY/H2Va6taUd0k4yFgLc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "/x+dNfxdd/lkx8Z8VZVfoYl7LPoaZ/iKEzZXBrAtIJc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DE4cmjFLPqZlmRomO0qQiruUBtzoCe8ZdNRcfNH92pU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "M6EKNcLPw/iojAChgYUSieaBYWcbsjKtB94SaHOr8vk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+qP49lDPeyhaduTvXJgtJEqHNEYANVu9Bg3Bxz7Td9w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ruMrC2VIS+VKbJwCFb3bfkaLTju9nE+yPONV9s0M0Vo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EbjDlSB5JKnDKff4d8hOmaOwJ7B9Q6NQFisLj+DPC+0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "C/yYOTB94edyqAbiQNu8/H7FoG3yRRjHDkMykz4+Mv0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CBxqrejG+qQQq2YTd6iP/06kiu2CxxzBFaZK3Ofb1CM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2ZOQ/fpho+AbDENWBZaln7wRoepIRdhyT648dr8O5cU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "EghIgEPz01+myPgj8oid+PgncvobvC7vjvG3THEEQ0M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "92CysZYNF8riwAMhdrIPKxfODw9p07cKQy/Snn8XmVY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VO0LeTBQmsEf7sCHzTnZwUPNTqRZ49R8V5E9XnZ/5N4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "exs8BQMJq7U6ZXYgIizT7XN+X/hOmmn4YEuzev9zgSI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qHpS4k1I+gPniNp4CA8TY8lLN36vBYmgbKMFpbYMEqg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+7lWKCKAWFw6gPZdHE6E8KIfI14/fSvtWUmllb5WLi0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YiH/US0q6679hWblFDDKNqUjCgggoU8sUCssTIF1QbU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YgwkKElEubNfvXL9hJxzqQUQtHiXN/OCGxNL1MUZZlM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hZFST4INZTTuhvJlGJeMwlUAK270UCOTCDeBAnN4a7g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "24I1Zw35AuGnK3CqJhbCwYb0IPuu5sCRrM5iyeITOLc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vgD12JB4Q1S/kGPSQ1KOgp386KnG1GbM/5+60oRGcGw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+wNE+OL+CB9d4AUJdVxd56jUJCAXmmk9fapuB2TAc4g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uhQh1B2Pe4RkNw/kPEcgaLenuikKoRf1iyfZhpXdodc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "eu8gjAUIp8ybO204AgeOq5v1neI1yljqy5v3I6lo1lM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7QG6oVbASBAjrnCPxzzUNnuFSFNlKhbuBafkF8pr7Is=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "PUS1xb2oHSDTdYltutoSSxBiJ1NjxH3l2kA4P1CZLEs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XPMh/JDC/O93gJJCwwgJDb8ssWZvRvezNmKmyn3nIfk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jWz+KGwMk/GOvFAK2rOxF3OjxeZAWfmUQ1HGJ7icw4A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "o7XbW68pc6flYigf3LW4WAGUWxpeqxaQLkHUhUR9RZ8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "nqR+g60+5U0okbqJadSqGgnC+j1JcP8rwMcfzOs2ACI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Hz43qVK95tSfbYFtaE/8fE97XMk1RiO8XpWjwZHB80o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "noZUWlZ8M6KXU5rkifyo8/duw5IL7/fXbJvT7bNmW9k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WONVHCuPSanXDRQQ/3tmyJ0Vq+Lu/4hRaMUf0g0kSuw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UEaj6vQRoIghE8Movd8AGXhtwIOXlP4cBsECIUvE5Y8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "D3n2YcO8+PB4C8brDo7kxKjF9Y844rVkdRMLTgsQkrw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "C+YA0G9KjxZVaWwOMuh/dcnHnHAlYnbFrRl0IEpmsY0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rUnmbmQanxrbFPYYrwyQ53x66OSt27yAvF+s48ezKDc=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-Update.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-Update.json deleted file mode 100644 index ec95e0334..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Double-Update.json +++ /dev/null @@ -1,1140 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Double. Update.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$numberDouble": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$numberDouble": "1" - } - } - } - }, - { - "name": "updateOne", - "arguments": { - "filter": { - "encryptedDoubleNoPrecision": { - "$gt": { - "$numberDouble": "0" - } - } - }, - "update": { - "$set": { - "encryptedDoubleNoPrecision": { - "$numberDouble": "2" - } - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command_name": "update", - "command": { - "update": "default", - "ordered": true, - "updates": [ - { - "q": { - "encryptedDoubleNoPrecision": { - "$gt": { - "$binary": { - "base64": "DbMkAAADcGF5bG9hZABXJAAABGcAQyQAAAMwAH0AAAAFZAAgAAAAAHgYoMGjEE6fAlAhICv0+doHcVX8CmMVxyq7+jlyGrvmBXMAIAAAAAC/5MQZgTHuIr/O5Z3mXPvqrom5JTQ8IeSpQGhO9sB+8gVsACAAAAAAuPSXVmJUAUpTQg/A9Bu1hYczZF58KEhVofakygbsvJQAAzEAfQAAAAVkACAAAAAA2kiWNvEc4zunJ1jzvuClFC9hjZMYruKCqAaxq+oY8EAFcwAgAAAAACofIS72Cm6s866UCk+evTH3CvKBj/uZd72sAL608rzTBWwAIAAAAADuCQ/M2xLeALF0UFZtJb22QGOhHmJv6xoO+kZIHcDeiAADMgB9AAAABWQAIAAAAABkfoBGmU3hjYBvQbjNW19kfXneBQsQQPRfUL3UAwI2cAVzACAAAAAAUpK2BUOqX/DGdX5YJniEZMWkofxHqeAbXceEGJxhp8AFbAAgAAAAAKUaLzIldNIZv6RHE+FwbMjzcNHqPESwF/37mm43VPrsAAMzAH0AAAAFZAAgAAAAAFNprhQ3ZwIcYbuzLolAT5n/vc14P9kUUQComDu6eFyKBXMAIAAAAAAcx9z9pk32YbPV/sfPZl9ALIEVsqoLXgqWLVK/tP+heAVsACAAAAAA/qxvuvJbAHwwhfrPVpmCFzNvg2cU/NXaWgqgYUZpgXwAAzQAfQAAAAVkACAAAAAAODI+pB2pCuB+YmNEUAgtMfNdt3DmSkrJ96gRzLphgb8FcwAgAAAAAAT7dewFDxUDECQ3zVq75/cUN4IP+zsqhkP5+czUwlJIBWwAIAAAAACFGeOtd5zBXTJ4JYonkn/HXZfHipUlqGwIRUcH/VTatwADNQB9AAAABWQAIAAAAACNAk+yTZ4Ewk1EnotQK8O3h1gg9I7pr9q2+4po1iJVgAVzACAAAAAAUj/LesmtEsgqYVzMJ67umVA11hJTdDXwbxDoQ71vWyUFbAAgAAAAABlnhpgTQ0WjLb5u0b/vEydrCeFjVynKd7aqb+UnvVLeAAM2AH0AAAAFZAAgAAAAAD/FIrGYFDjyYmVb7oTMVwweWP7A6F9LnyIuNO4MjBnXBXMAIAAAAACIZgJCQRZu7NhuNMyOqCn1tf+DfU1qm10TPCfj5JYV3wVsACAAAAAA5hmY4ptuNxULGf87SUFXQWGAONsL9U29duh8xqsHtxoAAzcAfQAAAAVkACAAAAAAciRW40ORJLVwchOEpz87Svb+5toAFM6LxDWv928ECwQFcwAgAAAAAN0dipyESIkszfjRzdDi8kAGaa2Hf4wrPAtiWwboZLuxBWwAIAAAAAANr4o/+l1OIbbaX5lZ3fQ/WIeOcEXjNI1F0WbSgQrzaQADOAB9AAAABWQAIAAAAACZqAyCzYQupJ95mrBJX54yIz9VY7I0WrxpNYElCI4dTQVzACAAAAAA/eyJb6d1xfE+jJlVXMTD3HS/NEYENPVKAuj56Dr2dSEFbAAgAAAAANkSt154Or/JKb31VvbZFV46RPgUp8ff/hcPORL7PpFBAAM5AH0AAAAFZAAgAAAAAI5bm3YO0Xgf0VT+qjVTTfvckecM3Cwqj7DTKZXf8/NXBXMAIAAAAAD/m+h8fBhWaHm6Ykuz0WX1xL4Eme3ErLObyEVJf8NCywVsACAAAAAAfb1VZZCqs2ivYbRzX4p5CtaCkKW+g20Pr57FWXzEZi8AAzEwAH0AAAAFZAAgAAAAANqo4+p6qdtCzcB4BX1wQ6llU7eFBnuu4MtZwp4B6mDlBXMAIAAAAAAGiz+VaukMZ+6IH4jtn4KWWdKK4/W+O+gRioQDrfzpMgVsACAAAAAAG4YYkTp80EKo59mlHExDodRQFR7njhR5dmISwUJ6ukAAAzExAH0AAAAFZAAgAAAAAPrFXmHP2Y4YAm7b/aqsdn/DPoDkv7B8egWkfe23XsM1BXMAIAAAAAAGhwpKAr7skeqHm3oseSbO7qKNhmYsuUrECBxJ5k+D2AVsACAAAAAAAqPQi9luYAu3GrFCEsVjd9z2zIDcp6SPTR2w6KQEr+IAAzEyAH0AAAAFZAAgAAAAABzjYxwAjXxXc0Uxv18rH8I3my0Aguow0kTwKyxbrm+cBXMAIAAAAADVbqJVr6IdokuhXkEtXF0C2gINLiAjMVN20lE20Vmp2QVsACAAAAAAD7K1Fx4gFaaizkIUrf+EGXQeG7QX1jadhGc6Ji471H8AAzEzAH0AAAAFZAAgAAAAAFMm2feF2fFCm/UC6AfIyepX/xJDSmnnolQIBnHcPmb5BXMAIAAAAABLI11kFrQoaNVZFmq/38aRNImPOjdJh0Lo6irI8M/AaAVsACAAAAAAOWul0oVqJ9CejD2RqphhTC98DJeRQy5EwbNerU2+4l8AAzE0AH0AAAAFZAAgAAAAAJvXB3KyNiNtQko4SSzo/9b2qmM2zU9CQTTDfLSBWMgRBXMAIAAAAAAvjuVP7KsLRDeqVqRziTKpBrjVyqKiIbO9Gw8Wl2wFTAVsACAAAAAADlE+oc1ins+paNcaOZJhBlKlObDJ4VQORWjFYocM4LgAAzE1AH0AAAAFZAAgAAAAAPGdcxDiid8z8XYnfdDivNMYVPgBKdGOUw6UStU+48CdBXMAIAAAAAARj6g1Ap0eEfuCZ4X2TsEw+Djrhto3fA5nLwPaY0vCTgVsACAAAAAAoHqiwGOUkBu8SX5U1yHho+UIFdSN2MdQN5s6bQ0EsJYAAzE2AH0AAAAFZAAgAAAAAP5rGPrYGt3aKob5f/ldP0qrW7bmWvqnKY4QwdDWz400BXMAIAAAAADTQkW2ymaaf/bhteOOGmSrIR97bAnJx+yN3yMj1bTeewVsACAAAAAADyQnHGH2gF4w4L8axUsSTf6Ubk7L5/eoFOJk12MtZAoAAzE3AH0AAAAFZAAgAAAAAAlz6wJze5UkIxKpJOZFGCOf3v2KByWyI6NB6JM9wNcBBXMAIAAAAABUC7P/neUIHHoZtq0jFVBHY75tSFYr1Y5S16YN5XxC1QVsACAAAAAAgvxRbXDisNnLY3pfsjDdnFLtkvYUC4lhA68eBXc7KAwAAzE4AH0AAAAFZAAgAAAAAFJ8AtHcjia/9Y5pLEc3qVgH5xKiXw12G9Kn2A1EY8McBXMAIAAAAAAxe7Bdw7eUSBk/oAawa7uicTEDgXLymRNhBy1LAxhDvwVsACAAAAAAxKPaIBKVx3jTA+R/el7P7AZ7efrmTGjJs3Hj/YdMddwAAzE5AH0AAAAFZAAgAAAAAO8uwQUaKFb6vqR3Sv3Wn4QAonC2exOC9lGG1juqP5DtBXMAIAAAAABZf1KyJgQg8/Rf5c02DgDK2aQu0rNCOvaL60ohDHyY+gVsACAAAAAAqyEjfKC8lYoIfoXYHUqHZPoaA6EK5BAZy5dxXZmay4kAAzIwAH0AAAAFZAAgAAAAAE8YtqyRsGCeiR6hhiyisR/hccmK4nZqIMzO4lUBmEFzBXMAIAAAAAC1UYOSKqAeG1UJiKjWFVskRhuFKpj9Ezy+lICZvFlN5AVsACAAAAAA6Ct9nNMKyRazn1OKnRKagm746CGu+jyhbL1qJnZxGi0AAzIxAH0AAAAFZAAgAAAAAPhCrMausDx1QUIEqp9rUdRKyM6a9AAx7jQ3ILIu8wNIBXMAIAAAAACmH8lotGCiF2q9VQxhsS+7LAZv79VUAsOUALaGxE/EpAVsACAAAAAAnc1xCKfdvbUEc8F7XZqlNn1C+hZTtC0I9I3LL06iaNkAAzIyAH0AAAAFZAAgAAAAAOBi/GAYFcstMSJPgp3VkMiuuUUCrZytvqYaU8dwm8v2BXMAIAAAAACEZSZVyD3pKzGlbdwlYmWQhHHTV5SnNLknl2Gw8IaUTQVsACAAAAAAfsLZsEDcWSuNsIo/TD1ReyQW75HPMgmuKZuWFOLKRLoAAzIzAH0AAAAFZAAgAAAAAIQuup+YGfH3mflzWopN8J1X8o8a0d9CSGIvrA5HOzraBXMAIAAAAADYvNLURXsC2ITMqK14LABQBI+hZZ5wNf24JMcKLW+84AVsACAAAAAACzfjbTBH7IwDU91OqLAz94RFkoqBOkzKAqQb55gT4/MAAzI0AH0AAAAFZAAgAAAAAKsh0ADyOnVocFrOrf6MpTrNvAj8iaiE923DPryu124gBXMAIAAAAADg24a8NVE1GyScc6tmnTbmu5ulzO+896fE92lN08MeswVsACAAAAAAaPxcOIxnU7But88/yadOuDJDMcCywwrRitaxMODT4msAAzI1AH0AAAAFZAAgAAAAAKkVC2Y6HtRmv72tDnPUSjJBvse7SxLqnr09/Uuj9sVVBXMAIAAAAABYNFUkH7ylPMN+Bc3HWX1e0flGYNbtJNCY9SltJCW/UAVsACAAAAAAZYK/f9H4OeihmpiFMH7Wm7uLvs2s92zNA8wyrNZTsuMAAzI2AH0AAAAFZAAgAAAAADDggcwcb/Yn1Kk39sOHsv7BO/MfP3m/AJzjGH506Wf9BXMAIAAAAAAYZIsdjICS0+BDyRUPnrSAZfPrwtuMaEDEn0/ijLNQmAVsACAAAAAAGPnYVvo2ulO9z4LGd/69NAklfIcZqZvFX2KK0s+FcTUAAzI3AH0AAAAFZAAgAAAAAEWY7dEUOJBgjOoWVht1wLehsWAzB3rSOBtLgTuM2HC8BXMAIAAAAAAAoswiHRROurjwUW8u8D5EUT+67yvrgpB/j6PzBDAfVwVsACAAAAAA6NhRTYFL/Sz4tao7vpPjLNgAJ0FX6P/IyMW65qT6YsMAAzI4AH0AAAAFZAAgAAAAAPZaapeAUUFPA7JTCMOWHJa9lnPFh0/gXfAPjA1ezm4ZBXMAIAAAAACmJvLY2nivw7/b3DOKH/X7bBXjJwoowqb1GtEFO3OYgAVsACAAAAAA/JcUoyKacCB1NfmH8vYqC1f7rd13KShrQqV2r9QBP44AAzI5AH0AAAAFZAAgAAAAAK00u6jadxCZAiA+fTsPVDsnW5p5LCr4+kZZZOTDuZlfBXMAIAAAAAAote4zTEYMDgaaQbAdN8Dzv93ljPLdGjJzvnRn3KXgtQVsACAAAAAAxXd9Mh6R3mnJy8m7UfqMKi6oD5DlZpkaOz6bEjMOdiwAAzMwAH0AAAAFZAAgAAAAAFbgabdyymiEVYYwtJSWa7lfl/oYuj/SukzJeDOR6wPVBXMAIAAAAADAFGFjS1vPbN6mQEhkDYTD6V2V23Ys9gUEUMGNvMPkaAVsACAAAAAAL/D5Sze/ZoEanZLK0IeEkhgVkxEjMWVCfmJaD3a8uNIAAzMxAH0AAAAFZAAgAAAAABNMR6UBv2E627CqLtQ/eDYx7OEwQ7JrR4mSHFa1N8tLBXMAIAAAAAAxH4gucI4UmNVB7625C6hFSVCuIpJO3lusJlPuL8H5EQVsACAAAAAAVLHNg0OUVqZ7WGOP53BkTap9FOw9dr1P4J8HxqFqU04AAzMyAH0AAAAFZAAgAAAAAG8cd6WBneNunlqrQ2EmNf35W7OGObGq9WL4ePX+LUDmBXMAIAAAAAAjJ2+sX87NSis9hBsgb1QprVRnO7Bf+GObCGoUqyPE4wVsACAAAAAAs9c9SM49/pWmyUQKslpt3RTMBNSRppfNO0JBvUqHPg0AAzMzAH0AAAAFZAAgAAAAAFWOUGkUpy8yf6gB3dio/aOfRKh7XuhvsUj48iESFJrGBXMAIAAAAAAY7sCDMcrUXvNuL6dO0m11WyijzXZvPIcOKob6IpC4PQVsACAAAAAAJOP+EHz6awDb1qK2bZQ3kTV7wsj5Daj/IGAWh4g7omAAAzM0AH0AAAAFZAAgAAAAAGUrIdKxOihwNmo6B+aG+Ag1qa0+iqdksHOjQj+Oy9bZBXMAIAAAAABwa5dbI2KmzBDNBTQBEkjZv4sPaeRkRNejcjdVymRFKQVsACAAAAAA4ml/nm0gJNTcJ4vuD+T2Qfq2fQZlibJp/j6MOGDrbHMAAzM1AH0AAAAFZAAgAAAAAOx89xV/hRk64/CkM9N2EMK6aldII0c8smdcsZ46NbP8BXMAIAAAAADBF6tfQ+7q9kTuLyuyrSnDgmrdmrXkdhl980i1KHuGHgVsACAAAAAACUqiFqHZdGbwAA+hN0YUE5zFg+H+dabIB4dj5/75W/YAAzM2AH0AAAAFZAAgAAAAAMkN0L1oQWXhjwn9rAdudcYeN8/5VdCKU8cmDt7BokjsBXMAIAAAAAAT62pGXoRwExe9uvgYOI0hg5tOxilrWfoEmT0SMglWJwVsACAAAAAAlVz4dhiprSbUero6JFfxzSJGclg63oAkAmgbSwbcYxIAAzM3AH0AAAAFZAAgAAAAANxfa4xCoaaB7k1C1RoH1LBhsCbN2yEq15BT9b+iqEC4BXMAIAAAAACAX9LV8Pemfw7NF0iB1/85NzM1Ef+1mUfyehacUVgobQVsACAAAAAAVq4xpbymLk0trPC/a2MvB39I7hRiX8EJsVSI5E5hSBkAAzM4AH0AAAAFZAAgAAAAAOYIYoWkX7dGuyKfi3XssUlc7u/gWzqrR9KMkikKVdmSBXMAIAAAAABVF2OYjRTGi9Tw8XCAwZWLpX35Yl271TlNWp6N/nROhAVsACAAAAAA0nWwYzXQ1+EkDvnGq+SMlq20z+j32Su+i/A95SggPb4AAzM5AH0AAAAFZAAgAAAAAIy0+bXZi10QC+q7oSOLXK5Fee7VEk/qHSXukfeVIfgzBXMAIAAAAAAQ3IIV/JQCHW95AEbH5zGIHtJqyuPjWPMIZ+VmQHlxEwVsACAAAAAAp0jYsyohKv9Pm+4k+DplEGbl9WLZpAJzitrcDj4CNsMAAzQwAH0AAAAFZAAgAAAAAL5SOJQ3LOhgdXJ5v086NNeAl1qonQnchObdpZJ1kHeEBXMAIAAAAAA+tEqTXODtik+ydJZSnUqXF9f18bPeze9eWtR7ExZJgQVsACAAAAAAbrkZCVgB9Qsp4IAbdf+bD4fT6Boqk5UtuA/zhNrh1y0AAzQxAH0AAAAFZAAgAAAAAKl8zcHJRDjSjJeV/WvMxulW1zrTFtaeBy/aKKhadc6UBXMAIAAAAADBdWQl5SBIvtZZLIHszePwkO14W1mQ0izUk2Ov21cPNAVsACAAAAAAHErCYycpqiIcCZHdmPL1hi+ovLQk4TAvENpfLdTRamQAAzQyAH0AAAAFZAAgAAAAAFvotcNaoKnVt5CBCOPwjexFO0WGWuaIGL6H/6KSau+6BXMAIAAAAAD2y2mBN5xPu5PJoY2zcr0GnQDtHRBogA5+xzIxccE9fwVsACAAAAAAdS34xzJesnUfxLCcc1U7XzUqLy8MAzV/tcjbqaD3lkMAAzQzAH0AAAAFZAAgAAAAAPezU0/vNT4Q4YKbTbaeHqcwNLT+IjW/Y9QFpIooihjPBXMAIAAAAACj2x4O4rHter8ZnTws5LAP9jJ/6kk9C/V3vL50LoFZHAVsACAAAAAAQdBDF3747uCVP5lB/zr8VmzxJfTSZHBKeIgm5FyONXwAAzQ0AH0AAAAFZAAgAAAAAMqpayM2XotEFmm0gwQd9rIzApy0X+7HfOhNk6VU7F5lBXMAIAAAAACJR9+q5T9qFHXFNgGbZnPubG8rkO6cwWhzITQTmd6VgwVsACAAAAAAOZLQ6o7e4mVfDzbpQioa4d3RoTvqwgnbmc5Qh2wsZuoAAzQ1AH0AAAAFZAAgAAAAANCeyW+3oebaQk+aqxNVhAcT/BZ5nhsTVdKS3tMrLSvWBXMAIAAAAADxRFMDhkyuEc++WnndMfoUMLNL7T7rWoeblcrpSI6soQVsACAAAAAAdBuBMJ1lxt0DRq9pOZldQqchLs3B/W02txcMLD490FEAAzQ2AH0AAAAFZAAgAAAAAIbo5YBTxXM7HQhl7UP9NNgpPGFkBx871r1B65G47+K8BXMAIAAAAAC21dJSxnEhnxO5gzN5/34BL4von45e1meW92qowzb8fQVsACAAAAAAm3Hk2cvBN0ANaR5jzeZE5TsdxDvJCTOT1I01X7cNVaYAAzQ3AH0AAAAFZAAgAAAAABm/6pF96j26Jm7z5KkY1y33zcAEXLx2n0DwC03bs/ixBXMAIAAAAAD01OMvTZI/mqMgxIhA5nLs068mW+GKl3OW3ilf2D8+LgVsACAAAAAAaLvJDrqBESTNZSdcXsd+8GXPl8ZkUsGpeYuyYVv/kygAAzQ4AH0AAAAFZAAgAAAAAJ/D3+17gaQdkBqkL2wMwccdmCaVOtxzIkM8VyI4xI5zBXMAIAAAAAAggLVmkc5u+YzBR+oNE+XgLVp64fC6MzUb/Ilu/Jsw0AVsACAAAAAACz3HVKdWkx82/kGbVpcbAeZtsj2R5Zr0dEPfle4IErkAAzQ5AH0AAAAFZAAgAAAAAJMRyUW50oaTzspS6A3TUoXyC3gNYQoShUGPakMmeVZrBXMAIAAAAACona2Pqwt4U2PmFrtmu37jB9kQ/12okyAVtYa8TQkDiQVsACAAAAAAltJJKjCMyBTJ+4PkdDCPJdeX695P8P5h7WOZ+kmExMAAAzUwAH0AAAAFZAAgAAAAAByuYl8dBvfaZ0LO/81JW4hYypeNmvLMaxsIdvqMPrWoBXMAIAAAAABNddwobOUJzm9HOUD8BMZJqkNCUCqstHZkC76FIdNg9AVsACAAAAAAQQOkIQtkyNavqCnhQbNg3HfqrJdsAGaoxSJePJl1qXsAAzUxAH0AAAAFZAAgAAAAAHEzLtfmF/sBcYPPdj8867VmmQyU1xK9I/3Y0478azvABXMAIAAAAAAcmyFajZPnBTbO+oLInNwlApBocUekKkxz2hYFeSlQ+gVsACAAAAAAZ6IkrOVRcC8vSA6Vb4fPWZJrYexXhEabIuYIeXNsCSgAAzUyAH0AAAAFZAAgAAAAAJam7JYsZe2cN20ZYm2W3v1pisNt5PLiniMzymBLWyMtBXMAIAAAAABxCsKVMZMTn3n+R2L7pVz5nW804r8HcK0mCBw3jUXKXAVsACAAAAAA7j3JGnNtR64P4dJLeUoScFRGfa8ekjh3dvhw46sRFk0AAzUzAH0AAAAFZAAgAAAAAMXrXx0saZ+5gORmwM2FLuZG6iuO2YS+1IGPoAtDKoKBBXMAIAAAAADIQsxCr8CfFKaBcx8kIeSywnGh7JHjKRJ9vJd9x79y7wVsACAAAAAAcvBV+SykDYhmRFyVYwFYB9oBKBSHr55Jdz2cXeowsUQAAzU0AH0AAAAFZAAgAAAAACbzcUD3INSnCRspOKF7ubne74OK9L0FTZvi9Ay0JVDYBXMAIAAAAADPebVQH8Btk9rhBIoUOdSAdpPvz7qIY4UC2i6IGisSAQVsACAAAAAAiBunJi0mPnnXdnldiq+If8dcb/n6apHnaIFt+oyYO1kAAzU1AH0AAAAFZAAgAAAAACUc2CtD1MK/UTxtv+8iA9FoHEyTwdl43HKeSwDw2Lp5BXMAIAAAAACCIduIdw65bQMzRYRfjBJj62bc69T4QqH4QoWanwlvowVsACAAAAAAM0TV7S+aPVVzJOQ+cpSNKHTwyQ0mWa8tcHzfk3nR+9IAAzU2AH0AAAAFZAAgAAAAAHSaHWs/dnmI9sc7nB50VB2Bzs0kHapMHCQdyVEYY30TBXMAIAAAAACkV22lhEjWv/9/DubfHBAcwJggKI5mIbSK5L2nyqloqQVsACAAAAAAS19m7DccQxgryOsBJ3GsCs37yfQqNi1G+S6fCXpEhn4AAzU3AH0AAAAFZAAgAAAAAAL8jhNBG0KXXZhmZ0bPXtfgapJCB/AI+BEHB0eZ3C75BXMAIAAAAADHx/fPa639EBmGV5quLi8IQT600ifiKSOhTDOK19DnzwVsACAAAAAAlyLTDVkHxbayklD6Qymh3odIK1JHaOtps4f4HR+PcDgAAzU4AH0AAAAFZAAgAAAAAAxgeclNl09H7HvzD1oLwb2YpFca5eaX90uStYXHilqKBXMAIAAAAACMU5pSxzIzWlQxHyW170Xs9EhD1hURASQk+qkx7K5Y6AVsACAAAAAAJbMMwJfNftA7Xom8Bw/ghuZmSa3x12vTZxBUbV8m888AAzU5AH0AAAAFZAAgAAAAABmO7QD9vxWMmFjIHz13lyOeV6vHT6mYCsWxF7hb/yOjBXMAIAAAAACT9lmgkiqzuWG24afuzYiCeK9gmJqacmxAruIukd0xEAVsACAAAAAAZa0/FI/GkZR7CtX18Xg9Tn9zfxkD0UoaSt+pIO5t1t4AAzYwAH0AAAAFZAAgAAAAAB89SjLtDJkqEghRGyj6aQ/2qvWLNuMROoXmzbYbCMKMBXMAIAAAAAC8sywgND+CjhVTF6HnRQeay8y9/HnVzDI42dEPah28LQVsACAAAAAAoxv7UKh0RqUAWcOsQvU123zO1qZn73Xfib0qncZCB34AAzYxAH0AAAAFZAAgAAAAABN2alGq9Aats1mwERNGwL/fIwZSvVCe9/8XMHTFlpUpBXMAIAAAAACuDPjJgvvbBYhbLpjMiWUCsVppiYrhvR+yMysNPN8cZAVsACAAAAAAKpADjc4bzIZMi9Q/+oe0EMRJHYQt6dlo1x/lRquagqkAAzYyAH0AAAAFZAAgAAAAAL8YB6VAqGBiWD4CBv16IBscg5J7VQCTZu87n6pj+86KBXMAIAAAAAAmxm8e68geeyAdUjSMWBHzUjneVB0pG9TBXIoE6467hAVsACAAAAAAV76JZAlYpgC/Zl8awx2ArCg1uuyy2XVTSkp0wUMi/7UAAzYzAH0AAAAFZAAgAAAAAL4yLkCTV5Dmxa5toBu4JT8ge/cITAaURIOuFuOtFUkeBXMAIAAAAAAXoFNQOMGkAj7qEJP0wQafmFSXgWGeorDVbwyOxWLIsgVsACAAAAAAc4Un6dtIFe+AQ+RSfNWs3q63RTHhmyc+5GKRRdpWRv8AAzY0AH0AAAAFZAAgAAAAAEU8DoUp46YtYjNFS9kNXwdYxQ9IW27vCTb+VcqqfnKNBXMAIAAAAADe7vBOgYReE8X78k5ARuUnv4GmzPZzg6SbConf4L2G3wVsACAAAAAA78YHWVkp6HbZ0zS4UL2z/2pj9vPDcMDt7zTv6NcRsVsAAzY1AH0AAAAFZAAgAAAAAPa4yKTtkUtySuWo1ZQsp2QXtPb5SYqzA5vYDnS1P6c0BXMAIAAAAADKnF58R1sXlHlsHIvCBR3YWW/qk54z9CTDhZydkD1cOQVsACAAAAAAHW3ERalTFWKMzjuXF3nFh0pSrQxM/ojnPbPhc4v5MaQAAzY2AH0AAAAFZAAgAAAAAN5WJnMBmfgpuQPyonmY5X6OdRvuHw4nhsnGRnFAQ95VBXMAIAAAAACwftzu7KVV1rmGKwXtJjs3cJ1gE3apr8+N0SAg1F2cHwVsACAAAAAATDW0reyaCjbJuVLJzbSLx1OBuBoQu+090kgW4RurVacAAzY3AH0AAAAFZAAgAAAAACHvDsaPhoSb6DeGnKQ1QOpGYAgK82qpnqwcmzSeWaJHBXMAIAAAAABRq3C5+dOfnkAHM5Mg5hPB3O4jhwQlBgQWLA7Ph5bhgwVsACAAAAAAqkC8zYASvkVrp0pqmDyFCkPaDmD/ePAJpMuNOCBhni8AAzY4AH0AAAAFZAAgAAAAAOBePJvccPMJmy515KB1AkXF5Pi8NOG4V8psWy0SPRP+BXMAIAAAAAB3dOJG9xIDtEKCRzeNnPS3bFZepMj8UKBobKpSoCPqpgVsACAAAAAAPG3IxQVOdZrr509ggm5FKizWWoZPuVtOgOIGZ3m+pdEAAzY5AH0AAAAFZAAgAAAAABUvRrDQKEXLMdhnzXRdhiL6AGNs2TojPky+YVLXs+JnBXMAIAAAAAD1kYicbEEcPzD4QtuSYQQWDPq8fuUWGddpWayKn3dT9QVsACAAAAAA9+Sf7PbyFcY45hP9oTfjQiOUS3vEIAT8C0vOHymwYSUAAzcwAH0AAAAFZAAgAAAAAOvSnpujeKNen4pqc2HR63C5s5oJ1Vf4CsbKoYQvkwl5BXMAIAAAAACw2+vAMdibzd2YVVNfk81yXkFZP0WLJ82JBxJmXnYE+QVsACAAAAAArQ/E1ACyhK4ZyLqH9mNkCU7WClqRQTGyW9tciSGG/EMAAzcxAH0AAAAFZAAgAAAAAAo0xfGG7tJ3GWhgPVhW5Zn239nTD3PadShCNRc9TwdNBXMAIAAAAADZh243oOhenu0s/P/5KZLBDh9ADqKHtSWcXpO9D2sIjgVsACAAAAAAlgTPaoQKz+saU8rwCT3UiNOdG6hdpjzFx9GBn08ZkBEAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAABbW4A////////7/8BbXgA////////738A", - "subType": "06" - } - } - } - }, - "u": { - "$set": { - "encryptedDoubleNoPrecision": { - "$$type": "binData" - } - } - } - } - ], - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoubleNoPrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - } - } - } - ] - } - } - }, - "$db": "default" - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "6YrBn2ofIw1b5ooakrLOwF41BWrps8OO0H9WH4/rtlE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "n+XAuFnP8Dov9TnhGFxNx0K/MnVM9WbJ7RouEu0ndO0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yRXojuVdn5GQtD97qYlaCL6cOLmZ7Cvcb3wFjkLUIdM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DuIkdRPITRs55I4SZmgomAHCIsDQmXRhW8+MOznkzSk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SsBk+Et1lTbU+QRPx+xyJ/jMkmfG+QCvQEpip2YYrzA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "crCIzOd8KhHvvUlX7M1v9bhvU4pLdTc+X2SuqoKU5Ek=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "YOWdCw4UrqnxkAaVjqmC4sKQDMVMHEpFGnlxpxdaU6E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "M3SShp81Ff8tQ632qKbv9MUcN6wjDaBReI0VXNu6Xh4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gzHlSPxpM0hT75kQvWFzGlOxKvDoiKQZOr19V6l2zXI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "s3JnppOGYw9SL2Q1kMAZs948v2F5PrpXjGei/HioDWs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cG6+3Gk/zEH68P/uuuwiAUVCuyJwa1LeV+t29FlPPAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dupdvR3AyJtM+g9NDKiaLVOtGca387JQp8w+V03m7Ig=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JqEQc5svj2jTvZ6LLA5ivE+kTb/0aRemSEmxk4G7Zrg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "szcXXXKnob+p3SoM4yED2R920LeJ7cVsclPMFTe4CeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "o1QoGVXmuBdHwHm7aCtGMlMVKrjFdYvJXpoq6uhIAZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Jfm5wPlqqLCJRGQIqRq2NGmpn7s0Vrih2H3YAOoI2YU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zMHLb8ARbsYo8Ld05bqnGFf1Usha6EGb8QKwdSAyps0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yQdtq9lh5pugL7/i0Bj/PuZUUBUIzf+7wj1rl5y736w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wGWVZdO7qIuyDg/BqDgqjgoQ02h5YYgwXQB1oCin2NE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "by9HMLj6NTEpgztZ5HSN6GxImkXPcaFINYDzgZY33X8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tWo0vbasi7bXmn/MsOx13VC1IsWtpx/nYp0uj4iMzdA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tQQpndUYd5O87lOtrGjH3wl9VsOK0ray7RMasL90sBM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cQjXEDCMsOpKLLf+vlTgIHA+cbSJdzqhbSX9Wvh95aA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7yMpU48IxK9SzP2cx3VnTownGEwFmeFofuuFT97SuuY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kSOx1kz0CmBgzKQHZlo65ZUY1DIv9A99JRm+Us2y6Ew=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ubQpdPBe6/xvtr+AcXdfYLSvYCR4ot0tivehkCsupb4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xal+iCJ6FTefRQToyoNksc9NCZShyn04NDGi4IYrcoM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "d7jU4iOK50xHxlkSifcxlZFCM46TSgQzoYivxG3HNLY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tJvl2nsBLBVzL3pp6sKWCL4UXeh3q/roYBJjSb74ve0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OIUCaKRvIx9t1w6Hxlz1IcQTdPNCfdRNwnnTm10W+X0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A9tvzsiElotOUVIB4CqfQp9mAwqvTM35YkmAR170aHA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lI8gpK7hpb7c9x4RQugsxMnQay5LZJmwslZdvMx/dcE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dNCzh40U0XvdKnSDi3HRQOWQftEsDVqc4uUvsVFGoq8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "IP+iwEBWBwVVZIdpaMu8k5+soFCz+TZkYn3drKZ9grE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pnqyh6e0y5svHkJDShlN9CHV0WvMBE4QbtJpQw5ZCXc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "elEl42tbVDoRTLjAhZUFEtXiut4b3PVhg/1ZLZSQdtE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vHuu2FxwclMHqyE6JBYbTYgbEkB0dqb/JuaxsvfwsmY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xTf7NCe3Gf8QpE78HR5OknlLTKfs9J+RN9UZpH6fnso=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XiWSasRnJAulGR6+LCVD3mwRObXylqYWR9jvpywq12c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MZMxEQ5ikx0PG1YFIExv0UnTZogsvgeOEZTpzvBDn4w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yZMyMZBDrWbAhvnic7vvIYhmO9m5H2iuv0c8KNZrBzY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xxM14hTPY5j0vvcK2C7YAEjzdsfUTFHozHC0hEo1bxI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+01rqR1xVwkpGXcstbk1ItJqFVjH6Q8MGxEN3Cm9Y1A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xOpLV0Z2VTRJ3iWtnWZcsyjXubTIkYWo31cO+HV1o1k=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BWUOLqgLBqc5NwxVlSV5H3KFQPXbCp7mdo+jF+8cJqY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "fuQb1S6xZDGlrEbK+kI23aL53PP1PVNwqICnZNt9Yzg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfscnoibFttahLdPVC4Ee+47ewGFKpDSU7M6HX19bKE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rpSW2awybNVeKtat91VFxqbINoTfNhPfQAu+d73Xtf8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "9M/CP9ccOIIj2LLFmE0GFDO0Ban2wsNalEXfM6+h+1s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WrEMG49l1ye4MhXs5ZS9tz8P6h+hDvthIg/2wW9ne1Q=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ImNhbfeyfH8qIEeA5ic0s3dAQBdzzTBS+CPsNih9vZ0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dWP33YDSn04UKJN2ogh2Rui0iW/0q2y18OCDRVcfyoo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "lYv0isAtfGh6H9tdp3cp2eHU7q2J+uk7QrgcxtK3w7Y=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "VGMoamB/+7zTOYcY/pqJc96xlv2PdW4hwsIAEIslTDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yNeBWMF7BnD9wVwz2PgJsvWr77QiVvvWUvJF0+fqBug=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SfpvObJ+tJBXSvqeN7vlOfmhYign635lciYAJIjUtY8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dsen4NqjzVGjpjufiTMs3+gqeD09EbnuogPgxrJECwg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "pxCWVM3sn19NsFEpgHbgLa+PmYlhN3mMiP0Wk8kJhYw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q11KNvJszjYIB9n9HcC+N4uz11a3eRj1L3BH9scKMDQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "A1PmkgcEToWh1JiVWE6mI5jUu7poxWWuCUt/cgRUUDc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "qJo3Hu4PJeanL7XEaWXO/n3YsodhZyd+MJOOmB9Kpd8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "BkBKLO8URFscfRY9Bav/1+L9mLohDgNr/MkZtGiraIs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "rZq5WA3Hx3xthOyHAJXK//f8pE2qbz7YKu3TIMp9GFY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X07a/Lm80p5xd4RFs1dNmw+90tmPDPdGiAKVZkxd4zY=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedDoubleNoPrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "HI88j1zrIsFoijIXKybr9mYubNV5uVeODyLHFH4Ueco=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wXVD/HSbBljko0jJcaxJ1nrzs2+pchLQqYR3vywS8SU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "KhscCh+tt/pp8lxtKZQSPPUU94RvJYPKG/sjtzIa4Ws=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RISnuNrTTVNW5HnwCgQJ301pFw8DOcYrAMQIwVwjOkI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Ra5zukLh2boua0Bh74qA+mtIoixGXlsNsxiJqHtqdTI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "eqr0v+NNWXWszi9ni8qH58Q6gw5x737tJvH3lPaNHO4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "d42QupriWIwGrFAquXNFi0ehEuidIbHLFZtg1Sm2nN8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "2azRVxaaTIJKcgY2FU012gcyP8Y05cRDpfUaMnCBaQU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "3nlgkM4K/AAcHesRYYdEu24UGetHodVnVfHzw4yxZBM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "hqy91FNmAAac2zUaPO6eWFkx0/37rOWGrwXN+fzL0tU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "akX+fmscSDSF9pB5MPj56iaJPtohr0hfXNk/OPWsGv8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1ZvUb10Q7cN4cNLktd5yNjqgtawsYnkbeVBZV6WuY/I=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "otCwtuKiY4hCyXvYzXvo10OcnzZppebo38KsAlq49QM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Mty8EscckeT/dhMfrPFyDbLnmMOcYRUQ3mLK4KTu6V8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "tnvgLLkJINO7csREYu4dEVe1ICrBeu7OP+HdfoX3M2E=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kOefsHgEVhkJ17UuP7Dxogy6sAQbzf1SFPKCj6XRlrQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "F+JQ79xavpaHdJzdhvwyHbzdZJLNHAymc/+67La3gao=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "NCZ9zp5rDRceENuSgAfTLEyKg0YgmXAhK0B8WSj7+Pw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wL1CJ7cYR5slx8mHq++uMdjDfkt9037lQTUztEMF56M=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "txefkzTMITZE+XvvRFZ7QcgwDT/7m8jNmxRk4QBaoZI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jFunW3v1tSYMyZtQQD28eEy9qqDp4Kqo7gMN29N4bfQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QMO915KUiS3X3R1bU1YoafVM2s0NeHo3EjgTA9PnGwY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "nwdKJEXdilzvb7494vbuDJ+y6SrfJahza1dYIsHIWVI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vpWMX+T/VXXajFo0UbuYjtp0AEzBU0Y+lP+ih2EQ7mg=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1lmzG0J1DhKDRhhq5y5Buygu4G8eV2X0t7kUY90EohM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SiKqpXqO0trwhFvBWK274hMklpCgMhNs/JY84yyn/NE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7cPGPYCKPTay+ZR9Gx6oOueduOgaFrSuAXmNDpDHXdI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4THEYvAkjs2Fh7FIe5LC45P4i4N0L7ob67UOVbhp6Nk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "B+UGsChLLZR7iqnt8yq91OgmTgwiUKTJhFxY4NT0O6c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X1uYwBCsCg1H+PnKdwtBqXlt0zKEURi8bOM940GcPfk=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xYOgT5l7shlNXCwHlguovmDkcEnF8dXyYlTyYrgZ8GE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "vFMTZqV8bh1+gcKzTkXweMddJlgdUnwX0DWzUUaMok4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4HI0y9FrtleZxZ7M6INdNhLelrQ2Rv/+ykWCBl+tMC8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jpJ0bBE474OUkn1vUiLWumIBtYmwc7J5+LQU/nyeLQc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jQTPeXZvdxY/DjtPfYfKUArIDsf0E9MVFy2O26sv1ec=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "QLLto0ExR2ZYMGqlyaMZc/hXFFTlwmgtKbiVq/xJIeI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yBJNviU1nchbGbhx6InXCVRXa90sEepz1EwbYuKXu2U=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jpEf0vHxrPu9gTJutNXSi2g/2Mc4WXFEN7yHonZEb7A=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "E09kLFckMYwNuhggMxmPtwndyvIAx+Vl+b2CV6FP75s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "N+ue6/cLPb5NssmJCCeo18LlbKPz6r2z20AsnTKRvOo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "yVQNZP8hhsvNGyDph2QP2qTNdXZTiIEVineKg+Qf33o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cSC9uI+9c5S8X+0G7amVyug1p0ZlgBsbEDYYyezBevQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1NpZGjoQzuQtekj80Rifxe9HbE08W07dfwxaFHaVn84=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "5Ghuq/8l11Ug9Uf/RTwf9On3OxOwIXUcb9soiy4J7/w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0LWKaEty6ywxLFhDaAqulqfMnYc+tgPfH4apyEeKg80=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "OwSthmCBtt6NIAoAh7aCbj82Yr/+9t8U7WuBQhFT3AQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "iYiyg6/1isqbMdvFPIGucu3cNM4NAZNtJhHpGZ4eM+c=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "waBgs8jWuGJPIF5zCRh6OmIyfK5GCBQgTMfmKSR2wyY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "1Jdtbe2BKJXPU2G9ywOrlODZ/cNYEQlKzAW3aMe1Hy4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xaLEnNUS/2ySerBpb9dN/D31t+wYcKekwTfkwtni0Mc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "bIVBrOhOvr6cL55Tr24+B+CC9MiG7U6K54aAr2IXXuw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6Cdq5wroGu2TEFnekuT7LhOpd/K/+PcipIljcHU9QL4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "K5l64vI4S/pLviLW6Pl0U3iQkI3ge0xg4RAHcEsyKJo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "bzhuvZ0Ls22yIOX+Hz51eAHlSuDbWR/e0u4EhfdpHbc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Qv+fr6uD4o0bZRp69QJCFL6zvn3G82c7L+N1IFzj7H0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "XAmISMbD3aEyQT+BQEphCKFNa0F0GDKFuhM9cGceKoQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4VLCokntMfm1AogpUnYGvhV7nllWSo3mS3hVESMy+hA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "xiXNLj/CipEH63Vb5cidi8q9X47EF4f3HtJSOH7mfM8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "4XlCYfYBjI9XA5zOSgTiEBYcZsdwyXL+f5XtH2xUIOc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "k6DfQy7ZYJIkEly2B5hjOZznL4NcgMkllZjJLb7yq7w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ZzM6gwWesa3lxbZVZthpPFs2s3GV0RZREE2zOMhBRBo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "US+jeMeeOd7J0wR0efJtq2/18lcO8YFvhT4O3DeaonQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "b6iSxiI1FM9SzxuG1bHqGA1i4+3GOi0/SPW00XB4L7o=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kn3LsxAVkzIZKK9I6fi0Cctr0yjXOYgaQWMCoj4hLpM=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-Aggregate.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-Aggregate.json deleted file mode 100644 index e8a50ebec..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-Aggregate.json +++ /dev/null @@ -1,580 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range DoublePrecision. Aggregate.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoublePrecision": { - "$gt": { - "$numberDouble": "0" - } - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1" - } - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDoublePrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "default", - "pipeline": [ - { - "$match": { - "encryptedDoublePrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - } - } - ], - "cursor": {}, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "aggregate" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "Dri0CXmL78L2DOgk9w0DwxHOMGMzih7m6l59vgy+WWo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "b7d8mRzD1kI1tdc7uNL+YAUonJ6pODLsRLkArfEKSkM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Xg8C1/A0KJaXOw4i+26Rv03/CydaaunOzXh0CIT+gn8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UoKUDw2wJYToUCcFaIs03YQSTksYR0MIOTJllwODqKc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "c/5cwAT0C5jber2xlJnWD3a5tVDy0nRtr5HG02hoFOY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wSUrRXavAGaajNeqC5mEUH1K67oYl5Wy9RNIzKjwLAM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6vrp4wWDtHEgHWR99I70WVDzevg1Fk/Pw5U8gUDa0OU=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedDoublePrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "mVZb+Ra0EYjQ4Zrh9X//E2T8MRj7NMqm5GUJXhRrBEI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FA74j21GUEJb1DJBOpR9nVnjaDZnd8yAQNuaW9Qi26g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kJv//KVkbrobIBf+QeWC5jxn20mx/P0R1N6aCSMgKM8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zB+Whi9IUUGxfLEe+lGuIzLX4LFbIhaIAm5lRk65QTc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ybO1QU3CgvhO8JgRXH+HxKszWcpl5aGDYYVa75fHa1g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X3Y3eSAbbMg//JgiHHiFpYOpV61t8kkDexI+CQyitH4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SlNHXyqVFGDPrX/2ppwog6l4pwj3PKda2TkZbqgfSfA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "McjV8xwTF3xI7863DYOBdyvIv6UpzThl6v9vBRk05bI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MgwakFvPyBlwqFTbhWUF79URJQWFoJTGotlEVSPPUsQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DyBERpMSD5lEM5Nhpcn4WGgxgn/mkUVJp+PYSLX5jsE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "I43iazc0xj1WVbYB/V+uTL/tughN1bBlxh1iypBnNsA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wjOBa/ATMuOywFmuPgC0GF/oeLqu0Z7eK5udzkTPbis=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gRQVwiR+m+0Vg8ZDXqrQQcVnTyobwCXNaA4BCJVXtMc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WUZ6huwx0ZbLb0R00uiC9FOJzsUocUN8qE5+YRenkvQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7s79aKEuPgQcS/YPOOVcYNZvHIo7FFsWtFCrnDKXefA=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-Correctness.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-Correctness.json deleted file mode 100644 index 87d0e3dd8..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-Correctness.json +++ /dev/null @@ -1,1650 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "Find with $gt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$gt": { - "$numberDouble": "0.0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $gte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$gte": { - "$numberDouble": "0.0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - }, - { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $gt with no results", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$gt": { - "$numberDouble": "1.0" - } - } - } - }, - "result": [] - } - ] - }, - { - "description": "Find with $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$lt": { - "$numberDouble": "1.0" - } - } - } - }, - "result": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - ] - } - ] - }, - { - "description": "Find with $lte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$lte": { - "$numberDouble": "1.0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - }, - { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $lt below min", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$lt": { - "$numberDouble": "0.0" - } - } - } - }, - "result": { - "errorContains": "must be greater than the range minimum" - } - } - ] - }, - { - "description": "Find with $gt above max", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$gt": { - "$numberDouble": "200.0" - } - } - } - }, - "result": { - "errorContains": "must be less than the range max" - } - } - ] - }, - { - "description": "Find with $gt and $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$gt": { - "$numberDouble": "0.0" - }, - "$lt": { - "$numberDouble": "2.0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with equality", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - }, - "result": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - ] - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with full range", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$gte": { - "$numberDouble": "0.0" - }, - "$lte": { - "$numberDouble": "200.0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - }, - { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Find with $in", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$in": [ - { - "$numberDouble": "0.0" - } - ] - } - } - }, - "result": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - ] - } - ] - }, - { - "description": "Insert out of range", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "-1" - } - } - }, - "result": { - "errorContains": "value must be greater than or equal to the minimum value" - } - } - ] - }, - { - "description": "Insert min and max", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 200, - "encryptedDoublePrecision": { - "$numberDouble": "200.0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - }, - { - "_id": 200, - "encryptedDoublePrecision": { - "$numberDouble": "200.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoublePrecision": { - "$gte": { - "$numberDouble": "0.0" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - }, - { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gt with no results", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoublePrecision": { - "$gt": { - "$numberDouble": "1.0" - } - } - } - } - ] - }, - "result": [] - } - ] - }, - { - "description": "Aggregate with $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoublePrecision": { - "$lt": { - "$numberDouble": "1.0" - } - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $lte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoublePrecision": { - "$lte": { - "$numberDouble": "1.0" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - }, - { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $lt below min", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoublePrecision": { - "$lt": { - "$numberDouble": "0.0" - } - } - } - } - ] - }, - "result": { - "errorContains": "must be greater than the range minimum" - } - } - ] - }, - { - "description": "Aggregate with $gt above max", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoublePrecision": { - "$gt": { - "$numberDouble": "200.0" - } - } - } - } - ] - }, - "result": { - "errorContains": "must be less than the range max" - } - } - ] - }, - { - "description": "Aggregate with $gt and $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoublePrecision": { - "$gt": { - "$numberDouble": "0.0" - }, - "$lt": { - "$numberDouble": "2.0" - } - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with equality", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - ] - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with full range", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoublePrecision": { - "$gte": { - "$numberDouble": "0.0" - }, - "$lte": { - "$numberDouble": "200.0" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - }, - { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $in", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1.0" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedDoublePrecision": { - "$in": [ - { - "$numberDouble": "0.0" - } - ] - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0.0" - } - } - ] - } - ] - }, - { - "description": "Wrong type: Insert Int", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberInt": "0" - } - } - }, - "result": { - "errorContains": "cannot encrypt element" - } - } - ] - }, - { - "description": "Wrong type: Find Int", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$gte": { - "$numberInt": "0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": { - "errorContains": "field type is not supported" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-Delete.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-Delete.json deleted file mode 100644 index 8a0fecf78..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-Delete.json +++ /dev/null @@ -1,474 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range DoublePrecision. Delete.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1" - } - } - } - }, - { - "name": "deleteOne", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$gt": { - "$numberDouble": "0" - } - } - } - }, - "result": { - "deletedCount": 1 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDoublePrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "delete": "default", - "deletes": [ - { - "q": { - "encryptedDoublePrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - }, - "limit": 1 - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "delete" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "Dri0CXmL78L2DOgk9w0DwxHOMGMzih7m6l59vgy+WWo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "b7d8mRzD1kI1tdc7uNL+YAUonJ6pODLsRLkArfEKSkM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Xg8C1/A0KJaXOw4i+26Rv03/CydaaunOzXh0CIT+gn8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UoKUDw2wJYToUCcFaIs03YQSTksYR0MIOTJllwODqKc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "c/5cwAT0C5jber2xlJnWD3a5tVDy0nRtr5HG02hoFOY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wSUrRXavAGaajNeqC5mEUH1K67oYl5Wy9RNIzKjwLAM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6vrp4wWDtHEgHWR99I70WVDzevg1Fk/Pw5U8gUDa0OU=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-FindOneAndUpdate.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-FindOneAndUpdate.json deleted file mode 100644 index ac77931d6..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-FindOneAndUpdate.json +++ /dev/null @@ -1,584 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range DoublePrecision. FindOneAndUpdate.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1" - } - } - } - }, - { - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$gt": { - "$numberDouble": "0" - } - } - }, - "update": { - "$set": { - "encryptedDoublePrecision": { - "$numberDouble": "2" - } - } - }, - "returnDocument": "Before" - }, - "result": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDoublePrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "default", - "query": { - "encryptedDoublePrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - }, - "update": { - "$set": { - "encryptedDoublePrecision": { - "$$type": "binData" - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "findAndModify" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "Dri0CXmL78L2DOgk9w0DwxHOMGMzih7m6l59vgy+WWo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "b7d8mRzD1kI1tdc7uNL+YAUonJ6pODLsRLkArfEKSkM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Xg8C1/A0KJaXOw4i+26Rv03/CydaaunOzXh0CIT+gn8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UoKUDw2wJYToUCcFaIs03YQSTksYR0MIOTJllwODqKc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "c/5cwAT0C5jber2xlJnWD3a5tVDy0nRtr5HG02hoFOY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wSUrRXavAGaajNeqC5mEUH1K67oYl5Wy9RNIzKjwLAM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6vrp4wWDtHEgHWR99I70WVDzevg1Fk/Pw5U8gUDa0OU=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedDoublePrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "V6knyt7Zq2CG3++l75UtBx2m32iGAPjHiAe439Bf02w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "F08nMDWDZc+DbWM7XCEJNNCEYyinRmrvGP7EWhmp4is=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cXH4688amcDc8kZOJq4UP8cE3R58Zl7e+Qo/1jyspps=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uURBxvTp3FBCVkd+LPqyuY7d6rMW6SGIJQEPY/wtkZI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jG3hax1L3RBp9t38vUt53FsBxgr/+Si/vVISpAylYpE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kwtIW8MhH9Ky5xNjBx8gFA/SHh2YVphie7g5FGBzals=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FHflwFuEMu4xX0ZApHi+pdlBH+oevAtXckCUb5Wv0xU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0OKSXELxPP85SBVwDGf3LtMEQCJ8TTkFUl/+6jlkdb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "25j9sQXZCihCmHKvTHgaBsAVZFcGPn7JjHdrCGlwyyw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uEw0lpQtBppR3vqV9j9+NQRSBF1BzZukb8c9IhyWvxc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zVhZ7Q59O087ji49oMJvBIgeir2oqvUpnh4p53GcTow=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dowrzKs+qJhRMZyKDbhjXbuX43FbmUKOaw9I8YlOZDw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ep5B6cska6THLIF7Mn3tn3RvV9EiwLSt0eZM/CLRUDc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "URNp/YmmDh5wIZUfAzzgPyJeMNiVx9PMsz52DZRujGY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wlM4IAQhhKQEzoVqS8b1Ddd50GB95OFb9LnzOwyjCP4=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-InsertFind.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-InsertFind.json deleted file mode 100644 index 5dcc09dca..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-InsertFind.json +++ /dev/null @@ -1,571 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range DoublePrecision. Insert and Find.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$gt": { - "$numberDouble": "0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1" - } - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDoublePrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "encryptedDoublePrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "Dri0CXmL78L2DOgk9w0DwxHOMGMzih7m6l59vgy+WWo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "b7d8mRzD1kI1tdc7uNL+YAUonJ6pODLsRLkArfEKSkM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Xg8C1/A0KJaXOw4i+26Rv03/CydaaunOzXh0CIT+gn8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UoKUDw2wJYToUCcFaIs03YQSTksYR0MIOTJllwODqKc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "c/5cwAT0C5jber2xlJnWD3a5tVDy0nRtr5HG02hoFOY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wSUrRXavAGaajNeqC5mEUH1K67oYl5Wy9RNIzKjwLAM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6vrp4wWDtHEgHWR99I70WVDzevg1Fk/Pw5U8gUDa0OU=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedDoublePrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "mVZb+Ra0EYjQ4Zrh9X//E2T8MRj7NMqm5GUJXhRrBEI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FA74j21GUEJb1DJBOpR9nVnjaDZnd8yAQNuaW9Qi26g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kJv//KVkbrobIBf+QeWC5jxn20mx/P0R1N6aCSMgKM8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zB+Whi9IUUGxfLEe+lGuIzLX4LFbIhaIAm5lRk65QTc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ybO1QU3CgvhO8JgRXH+HxKszWcpl5aGDYYVa75fHa1g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X3Y3eSAbbMg//JgiHHiFpYOpV61t8kkDexI+CQyitH4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SlNHXyqVFGDPrX/2ppwog6l4pwj3PKda2TkZbqgfSfA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "McjV8xwTF3xI7863DYOBdyvIv6UpzThl6v9vBRk05bI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "MgwakFvPyBlwqFTbhWUF79URJQWFoJTGotlEVSPPUsQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "DyBERpMSD5lEM5Nhpcn4WGgxgn/mkUVJp+PYSLX5jsE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "I43iazc0xj1WVbYB/V+uTL/tughN1bBlxh1iypBnNsA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wjOBa/ATMuOywFmuPgC0GF/oeLqu0Z7eK5udzkTPbis=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "gRQVwiR+m+0Vg8ZDXqrQQcVnTyobwCXNaA4BCJVXtMc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "WUZ6huwx0ZbLb0R00uiC9FOJzsUocUN8qE5+YRenkvQ=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "7s79aKEuPgQcS/YPOOVcYNZvHIo7FFsWtFCrnDKXefA=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-Update.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-Update.json deleted file mode 100644 index 483e3d52e..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-DoublePrecision-Update.json +++ /dev/null @@ -1,588 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range DoublePrecision. Update.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedDoublePrecision": { - "$numberDouble": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedDoublePrecision": { - "$numberDouble": "1" - } - } - } - }, - { - "name": "updateOne", - "arguments": { - "filter": { - "encryptedDoublePrecision": { - "$gt": { - "$numberDouble": "0" - } - } - }, - "update": { - "$set": { - "encryptedDoublePrecision": { - "$numberDouble": "2" - } - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedDoublePrecision": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command_name": "update", - "command": { - "update": "default", - "ordered": true, - "updates": [ - { - "q": { - "encryptedDoublePrecision": { - "$gt": { - "$binary": { - "base64": "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", - "subType": "06" - } - } - } - }, - "u": { - "$set": { - "encryptedDoublePrecision": { - "$$type": "binData" - } - } - } - } - ], - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedDoublePrecision", - "bsonType": "double", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberDouble": "0.0" - }, - "max": { - "$numberDouble": "200.0" - }, - "precision": { - "$numberInt": "2" - } - } - } - ] - } - } - }, - "$db": "default" - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedDoublePrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "Dri0CXmL78L2DOgk9w0DwxHOMGMzih7m6l59vgy+WWo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "b7d8mRzD1kI1tdc7uNL+YAUonJ6pODLsRLkArfEKSkM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "Xg8C1/A0KJaXOw4i+26Rv03/CydaaunOzXh0CIT+gn8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "UoKUDw2wJYToUCcFaIs03YQSTksYR0MIOTJllwODqKc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "c/5cwAT0C5jber2xlJnWD3a5tVDy0nRtr5HG02hoFOY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wSUrRXavAGaajNeqC5mEUH1K67oYl5Wy9RNIzKjwLAM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6vrp4wWDtHEgHWR99I70WVDzevg1Fk/Pw5U8gUDa0OU=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedDoublePrecision": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "V6knyt7Zq2CG3++l75UtBx2m32iGAPjHiAe439Bf02w=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "F08nMDWDZc+DbWM7XCEJNNCEYyinRmrvGP7EWhmp4is=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cXH4688amcDc8kZOJq4UP8cE3R58Zl7e+Qo/1jyspps=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uURBxvTp3FBCVkd+LPqyuY7d6rMW6SGIJQEPY/wtkZI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jG3hax1L3RBp9t38vUt53FsBxgr/+Si/vVISpAylYpE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kwtIW8MhH9Ky5xNjBx8gFA/SHh2YVphie7g5FGBzals=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FHflwFuEMu4xX0ZApHi+pdlBH+oevAtXckCUb5Wv0xU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "0OKSXELxPP85SBVwDGf3LtMEQCJ8TTkFUl/+6jlkdb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "25j9sQXZCihCmHKvTHgaBsAVZFcGPn7JjHdrCGlwyyw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uEw0lpQtBppR3vqV9j9+NQRSBF1BzZukb8c9IhyWvxc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zVhZ7Q59O087ji49oMJvBIgeir2oqvUpnh4p53GcTow=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "dowrzKs+qJhRMZyKDbhjXbuX43FbmUKOaw9I8YlOZDw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ep5B6cska6THLIF7Mn3tn3RvV9EiwLSt0eZM/CLRUDc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "URNp/YmmDh5wIZUfAzzgPyJeMNiVx9PMsz52DZRujGY=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "wlM4IAQhhKQEzoVqS8b1Ddd50GB95OFb9LnzOwyjCP4=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-Aggregate.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-Aggregate.json deleted file mode 100644 index 6cd837c78..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-Aggregate.json +++ /dev/null @@ -1,484 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Int. Aggregate.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedInt": { - "$gt": { - "$numberInt": "0" - } - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedInt": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedInt": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "default", - "pipeline": [ - { - "$match": { - "encryptedInt": { - "$gt": { - "$binary": { - "base64": "DW0FAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABWQAIAAAAAB99ZW/7KwXKzl5M3XQsAJ3JbEef90IoxFYBArNiYzlgQVzACAAAAAAYO/qaw0+92HAryxOUG7iK6hnIy3OaUA9jIqtHdvcq8YFbAAgAAAAAHrUYj8A0hVgc6VklpDiljOnykrUSfEsjm56XO/bsfKdAAMzAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzQAfQAAAAVkACAAAAAAV22FGF7ZDwK/EYiGNMlm/QuT3saQdyJM/Fn+ZyQug1oFcwAgAAAAACo7GwCvbcs5UHQMgds9/1QMklEVdjZigpuOFGrDmmxtBWwAIAAAAADQbYYPxlCMMGe2MulbiurApFLoeJSMvTeDU3pyEA2jNwADNQB9AAAABWQAIAAAAADFspsMG7yHjKppyllon1KqAsTrHaZ6JzNqnSz8o6iTvwVzACAAAAAAeiA5pqVIQQ9s6UY/P8v5Jjkl3I7iFNeLDYehikrINrsFbAAgAAAAAFjBTzTpNxDEkA0vSRj0jCED9KDRlboMVyilKyDz5YR4AAM2AH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWwAIAAAAAA9/YU9eI3D7QbXKIw/3/gzWJ6MZrCYhG0j1wNKgRQp5wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAAQbW4AAAAAABBteADIAAAAAA==", - "subType": "06" - } - } - } - } - } - ], - "cursor": {}, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "aggregate" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedInt": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedInt": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "25j9sQXZCihCmHKvTHgaBsAVZFcGPn7JjHdrCGlwyyw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FA74j21GUEJb1DJBOpR9nVnjaDZnd8yAQNuaW9Qi26g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kJv//KVkbrobIBf+QeWC5jxn20mx/P0R1N6aCSMgKM8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zB+Whi9IUUGxfLEe+lGuIzLX4LFbIhaIAm5lRk65QTc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ybO1QU3CgvhO8JgRXH+HxKszWcpl5aGDYYVa75fHa1g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X3Y3eSAbbMg//JgiHHiFpYOpV61t8kkDexI+CQyitH4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SlNHXyqVFGDPrX/2ppwog6l4pwj3PKda2TkZbqgfSfA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "McjV8xwTF3xI7863DYOBdyvIv6UpzThl6v9vBRk05bI=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-Correctness.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-Correctness.json deleted file mode 100644 index 9dc4e4e50..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-Correctness.json +++ /dev/null @@ -1,1644 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "Find with $gt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$gt": { - "$numberInt": "0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - ] - } - ] - }, - { - "description": "Find with $gte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$gte": { - "$numberInt": "0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - }, - { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - ] - } - ] - }, - { - "description": "Find with $gt with no results", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$gt": { - "$numberInt": "1" - } - } - } - }, - "result": [] - } - ] - }, - { - "description": "Find with $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$lt": { - "$numberInt": "1" - } - } - } - }, - "result": [ - { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - ] - } - ] - }, - { - "description": "Find with $lte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$lte": { - "$numberInt": "1" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - }, - { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - ] - } - ] - }, - { - "description": "Find with $lt below min", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$lt": { - "$numberInt": "0" - } - } - } - }, - "result": { - "errorContains": "must be greater than the range minimum" - } - } - ] - }, - { - "description": "Find with $gt above max", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$gt": { - "$numberInt": "200" - } - } - } - }, - "result": { - "errorContains": "must be less than the range maximum" - } - } - ] - }, - { - "description": "Find with $gt and $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$gt": { - "$numberInt": "0" - }, - "$lt": { - "$numberInt": "2" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - ] - } - ] - }, - { - "description": "Find with equality", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$numberInt": "0" - } - } - }, - "result": [ - { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - ] - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$numberInt": "1" - } - } - }, - "result": [ - { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - ] - } - ] - }, - { - "description": "Find with full range", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$gte": { - "$numberInt": "0" - }, - "$lte": { - "$numberInt": "200" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - }, - { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - ] - } - ] - }, - { - "description": "Find with $in", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$in": [ - { - "$numberInt": "0" - } - ] - } - } - }, - "result": [ - { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - ] - } - ] - }, - { - "description": "Insert out of range", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "-1" - } - } - }, - "result": { - "errorContains": "value must be greater than or equal to the minimum value" - } - } - ] - }, - { - "description": "Insert min and max", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 200, - "encryptedInt": { - "$numberInt": "200" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - }, - { - "_id": 200, - "encryptedInt": { - "$numberInt": "200" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedInt": { - "$gte": { - "$numberInt": "0" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - }, - { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gt with no results", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedInt": { - "$gt": { - "$numberInt": "1" - } - } - } - } - ] - }, - "result": [] - } - ] - }, - { - "description": "Aggregate with $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedInt": { - "$lt": { - "$numberInt": "1" - } - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $lte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedInt": { - "$lte": { - "$numberInt": "1" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - }, - { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $lt below min", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedInt": { - "$lt": { - "$numberInt": "0" - } - } - } - } - ] - }, - "result": { - "errorContains": "must be greater than the range minimum" - } - } - ] - }, - { - "description": "Aggregate with $gt above max", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedInt": { - "$gt": { - "$numberInt": "200" - } - } - } - } - ] - }, - "result": { - "errorContains": "must be less than the range maximum" - } - } - ] - }, - { - "description": "Aggregate with $gt and $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedInt": { - "$gt": { - "$numberInt": "0" - }, - "$lt": { - "$numberInt": "2" - } - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - ] - } - ] - }, - { - "description": "Aggregate with equality", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedInt": { - "$numberInt": "0" - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - ] - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedInt": { - "$numberInt": "1" - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - ] - } - ] - }, - { - "description": "Aggregate with full range", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedInt": { - "$gte": { - "$numberInt": "0" - }, - "$lte": { - "$numberInt": "200" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - }, - { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $in", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedInt": { - "$in": [ - { - "$numberInt": "0" - } - ] - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - ] - } - ] - }, - { - "description": "Wrong type: Insert Double", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberDouble": "0" - } - } - }, - "result": { - "errorContains": "cannot encrypt element" - } - } - ] - }, - { - "description": "Wrong type: Find Double", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$gte": { - "$numberDouble": "0" - } - } - } - }, - "result": { - "errorContains": "field type is not supported" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-Delete.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-Delete.json deleted file mode 100644 index b251db915..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-Delete.json +++ /dev/null @@ -1,420 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Int. Delete.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "deleteOne", - "arguments": { - "filter": { - "encryptedInt": { - "$gt": { - "$numberInt": "0" - } - } - } - }, - "result": { - "deletedCount": 1 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedInt": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedInt": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "delete": "default", - "deletes": [ - { - "q": { - "encryptedInt": { - "$gt": { - "$binary": { - "base64": "DW0FAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABWQAIAAAAAB99ZW/7KwXKzl5M3XQsAJ3JbEef90IoxFYBArNiYzlgQVzACAAAAAAYO/qaw0+92HAryxOUG7iK6hnIy3OaUA9jIqtHdvcq8YFbAAgAAAAAHrUYj8A0hVgc6VklpDiljOnykrUSfEsjm56XO/bsfKdAAMzAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzQAfQAAAAVkACAAAAAAV22FGF7ZDwK/EYiGNMlm/QuT3saQdyJM/Fn+ZyQug1oFcwAgAAAAACo7GwCvbcs5UHQMgds9/1QMklEVdjZigpuOFGrDmmxtBWwAIAAAAADQbYYPxlCMMGe2MulbiurApFLoeJSMvTeDU3pyEA2jNwADNQB9AAAABWQAIAAAAADFspsMG7yHjKppyllon1KqAsTrHaZ6JzNqnSz8o6iTvwVzACAAAAAAeiA5pqVIQQ9s6UY/P8v5Jjkl3I7iFNeLDYehikrINrsFbAAgAAAAAFjBTzTpNxDEkA0vSRj0jCED9KDRlboMVyilKyDz5YR4AAM2AH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWwAIAAAAAA9/YU9eI3D7QbXKIw/3/gzWJ6MZrCYhG0j1wNKgRQp5wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAAQbW4AAAAAABBteADIAAAAAA==", - "subType": "06" - } - } - } - }, - "limit": 1 - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "delete" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedInt": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-FindOneAndUpdate.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-FindOneAndUpdate.json deleted file mode 100644 index 6e09b5ea2..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-FindOneAndUpdate.json +++ /dev/null @@ -1,488 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Int. FindOneAndUpdate.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "encryptedInt": { - "$gt": { - "$numberInt": "0" - } - } - }, - "update": { - "$set": { - "encryptedInt": { - "$numberInt": "2" - } - } - }, - "returnDocument": "Before" - }, - "result": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedInt": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedInt": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "default", - "query": { - "encryptedInt": { - "$gt": { - "$binary": { - "base64": "DW0FAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABWQAIAAAAAB99ZW/7KwXKzl5M3XQsAJ3JbEef90IoxFYBArNiYzlgQVzACAAAAAAYO/qaw0+92HAryxOUG7iK6hnIy3OaUA9jIqtHdvcq8YFbAAgAAAAAHrUYj8A0hVgc6VklpDiljOnykrUSfEsjm56XO/bsfKdAAMzAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzQAfQAAAAVkACAAAAAAV22FGF7ZDwK/EYiGNMlm/QuT3saQdyJM/Fn+ZyQug1oFcwAgAAAAACo7GwCvbcs5UHQMgds9/1QMklEVdjZigpuOFGrDmmxtBWwAIAAAAADQbYYPxlCMMGe2MulbiurApFLoeJSMvTeDU3pyEA2jNwADNQB9AAAABWQAIAAAAADFspsMG7yHjKppyllon1KqAsTrHaZ6JzNqnSz8o6iTvwVzACAAAAAAeiA5pqVIQQ9s6UY/P8v5Jjkl3I7iFNeLDYehikrINrsFbAAgAAAAAFjBTzTpNxDEkA0vSRj0jCED9KDRlboMVyilKyDz5YR4AAM2AH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWwAIAAAAAA9/YU9eI3D7QbXKIw/3/gzWJ6MZrCYhG0j1wNKgRQp5wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAAQbW4AAAAAABBteADIAAAAAA==", - "subType": "06" - } - } - } - }, - "update": { - "$set": { - "encryptedInt": { - "$$type": "binData" - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "findAndModify" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedInt": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedInt": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "hyDcE6QQjPrYJaIS/n7evEZFYcm31Tj89CpEYGF45cI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "F08nMDWDZc+DbWM7XCEJNNCEYyinRmrvGP7EWhmp4is=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cXH4688amcDc8kZOJq4UP8cE3R58Zl7e+Qo/1jyspps=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uURBxvTp3FBCVkd+LPqyuY7d6rMW6SGIJQEPY/wtkZI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jG3hax1L3RBp9t38vUt53FsBxgr/+Si/vVISpAylYpE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kwtIW8MhH9Ky5xNjBx8gFA/SHh2YVphie7g5FGBzals=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FHflwFuEMu4xX0ZApHi+pdlBH+oevAtXckCUb5Wv0xU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ty4cnzJdAlbQKnh7px3GEYjBnvO+jIOaKjoTRDtmh3M=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-InsertFind.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-InsertFind.json deleted file mode 100644 index cbab7e769..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-InsertFind.json +++ /dev/null @@ -1,475 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Int. Insert and Find.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$gt": { - "$numberInt": "0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedInt": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedInt": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "encryptedInt": { - "$gt": { - "$binary": { - "base64": "DW0FAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABWQAIAAAAAB99ZW/7KwXKzl5M3XQsAJ3JbEef90IoxFYBArNiYzlgQVzACAAAAAAYO/qaw0+92HAryxOUG7iK6hnIy3OaUA9jIqtHdvcq8YFbAAgAAAAAHrUYj8A0hVgc6VklpDiljOnykrUSfEsjm56XO/bsfKdAAMzAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzQAfQAAAAVkACAAAAAAV22FGF7ZDwK/EYiGNMlm/QuT3saQdyJM/Fn+ZyQug1oFcwAgAAAAACo7GwCvbcs5UHQMgds9/1QMklEVdjZigpuOFGrDmmxtBWwAIAAAAADQbYYPxlCMMGe2MulbiurApFLoeJSMvTeDU3pyEA2jNwADNQB9AAAABWQAIAAAAADFspsMG7yHjKppyllon1KqAsTrHaZ6JzNqnSz8o6iTvwVzACAAAAAAeiA5pqVIQQ9s6UY/P8v5Jjkl3I7iFNeLDYehikrINrsFbAAgAAAAAFjBTzTpNxDEkA0vSRj0jCED9KDRlboMVyilKyDz5YR4AAM2AH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWwAIAAAAAA9/YU9eI3D7QbXKIw/3/gzWJ6MZrCYhG0j1wNKgRQp5wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAAQbW4AAAAAABBteADIAAAAAA==", - "subType": "06" - } - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedInt": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedInt": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "25j9sQXZCihCmHKvTHgaBsAVZFcGPn7JjHdrCGlwyyw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FA74j21GUEJb1DJBOpR9nVnjaDZnd8yAQNuaW9Qi26g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kJv//KVkbrobIBf+QeWC5jxn20mx/P0R1N6aCSMgKM8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zB+Whi9IUUGxfLEe+lGuIzLX4LFbIhaIAm5lRk65QTc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ybO1QU3CgvhO8JgRXH+HxKszWcpl5aGDYYVa75fHa1g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X3Y3eSAbbMg//JgiHHiFpYOpV61t8kkDexI+CQyitH4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SlNHXyqVFGDPrX/2ppwog6l4pwj3PKda2TkZbqgfSfA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "McjV8xwTF3xI7863DYOBdyvIv6UpzThl6v9vBRk05bI=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-Update.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-Update.json deleted file mode 100644 index cb6b22394..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Int-Update.json +++ /dev/null @@ -1,492 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Int. Update.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedInt": { - "$numberInt": "1" - } - } - } - }, - { - "name": "updateOne", - "arguments": { - "filter": { - "encryptedInt": { - "$gt": { - "$numberInt": "0" - } - } - }, - "update": { - "$set": { - "encryptedInt": { - "$numberInt": "2" - } - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedInt": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedInt": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command_name": "update", - "command": { - "update": "default", - "ordered": true, - "updates": [ - { - "q": { - "encryptedInt": { - "$gt": { - "$binary": { - "base64": "DW0FAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABWQAIAAAAAB99ZW/7KwXKzl5M3XQsAJ3JbEef90IoxFYBArNiYzlgQVzACAAAAAAYO/qaw0+92HAryxOUG7iK6hnIy3OaUA9jIqtHdvcq8YFbAAgAAAAAHrUYj8A0hVgc6VklpDiljOnykrUSfEsjm56XO/bsfKdAAMzAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzQAfQAAAAVkACAAAAAAV22FGF7ZDwK/EYiGNMlm/QuT3saQdyJM/Fn+ZyQug1oFcwAgAAAAACo7GwCvbcs5UHQMgds9/1QMklEVdjZigpuOFGrDmmxtBWwAIAAAAADQbYYPxlCMMGe2MulbiurApFLoeJSMvTeDU3pyEA2jNwADNQB9AAAABWQAIAAAAADFspsMG7yHjKppyllon1KqAsTrHaZ6JzNqnSz8o6iTvwVzACAAAAAAeiA5pqVIQQ9s6UY/P8v5Jjkl3I7iFNeLDYehikrINrsFbAAgAAAAAFjBTzTpNxDEkA0vSRj0jCED9KDRlboMVyilKyDz5YR4AAM2AH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWwAIAAAAAA9/YU9eI3D7QbXKIw/3/gzWJ6MZrCYhG0j1wNKgRQp5wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAAQbW4AAAAAABBteADIAAAAAA==", - "subType": "06" - } - } - } - }, - "u": { - "$set": { - "encryptedInt": { - "$$type": "binData" - } - } - } - } - ], - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - } - } - }, - "$db": "default" - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedInt": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedInt": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "hyDcE6QQjPrYJaIS/n7evEZFYcm31Tj89CpEYGF45cI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "F08nMDWDZc+DbWM7XCEJNNCEYyinRmrvGP7EWhmp4is=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cXH4688amcDc8kZOJq4UP8cE3R58Zl7e+Qo/1jyspps=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uURBxvTp3FBCVkd+LPqyuY7d6rMW6SGIJQEPY/wtkZI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jG3hax1L3RBp9t38vUt53FsBxgr/+Si/vVISpAylYpE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kwtIW8MhH9Ky5xNjBx8gFA/SHh2YVphie7g5FGBzals=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FHflwFuEMu4xX0ZApHi+pdlBH+oevAtXckCUb5Wv0xU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ty4cnzJdAlbQKnh7px3GEYjBnvO+jIOaKjoTRDtmh3M=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-Aggregate.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-Aggregate.json deleted file mode 100644 index 5c4bf1010..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-Aggregate.json +++ /dev/null @@ -1,484 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Long. Aggregate.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedLong": { - "$gt": { - "$numberLong": "0" - } - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedLong": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedLong": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "aggregate": "default", - "pipeline": [ - { - "$match": { - "encryptedLong": { - "$gt": { - "$binary": { - "base64": "DXUFAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABWQAIAAAAAB99ZW/7KwXKzl5M3XQsAJ3JbEef90IoxFYBArNiYzlgQVzACAAAAAAYO/qaw0+92HAryxOUG7iK6hnIy3OaUA9jIqtHdvcq8YFbAAgAAAAAHrUYj8A0hVgc6VklpDiljOnykrUSfEsjm56XO/bsfKdAAMzAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzQAfQAAAAVkACAAAAAAV22FGF7ZDwK/EYiGNMlm/QuT3saQdyJM/Fn+ZyQug1oFcwAgAAAAACo7GwCvbcs5UHQMgds9/1QMklEVdjZigpuOFGrDmmxtBWwAIAAAAADQbYYPxlCMMGe2MulbiurApFLoeJSMvTeDU3pyEA2jNwADNQB9AAAABWQAIAAAAADFspsMG7yHjKppyllon1KqAsTrHaZ6JzNqnSz8o6iTvwVzACAAAAAAeiA5pqVIQQ9s6UY/P8v5Jjkl3I7iFNeLDYehikrINrsFbAAgAAAAAFjBTzTpNxDEkA0vSRj0jCED9KDRlboMVyilKyDz5YR4AAM2AH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWwAIAAAAAA9/YU9eI3D7QbXKIw/3/gzWJ6MZrCYhG0j1wNKgRQp5wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAASbW4AAAAAAAAAAAASbXgAyAAAAAAAAAAA", - "subType": "06" - } - } - } - } - } - ], - "cursor": {}, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - } - } - } - }, - "command_name": "aggregate" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedLong": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedLong": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "25j9sQXZCihCmHKvTHgaBsAVZFcGPn7JjHdrCGlwyyw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FA74j21GUEJb1DJBOpR9nVnjaDZnd8yAQNuaW9Qi26g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kJv//KVkbrobIBf+QeWC5jxn20mx/P0R1N6aCSMgKM8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zB+Whi9IUUGxfLEe+lGuIzLX4LFbIhaIAm5lRk65QTc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ybO1QU3CgvhO8JgRXH+HxKszWcpl5aGDYYVa75fHa1g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X3Y3eSAbbMg//JgiHHiFpYOpV61t8kkDexI+CQyitH4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SlNHXyqVFGDPrX/2ppwog6l4pwj3PKda2TkZbqgfSfA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "McjV8xwTF3xI7863DYOBdyvIv6UpzThl6v9vBRk05bI=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-Correctness.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-Correctness.json deleted file mode 100644 index d81e0933f..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-Correctness.json +++ /dev/null @@ -1,1644 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "Find with $gt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedLong": { - "$gt": { - "$numberLong": "0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - ] - } - ] - }, - { - "description": "Find with $gte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedLong": { - "$gte": { - "$numberLong": "0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - }, - { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - ] - } - ] - }, - { - "description": "Find with $gt with no results", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedLong": { - "$gt": { - "$numberLong": "1" - } - } - } - }, - "result": [] - } - ] - }, - { - "description": "Find with $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedLong": { - "$lt": { - "$numberLong": "1" - } - } - } - }, - "result": [ - { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - ] - } - ] - }, - { - "description": "Find with $lte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedLong": { - "$lte": { - "$numberLong": "1" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - }, - { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - ] - } - ] - }, - { - "description": "Find with $lt below min", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedLong": { - "$lt": { - "$numberLong": "0" - } - } - } - }, - "result": { - "errorContains": "must be greater than the range minimum" - } - } - ] - }, - { - "description": "Find with $gt above max", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedLong": { - "$gt": { - "$numberLong": "200" - } - } - } - }, - "result": { - "errorContains": "must be less than the range maximum" - } - } - ] - }, - { - "description": "Find with $gt and $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedLong": { - "$gt": { - "$numberLong": "0" - }, - "$lt": { - "$numberLong": "2" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - ] - } - ] - }, - { - "description": "Find with equality", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedLong": { - "$numberLong": "0" - } - } - }, - "result": [ - { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - ] - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedLong": { - "$numberLong": "1" - } - } - }, - "result": [ - { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - ] - } - ] - }, - { - "description": "Find with full range", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedLong": { - "$gte": { - "$numberLong": "0" - }, - "$lte": { - "$numberLong": "200" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - }, - { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - ] - } - ] - }, - { - "description": "Find with $in", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedLong": { - "$in": [ - { - "$numberLong": "0" - } - ] - } - } - }, - "result": [ - { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - ] - } - ] - }, - { - "description": "Insert out of range", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "-1" - } - } - }, - "result": { - "errorContains": "value must be greater than or equal to the minimum value" - } - } - ] - }, - { - "description": "Insert min and max", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 200, - "encryptedLong": { - "$numberLong": "200" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - } - }, - "result": [ - { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - }, - { - "_id": 200, - "encryptedLong": { - "$numberLong": "200" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedLong": { - "$gte": { - "$numberLong": "0" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - }, - { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $gt with no results", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedLong": { - "$gt": { - "$numberLong": "1" - } - } - } - } - ] - }, - "result": [] - } - ] - }, - { - "description": "Aggregate with $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedLong": { - "$lt": { - "$numberLong": "1" - } - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $lte", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedLong": { - "$lte": { - "$numberLong": "1" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - }, - { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $lt below min", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedLong": { - "$lt": { - "$numberLong": "0" - } - } - } - } - ] - }, - "result": { - "errorContains": "must be greater than the range minimum" - } - } - ] - }, - { - "description": "Aggregate with $gt above max", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedLong": { - "$gt": { - "$numberLong": "200" - } - } - } - } - ] - }, - "result": { - "errorContains": "must be less than the range maximum" - } - } - ] - }, - { - "description": "Aggregate with $gt and $lt", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedLong": { - "$gt": { - "$numberLong": "0" - }, - "$lt": { - "$numberLong": "2" - } - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - ] - } - ] - }, - { - "description": "Aggregate with equality", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedLong": { - "$numberLong": "0" - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - ] - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedLong": { - "$numberLong": "1" - } - } - } - ] - }, - "result": [ - { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - ] - } - ] - }, - { - "description": "Aggregate with full range", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedLong": { - "$gte": { - "$numberLong": "0" - }, - "$lte": { - "$numberLong": "200" - } - } - } - }, - { - "$sort": { - "_id": 1 - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - }, - { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $in", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "encryptedLong": { - "$in": [ - { - "$numberLong": "0" - } - ] - } - } - } - ] - }, - "result": [ - { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - ] - } - ] - }, - { - "description": "Wrong type: Insert Double", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberDouble": "0" - } - } - }, - "result": { - "errorContains": "cannot encrypt element" - } - } - ] - }, - { - "description": "Wrong type: Find Double", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "encryptedLong": { - "$gte": { - "$numberDouble": "0" - } - } - } - }, - "result": { - "errorContains": "field type is not supported" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-Delete.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-Delete.json deleted file mode 100644 index faf0c401b..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-Delete.json +++ /dev/null @@ -1,420 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Long. Delete.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "deleteOne", - "arguments": { - "filter": { - "encryptedLong": { - "$gt": { - "$numberLong": "0" - } - } - } - }, - "result": { - "deletedCount": 1 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedLong": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedLong": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "delete": "default", - "deletes": [ - { - "q": { - "encryptedLong": { - "$gt": { - "$binary": { - "base64": "DXUFAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABWQAIAAAAAB99ZW/7KwXKzl5M3XQsAJ3JbEef90IoxFYBArNiYzlgQVzACAAAAAAYO/qaw0+92HAryxOUG7iK6hnIy3OaUA9jIqtHdvcq8YFbAAgAAAAAHrUYj8A0hVgc6VklpDiljOnykrUSfEsjm56XO/bsfKdAAMzAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzQAfQAAAAVkACAAAAAAV22FGF7ZDwK/EYiGNMlm/QuT3saQdyJM/Fn+ZyQug1oFcwAgAAAAACo7GwCvbcs5UHQMgds9/1QMklEVdjZigpuOFGrDmmxtBWwAIAAAAADQbYYPxlCMMGe2MulbiurApFLoeJSMvTeDU3pyEA2jNwADNQB9AAAABWQAIAAAAADFspsMG7yHjKppyllon1KqAsTrHaZ6JzNqnSz8o6iTvwVzACAAAAAAeiA5pqVIQQ9s6UY/P8v5Jjkl3I7iFNeLDYehikrINrsFbAAgAAAAAFjBTzTpNxDEkA0vSRj0jCED9KDRlboMVyilKyDz5YR4AAM2AH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWwAIAAAAAA9/YU9eI3D7QbXKIw/3/gzWJ6MZrCYhG0j1wNKgRQp5wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAASbW4AAAAAAAAAAAASbXgAyAAAAAAAAAAA", - "subType": "06" - } - } - } - }, - "limit": 1 - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - } - } - } - }, - "command_name": "delete" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedLong": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-FindOneAndUpdate.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-FindOneAndUpdate.json deleted file mode 100644 index b233b40b5..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-FindOneAndUpdate.json +++ /dev/null @@ -1,488 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Long. FindOneAndUpdate.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "encryptedLong": { - "$gt": { - "$numberLong": "0" - } - } - }, - "update": { - "$set": { - "encryptedLong": { - "$numberLong": "2" - } - } - }, - "returnDocument": "Before" - }, - "result": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedLong": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedLong": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "findAndModify": "default", - "query": { - "encryptedLong": { - "$gt": { - "$binary": { - "base64": "DXUFAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABWQAIAAAAAB99ZW/7KwXKzl5M3XQsAJ3JbEef90IoxFYBArNiYzlgQVzACAAAAAAYO/qaw0+92HAryxOUG7iK6hnIy3OaUA9jIqtHdvcq8YFbAAgAAAAAHrUYj8A0hVgc6VklpDiljOnykrUSfEsjm56XO/bsfKdAAMzAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzQAfQAAAAVkACAAAAAAV22FGF7ZDwK/EYiGNMlm/QuT3saQdyJM/Fn+ZyQug1oFcwAgAAAAACo7GwCvbcs5UHQMgds9/1QMklEVdjZigpuOFGrDmmxtBWwAIAAAAADQbYYPxlCMMGe2MulbiurApFLoeJSMvTeDU3pyEA2jNwADNQB9AAAABWQAIAAAAADFspsMG7yHjKppyllon1KqAsTrHaZ6JzNqnSz8o6iTvwVzACAAAAAAeiA5pqVIQQ9s6UY/P8v5Jjkl3I7iFNeLDYehikrINrsFbAAgAAAAAFjBTzTpNxDEkA0vSRj0jCED9KDRlboMVyilKyDz5YR4AAM2AH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWwAIAAAAAA9/YU9eI3D7QbXKIw/3/gzWJ6MZrCYhG0j1wNKgRQp5wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAASbW4AAAAAAAAAAAASbXgAyAAAAAAAAAAA", - "subType": "06" - } - } - } - }, - "update": { - "$set": { - "encryptedLong": { - "$$type": "binData" - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - } - } - } - }, - "command_name": "findAndModify" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedLong": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedLong": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "hyDcE6QQjPrYJaIS/n7evEZFYcm31Tj89CpEYGF45cI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "F08nMDWDZc+DbWM7XCEJNNCEYyinRmrvGP7EWhmp4is=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cXH4688amcDc8kZOJq4UP8cE3R58Zl7e+Qo/1jyspps=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uURBxvTp3FBCVkd+LPqyuY7d6rMW6SGIJQEPY/wtkZI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jG3hax1L3RBp9t38vUt53FsBxgr/+Si/vVISpAylYpE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kwtIW8MhH9Ky5xNjBx8gFA/SHh2YVphie7g5FGBzals=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FHflwFuEMu4xX0ZApHi+pdlBH+oevAtXckCUb5Wv0xU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ty4cnzJdAlbQKnh7px3GEYjBnvO+jIOaKjoTRDtmh3M=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-InsertFind.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-InsertFind.json deleted file mode 100644 index 1b787d4cb..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-InsertFind.json +++ /dev/null @@ -1,475 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Long. Insert and Find.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedLong": { - "$gt": { - "$numberLong": "0" - } - } - } - }, - "result": [ - { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedLong": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedLong": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "encryptedLong": { - "$gt": { - "$binary": { - "base64": "DXUFAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABWQAIAAAAAB99ZW/7KwXKzl5M3XQsAJ3JbEef90IoxFYBArNiYzlgQVzACAAAAAAYO/qaw0+92HAryxOUG7iK6hnIy3OaUA9jIqtHdvcq8YFbAAgAAAAAHrUYj8A0hVgc6VklpDiljOnykrUSfEsjm56XO/bsfKdAAMzAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzQAfQAAAAVkACAAAAAAV22FGF7ZDwK/EYiGNMlm/QuT3saQdyJM/Fn+ZyQug1oFcwAgAAAAACo7GwCvbcs5UHQMgds9/1QMklEVdjZigpuOFGrDmmxtBWwAIAAAAADQbYYPxlCMMGe2MulbiurApFLoeJSMvTeDU3pyEA2jNwADNQB9AAAABWQAIAAAAADFspsMG7yHjKppyllon1KqAsTrHaZ6JzNqnSz8o6iTvwVzACAAAAAAeiA5pqVIQQ9s6UY/P8v5Jjkl3I7iFNeLDYehikrINrsFbAAgAAAAAFjBTzTpNxDEkA0vSRj0jCED9KDRlboMVyilKyDz5YR4AAM2AH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWwAIAAAAAA9/YU9eI3D7QbXKIw/3/gzWJ6MZrCYhG0j1wNKgRQp5wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAASbW4AAAAAAAAAAAASbXgAyAAAAAAAAAAA", - "subType": "06" - } - } - } - }, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - } - } - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedLong": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedLong": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "25j9sQXZCihCmHKvTHgaBsAVZFcGPn7JjHdrCGlwyyw=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FA74j21GUEJb1DJBOpR9nVnjaDZnd8yAQNuaW9Qi26g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kJv//KVkbrobIBf+QeWC5jxn20mx/P0R1N6aCSMgKM8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "zB+Whi9IUUGxfLEe+lGuIzLX4LFbIhaIAm5lRk65QTc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ybO1QU3CgvhO8JgRXH+HxKszWcpl5aGDYYVa75fHa1g=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "X3Y3eSAbbMg//JgiHHiFpYOpV61t8kkDexI+CQyitH4=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "SlNHXyqVFGDPrX/2ppwog6l4pwj3PKda2TkZbqgfSfA=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "McjV8xwTF3xI7863DYOBdyvIv6UpzThl6v9vBRk05bI=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-Update.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-Update.json deleted file mode 100644 index 07182bb5e..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-Long-Update.json +++ /dev/null @@ -1,492 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "FLE2 Range Long. Update.", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedLong": { - "$numberLong": "0" - } - } - } - }, - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedLong": { - "$numberLong": "1" - } - } - } - }, - { - "name": "updateOne", - "arguments": { - "filter": { - "encryptedLong": { - "$gt": { - "$numberLong": "0" - } - } - }, - "update": { - "$set": { - "encryptedLong": { - "$numberLong": "2" - } - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 0, - "encryptedLong": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedLong": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command_name": "update", - "command": { - "update": "default", - "ordered": true, - "updates": [ - { - "q": { - "encryptedLong": { - "$gt": { - "$binary": { - "base64": "DXUFAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABWQAIAAAAAB99ZW/7KwXKzl5M3XQsAJ3JbEef90IoxFYBArNiYzlgQVzACAAAAAAYO/qaw0+92HAryxOUG7iK6hnIy3OaUA9jIqtHdvcq8YFbAAgAAAAAHrUYj8A0hVgc6VklpDiljOnykrUSfEsjm56XO/bsfKdAAMzAH0AAAAFZAAgAAAAAOK8brUuc2onBNDRtfYMR736dHj4dQqXod8JG7tAMTsDBXMAIAAAAAAW6SrGAL6Bx0s7ZlsYULFfOAiYIGhEWu6md3r+Rk40awVsACAAAAAAIHYXP8RLcCboUmHN3+OlnEw1DxaLSnbTB9PdF228fFAAAzQAfQAAAAVkACAAAAAAV22FGF7ZDwK/EYiGNMlm/QuT3saQdyJM/Fn+ZyQug1oFcwAgAAAAACo7GwCvbcs5UHQMgds9/1QMklEVdjZigpuOFGrDmmxtBWwAIAAAAADQbYYPxlCMMGe2MulbiurApFLoeJSMvTeDU3pyEA2jNwADNQB9AAAABWQAIAAAAADFspsMG7yHjKppyllon1KqAsTrHaZ6JzNqnSz8o6iTvwVzACAAAAAAeiA5pqVIQQ9s6UY/P8v5Jjkl3I7iFNeLDYehikrINrsFbAAgAAAAAFjBTzTpNxDEkA0vSRj0jCED9KDRlboMVyilKyDz5YR4AAM2AH0AAAAFZAAgAAAAAPcLmtq+V1e+MRlZ7NHq1+mrRVBQje5zj685ZvdsfKvSBXMAIAAAAABdHz/3w2k5km97QN9m7oLFYJaVJneNlMboIlz5yUASQAVsACAAAAAAWbp8JVJnx8fEVAJFa7WMfMa7wXeP5M3C8MX20J/i9n0AAzcAfQAAAAVkACAAAAAAYfLwnoxK6XAGQrJFy8+TIJoq38ldBaO75h4zA4ZX5tQFcwAgAAAAAC2wk8UcJH5X5XGnDBYmel6srpBkzBhHtt3Jw1u5TSJ1BWwAIAAAAAA9/YU9eI3D7QbXKIw/3/gzWJ6MZrCYhG0j1wNKgRQp5wADOAB9AAAABWQAIAAAAADGvyrtKkIcaV17ynZA7b2k5Pz6OhvxdWNkDvDWJIja8wVzACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAASbW4AAAAAAAAAAAASbXgAyAAAAAAAAAAA", - "subType": "06" - } - } - } - }, - "u": { - "$set": { - "encryptedLong": { - "$$type": "binData" - } - } - } - } - ], - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedLong", - "bsonType": "long", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberInt": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberLong": "0" - }, - "max": { - "$numberLong": "200" - } - } - } - ] - } - } - }, - "$db": "default" - } - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 0, - "encryptedLong": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=", - "subType": "00" - } - } - ] - }, - { - "_id": 1, - "encryptedLong": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "hyDcE6QQjPrYJaIS/n7evEZFYcm31Tj89CpEYGF45cI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "F08nMDWDZc+DbWM7XCEJNNCEYyinRmrvGP7EWhmp4is=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "cXH4688amcDc8kZOJq4UP8cE3R58Zl7e+Qo/1jyspps=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "uURBxvTp3FBCVkd+LPqyuY7d6rMW6SGIJQEPY/wtkZI=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "jG3hax1L3RBp9t38vUt53FsBxgr/+Si/vVISpAylYpE=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "kwtIW8MhH9Ky5xNjBx8gFA/SHh2YVphie7g5FGBzals=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "FHflwFuEMu4xX0ZApHi+pdlBH+oevAtXckCUb5Wv0xU=", - "subType": "00" - } - }, - { - "$binary": { - "base64": "ty4cnzJdAlbQKnh7px3GEYjBnvO+jIOaKjoTRDtmh3M=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-WrongType.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-WrongType.json deleted file mode 100644 index 621560450..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Rangev2-WrongType.json +++ /dev/null @@ -1,163 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "8.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ], - "maxServerVersion": "8.99.99" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedInt", - "bsonType": "int", - "queries": { - "queryType": "range", - "contention": { - "$numberLong": "0" - }, - "trimFactor": { - "$numberLong": "1" - }, - "sparsity": { - "$numberLong": "1" - }, - "min": { - "$numberInt": "0" - }, - "max": { - "$numberInt": "200" - } - } - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "Wrong type: Insert Double", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberDouble": "0" - } - } - }, - "result": { - "errorContains": "cannot encrypt element" - } - } - ] - }, - { - "description": "Wrong type: Find Double", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 0, - "encryptedInt": { - "$numberInt": "0" - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "encryptedInt": { - "$gte": { - "$numberDouble": "0" - } - } - }, - "sort": { - "_id": 1 - } - }, - "result": { - "errorContains": "field type is not supported" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-Update.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-Update.json deleted file mode 100644 index cb260edc0..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-Update.json +++ /dev/null @@ -1,570 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "encrypted_fields": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1648914851981" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "Update can query an FLE2 indexed field", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedIndexed": "value123" - } - } - }, - { - "name": "updateOne", - "arguments": { - "filter": { - "encryptedIndexed": "value123" - }, - "update": { - "$set": { - "foo": "bar" - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedIndexed": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "update": "default", - "updates": [ - { - "q": { - "encryptedIndexed": { - "$eq": { - "$binary": { - "base64": "DIkAAAAFZAAgAAAAAPtVteJQAlgb2YMa/+7YWH00sbQPyt7L6Rb8OwBdMmL2BXMAIAAAAAAd44hgVKnEnTFlwNVC14oyc9OZOTspeymusqkRQj57nAVsACAAAAAAaZ9s3G+4znfxStxeOZwcZy1OhzjMGc5hjmdMN+b/w6kSY20AAAAAAAAAAAAA", - "subType": "06" - } - } - } - }, - "u": { - "$set": { - "foo": "bar" - } - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "command_name": "update" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encryptedIndexed": { - "$$type": "binData" - }, - "foo": "bar", - "__safeContent__": [ - { - "$binary": { - "base64": "ThpoKfQ8AkOzkFfNC1+9PF0pY2nIzfXvRdxQgjkNbBw=", - "subType": "00" - } - } - ] - } - ] - } - } - }, - { - "description": "Update can modify an FLE2 indexed field", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encryptedIndexed": "value123" - } - } - }, - { - "name": "updateOne", - "arguments": { - "filter": { - "encryptedIndexed": "value123" - }, - "update": { - "$set": { - "encryptedIndexed": "value456" - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": [ - { - "encryptedIndexed": "value456" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encryptedIndexed": { - "$$type": "binData" - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "update": "default", - "updates": [ - { - "q": { - "encryptedIndexed": { - "$eq": { - "$binary": { - "base64": "DIkAAAAFZAAgAAAAAPtVteJQAlgb2YMa/+7YWH00sbQPyt7L6Rb8OwBdMmL2BXMAIAAAAAAd44hgVKnEnTFlwNVC14oyc9OZOTspeymusqkRQj57nAVsACAAAAAAaZ9s3G+4znfxStxeOZwcZy1OhzjMGc5hjmdMN+b/w6kSY20AAAAAAAAAAAAA", - "subType": "06" - } - } - } - }, - "u": { - "$set": { - "encryptedIndexed": { - "$$type": "binData" - } - } - } - } - ], - "ordered": true, - "encryptionInformation": { - "type": 1, - "schema": { - "default.default": { - "escCollection": "enxcol_.default.esc", - "ecocCollection": "enxcol_.default.ecoc", - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "command_name": "update" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": { - "$eq": 1 - } - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encryptedIndexed": { - "$$type": "binData" - }, - "__safeContent__": [ - { - "$binary": { - "base64": "rhe7/w8Ob8Unl44rGr/moScx6m5VODQnscDhF4Nkn6g=", - "subType": "00" - } - } - ] - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/fle2v2-validatorAndPartialFieldExpression.json b/tests/SpecTests/client-side-encryption/tests/fle2v2-validatorAndPartialFieldExpression.json deleted file mode 100644 index 901c4dd84..000000000 --- a/tests/SpecTests/client-side-encryption/tests/fle2v2-validatorAndPartialFieldExpression.json +++ /dev/null @@ -1,503 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "7.0.0", - "topology": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "tests": [ - { - "description": "create with a validator on an unencrypted field is OK", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - }, - "encryptedFieldsMap": { - "default.encryptedCollection": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection", - "validator": { - "unencrypted_string": "foo" - } - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection" - } - } - ] - }, - { - "description": "create with a validator on an encrypted field is an error", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - }, - "encryptedFieldsMap": { - "default.encryptedCollection": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection", - "validator": { - "encryptedIndexed": "foo" - } - }, - "result": { - "errorContains": "Comparison to encrypted fields not supported" - } - } - ] - }, - { - "description": "collMod with a validator on an unencrypted field is OK", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - }, - "encryptedFieldsMap": { - "default.encryptedCollection": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "command": { - "collMod": "encryptedCollection", - "validator": { - "unencrypted_string": "foo" - } - } - } - } - ] - }, - { - "description": "collMod with a validator on an encrypted field is an error", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - }, - "encryptedFieldsMap": { - "default.encryptedCollection": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "command": { - "collMod": "encryptedCollection", - "validator": { - "encryptedIndexed": "foo" - } - } - }, - "result": { - "errorContains": "Comparison to encrypted fields not supported" - } - } - ] - }, - { - "description": "createIndexes with a partialFilterExpression on an unencrypted field is OK", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - }, - "encryptedFieldsMap": { - "default.encryptedCollection": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "command": { - "createIndexes": "encryptedCollection", - "indexes": [ - { - "name": "name", - "key": { - "name": 1 - }, - "partialFilterExpression": { - "unencrypted_string": "foo" - } - } - ] - } - } - }, - { - "name": "assertIndexExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection", - "index": "name" - } - } - ] - }, - { - "description": "createIndexes with a partialFilterExpression on an encrypted field is an error", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - }, - "encryptedFieldsMap": { - "default.encryptedCollection": { - "fields": [ - { - "keyId": { - "$binary": { - "base64": "EjRWeBI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedIndexed", - "bsonType": "string", - "queries": { - "queryType": "equality", - "contention": { - "$numberLong": "0" - } - } - }, - { - "keyId": { - "$binary": { - "base64": "q83vqxI0mHYSNBI0VniQEg==", - "subType": "04" - } - }, - "path": "encryptedUnindexed", - "bsonType": "string" - } - ] - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "command": { - "createIndexes": "encryptedCollection", - "indexes": [ - { - "name": "name", - "key": { - "name": 1 - }, - "partialFilterExpression": { - "encryptedIndexed": "foo" - } - } - ] - } - }, - "result": { - "errorContains": "Comparison to encrypted fields not supported" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/gcpKMS.json b/tests/SpecTests/client-side-encryption/tests/gcpKMS.json deleted file mode 100644 index 65f12ec13..000000000 --- a/tests/SpecTests/client-side-encryption/tests/gcpKMS.json +++ /dev/null @@ -1,237 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "json_schema": { - "properties": { - "encrypted_string_aws": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "encrypted_string_azure": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZURE+AAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "encrypted_string_gcp": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCP+AAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "encrypted_string_local": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "encrypted_string_kmip": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "dBHpr8aITfeBQ15grpbLpQ==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "encrypted_string_kmip_delegated": { - "encrypt": { - "keyId": [ - { - "$uuid": "7411e9af-c688-4df7-8143-5e60ae96cba6" - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "GCP+AAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "CiQAIgLj0WyktnB4dfYHo5SLZ41K4ASQrjJUaSzl5vvVH0G12G0SiQEAjlV8XPlbnHDEDFbdTO4QIe8ER2/172U1ouLazG0ysDtFFIlSvWX5ZnZUrRMmp/R2aJkzLXEt/zf8Mn4Lfm+itnjgo5R9K4pmPNvvPKNZX5C16lrPT+aA+rd+zXFSmlMg3i5jnxvTdLHhg3G7Q/Uv1ZIJskKt95bzLoe0tUVzRWMYXLIEcohnQg==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1601574333107" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1601574333107" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "gcp", - "projectId": "devprod-drivers", - "location": "global", - "keyRing": "key-ring-csfle", - "keyName": "key-name-csfle" - }, - "keyAltNames": [ - "altname", - "gcp_altname" - ] - } - ], - "tests": [ - { - "description": "Insert a document with auto encryption using GCP KMS provider", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "gcp": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string_gcp": "string0" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "GCP+AAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault" - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_string_gcp": { - "$binary": { - "base64": "ARgj/gAAAAAAAAAAAAAAAAACwFd+Y5Ojw45GUXNvbcIpN9YkRdoHDHkR4kssdn0tIMKlDQOLFkWFY9X07IRlXsxPD8DcTiKnl6XINK28vhcGlg==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string_gcp": { - "$binary": { - "base64": "ARgj/gAAAAAAAAAAAAAAAAACwFd+Y5Ojw45GUXNvbcIpN9YkRdoHDHkR4kssdn0tIMKlDQOLFkWFY9X07IRlXsxPD8DcTiKnl6XINK28vhcGlg==", - "subType": "06" - } - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/getMore.json b/tests/SpecTests/client-side-encryption/tests/getMore.json deleted file mode 100644 index 94e788ef6..000000000 --- a/tests/SpecTests/client-side-encryption/tests/getMore.json +++ /dev/null @@ -1,266 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - }, - { - "_id": 3, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACQ76HWOut3DZtQuV90hp1aaCpZn95vZIaWmn+wrBehcEtcFwyJlBdlyzDzZTWPZCPgiFq72Wvh6Y7VbpU9NAp3A==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "getMore with encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "batchSize": 2, - "filter": {} - }, - "result": [ - { - "_id": 1, - "encrypted_string": "string0" - }, - { - "_id": 2, - "encrypted_string": "string1" - }, - { - "_id": 3, - "encrypted_string": "string2" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "batchSize": 2 - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "default", - "batchSize": 2 - }, - "command_name": "getMore" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - }, - { - "_id": 3, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACQ76HWOut3DZtQuV90hp1aaCpZn95vZIaWmn+wrBehcEtcFwyJlBdlyzDzZTWPZCPgiFq72Wvh6Y7VbpU9NAp3A==", - "subType": "06" - } - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/insert.json b/tests/SpecTests/client-side-encryption/tests/insert.json deleted file mode 100644 index cf2910fd7..000000000 --- a/tests/SpecTests/client-side-encryption/tests/insert.json +++ /dev/null @@ -1,344 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "insertOne with encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0", - "random": "abc" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - }, - "random": { - "$$type": "binData" - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - }, - "random": { - "$$type": "binData" - } - } - ] - } - } - }, - { - "description": "insertMany with encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 1, - "encrypted_string": "string0", - "random": "abc" - }, - { - "_id": 2, - "encrypted_string": "string1" - } - ] - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - }, - "random": { - "$$type": "binData" - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - }, - "random": { - "$$type": "binData" - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/keyAltName.json b/tests/SpecTests/client-side-encryption/tests/keyAltName.json deleted file mode 100644 index 7f71b9dbe..000000000 --- a/tests/SpecTests/client-side-encryption/tests/keyAltName.json +++ /dev/null @@ -1,228 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "Insert with encryption using key alt name", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_w_altname": "string0", - "altname": "altname" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [] - } - }, - { - "keyAltNames": { - "$in": [ - "altname" - ] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_w_altname": { - "$$type": "binData" - }, - "altname": "altname" - } - ], - "ordered": true - }, - "command_name": "insert" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_w_altname": { - "$$type": "binData" - }, - "altname": "altname" - } - ] - } - } - }, - { - "description": "Replace with key alt name fails", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$set": { - "encrypted_w_altname": "string0" - } - }, - "upsert": true - }, - "result": { - "errorContains": "A non-static (JSONPointer) keyId is not supported" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/kmipKMS.json b/tests/SpecTests/client-side-encryption/tests/kmipKMS.json deleted file mode 100644 index 349328b43..000000000 --- a/tests/SpecTests/client-side-encryption/tests/kmipKMS.json +++ /dev/null @@ -1,362 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "json_schema": { - "properties": { - "encrypted_string_aws": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "encrypted_string_azure": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AZURE+AAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "encrypted_string_gcp": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "GCP+AAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "encrypted_string_local": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "encrypted_string_kmip": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "dBHpr8aITfeBQ15grpbLpQ==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "encrypted_string_kmip_delegated": { - "encrypt": { - "keyId": [ - { - "$uuid": "7411e9af-c688-4df7-8143-5e60ae96cba6" - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "dBHpr8aITfeBQ15grpbLpQ==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "eUYDyB0HuWb+lQgUwO+6qJQyTTDTY2gp9FbemL7ZFo0pvr0x6rm6Ff9OVUTGH6HyMKipaeHdiIJU1dzsLwvqKvi7Beh+U4iaIWX/K0oEg1GOsJc0+Z/in8gNHbGUYLmycHViM3LES3kdt7FdFSUl5rEBHrM71yoNEXImz17QJWMGOuT4x6yoi2pvnaRJwfrI4DjpmnnTrDMac92jgZehbg==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1634220190041" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1634220190041" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "kmip", - "keyId": "1" - }, - "keyAltNames": [ - "altname", - "kmip_altname" - ] - }, - { - "_id": { - "$uuid": "7411e9af-c688-4df7-8143-5e60ae96cba6" - }, - "keyMaterial": { - "$binary": { - "base64": "5TLMFWlguBWe5GUESTvOVtkdBsCrynhnV72XRyZ66/nk+EP9/1oEp1t1sg0+vwCTqULHjBiUE6DRx2mYD/Eup1+u2Jgz9/+1sV1drXeOPALNPkSgiZiDbIb67zRi+wTABEcKcegJH+FhmSGxwUoQAiHCsCbcvia5P8tN1lt98YQ=", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1634220190041" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1634220190041" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "kmip", - "delegated": true, - "keyId": "11" - }, - "keyAltNames": [ - "delegated" - ] - } - ], - "tests": [ - { - "description": "Insert a document with auto encryption using KMIP KMS provider", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "kmip": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string_kmip": "string0" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "dBHpr8aITfeBQ15grpbLpQ==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault" - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_string_kmip": { - "$binary": { - "base64": "AXQR6a/GiE33gUNeYK6Wy6UCKCwtKFIsL8eKObDVxvqGupJNUk7kXswHhB7G5j/C1D+6no+Asra0KgSU43bTL3ooIBLVyIzbV5CDJYqzAsa4WQ==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string_kmip": { - "$binary": { - "base64": "AXQR6a/GiE33gUNeYK6Wy6UCKCwtKFIsL8eKObDVxvqGupJNUk7kXswHhB7G5j/C1D+6no+Asra0KgSU43bTL3ooIBLVyIzbV5CDJYqzAsa4WQ==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "Insert a document with auto encryption using KMIP delegated KMS provider", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "kmip": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string_kmip_delegated": "string0" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$uuid": "7411e9af-c688-4df7-8143-5e60ae96cba6" - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault" - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_string_kmip_delegated": { - "$binary": { - "base64": "AXQR6a/GiE33gUNeYK6Wy6YCkB+8NVfAAjIbvLqyXIg6g1a8tXrym92DPoqmxpcdQyH0vQM3aFNMz7tZwQBimKs29ztZV/LWjM633HhO5ACl9A==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string_kmip_delegated": { - "$binary": { - "base64": "AXQR6a/GiE33gUNeYK6Wy6YCkB+8NVfAAjIbvLqyXIg6g1a8tXrym92DPoqmxpcdQyH0vQM3aFNMz7tZwQBimKs29ztZV/LWjM633HhO5ACl9A==", - "subType": "06" - } - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/localKMS.json b/tests/SpecTests/client-side-encryption/tests/localKMS.json deleted file mode 100644 index 67c4ba130..000000000 --- a/tests/SpecTests/client-side-encryption/tests/localKMS.json +++ /dev/null @@ -1,191 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "json_schema": { - "properties": { - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "Ce9HSz/HKKGkIt4uyy+jDuKGA+rLC2cycykMo6vc8jXxqa1UVDYHWq1r+vZKbnnSRBfB981akzRKZCFpC05CTyFqDhXv6OnMjpG97OZEREGIsHEYiJkBW0jJJvfLLgeLsEpBzsro9FztGGXASxyxFRZFhXvHxyiLOKrdWfs7X1O/iK3pEoHMx6uSNSfUOgbebLfIqW7TO++iQS5g1xovXA==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local" - } - } - ], - "tests": [ - { - "description": "Insert a document with auto encryption using local KMS provider", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {}, - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0", - "random": "abc" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault" - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACV/+zJmpqMU47yxS/xIVAviGi7wHDuFwaULAixEAoIh0xHz73UYOM3D8D44gcJn67EROjbz4ITpYzzlCJovDL0Q==", - "subType": "06" - } - }, - "random": { - "$$type": "binData" - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACV/+zJmpqMU47yxS/xIVAviGi7wHDuFwaULAixEAoIh0xHz73UYOM3D8D44gcJn67EROjbz4ITpYzzlCJovDL0Q==", - "subType": "06" - } - }, - "random": { - "$$type": "binData" - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/localSchema.json b/tests/SpecTests/client-side-encryption/tests/localSchema.json deleted file mode 100644 index 4698520f6..000000000 --- a/tests/SpecTests/client-side-encryption/tests/localSchema.json +++ /dev/null @@ -1,258 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "json_schema": {}, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "A local schema should override", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0" - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": [ - { - "_id": 1, - "encrypted_string": "string0" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": 1 - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "A local schema with no encryption is an error", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "test": { - "bsonType": "string" - } - }, - "bsonType": "object", - "required": [ - "test" - ] - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0" - } - }, - "result": { - "errorContains": "JSON schema keyword 'required' is only allowed with a remote schema" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/malformedCiphertext.json b/tests/SpecTests/client-side-encryption/tests/malformedCiphertext.json deleted file mode 100644 index c81330ce8..000000000 --- a/tests/SpecTests/client-side-encryption/tests/malformedCiphertext.json +++ /dev/null @@ -1,321 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "00" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQ==", - "subType": "06" - } - } - }, - { - "_id": 3, - "encrypted_string": { - "$binary": { - "base64": "AQAAa2V2aW4gYWxiZXJ0c29uCg==", - "subType": "06" - } - } - } - ], - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "Wrong subtype", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "00" - } - } - } - ] - } - ] - }, - { - "description": "Empty data", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "_id": 2 - } - }, - "result": { - "errorContains": "malformed ciphertext" - } - } - ] - }, - { - "description": "Malformed data", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "_id": 3 - } - }, - "result": { - "errorContains": "not all keys requested were satisfied" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/maxWireVersion.json b/tests/SpecTests/client-side-encryption/tests/maxWireVersion.json deleted file mode 100644 index f04f58dff..000000000 --- a/tests/SpecTests/client-side-encryption/tests/maxWireVersion.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "runOn": [ - { - "maxServerVersion": "4.0.99" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "operation fails with maxWireVersion < 8", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - }, - "extraOptions": { - "mongocryptdBypassSpawn": true - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "encrypted_string": "string0" - } - }, - "result": { - "errorContains": "Auto-encryption requires a minimum MongoDB version of 4.2" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/missingKey.json b/tests/SpecTests/client-side-encryption/tests/missingKey.json deleted file mode 100644 index 275147bb7..000000000 --- a/tests/SpecTests/client-side-encryption/tests/missingKey.json +++ /dev/null @@ -1,179 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "Insert with encryption on a missing key", - "clientOptions": { - "autoEncryptOpts": { - "keyVaultNamespace": "keyvault.different", - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0", - "random": "abc" - } - }, - "result": { - "errorContains": "not all keys requested were satisfied" - } - } - ], - "outcome": { - "collection": { - "data": [] - } - }, - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "different", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/namedKMS.json b/tests/SpecTests/client-side-encryption/tests/namedKMS.json deleted file mode 100644 index c85944358..000000000 --- a/tests/SpecTests/client-side-encryption/tests/namedKMS.json +++ /dev/null @@ -1,197 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "json_schema": { - "properties": { - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "local+name2+AAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "_id": { - "$binary": { - "base64": "local+name2+AAAAAAAAAA==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "DX3iUuOlBsx6wBX9UZ3v/qXk1HNeBace2J+h/JwsDdF/vmSXLZ1l1VmZYIcpVFy6ODhdbzLjd4pNgg9wcm4etYig62KNkmtZ0/s1tAL5VsuW/s7/3PYnYGznZTFhLjIVcOH/RNoRj2eQb/sRTyivL85wePEpAU/JzuBj6qO9Y5txQgs1k0J3aNy10R9aQ8kC1NuSSpLAIXwE6DlNDDJXhw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "status": { - "$numberInt": "0" - }, - "masterKey": { - "provider": "local:name2" - } - } - ], - "tests": [ - { - "description": "Automatically encrypt and decrypt with a named KMS provider", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local:name2": { - "key": { - "$binary": { - "base64": "local+name2+YUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0" - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": [ - { - "_id": 1, - "encrypted_string": "string0" - } - ] - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "local+name2+AAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AZaHGpfp2pntvgAAAAAAAAAC07sFvTQ0I4O2U49hpr4HezaK44Ivluzv5ntQBTYHDlAJMLyRMyB6Dl+UGHBgqhHe/Xw+pcT9XdiUoOJYAx9g+w==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": 1 - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AZaHGpfp2pntvgAAAAAAAAAC07sFvTQ0I4O2U49hpr4HezaK44Ivluzv5ntQBTYHDlAJMLyRMyB6Dl+UGHBgqhHe/Xw+pcT9XdiUoOJYAx9g+w==", - "subType": "06" - } - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/noSchema.json b/tests/SpecTests/client-side-encryption/tests/noSchema.json deleted file mode 100644 index 095434f88..000000000 --- a/tests/SpecTests/client-side-encryption/tests/noSchema.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "unencrypted", - "tests": [ - { - "description": "Insert on an unencrypted collection", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1 - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "unencrypted" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "insert": "unencrypted", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true - }, - "command_name": "insert" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/replaceOne.json b/tests/SpecTests/client-side-encryption/tests/replaceOne.json deleted file mode 100644 index 975768681..000000000 --- a/tests/SpecTests/client-side-encryption/tests/replaceOne.json +++ /dev/null @@ -1,239 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "replaceOne with encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "replaceOne", - "arguments": { - "filter": { - "encrypted_string": "string0" - }, - "replacement": { - "encrypted_string": "string1", - "random": "abc" - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "update": "default", - "updates": [ - { - "q": { - "encrypted_string": { - "$eq": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - }, - "u": { - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - }, - "random": { - "$$type": "binData" - } - } - } - ], - "ordered": true - }, - "command_name": "update" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - }, - "random": { - "$$type": "binData" - } - } - ] - } - } - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/timeoutMS.json b/tests/SpecTests/client-side-encryption/tests/timeoutMS.json deleted file mode 100644 index b667767cf..000000000 --- a/tests/SpecTests/client-side-encryption/tests/timeoutMS.json +++ /dev/null @@ -1,200 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.4" - } - ], - "database_name": "cse-timeouts-db", - "collection_name": "cse-timeouts-coll", - "data": [], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "timeoutMS applied to listCollections to get collection schema", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "blockConnection": true, - "blockTimeMS": 60 - } - }, - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - }, - "timeoutMS": 50 - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0", - "random": "abc" - } - }, - "result": { - "isTimeoutError": true - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "cse-timeouts-coll" - }, - "maxTimeMS": { - "$$type": [ - "int", - "long" - ] - } - }, - "command_name": "listCollections" - } - } - ] - }, - { - "description": "remaining timeoutMS applied to find to get keyvault data", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listCollections", - "find" - ], - "blockConnection": true, - "blockTimeMS": 30 - } - }, - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - }, - "timeoutMS": 50 - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_string": "string0", - "random": "abc" - } - }, - "result": { - "isTimeoutError": true - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/types.json b/tests/SpecTests/client-side-encryption/tests/types.json deleted file mode 100644 index a6c6507e9..000000000 --- a/tests/SpecTests/client-side-encryption/tests/types.json +++ /dev/null @@ -1,1646 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "json_schema": {}, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "type=objectId", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_objectId": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "objectId", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_objectId": { - "$oid": "AAAAAAAAAAAAAAAAAAAAAAAA" - } - } - } - }, - { - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": { - "_id": 1, - "encrypted_objectId": { - "$oid": "AAAAAAAAAAAAAAAAAAAAAAAA" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_objectId": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAAHmkTPqvzfHMWpvS1mEsrjOxVQ2dyihEgIFWD5E0eNEsiMBQsC0GuvjdqYRL5DHLFI1vKuGek7EYYp0Qyii/tHqA==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": 1 - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_objectId": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAAHmkTPqvzfHMWpvS1mEsrjOxVQ2dyihEgIFWD5E0eNEsiMBQsC0GuvjdqYRL5DHLFI1vKuGek7EYYp0Qyii/tHqA==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "type=symbol", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_symbol": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "symbol", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_symbol": { - "$symbol": "test" - } - } - } - }, - { - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": { - "_id": 1, - "encrypted_symbol": { - "$symbol": "test" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_symbol": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAAOOmvDmWjcuKsSCO7U/7t9HJ8eI73B6wduyMbdkvn7n7V4uTJes/j+BTtneSdyG2JHKHGkevWAJSIU2XoO66BSXw==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": 1 - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_symbol": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAAOOmvDmWjcuKsSCO7U/7t9HJ8eI73B6wduyMbdkvn7n7V4uTJes/j+BTtneSdyG2JHKHGkevWAJSIU2XoO66BSXw==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "type=int", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_int": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "int", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_int": { - "$numberInt": "123" - } - } - } - }, - { - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": { - "_id": 1, - "encrypted_int": { - "$numberInt": "123" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_int": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAAQPNXJVXMEjGZnftMuf2INKufXCtQIRHdw5wTgn6QYt3ejcoAXyiwI4XIUizkpsob494qpt2in4tWeiO7b9zkA8Q==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": 1 - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_int": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAAQPNXJVXMEjGZnftMuf2INKufXCtQIRHdw5wTgn6QYt3ejcoAXyiwI4XIUizkpsob494qpt2in4tWeiO7b9zkA8Q==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "type=double", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_double": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "double", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_double": { - "$numberDouble": "1.23" - } - } - }, - "result": { - "errorContains": "element of type: double" - } - } - ] - }, - { - "description": "type=decimal", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_decimal": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "decimal", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_decimal": { - "$numberDecimal": "1.23" - } - } - }, - "result": { - "errorContains": "element of type: decimal" - } - } - ] - }, - { - "description": "type=binData", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_binData": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "binData", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_binData": { - "$binary": { - "base64": "AAAA", - "subType": "00" - } - } - } - } - }, - { - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": { - "_id": 1, - "encrypted_binData": { - "$binary": { - "base64": "AAAA", - "subType": "00" - } - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_binData": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAAFB/KHZQHaHHo8fctcl7v6kR+sLkJoTRx2cPSSck9ya+nbGROSeFhdhDRHaCzhV78fDEqnMDSVPNi+ZkbaIh46GQ==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": 1 - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_binData": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAAFB/KHZQHaHHo8fctcl7v6kR+sLkJoTRx2cPSSck9ya+nbGROSeFhdhDRHaCzhV78fDEqnMDSVPNi+ZkbaIh46GQ==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "type=javascript", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_javascript": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "javascript", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_javascript": { - "$code": "var x = 1;" - } - } - } - }, - { - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": { - "_id": 1, - "encrypted_javascript": { - "$code": "var x = 1;" - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_javascript": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAANrvMgJkTKWGMc9wt3E2RBR2Hu5gL9p+vIIdHe9FcOm99t1W480/oX1Gnd87ON3B399DuFaxi/aaIiQSo7gTX6Lw==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": 1 - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_javascript": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAANrvMgJkTKWGMc9wt3E2RBR2Hu5gL9p+vIIdHe9FcOm99t1W480/oX1Gnd87ON3B399DuFaxi/aaIiQSo7gTX6Lw==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "type=javascriptWithScope", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_javascriptWithScope": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "javascriptWithScope", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_javascriptWithScope": { - "$code": "var x = 1;", - "$scope": {} - } - } - }, - "result": { - "errorContains": "element of type: javascriptWithScope" - } - } - ] - }, - { - "description": "type=object", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_object": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "object", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_object": {} - } - }, - "result": { - "errorContains": "element of type: object" - } - } - ] - }, - { - "description": "type=timestamp", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_timestamp": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "timestamp", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_timestamp": { - "$timestamp": { - "t": 123, - "i": 456 - } - } - } - } - }, - { - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": { - "_id": 1, - "encrypted_timestamp": { - "$timestamp": { - "t": 123, - "i": 456 - } - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_timestamp": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAARJHaM4Gq3MpDTdBasBsEolQaOmxJQU1wsZVaSFAOLpEh1QihDglXI95xemePFMKhg+KNpFg7lw1ChCs2Wn/c26Q==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": 1 - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_timestamp": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAARJHaM4Gq3MpDTdBasBsEolQaOmxJQU1wsZVaSFAOLpEh1QihDglXI95xemePFMKhg+KNpFg7lw1ChCs2Wn/c26Q==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "type=regex", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_regex": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "regex", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_regex": { - "$regularExpression": { - "pattern": "test", - "options": "" - } - } - } - } - }, - { - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": { - "_id": 1, - "encrypted_regex": { - "$regularExpression": { - "pattern": "test", - "options": "" - } - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_regex": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAALVnxM4UqGhqf5eXw6nsS08am3YJrTf1EvjKitT8tyyMAbHsICIU3GUjuC7EBofCHbusvgo7pDyaClGostFz44nA==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": 1 - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_regex": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAALVnxM4UqGhqf5eXw6nsS08am3YJrTf1EvjKitT8tyyMAbHsICIU3GUjuC7EBofCHbusvgo7pDyaClGostFz44nA==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "type=date", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_date": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "date", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_date": { - "$date": { - "$numberLong": "123" - } - } - } - } - }, - { - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "result": { - "_id": 1, - "encrypted_date": { - "$date": { - "$numberLong": "123" - } - } - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "insert": "default", - "documents": [ - { - "_id": 1, - "encrypted_date": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAAJ5sN7u6l97+DswfKTqZAijSTSOo5htinGKQKUD7pHNJYlLXGOkB4glrCu7ibu0g3344RHQ5yUp4YxMEa8GD+Snw==", - "subType": "06" - } - } - } - ], - "ordered": true - }, - "command_name": "insert" - } - }, - { - "command_started_event": { - "command": { - "find": "default", - "filter": { - "_id": 1 - } - }, - "command_name": "find" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_date": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAAJ5sN7u6l97+DswfKTqZAijSTSOo5htinGKQKUD7pHNJYlLXGOkB4glrCu7ibu0g3344RHQ5yUp4YxMEa8GD+Snw==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "type=minKey", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_minKey": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "minKey", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_minKey": { - "$minKey": 1 - } - } - }, - "result": { - "errorContains": "Cannot encrypt element of type: minKey" - } - } - ] - }, - { - "description": "type=maxKey", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_maxKey": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "maxKey", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_maxKey": { - "$maxKey": 1 - } - } - }, - "result": { - "errorContains": "Cannot encrypt element of type: maxKey" - } - } - ] - }, - { - "description": "type=undefined", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_undefined": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "undefined", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_undefined": { - "$undefined": true - } - } - }, - "result": { - "errorContains": "Cannot encrypt element of type: undefined" - } - } - ] - }, - { - "description": "type=array", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_array": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "array", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_array": [] - } - }, - "result": { - "errorContains": "element of type: array" - } - } - ] - }, - { - "description": "type=bool", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_bool": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "bool", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_bool": true - } - }, - "result": { - "errorContains": "element of type: bool" - } - } - ] - }, - { - "description": "type=null", - "clientOptions": { - "autoEncryptOpts": { - "schemaMap": { - "default.default": { - "properties": { - "encrypted_null": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "null", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - }, - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "encrypted_null": true - } - }, - "result": { - "errorContains": "Cannot encrypt element of type: null" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/unsupportedCommand.json b/tests/SpecTests/client-side-encryption/tests/unsupportedCommand.json deleted file mode 100644 index 318871511..000000000 --- a/tests/SpecTests/client-side-encryption/tests/unsupportedCommand.json +++ /dev/null @@ -1,152 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "x": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "x": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "mapReduce deterministic encryption (unsupported)", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "mapReduce", - "arguments": { - "map": { - "$code": "function inc() { return emit(0, this.x + 1) }" - }, - "reduce": { - "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }" - }, - "out": { - "inline": 1 - } - }, - "result": { - "errorContains": "command not supported for auto encryption: mapreduce" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/updateMany.json b/tests/SpecTests/client-side-encryption/tests/updateMany.json deleted file mode 100644 index 823909044..000000000 --- a/tests/SpecTests/client-side-encryption/tests/updateMany.json +++ /dev/null @@ -1,307 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "updateMany with deterministic encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateMany", - "arguments": { - "filter": { - "encrypted_string": { - "$in": [ - "string0", - "string1" - ] - } - }, - "update": { - "$set": { - "encrypted_string": "string2", - "random": "abc" - } - } - }, - "result": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "update": "default", - "updates": [ - { - "q": { - "encrypted_string": { - "$in": [ - { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - }, - { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - } - ] - } - }, - "u": { - "$set": { - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACQ76HWOut3DZtQuV90hp1aaCpZn95vZIaWmn+wrBehcEtcFwyJlBdlyzDzZTWPZCPgiFq72Wvh6Y7VbpU9NAp3A==", - "subType": "06" - } - }, - "random": { - "$$type": "binData" - } - } - }, - "multi": true, - "upsert": false - } - ], - "ordered": true - }, - "command_name": "update" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACQ76HWOut3DZtQuV90hp1aaCpZn95vZIaWmn+wrBehcEtcFwyJlBdlyzDzZTWPZCPgiFq72Wvh6Y7VbpU9NAp3A==", - "subType": "06" - } - }, - "random": { - "$$type": "binData" - } - }, - { - "_id": 2, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACQ76HWOut3DZtQuV90hp1aaCpZn95vZIaWmn+wrBehcEtcFwyJlBdlyzDzZTWPZCPgiFq72Wvh6Y7VbpU9NAp3A==", - "subType": "06" - } - }, - "random": { - "$$type": "binData" - } - } - ] - } - } - }, - { - "description": "updateMany fails when filtering on a random field", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateMany", - "arguments": { - "filter": { - "random": "abc" - }, - "update": { - "$set": { - "encrypted_string": "string1" - } - } - }, - "result": { - "errorContains": "Cannot query on fields encrypted with the randomized encryption" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/updateOne.json b/tests/SpecTests/client-side-encryption/tests/updateOne.json deleted file mode 100644 index 23bada964..000000000 --- a/tests/SpecTests/client-side-encryption/tests/updateOne.json +++ /dev/null @@ -1,465 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "4.1.10" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ], - "json_schema": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - }, - "key_vault_data": [ - { - "status": 1, - "_id": { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - }, - "updateDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gEqnsxXlR51T5EbEVezUqqKAAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDHa4jo6yp0Z18KgbUgIBEIB74sKxWtV8/YHje5lv5THTl0HIbhSwM6EqRlmBiFFatmEWaeMk4tO4xBX65eq670I5TWPSLMzpp8ncGHMmvHqRajNBnmFtbYxN3E3/WjxmdbOOe+OXpnGJPcGsftc7cB2shRfA4lICPnE26+oVNXT6p0Lo20nY5XC7jyCO", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1552949630483" - } - }, - "keyAltNames": [ - "altname", - "another_altname" - ] - } - ], - "tests": [ - { - "description": "updateOne with deterministic encryption", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": { - "encrypted_string": "string0" - }, - "update": { - "$set": { - "encrypted_string": "string1", - "random": "abc" - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "find": "datakeys", - "filter": { - "$or": [ - { - "_id": { - "$in": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ] - } - }, - { - "keyAltNames": { - "$in": [] - } - } - ] - }, - "$db": "keyvault", - "readConcern": { - "level": "majority" - } - }, - "command_name": "find" - } - }, - { - "command_started_event": { - "command": { - "update": "default", - "updates": [ - { - "q": { - "encrypted_string": { - "$eq": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - }, - "u": { - "$set": { - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - }, - "random": { - "$$type": "binData" - } - } - } - } - ], - "ordered": true - }, - "command_name": "update" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACDdw4KFz3ZLquhsbt7RmDjD0N67n0uSXx7IGnQNCLeIKvot6s/ouI21Eo84IOtb6lhwUNPlSEBNY0/hbszWAKJg==", - "subType": "06" - } - }, - "random": { - "$$type": "binData" - } - } - ] - } - } - }, - { - "description": "updateOne fails when filtering on a random field", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": { - "random": "abc" - }, - "update": { - "$set": { - "encrypted_string": "string1" - } - } - }, - "result": { - "errorContains": "Cannot query on fields encrypted with the randomized encryption" - } - } - ] - }, - { - "description": "$unset works with an encrypted field", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$unset": { - "encrypted_string": "" - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "update": "default", - "updates": [ - { - "q": {}, - "u": { - "$unset": { - "encrypted_string": "" - } - } - } - ], - "ordered": true - }, - "command_name": "update" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1 - } - ] - } - } - }, - { - "description": "$rename works if target value has same encryption options", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$rename": { - "encrypted_string": "encrypted_string_equivalent" - } - } - }, - "result": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectations": [ - { - "command_started_event": { - "command": { - "listCollections": 1, - "filter": { - "name": "default" - } - }, - "command_name": "listCollections" - } - }, - { - "command_started_event": { - "command": { - "update": "default", - "updates": [ - { - "q": {}, - "u": { - "$rename": { - "encrypted_string": "encrypted_string_equivalent" - } - } - } - ], - "ordered": true - }, - "command_name": "update" - } - } - ], - "outcome": { - "collection": { - "data": [ - { - "_id": 1, - "encrypted_string_equivalent": { - "$binary": { - "base64": "AQAAAAAAAAAAAAAAAAAAAAACwj+3zkv2VM+aTfk60RqhXq6a/77WlLwu/BxXFkL7EppGsju/m8f0x5kBDD3EZTtGALGXlym5jnpZAoSIkswHoA==", - "subType": "06" - } - } - } - ] - } - } - }, - { - "description": "$rename fails if target value has different encryption options", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$rename": { - "encrypted_string": "random" - } - } - }, - "result": { - "errorContains": "$rename between two encrypted fields must have the same metadata or both be unencrypted" - } - } - ] - }, - { - "description": "an invalid update (no $ operators) is validated and errors", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "aws": {} - } - } - }, - "operations": [ - { - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "encrypted_string": "random" - } - }, - "result": { - "errorContains": "" - } - } - ] - } - ] -} diff --git a/tests/SpecTests/client-side-encryption/tests/validatorAndPartialFieldExpression.json b/tests/SpecTests/client-side-encryption/tests/validatorAndPartialFieldExpression.json deleted file mode 100644 index e07137ce1..000000000 --- a/tests/SpecTests/client-side-encryption/tests/validatorAndPartialFieldExpression.json +++ /dev/null @@ -1,642 +0,0 @@ -{ - "runOn": [ - { - "minServerVersion": "6.0.0" - } - ], - "database_name": "default", - "collection_name": "default", - "data": [], - "tests": [ - { - "description": "create with a validator on an unencrypted field is OK", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - }, - "schemaMap": { - "default.encryptedCollection": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection", - "validator": { - "unencrypted_string": "foo" - } - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection" - } - } - ] - }, - { - "description": "create with a validator on an encrypted field is an error", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - }, - "schemaMap": { - "default.encryptedCollection": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection", - "validator": { - "encrypted_string": "foo" - } - }, - "result": { - "errorContains": "Comparison to encrypted fields not supported" - } - } - ] - }, - { - "description": "collMod with a validator on an unencrypted field is OK", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - }, - "schemaMap": { - "default.encryptedCollection": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "command": { - "collMod": "encryptedCollection", - "validator": { - "unencrypted_string": "foo" - } - } - } - } - ] - }, - { - "description": "collMod with a validator on an encrypted field is an error", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - }, - "schemaMap": { - "default.encryptedCollection": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "command": { - "collMod": "encryptedCollection", - "validator": { - "encrypted_string": "foo" - } - } - }, - "result": { - "errorContains": "Comparison to encrypted fields not supported" - } - } - ] - }, - { - "description": "createIndexes with a partialFilterExpression on an unencrypted field is OK", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - }, - "schemaMap": { - "default.encryptedCollection": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "command": { - "createIndexes": "encryptedCollection", - "indexes": [ - { - "name": "name", - "key": { - "name": 1 - }, - "partialFilterExpression": { - "unencrypted_string": "foo" - } - } - ] - } - } - }, - { - "name": "assertIndexExists", - "object": "testRunner", - "arguments": { - "database": "default", - "collection": "encryptedCollection", - "index": "name" - } - } - ] - }, - { - "description": "createIndexes with a partialFilterExpression on an encrypted field is an error", - "clientOptions": { - "autoEncryptOpts": { - "kmsProviders": { - "local": { - "key": { - "$binary": { - "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk", - "subType": "00" - } - } - } - }, - "schemaMap": { - "default.encryptedCollection": { - "properties": { - "encrypted_w_altname": { - "encrypt": { - "keyId": "/altname", - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - }, - "random": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random" - } - }, - "encrypted_string_equivalent": { - "encrypt": { - "keyId": [ - { - "$binary": { - "base64": "AAAAAAAAAAAAAAAAAAAAAA==", - "subType": "04" - } - } - ], - "bsonType": "string", - "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic" - } - } - }, - "bsonType": "object" - } - } - } - }, - "operations": [ - { - "name": "dropCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "createCollection", - "object": "database", - "arguments": { - "collection": "encryptedCollection" - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "command": { - "createIndexes": "encryptedCollection", - "indexes": [ - { - "name": "name", - "key": { - "name": 1 - }, - "partialFilterExpression": { - "encrypted_string": "foo" - } - } - ] - } - }, - "result": { - "errorContains": "Comparison to encrypted fields not supported" - } - } - ] - } - ] -} diff --git a/tests/TestCase.php b/tests/TestCase.php index 87a951eed..2b6b86eb2 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -18,7 +18,6 @@ use Traversable; use function array_map; -use function array_merge; use function array_values; use function call_user_func; use function get_debug_type; @@ -92,11 +91,8 @@ protected static function getDatabaseName(): string * * Only fields in the expected document will be checked. The actual document * may contain additional fields. - * - * @param array|object $expectedDocument - * @param array|object $actualDocument */ - public function assertMatchesDocument($expectedDocument, $actualDocument): void + public function assertMatchesDocument(array|object $expectedDocument, array|object $actualDocument): void { (new DocumentsMatchConstraint($expectedDocument, true, true))->evaluate($actualDocument); } @@ -106,11 +102,8 @@ public function assertMatchesDocument($expectedDocument, $actualDocument): void * * The actual document will be compared directly with the expected document * and may not contain extra fields. - * - * @param array|object $expectedDocument - * @param array|object $actualDocument */ - public function assertSameDocument($expectedDocument, $actualDocument): void + public function assertSameDocument(array|object $expectedDocument, array|object $actualDocument): void { $this->assertEquals( Document::fromPHP($this->normalizeBSON($expectedDocument))->toRelaxedExtendedJSON(), @@ -146,44 +139,51 @@ public function dataDescription(): string return is_string($dataName) ? $dataName : ''; } - public function provideInvalidArrayValues(): array + final public static function provideInvalidArrayValues(): array + { + return self::wrapValuesForDataProvider(self::getInvalidArrayValues()); + } + + final public static function provideInvalidDocumentValues(): array { - return $this->wrapValuesForDataProvider($this->getInvalidArrayValues()); + return self::wrapValuesForDataProvider(self::getInvalidDocumentValues()); } - public function provideInvalidDocumentValues(): array + final public static function provideInvalidIntegerValues(): array { - return $this->wrapValuesForDataProvider($this->getInvalidDocumentValues()); + return self::wrapValuesForDataProvider(self::getInvalidIntegerValues()); } - public function provideInvalidIntegerValues(): array + final public static function provideInvalidStringValues(): array { - return $this->wrapValuesForDataProvider($this->getInvalidIntegerValues()); + return self::wrapValuesForDataProvider(self::getInvalidStringValues()); } - public function provideInvalidStringValues(): array + protected function assertDeprecated(callable $execution): mixed { - return $this->wrapValuesForDataProvider($this->getInvalidStringValues()); + return $this->assertError(E_USER_DEPRECATED | E_DEPRECATED, $execution); } - protected function assertDeprecated(callable $execution): void + protected function assertError(int $levels, callable $execution): mixed { $errors = []; set_error_handler(function ($errno, $errstr) use (&$errors): void { $errors[] = $errstr; - }, E_USER_DEPRECATED | E_DEPRECATED); + }, $levels); try { - call_user_func($execution); + $result = call_user_func($execution); } finally { restore_error_handler(); } $this->assertCount(1, $errors); + + return $result; } - protected function createOptionDataProvider(array $options): array + protected static function createOptionDataProvider(array $options): array { $data = []; @@ -208,141 +208,138 @@ protected function getCollectionName(): string { $class = new ReflectionClass($this); - return sprintf('%s.%s', $class->getShortName(), hash('crc32b', $this->getName())); + return sprintf('%s.%s', $class->getShortName(), hash('xxh3', $this->name())); } /** * Return a list of invalid array values. */ - protected function getInvalidArrayValues(bool $includeNull = false): array + protected static function getInvalidArrayValues(bool $includeNull = false): array { - return array_merge([123, 3.14, 'foo', true, new stdClass()], $includeNull ? [null] : []); + return [123, 3.14, 'foo', true, new stdClass(), ...($includeNull ? [null] : [])]; } /** * Return a list of invalid boolean values. */ - protected function getInvalidBooleanValues(bool $includeNull = false): array + protected static function getInvalidBooleanValues(bool $includeNull = false): array { - return array_merge([123, 3.14, 'foo', [], new stdClass()], $includeNull ? [null] : []); + return [123, 3.14, 'foo', [], new stdClass(), ...($includeNull ? [null] : [])]; } /** * Return a list of invalid document values. */ - protected function getInvalidDocumentValues(bool $includeNull = false): array + protected static function getInvalidDocumentValues(bool $includeNull = false): array + { + return [123, 3.14, 'foo', true, PackedArray::fromPHP([]), ...($includeNull ? [null] : [])]; + } + + protected static function getInvalidObjectValues(bool $includeNull = false): array { - return array_merge([123, 3.14, 'foo', true, PackedArray::fromPHP([])], $includeNull ? [null] : []); + return [123, 3.14, 'foo', true, [], new stdClass(), ...($includeNull ? [null] : [])]; } - protected function getInvalidDocumentCodecValues(): array + protected static function getInvalidDocumentCodecValues(): array { - return [123, 3.14, 'foo', true, [], new stdClass(), $this->createMock(Codec::class)]; + return [123, 3.14, 'foo', true, [], new stdClass(), self::createStub(Codec::class)]; } /** * Return a list of invalid hint values. */ - protected function getInvalidHintValues() + protected static function getInvalidHintValues(): array { - return [123, 3.14, true]; + return [123, 3.14, true, PackedArray::fromPHP([])]; } /** * Return a list of invalid integer values. */ - protected function getInvalidIntegerValues(bool $includeNull = false): array + protected static function getInvalidIntegerValues(bool $includeNull = false): array { - return array_merge([3.14, 'foo', true, [], new stdClass()], $includeNull ? [null] : []); + return [3.14, 'foo', true, [], new stdClass(), ...($includeNull ? [null] : [])]; } /** * Return a list of invalid ReadPreference values. */ - protected function getInvalidReadConcernValues(bool $includeNull = false): array + protected static function getInvalidReadConcernValues(bool $includeNull = false): array { - return array_merge( - [ - 123, - 3.14, - 'foo', - true, - [], - new stdClass(), - new ReadPreference(ReadPreference::PRIMARY), - new WriteConcern(1), - ], - $includeNull ? ['null' => null] : [], - ); + return [ + 123, + 3.14, + 'foo', + true, + [], + new stdClass(), + new ReadPreference(ReadPreference::PRIMARY), + new WriteConcern(1), + ...($includeNull ? ['null' => null] : []), + ]; } /** * Return a list of invalid ReadPreference values. */ - protected function getInvalidReadPreferenceValues(bool $includeNull = false): array + protected static function getInvalidReadPreferenceValues(bool $includeNull = false): array { - return array_merge( - [ - 123, - 3.14, - 'foo', - true, - [], - new stdClass(), - new ReadConcern(), - new WriteConcern(1), - ], - $includeNull ? ['null' => null] : [], - ); + return [ + 123, + 3.14, + 'foo', + true, + [], + new stdClass(), + new ReadConcern(), + new WriteConcern(1), + ...($includeNull ? ['null' => null] : []), + ]; } /** * Return a list of invalid Session values. */ - protected function getInvalidSessionValues(bool $includeNull = false): array + protected static function getInvalidSessionValues(bool $includeNull = false): array { - return array_merge( - [ - 123, - 3.14, - 'foo', - true, - [], - new stdClass(), - new ReadConcern(), - new ReadPreference(ReadPreference::PRIMARY), - new WriteConcern(1), - ], - $includeNull ? ['null' => null] : [], - ); + return [ + 123, + 3.14, + 'foo', + true, + [], + new stdClass(), + new ReadConcern(), + new ReadPreference(ReadPreference::PRIMARY), + new WriteConcern(1), + ...($includeNull ? ['null' => null] : []), + ]; } /** * Return a list of invalid string values. */ - protected function getInvalidStringValues(bool $includeNull = false): array + protected static function getInvalidStringValues(bool $includeNull = false): array { - return array_merge([123, 3.14, true, [], new stdClass()], $includeNull ? [null] : []); + return [123, 3.14, true, [], new stdClass(), ...($includeNull ? [null] : [])]; } /** * Return a list of invalid WriteConcern values. */ - protected function getInvalidWriteConcernValues(bool $includeNull = false): array + protected static function getInvalidWriteConcernValues(bool $includeNull = false): array { - return array_merge( - [ - 123, - 3.14, - 'foo', - true, - [], - new stdClass(), - new ReadConcern(), - new ReadPreference(ReadPreference::PRIMARY), - ], - $includeNull ? ['null' => null] : [], - ); + return [ + 123, + 3.14, + 'foo', + true, + [], + new stdClass(), + new ReadConcern(), + new ReadPreference(ReadPreference::PRIMARY), + ...($includeNull ? ['null' => null] : []), + ]; } /** @@ -358,7 +355,7 @@ protected function getNamespace(): string * * @param array $values List of values */ - protected function wrapValuesForDataProvider(array $values): array + final protected static function wrapValuesForDataProvider(array $values): array { return array_map(fn ($value) => [$value], $values); } @@ -370,11 +367,9 @@ protected function wrapValuesForDataProvider(array $values): array * its type and keys. Document fields will be sorted alphabetically. Each * value within the array or document will then be normalized recursively. * - * @param array|object $bson - * @return BSONDocument|BSONArray * @throws InvalidArgumentException if $bson is not an array or object */ - private function normalizeBSON($bson) + private function normalizeBSON(array|object $bson): BSONDocument|BSONArray { if (! is_array($bson) && ! is_object($bson)) { throw new InvalidArgumentException('$bson is not an array or object'); diff --git a/tests/UnifiedSpecTests/CollectionData.php b/tests/UnifiedSpecTests/CollectionData.php index 3ac6525f9..b7ca2f353 100644 --- a/tests/UnifiedSpecTests/CollectionData.php +++ b/tests/UnifiedSpecTests/CollectionData.php @@ -14,8 +14,10 @@ use function PHPUnit\Framework\assertContainsOnly; use function PHPUnit\Framework\assertIsArray; +use function PHPUnit\Framework\assertIsObject; use function PHPUnit\Framework\assertIsString; use function PHPUnit\Framework\assertNotNull; +use function PHPUnit\Framework\assertObjectNotHasProperty; use function PHPUnit\Framework\assertThat; use function sprintf; @@ -27,6 +29,8 @@ class CollectionData private array $documents; + private array $createOptions = []; + public function __construct(stdClass $o) { assertIsString($o->collectionName); @@ -38,6 +42,15 @@ public function __construct(stdClass $o) assertIsArray($o->documents); assertContainsOnly('object', $o->documents); $this->documents = $o->documents; + + if (isset($o->createOptions)) { + assertIsObject($o->createOptions); + /* The writeConcern option is prohibited here, as prepareInitialData() applies w:majority. Since a session + * option would be ignored by prepareInitialData() we can assert that it is also omitted. */ + assertObjectNotHasProperty('writeConcern', $o->createOptions); + assertObjectNotHasProperty('session', $o->createOptions); + $this->createOptions = (array) $o->createOptions; + } } public function prepareInitialData(Client $client, ?Session $session = null): void @@ -49,13 +62,13 @@ public function prepareInitialData(Client $client, ?Session $session = null): vo $database->dropCollection($this->collectionName, ['session' => $session]); - if (empty($this->documents)) { - $database->createCollection($this->collectionName, ['session' => $session]); - - return; + if (empty($this->documents) || ! empty($this->createOptions)) { + $database->createCollection($this->collectionName, ['session' => $session] + $this->createOptions); } - $database->selectCollection($this->collectionName)->insertMany($this->documents, ['session' => $session]); + if (! empty($this->documents)) { + $database->selectCollection($this->collectionName)->insertMany($this->documents, ['session' => $session]); + } } public function assertOutcome(Client $client): void diff --git a/tests/UnifiedSpecTests/Constraint/IsBsonType.php b/tests/UnifiedSpecTests/Constraint/IsBsonType.php index da88aca39..e81ccb2a3 100644 --- a/tests/UnifiedSpecTests/Constraint/IsBsonType.php +++ b/tests/UnifiedSpecTests/Constraint/IsBsonType.php @@ -23,7 +23,6 @@ use PHPUnit\Framework\Constraint\Constraint; use PHPUnit\Framework\Constraint\LogicalOr; use RuntimeException; -use Symfony\Bridge\PhpUnit\ConstraintTrait; use function array_keys; use function array_map; @@ -40,8 +39,6 @@ final class IsBsonType extends Constraint { - use ConstraintTrait; - private static array $types = [ 'double', 'string', @@ -67,15 +64,11 @@ final class IsBsonType extends Constraint 'number', ]; - private string $type; - - public function __construct(string $type) + public function __construct(private string $type) { if (! in_array($type, self::$types)) { throw new RuntimeException(sprintf('Type specified for %s <%s> is not a valid type', self::class, $type)); } - - $this->type = $type; } public static function any(): LogicalOr @@ -92,82 +85,37 @@ public static function anyOf(string ...$types): Constraint return LogicalOr::fromConstraints(...array_map(fn ($type) => new self($type), $types)); } - private function doMatches($other): bool + protected function matches($other): bool { - switch ($this->type) { - case 'double': - return is_float($other); - - case 'string': - return is_string($other); - - case 'object': - return self::isObject($other); - - case 'array': - return self::isArray($other); - - case 'binData': - return $other instanceof BinaryInterface; - - case 'undefined': - return $other instanceof Undefined; - - case 'objectId': - return $other instanceof ObjectIdInterface; - - case 'bool': - return is_bool($other); - - case 'date': - return $other instanceof UTCDateTimeInterface; - - case 'null': - return $other === null; - - case 'regex': - return $other instanceof RegexInterface; - - case 'dbPointer': - return $other instanceof DBPointer; - - case 'javascript': - return $other instanceof JavascriptInterface && $other->getScope() === null; - - case 'symbol': - return $other instanceof Symbol; - - case 'javascriptWithScope': - return $other instanceof JavascriptInterface && $other->getScope() !== null; - - case 'int': - return is_int($other); - - case 'timestamp': - return $other instanceof TimestampInterface; - - case 'long': - return is_int($other) || $other instanceof Int64; - - case 'decimal': - return $other instanceof Decimal128Interface; - - case 'minKey': - return $other instanceof MinKeyInterface; - - case 'maxKey': - return $other instanceof MaxKeyInterface; - - case 'number': - return is_int($other) || $other instanceof Int64 || is_float($other) || $other instanceof Decimal128Interface; - - default: - // This should already have been caught in the constructor - throw new LogicException('Unsupported type: ' . $this->type); - } + return match ($this->type) { + 'double' => is_float($other), + 'string' => is_string($other), + 'object' => self::isObject($other), + 'array' => self::isArray($other), + 'binData' => $other instanceof BinaryInterface, + 'undefined' => $other instanceof Undefined, + 'objectId' => $other instanceof ObjectIdInterface, + 'bool' => is_bool($other), + 'date' => $other instanceof UTCDateTimeInterface, + 'null' => $other === null, + 'regex' => $other instanceof RegexInterface, + 'dbPointer' => $other instanceof DBPointer, + 'javascript' => $other instanceof JavascriptInterface && $other->getScope() === null, + 'symbol' => $other instanceof Symbol, + 'javascriptWithScope' => $other instanceof JavascriptInterface && $other->getScope() !== null, + 'int' => is_int($other), + 'timestamp' => $other instanceof TimestampInterface, + 'long' => is_int($other) || $other instanceof Int64, + 'decimal' => $other instanceof Decimal128Interface, + 'minKey' => $other instanceof MinKeyInterface, + 'maxKey' => $other instanceof MaxKeyInterface, + 'number' => is_int($other) || $other instanceof Int64 || is_float($other) || $other instanceof Decimal128Interface, + // This should already have been caught in the constructor + default => throw new LogicException('Unsupported type: ' . $this->type), + }; } - private function doToString(): string + public function toString(): string { return sprintf('is of BSON type "%s"', $this->type); } diff --git a/tests/UnifiedSpecTests/Constraint/IsBsonTypeTest.php b/tests/UnifiedSpecTests/Constraint/IsBsonTypeTest.php index 7300ecd1a..dd3c6e3e3 100644 --- a/tests/UnifiedSpecTests/Constraint/IsBsonTypeTest.php +++ b/tests/UnifiedSpecTests/Constraint/IsBsonTypeTest.php @@ -17,6 +17,7 @@ use MongoDB\Model\BSONArray; use MongoDB\Model\BSONDocument; use MongoDB\Tests\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Constraint\Constraint; use PHPUnit\Framework\ExpectationFailedException; use stdClass; @@ -27,13 +28,13 @@ class IsBsonTypeTest extends TestCase { - /** @dataProvider provideTypes */ + #[DataProvider('provideTypes')] public function testConstraint($type, $value): void { $this->assertResult(true, new IsBsonType($type), $value, $this->dataName() . ' is ' . $type); } - public function provideTypes() + public static function provideTypes() { $undefined = Document::fromJSON('{ "x": {"$undefined": true} }')->toPHP()->x; $symbol = Document::fromJSON('{ "x": {"$symbol": "test"} }')->toPHP()->x; @@ -76,7 +77,7 @@ public function provideTypes() ]; } - /** @dataProvider provideTypes */ + #[DataProvider('provideTypes')] public function testAny($type, $value): void { $this->assertResult(true, IsBsonType::any(), $value, $this->dataName() . ' is a BSON type'); diff --git a/tests/UnifiedSpecTests/Constraint/Matches.php b/tests/UnifiedSpecTests/Constraint/Matches.php index caf391f40..a6bda1420 100644 --- a/tests/UnifiedSpecTests/Constraint/Matches.php +++ b/tests/UnifiedSpecTests/Constraint/Matches.php @@ -3,6 +3,9 @@ namespace MongoDB\Tests\UnifiedSpecTests\Constraint; use LogicException; +use MongoDB\BSON\Document; +use MongoDB\BSON\Int64; +use MongoDB\BSON\PackedArray; use MongoDB\BSON\Serializable; use MongoDB\BSON\Type; use MongoDB\Model\BSONArray; @@ -13,7 +16,7 @@ use RuntimeException; use SebastianBergmann\Comparator\ComparisonFailure; use SebastianBergmann\Comparator\Factory; -use Symfony\Bridge\PhpUnit\ConstraintTrait; +use SebastianBergmann\Exporter\Exporter; use function array_keys; use function count; @@ -25,11 +28,16 @@ use function is_int; use function is_object; use function ltrim; +use function PHPUnit\Framework\assertInstanceOf; use function PHPUnit\Framework\assertIsBool; use function PHPUnit\Framework\assertIsString; +use function PHPUnit\Framework\assertJson; +use function PHPUnit\Framework\assertLessThanOrEqual; use function PHPUnit\Framework\assertMatchesRegularExpression; use function PHPUnit\Framework\assertNotNull; +use function PHPUnit\Framework\assertStringStartsWith; use function PHPUnit\Framework\assertThat; +use function PHPUnit\Framework\assertTrue; use function PHPUnit\Framework\containsOnly; use function PHPUnit\Framework\isInstanceOf; use function PHPUnit\Framework\isType; @@ -39,6 +47,7 @@ use function sprintf; use function str_starts_with; use function strrchr; +use function trim; /** * Constraint that checks if one value matches another. @@ -49,12 +58,7 @@ */ class Matches extends Constraint { - use ConstraintTrait; - - private ?EntityMap $entityMap = null; - - /** @var mixed */ - private $value; + private mixed $value; private bool $allowExtraRootKeys; @@ -64,16 +68,15 @@ class Matches extends Constraint private Factory $comparatorFactory; - public function __construct($value, ?EntityMap $entityMap = null, $allowExtraRootKeys = true, $allowOperators = true) + public function __construct($value, private ?EntityMap $entityMap = null, $allowExtraRootKeys = true, $allowOperators = true) { $this->value = self::prepare($value); - $this->entityMap = $entityMap; $this->allowExtraRootKeys = $allowExtraRootKeys; $this->allowOperators = $allowOperators; $this->comparatorFactory = Factory::getInstance(); } - private function doEvaluate($other, $description = '', $returnResult = false) + public function evaluate($other, $description = '', $returnResult = false): ?bool { $other = self::prepare($other); $success = false; @@ -89,14 +92,14 @@ private function doEvaluate($other, $description = '', $returnResult = false) } catch (RuntimeException $e) { /* This will generally catch internal errors from failAt(), which * include a key path to pinpoint the failure. */ + $exporter = new Exporter(); $this->lastFailure = new ComparisonFailure( $this->value, $other, /* TODO: Improve the exporter to canonicalize documents by * sorting keys and remove spl_object_hash from output. */ - $this->exporter()->export($this->value), - $this->exporter()->export($other), - false, + $exporter->export($this->value), + $exporter->export($other), $e->getMessage(), ); } @@ -108,6 +111,8 @@ private function doEvaluate($other, $description = '', $returnResult = false) if (! $success) { $this->fail($other, $description, $this->lastFailure); } + + return null; } private function assertEquals($expected, $actual, string $keyPath): void @@ -261,7 +266,36 @@ private function assertMatchesOperator(BSONDocument $operator, $actual, string $ $constraint = IsBsonType::anyOf(...(array) $operator['$$type']); if (! $constraint->evaluate($actual, '', true)) { - self::failAt(sprintf('%s is not an expected BSON type: %s', $this->exporter()->shortenedExport($actual), implode(', ', $types)), $keyPath); + self::failAt(sprintf('%s is not an expected BSON type: %s', (new Exporter())->shortenedExport($actual), implode(', ', (array) $operator['$$type'])), $keyPath); + } + + return; + } + + if ($name === '$$matchAsDocument') { + assertInstanceOf(BSONDocument::class, $operator['$$matchAsDocument'], '$$matchAsDocument requires a BSON document'); + assertIsString($actual, '$$matchAsDocument requires actual value to be a JSON string'); + assertJson($actual, '$$matchAsDocument requires actual value to be a JSON string'); + + /* Note: assertJson() accepts array and scalar values, but the spec + * assumes that the JSON string will yield a document. */ + assertStringStartsWith('{', trim($actual), '$$matchAsDocument requires actual value to be a JSON string denoting an object'); + + $actualDocument = Document::fromJSON($actual)->toPHP(); + $constraint = new Matches($operator['$$matchAsDocument'], $this->entityMap, allowExtraRootKeys: false); + + if (! $constraint->evaluate($actualDocument, '', true)) { + self::failAt(sprintf('%s did not match: %s', (new Exporter())->shortenedExport($actual), $constraint->additionalFailureDescription(null)), $keyPath); + } + + return; + } + + if ($name === '$$matchAsRoot') { + $constraint = new Matches($operator['$$matchAsRoot'], $this->entityMap, allowExtraRootKeys: true); + + if (! $constraint->evaluate($actual, '', true)) { + self::failAt(sprintf('$actual did not match as root-level document: %s', $constraint->additionalFailureDescription(null)), $keyPath); } return; @@ -289,7 +323,7 @@ private function assertMatchesOperator(BSONDocument $operator, $actual, string $ assertIsString($actual); if ($actual !== hex2bin($operator['$$matchesHexBytes'])) { - self::failAt(sprintf('%s does not match expected hex bytes: %s', $this->exporter()->shortenedExport($actual), $operator['$$matchesHexBytes']), $keyPath); + self::failAt(sprintf('%s does not match expected hex bytes: %s', (new Exporter())->shortenedExport($actual), $operator['$$matchesHexBytes']), $keyPath); } return; @@ -322,11 +356,18 @@ private function assertMatchesOperator(BSONDocument $operator, $actual, string $ return; } + if ($name === '$$lte') { + assertTrue(self::isNumeric($operator['$$lte']), '$$lte requires number'); + assertTrue(self::isNumeric($actual), '$actual operand for $$lte should be a number'); + assertLessThanOrEqual($operator['$$lte'], $actual); + + return; + } + throw new LogicException('unsupported operator: ' . $name); } - /** @see ConstraintTrait */ - private function doAdditionalFailureDescription($other) + protected function additionalFailureDescription($other): string { if ($this->lastFailure === null) { return ''; @@ -335,30 +376,27 @@ private function doAdditionalFailureDescription($other) return $this->lastFailure->getMessage(); } - /** @see ConstraintTrait */ - private function doFailureDescription($other) + protected function failureDescription($other): string { return 'expected value matches actual value'; } - /** @see ConstraintTrait */ - private function doMatches($other) + protected function matches($other): bool { $other = self::prepare($other); try { $this->assertMatches($this->value, $other); - } catch (RuntimeException $e) { + } catch (RuntimeException) { return false; } return true; } - /** @see ConstraintTrait */ - private function doToString() + public function toString(): string { - return 'matches ' . $this->exporter()->export($this->value); + return 'matches ' . (new Exporter())->export($this->value); } /** @psalm-return never-return */ @@ -408,11 +446,8 @@ private static function isOperator(BSONDocument $document): bool * converted to a BSONDocument; otherwise, it will be converted to a * BSONArray or BSONDocument based on its keys. Each value within an array * or document will then be prepared recursively. - * - * @param mixed $bson - * @return mixed */ - private static function prepare($bson) + private static function prepare(mixed $bson): mixed { if (! is_array($bson) && ! is_object($bson)) { return $bson; @@ -423,8 +458,14 @@ private static function prepare($bson) return self::prepare($bson->bsonSerialize()); } - /* Serializable has already been handled, so any remaining instances of - * Type will not serialize as BSON arrays or objects */ + // Recurse on the PHP representation of Document and PackedArray types + if ($bson instanceof Document || $bson instanceof PackedArray) { + return self::prepare($bson->toPHP()); + } + + /* Serializable, Document, and PackedArray have already been handled. + * Any remaining Type instances will not serialize as BSON arrays or + * objects. */ if ($bson instanceof Type) { return $bson; } diff --git a/tests/UnifiedSpecTests/Constraint/MatchesTest.php b/tests/UnifiedSpecTests/Constraint/MatchesTest.php index 1cae59531..41b57fad1 100644 --- a/tests/UnifiedSpecTests/Constraint/MatchesTest.php +++ b/tests/UnifiedSpecTests/Constraint/MatchesTest.php @@ -5,13 +5,12 @@ use MongoDB\BSON\Binary; use MongoDB\Tests\FunctionalTestCase; use MongoDB\Tests\UnifiedSpecTests\EntityMap; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\ExpectationFailedException; use stdClass; use function hex2bin; -use function phpversion; use function preg_quote; -use function version_compare; class MatchesTest extends FunctionalTestCase { @@ -31,6 +30,12 @@ public function testFlexibleNumericComparison(): void $this->assertResult(true, $c, ['x' => 1.0, 'y' => 1.0], 'Float instead of expected int matches'); $this->assertResult(true, $c, ['x' => 1, 'y' => 1], 'Int instead of expected float matches'); $this->assertResult(false, $c, ['x' => 'foo', 'y' => 1.0], 'Different type does not match'); + + /* Matches uses PHPUnit's comparators, which follow PHP behavior. This + * is more liberal than the comparison logic called for by the unified + * test format. This test can be removed when PHPLIB-1577 is addressed. + */ + $this->assertResult(true, $c, ['x' => '1.0', 'y' => '1'], 'Numeric strings may match ints and floats'); } public function testDoNotAllowExtraRootKeys(): void @@ -71,10 +76,6 @@ public function testOperatorExists(): void public function testOperatorType(): void { - if (version_compare(phpversion(), '8.4', '>=')) { - $this->markTestIncomplete('Test fails on PHP 8.4 due to deprecations'); - } - $c = new Matches(['x' => ['$$type' => 'string']]); $this->assertResult(true, $c, ['x' => 'foo'], 'string matches string type'); $this->assertResult(false, $c, ['x' => 1], 'integer does not match string type'); @@ -176,7 +177,38 @@ public function testOperatorSessionLsid(): void $this->assertResult(false, $c, ['x' => 1], 'session LSID does not match (embedded)'); } - /** @dataProvider errorMessageProvider */ + public function testOperatorMatchAsDocument(): void + { + $c = new Matches(['json' => ['$$matchAsDocument' => ['x' => 1]]]); + $this->assertResult(true, $c, ['json' => '{"x": 1}'], 'JSON document matches'); + $this->assertResult(false, $c, ['json' => '{"x": 2}'], 'JSON document does not match'); + $this->assertResult(false, $c, ['json' => '{"x": 1, "y": 2}'], 'JSON document cannot contain extra fields'); + + $c = new Matches(['json' => ['$$matchAsDocument' => ['x' => 1.0]]]); + $this->assertResult(true, $c, ['json' => '{"x": 1}'], 'JSON document matches (flexible numeric comparison)'); + + $c = new Matches(['json' => ['$$matchAsDocument' => ['x' => ['$$exists' => true]]]]); + $this->assertResult(true, $c, ['json' => '{"x": 1}'], 'JSON document matches (special operators)'); + $this->assertResult(false, $c, ['json' => '{"y": 1}'], 'JSON document does not match (special operators)'); + + $c = new Matches(['json' => ['$$matchAsDocument' => ['x' => ['$$type' => 'objectId']]]]); + $this->assertResult(true, $c, ['json' => '{"x": {"$oid": "57e193d7a9cc81b4027498b5"}}'], 'JSON document matches (extended JSON)'); + $this->assertResult(false, $c, ['json' => '{"x": {"$numberDecimal": "1234.5"}}'], 'JSON document does not match (extended JSON)'); + } + + public function testOperatorMatchAsRoot(): void + { + $c = new Matches(['x' => ['$$matchAsRoot' => ['y' => 2]]]); + $this->assertResult(true, $c, ['x' => ['y' => 2, 'z' => 3]], 'Nested document matches (allow extra fields)'); + $this->assertResult(true, $c, ['x' => ['y' => 2.0, 'z' => 3.0]], 'Nested document matches (flexible numeric comparison)'); + $this->assertResult(false, $c, ['x' => ['y' => 3, 'z' => 3]], 'Nested document does not match'); + + $c = new Matches(['x' => ['$$matchAsRoot' => ['y' => ['$$exists' => true]]]]); + $this->assertResult(true, $c, ['x' => ['y' => 2, 'z' => 3]], 'Nested document matches (special operators)'); + $this->assertResult(false, $c, ['x' => ['z' => 3]], 'Nested document matches (special operators)'); + } + + #[DataProvider('errorMessageProvider')] public function testErrorMessages($expectedMessageRegex, Matches $constraint, $actualValue): void { try { @@ -188,7 +220,7 @@ public function testErrorMessages($expectedMessageRegex, Matches $constraint, $a } } - public function errorMessageProvider() + public static function errorMessageProvider() { return [ 'assertEquals: type check (root-level)' => [ @@ -259,7 +291,7 @@ public function errorMessageProvider() ]; } - /** @dataProvider operatorErrorMessageProvider */ + #[DataProvider('operatorErrorMessageProvider')] public function testOperatorSyntaxValidation($expectedMessage, Matches $constraint): void { $this->expectException(ExpectationFailedException::class); @@ -268,7 +300,7 @@ public function testOperatorSyntaxValidation($expectedMessage, Matches $constrai $constraint->evaluate(['x' => 1], '', true); } - public function operatorErrorMessageProvider() + public static function operatorErrorMessageProvider() { return [ '$$exists type' => [ @@ -307,6 +339,10 @@ public function operatorErrorMessageProvider() '$$sessionLsid requires string', new Matches(['x' => ['$$sessionLsid' => 1]], new EntityMap()), ], + '$$matchAsDocument type' => [ + '$$matchAsDocument requires a BSON document', + new Matches(['x' => ['$$matchAsDocument' => 'foo']]), + ], ]; } diff --git a/tests/UnifiedSpecTests/Context.php b/tests/UnifiedSpecTests/Context.php index 57e6e7bd2..0faa0611f 100644 --- a/tests/UnifiedSpecTests/Context.php +++ b/tests/UnifiedSpecTests/Context.php @@ -50,23 +50,17 @@ final class Context /** @var array */ private array $eventObserversByClient = []; - private Client $internalClient; - private bool $inLoop = false; - private string $uri; - private string $singleMongosUri; private string $multiMongosUri; private ?object $advanceClusterTime = null; - public function __construct(Client $internalClient, string $uri) + public function __construct(private Client $internalClient, private string $uri) { $this->entityMap = new EntityMap(); - $this->internalClient = $internalClient; - $this->uri = $uri; /* TODO: Consider leaving these unset, although that might require * redundant topology/serverless checks in Context::createClient(). */ @@ -103,34 +97,15 @@ public function createEntities(array $entities): void $id = $def->id ?? null; assertIsString($id); - switch ($type) { - case 'client': - $this->createClient($id, $def); - break; - - case 'clientEncryption': - $this->createClientEncryption($id, $def); - break; - - case 'database': - $this->createDatabase($id, $def); - break; - - case 'collection': - $this->createCollection($id, $def); - break; - - case 'session': - $this->createSession($id, $def); - break; - - case 'bucket': - $this->createBucket($id, $def); - break; - - default: - throw new LogicException('Unsupported entity type: ' . $type); - } + match ($type) { + 'client' => $this->createClient($id, $def), + 'clientEncryption' => $this->createClientEncryption($id, $def), + 'database' => $this->createDatabase($id, $def), + 'collection' => $this->createCollection($id, $def), + 'session' => $this->createSession($id, $def), + 'bucket' => $this->createBucket($id, $def), + default => throw new LogicException('Unsupported entity type: ' . $type), + }; } } @@ -234,8 +209,7 @@ public function stopEventCollectors(): void } } - /** @param string|array $readPreferenceTags */ - private function convertReadPreferenceTags($readPreferenceTags): array + private function convertReadPreferenceTags(string|array $readPreferenceTags): array { return array_map( static function (string $readPreferenceTagSet): array { @@ -518,6 +492,10 @@ private static function getEnv(string $name): string private static function prepareCollectionOrDatabaseOptions(array $options): array { + if (array_key_exists('timeoutMS', $options)) { + Assert::markTestIncomplete('CSOT is not yet implemented (PHPC-1760)'); + } + Util::assertHasOnlyKeys($options, ['readConcern', 'readPreference', 'writeConcern']); return Util::prepareCommonOptions($options); @@ -535,10 +513,6 @@ private static function prepareBucketOptions(array $options): array assertIsInt($options['chunkSizeBytes']); } - if (array_key_exists('disableMD5', $options)) { - assertIsBool($options['disableMD5']); - } - return Util::prepareCommonOptions($options); } diff --git a/tests/UnifiedSpecTests/EntityMap.php b/tests/UnifiedSpecTests/EntityMap.php index 00c7f9d3f..32b99ffd0 100644 --- a/tests/UnifiedSpecTests/EntityMap.php +++ b/tests/UnifiedSpecTests/EntityMap.php @@ -63,12 +63,9 @@ public function offsetExists($id): bool return array_key_exists($id, $this->map); } - /** - * @see https://php.net/arrayaccess.offsetget - * @return mixed - */ + /** @see https://php.net/arrayaccess.offsetget */ #[ReturnTypeWillChange] - public function offsetGet($id) + public function offsetGet($id): mixed { assertIsString($id); assertArrayHasKey($id, $this->map, sprintf('No entity is defined for "%s"', $id)); @@ -100,16 +97,11 @@ public function set(string $id, $value, ?string $parentId = null): void $parent = $parentId === null ? null : $this->map[$parentId]; $this->map[$id] = new class ($id, $value, $parent) { - public string $id; - /** @var mixed */ - public $value; - public ?self $parent; + public mixed $value; - public function __construct(string $id, $value, ?self $parent = null) + public function __construct(public string $id, $value, public ?self $parent = null) { - $this->id = $id; $this->value = $value; - $this->parent = $parent; } public function getRoot(): self diff --git a/tests/UnifiedSpecTests/EventCollector.php b/tests/UnifiedSpecTests/EventCollector.php index 8acf41de7..0ecd622dc 100644 --- a/tests/UnifiedSpecTests/EventCollector.php +++ b/tests/UnifiedSpecTests/EventCollector.php @@ -10,7 +10,6 @@ use function array_filter; use function array_flip; -use function get_class; use function microtime; use function MongoDB\Driver\Monitoring\addSubscriber; use function MongoDB\Driver\Monitoring\removeSubscriber; @@ -45,15 +44,9 @@ final class EventCollector implements CommandSubscriber 'CommandFailedEvent' => CommandFailedEvent::class, ]; - private string $clientId; - - private Context $context; - private array $collectEvents = []; - private BSONArray $eventList; - - public function __construct(BSONArray $eventList, array $collectEvents, string $clientId, Context $context) + public function __construct(private BSONArray $eventList, array $collectEvents, private string $clientId, private Context $context) { assertNotEmpty($collectEvents); @@ -68,10 +61,6 @@ public function __construct(BSONArray $eventList, array $collectEvents, string $ $this->collectEvents[self::$supportedEvents[$event]] = 1; } } - - $this->clientId = $clientId; - $this->context = $context; - $this->eventList = $eventList; } /** @see https://php.net/manual/en/mongodb-driver-monitoring-commandsubscriber.commandfailed.php */ @@ -102,8 +91,7 @@ public function stop(): void removeSubscriber($this); } - /** @param CommandStartedEvent|CommandSucceededEvent|CommandFailedEvent $event */ - private function handleCommandMonitoringEvent($event): void + private function handleCommandMonitoringEvent(CommandStartedEvent|CommandSucceededEvent|CommandFailedEvent $event): void { assertIsObject($event); @@ -111,7 +99,7 @@ private function handleCommandMonitoringEvent($event): void return; } - if (! isset($this->collectEvents[get_class($event)])) { + if (! isset($this->collectEvents[$event::class])) { return; } @@ -150,6 +138,6 @@ private static function getEventName(object $event): string $eventNamesByClass = array_flip(array_filter(self::$supportedEvents)); } - return $eventNamesByClass[get_class($event)]; + return $eventNamesByClass[$event::class]; } } diff --git a/tests/UnifiedSpecTests/EventObserver.php b/tests/UnifiedSpecTests/EventObserver.php index 1f8af6648..aa057fbfd 100644 --- a/tests/UnifiedSpecTests/EventObserver.php +++ b/tests/UnifiedSpecTests/EventObserver.php @@ -15,7 +15,6 @@ use function array_reverse; use function count; use function current; -use function get_class; use function is_object; use function key; use function MongoDB\Driver\Monitoring\addSubscriber; @@ -28,7 +27,7 @@ use function PHPUnit\Framework\assertIsObject; use function PHPUnit\Framework\assertIsString; use function PHPUnit\Framework\assertNotEmpty; -use function PHPUnit\Framework\assertObjectHasAttribute; +use function PHPUnit\Framework\assertObjectHasProperty; use function PHPUnit\Framework\assertSame; use function PHPUnit\Framework\assertThat; use function sprintf; @@ -43,7 +42,7 @@ final class EventObserver implements CommandSubscriber * These commands are always considered sensitive (i.e. command and reply * documents should be redacted). * - * @see https://github.com/mongodb/specifications/blob/master/source/command-monitoring/command-monitoring.rst#security + * @see https://github.com/mongodb/specifications/blob/master/source/command-monitoring/command-monitoring.md#security */ private static array $sensitiveCommands = [ 'authenticate' => 1, @@ -61,7 +60,7 @@ final class EventObserver implements CommandSubscriber * These commands are only considered sensitive when the command or reply * document includes a speculativeAuthenticate field. * - * @see https://github.com/mongodb/specifications/blob/master/source/command-monitoring/command-monitoring.rst#security + * @see https://github.com/mongodb/specifications/blob/master/source/command-monitoring/command-monitoring.md#security */ private static array $sensitiveCommandsWithSpeculativeAuthenticate = [ 'ismaster' => 1, @@ -95,10 +94,6 @@ final class EventObserver implements CommandSubscriber private array $actualEvents = []; - private string $clientId; - - private Context $context; - /** * The configureFailPoint command (used by failPoint and targetedFailPoint * operations) is always ignored. @@ -107,9 +102,7 @@ final class EventObserver implements CommandSubscriber private array $observeEvents = []; - private bool $observeSensitiveCommands; - - public function __construct(array $observeEvents, array $ignoreCommands, bool $observeSensitiveCommands, string $clientId, Context $context) + public function __construct(array $observeEvents, array $ignoreCommands, private bool $observeSensitiveCommands, private string $clientId, private Context $context) { assertNotEmpty($observeEvents); @@ -132,10 +125,6 @@ public function __construct(array $observeEvents, array $ignoreCommands, bool $o assertIsString($command); $this->ignoreCommands[$command] = 1; } - - $this->observeSensitiveCommands = $observeSensitiveCommands; - $this->clientId = $clientId; - $this->context = $context; } /** @see https://php.net/manual/en/mongodb-driver-monitoring-commandsubscriber.commandfailed.php */ @@ -176,7 +165,7 @@ public function getLsidsOnLastTwoCommands(): array } $command = $event->getCommand(); - assertObjectHasAttribute('lsid', $command); + assertObjectHasProperty('lsid', $command); $lsids[] = $command->lsid; if (count($lsids) === 2) { @@ -223,23 +212,16 @@ public function assert(array $expectedEvents, bool $ignoreExtraEvents): void } } - private function assertEvent($actual, stdClass $expected, string $message) + private function assertEvent($actual, stdClass $expected, string $message): void { assertIsObject($actual); - switch (get_class($actual)) { - case CommandStartedEvent::class: - return $this->assertCommandStartedEvent($actual, $expected, $message); - - case CommandSucceededEvent::class: - return $this->assertCommandSucceededEvent($actual, $expected, $message); - - case CommandFailedEvent::class: - return $this->assertCommandFailedEvent($actual, $expected, $message); - - default: - Assert::fail($message . ': Unsupported event type: ' . get_class($actual)); - } + match ($actual::class) { + CommandStartedEvent::class => $this->assertCommandStartedEvent($actual, $expected, $message), + CommandSucceededEvent::class => $this->assertCommandSucceededEvent($actual, $expected, $message), + CommandFailedEvent::class => $this->assertCommandFailedEvent($actual, $expected, $message), + default => Assert::fail($message . ': Unsupported event type: ' . $actual::class) + }; } private function assertCommandStartedEvent(CommandStartedEvent $actual, stdClass $expected, string $message): void @@ -329,8 +311,7 @@ private function assertCommandFailedEvent(CommandFailedEvent $actual, stdClass $ } } - /** @param CommandStartedEvent|CommandSucceededEvent|CommandFailedEvent $event */ - private function handleEvent($event): void + private function handleEvent(CommandStartedEvent|CommandSucceededEvent|CommandFailedEvent $event): void { if (! $this->context->isActiveClient($this->clientId)) { return; @@ -340,7 +321,7 @@ private function handleEvent($event): void return; } - if (! isset($this->observeEvents[get_class($event)])) { + if (! isset($this->observeEvents[$event::class])) { return; } @@ -355,8 +336,7 @@ private function handleEvent($event): void $this->actualEvents[] = $event; } - /** @param CommandStartedEvent|CommandSucceededEvent|CommandFailedEvent $event */ - private function isSensitiveCommand($event): bool + private function isSensitiveCommand(CommandStartedEvent|CommandSucceededEvent|CommandFailedEvent $event): bool { if (isset(self::$sensitiveCommands[$event->getCommandName()])) { return true; diff --git a/tests/UnifiedSpecTests/ExpectedError.php b/tests/UnifiedSpecTests/ExpectedError.php index af28b0ece..092701479 100644 --- a/tests/UnifiedSpecTests/ExpectedError.php +++ b/tests/UnifiedSpecTests/ExpectedError.php @@ -2,18 +2,18 @@ namespace MongoDB\Tests\UnifiedSpecTests; +use MongoDB\Driver\Exception\BulkWriteCommandException; use MongoDB\Driver\Exception\BulkWriteException; use MongoDB\Driver\Exception\CommandException; use MongoDB\Driver\Exception\ExecutionTimeoutException; use MongoDB\Driver\Exception\RuntimeException; use MongoDB\Driver\Exception\ServerException; -use MongoDB\Driver\Exception\WriteException; use MongoDB\Tests\UnifiedSpecTests\Constraint\Matches; use PHPUnit\Framework\Assert; use stdClass; use Throwable; -use function get_class; +use function count; use function PHPUnit\Framework\assertArrayHasKey; use function PHPUnit\Framework\assertContainsOnly; use function PHPUnit\Framework\assertCount; @@ -27,7 +27,7 @@ use function PHPUnit\Framework\assertNotInstanceOf; use function PHPUnit\Framework\assertNotNull; use function PHPUnit\Framework\assertNull; -use function PHPUnit\Framework\assertObjectHasAttribute; +use function PHPUnit\Framework\assertObjectHasProperty; use function PHPUnit\Framework\assertSame; use function PHPUnit\Framework\assertStringContainsStringIgnoringCase; use function PHPUnit\Framework\assertThat; @@ -58,7 +58,7 @@ final class ExpectedError private ?string $codeName = null; - private ?Matches $matchesResultDocument = null; + private ?Matches $matchesErrorResponse = null; private array $includedLabels = []; @@ -66,6 +66,10 @@ final class ExpectedError private ?ExpectedResult $expectedResult = null; + private ?array $writeErrors = null; + + private ?array $writeConcernErrors = null; + public function __construct(?stdClass $o, EntityMap $entityMap) { if ($o === null) { @@ -83,6 +87,10 @@ public function __construct(?stdClass $o, EntityMap $entityMap) $this->isClientError = $o->isClientError; } + if (property_exists($o, 'isTimeoutError')) { + Assert::markTestIncomplete('CSOT is not yet implemented (PHPC-1760)'); + } + if (isset($o->errorContains)) { assertIsString($o->errorContains); $this->messageContains = $o->errorContains; @@ -100,7 +108,7 @@ public function __construct(?stdClass $o, EntityMap $entityMap) if (isset($o->errorResponse)) { assertIsObject($o->errorResponse); - $this->matchesResultDocument = new Matches($o->errorResponse, $entityMap); + $this->matchesErrorResponse = new Matches($o->errorResponse, $entityMap); } if (isset($o->errorLabelsContain)) { @@ -118,6 +126,24 @@ public function __construct(?stdClass $o, EntityMap $entityMap) if (property_exists($o, 'expectResult')) { $this->expectedResult = new ExpectedResult($o, $entityMap); } + + if (isset($o->writeErrors)) { + assertIsObject($o->writeErrors); + assertContainsOnly('object', (array) $o->writeErrors); + + foreach ($o->writeErrors as $i => $writeError) { + $this->writeErrors[$i] = new Matches($writeError, $entityMap); + } + } + + if (isset($o->writeConcernErrors)) { + assertIsArray($o->writeConcernErrors); + assertContainsOnly('object', $o->writeConcernErrors); + + foreach ($o->writeConcernErrors as $i => $writeConcernError) { + $this->writeConcernErrors[$i] = new Matches($writeConcernError, $entityMap); + } + } } /** @@ -128,7 +154,7 @@ public function __construct(?stdClass $o, EntityMap $entityMap) public function assert(?Throwable $e = null): void { if (! $this->isError && $e !== null) { - Assert::fail(sprintf("Operation threw unexpected %s: %s\n%s", get_class($e), $e->getMessage(), $e->getTraceAsString())); + Assert::fail(sprintf("Operation threw unexpected %s: %s\n%s", $e::class, $e->getMessage(), $e->getTraceAsString())); } if (! $this->isError) { @@ -157,15 +183,21 @@ public function assert(?Throwable $e = null): void $this->assertCodeName($e); } - if (isset($this->matchesResultDocument)) { - assertThat($e, logicalOr(isInstanceOf(CommandException::class), isInstanceOf(WriteException::class))); + if (isset($this->matchesErrorResponse)) { + assertThat($e, logicalOr( + isInstanceOf(CommandException::class), + isInstanceOf(BulkWriteException::class), + isInstanceOf(BulkWriteCommandException::class), + )); if ($e instanceof CommandException) { - assertThat($e->getResultDocument(), $this->matchesResultDocument, 'CommandException result document matches'); - } elseif ($e instanceof WriteException) { + assertThat($e->getResultDocument(), $this->matchesErrorResponse, 'CommandException result document matches expected errorResponse'); + } elseif ($e instanceof BulkWriteCommandException) { + assertThat($e->getErrorReply(), $this->matchesErrorResponse, 'BulkWriteCommandException error reply matches expected errorResponse'); + } elseif ($e instanceof BulkWriteException) { $writeErrors = $e->getWriteResult()->getErrorReplies(); assertCount(1, $writeErrors); - assertThat($writeErrors[0], $this->matchesResultDocument, 'WriteException result document matches'); + assertThat($writeErrors[0], $this->matchesErrorResponse, 'BulkWriteException first error reply matches expected errorResponse'); } } @@ -182,16 +214,34 @@ public function assert(?Throwable $e = null): void } if (isset($this->expectedResult)) { - assertInstanceOf(BulkWriteException::class, $e); - $this->expectedResult->assert($e->getWriteResult()); + assertThat($e, logicalOr( + isInstanceOf(BulkWriteException::class), + isInstanceOf(BulkWriteCommandException::class), + )); + + if ($e instanceof BulkWriteCommandException) { + $this->expectedResult->assert($e->getPartialResult()); + } elseif ($e instanceof BulkWriteException) { + $this->expectedResult->assert($e->getWriteResult()); + } + } + + if (isset($this->writeErrors)) { + assertInstanceOf(BulkWriteCommandException::class, $e); + $this->assertWriteErrors($e->getWriteErrors()); + } + + if (isset($this->writeConcernErrors)) { + assertInstanceOf(BulkWriteCommandException::class, $e); + $this->assertWriteConcernErrors($e->getWriteConcernErrors()); } } private function assertIsClientError(Throwable $e): void { - /* Note: BulkWriteException may proxy a previous exception. Unwrap it - * to check the original error. */ - if ($e instanceof BulkWriteException && $e->getPrevious() !== null) { + /* Note: BulkWriteException and BulkWriteCommandException may proxy a + * previous exception. Unwrap it to check the original error. */ + if (($e instanceof BulkWriteException || $e instanceof BulkWriteCommandException) && $e->getPrevious() !== null) { $e = $e->getPrevious(); } @@ -219,13 +269,56 @@ private function assertCodeName(ServerException $e): void $result = $e->getResultDocument(); if (isset($result->writeConcernError)) { - assertObjectHasAttribute('codeName', $result->writeConcernError); + assertObjectHasProperty('codeName', $result->writeConcernError); assertSame($this->codeName, $result->writeConcernError->codeName); return; } - assertObjectHasAttribute('codeName', $result); + assertObjectHasProperty('codeName', $result); assertSame($this->codeName, $result->codeName); } + + private function assertWriteErrors(array $writeErrors): void + { + assertCount(count($this->writeErrors), $writeErrors); + + foreach ($this->writeErrors as $i => $matchesWriteError) { + assertArrayHasKey($i, $writeErrors); + $writeError = $writeErrors[$i]; + + // Not required by the spec test, but asserts PHPC correctness + assertSame((int) $i, $writeError->getIndex()); + + /* Convert the WriteError into a document for matching. These + * field names are derived from the CRUD spec. */ + $writeErrorDocument = [ + 'code' => $writeError->getCode(), + 'message' => $writeError->getMessage(), + 'details' => $writeError->getInfo(), + ]; + + assertThat($writeErrorDocument, $matchesWriteError); + } + } + + private function assertWriteConcernErrors(array $writeConcernErrors): void + { + assertCount(count($this->writeConcernErrors), $writeConcernErrors); + + foreach ($this->writeConcernErrors as $i => $matchesWriteConcernError) { + assertArrayHasKey($i, $writeConcernErrors); + $writeConcernError = $writeConcernErrors[$i]; + + /* Convert the WriteConcernError into a document for matching. + * These field names are derived from the CRUD spec. */ + $writeConcernErrorDocument = [ + 'code' => $writeConcernError->getCode(), + 'message' => $writeConcernError->getMessage(), + 'details' => $writeConcernError->getInfo(), + ]; + + assertThat($writeConcernErrorDocument, $matchesWriteConcernError); + } + } } diff --git a/tests/UnifiedSpecTests/ExpectedResult.php b/tests/UnifiedSpecTests/ExpectedResult.php index 88166eea5..29871c289 100644 --- a/tests/UnifiedSpecTests/ExpectedResult.php +++ b/tests/UnifiedSpecTests/ExpectedResult.php @@ -4,6 +4,7 @@ use MongoDB\BulkWriteResult; use MongoDB\DeleteResult; +use MongoDB\Driver\BulkWriteCommandResult; use MongoDB\Driver\WriteResult; use MongoDB\InsertManyResult; use MongoDB\InsertOneResult; @@ -11,6 +12,7 @@ use MongoDB\UpdateResult; use stdClass; +use function array_filter; use function is_object; use function PHPUnit\Framework\assertThat; use function property_exists; @@ -19,21 +21,18 @@ final class ExpectedResult { private ?Matches $constraint = null; - private EntityMap $entityMap; - /** * ID of the entity yielding the result. This is mainly used to associate * entities with a root client for collation of observed events. */ private ?string $yieldingEntityId = null; - public function __construct(stdClass $o, EntityMap $entityMap, ?string $yieldingEntityId = null) + public function __construct(stdClass $o, private EntityMap $entityMap, ?string $yieldingEntityId = null) { if (property_exists($o, 'expectResult')) { $this->constraint = new Matches($o->expectResult, $entityMap); } - $this->entityMap = $entityMap; $this->yieldingEntityId = $yieldingEntityId; } @@ -60,6 +59,10 @@ private static function prepare($value) return $value; } + if ($value instanceof BulkWriteCommandResult) { + return self::prepareBulkWriteCommandResult($value); + } + if ( $value instanceof BulkWriteResult || $value instanceof WriteResult || @@ -74,7 +77,37 @@ private static function prepare($value) return $value; } - private static function prepareWriteResult($value) + private static function prepareBulkWriteCommandResult(BulkWriteCommandResult $result): array + { + $retval = ['acknowledged' => $result->isAcknowledged()]; + + if (! $retval['acknowledged']) { + return $retval; + } + + $retval = [ + 'deletedCount' => $result->getDeletedCount(), + 'insertedCount' => $result->getInsertedCount(), + 'matchedCount' => $result->getMatchedCount(), + 'modifiedCount' => $result->getModifiedCount(), + 'upsertedCount' => $result->getUpsertedCount(), + ]; + + /* Tests use $$unsetOrMatches to expect either no key or an empty + * document when verboseResults=false, so filter out null values. */ + $retval += array_filter( + [ + 'deleteResults' => $result->getDeleteResults()?->toPHP(), + 'insertResults' => $result->getInsertResults()?->toPHP(), + 'updateResults' => $result->getUpdateResults()?->toPHP(), + ], + fn ($value) => $value !== null, + ); + + return $retval; + } + + private static function prepareWriteResult($value): array { $result = ['acknowledged' => $value->isAcknowledged()]; diff --git a/tests/UnifiedSpecTests/Loop.php b/tests/UnifiedSpecTests/Loop.php index 69c0b9a79..62848596e 100644 --- a/tests/UnifiedSpecTests/Loop.php +++ b/tests/UnifiedSpecTests/Loop.php @@ -26,10 +26,6 @@ final class Loop private static int $sleepUsecBetweenIterations = 0; - private Context $context; - - private array $operations = []; - private ?BSONArray $errorList = null; private ?BSONArray $failureList = null; @@ -38,13 +34,10 @@ final class Loop private string $numIterationsEntityId; - public function __construct(array $operations, Context $context, array $options = []) + public function __construct(private array $operations, private Context $context, array $options = []) { assertContainsOnly(Operation::class, $operations); - $this->operations = $operations; - $this->context = $context; - foreach (['storeErrorsAsEntity', 'storeFailuresAsEntity', 'storeSuccessesAsEntity', 'storeIterationsAsEntity'] as $option) { if (array_key_exists($option, $options)) { assertIsString($options[$option]); diff --git a/tests/UnifiedSpecTests/ManagesFailPointsTrait.php b/tests/UnifiedSpecTests/ManagesFailPointsTrait.php index 1fbe0fd6a..2680e89ac 100644 --- a/tests/UnifiedSpecTests/ManagesFailPointsTrait.php +++ b/tests/UnifiedSpecTests/ManagesFailPointsTrait.php @@ -8,7 +8,7 @@ use stdClass; use function PHPUnit\Framework\assertIsString; -use function PHPUnit\Framework\assertObjectHasAttribute; +use function PHPUnit\Framework\assertObjectHasProperty; trait ManagesFailPointsTrait { @@ -17,9 +17,9 @@ trait ManagesFailPointsTrait public function configureFailPoint(stdClass $failPoint, Server $server): void { - assertObjectHasAttribute('configureFailPoint', $failPoint); + assertObjectHasProperty('configureFailPoint', $failPoint); assertIsString($failPoint->configureFailPoint); - assertObjectHasAttribute('mode', $failPoint); + assertObjectHasProperty('mode', $failPoint); $operation = new DatabaseCommand('admin', $failPoint); $operation->execute($server); @@ -35,7 +35,7 @@ public function disableFailPoints(): void try { $operation = new DatabaseCommand('admin', ['configureFailPoint' => $failPoint, 'mode' => 'off']); $operation->execute($server); - } catch (ConnectionException $e) { + } catch (ConnectionException) { // Retry once in case the connection was dropped by the last operation $operation = new DatabaseCommand('admin', ['configureFailPoint' => $failPoint, 'mode' => 'off']); $operation->execute($server); diff --git a/tests/UnifiedSpecTests/Operation.php b/tests/UnifiedSpecTests/Operation.php index 11da19280..8cb4509dd 100644 --- a/tests/UnifiedSpecTests/Operation.php +++ b/tests/UnifiedSpecTests/Operation.php @@ -3,11 +3,11 @@ namespace MongoDB\Tests\UnifiedSpecTests; use Error; -use MongoDB\BSON\Javascript; use MongoDB\ChangeStream; use MongoDB\Client; use MongoDB\Collection; use MongoDB\Database; +use MongoDB\Driver\BulkWriteCommand; use MongoDB\Driver\ClientEncryption; use MongoDB\Driver\Cursor; use MongoDB\Driver\Server; @@ -31,7 +31,6 @@ use function current; use function fopen; use function fwrite; -use function get_class; use function hex2bin; use function iterator_to_array; use function key; @@ -51,7 +50,7 @@ use function PHPUnit\Framework\assertNotEquals; use function PHPUnit\Framework\assertNotNull; use function PHPUnit\Framework\assertNull; -use function PHPUnit\Framework\assertObjectHasAttribute; +use function PHPUnit\Framework\assertObjectHasProperty; use function PHPUnit\Framework\assertSame; use function PHPUnit\Framework\assertThat; use function PHPUnit\Framework\assertTrue; @@ -74,8 +73,6 @@ final class Operation private array $arguments = []; - private Context $context; - private EntityMap $entityMap; private ExpectedError $expectError; @@ -86,9 +83,23 @@ final class Operation private ?string $saveResultAsEntity = null; - public function __construct(stdClass $o, Context $context) + private static array $unsupportedOperations = [ + self::OBJECT_TEST_RUNNER => [ + 'assertNumberConnectionsCheckedOut' => 'PHP does not implement CMAP', + 'createEntities' => 'createEntities is not implemented (PHPC-1760)', + ], + Client::class => ['listDatabaseObjects' => 'listDatabaseObjects is not implemented'], + Cursor::class => ['iterateOnce' => 'iterateOnce is not implemented (PHPC-1760)'], + Database::class => [ + 'createCommandCursor' => 'commandCursor API is not yet implemented (PHPLIB-1077)', + 'listCollectionObjects' => 'listCollectionObjects is not implemented', + 'runCursorCommand' => 'commandCursor API is not yet implemented (PHPLIB-1077)', + ], + Collection::class => ['listIndexNames' => 'listIndexNames is not implemented'], + ]; + + public function __construct(stdClass $o, private Context $context) { - $this->context = $context; $this->entityMap = $context->getEntityMap(); assertIsString($o->name); @@ -170,9 +181,10 @@ private function execute() $object = $this->entityMap[$this->object]; assertIsObject($object); + $this->skipIfOperationIsNotSupported($object::class); $this->context->setActiveClient($this->entityMap->getRootClientIdOf($this->object)); - switch (get_class($object)) { + switch ($object::class) { case Client::class: $result = $this->executeForClient($object); break; @@ -198,7 +210,7 @@ private function execute() $result = $this->executeForBucket($object); break; default: - Assert::fail('Unsupported entity type: ' . get_class($object)); + Assert::fail('Unsupported entity type: ' . $object::class); } return $result; @@ -243,6 +255,18 @@ private function executeForClient(Client $client) Util::assertArgumentsBySchema(Client::class, $this->name, $args); switch ($this->name) { + case 'clientBulkWrite': + assertArrayHasKey('models', $args); + assertIsArray($args['models']); + + // Options for ClientBulkWriteCommand and Server::executeBulkWriteCommand() will be mixed + $options = array_diff_key($args, ['models' => 1]); + + return $client->bulkWrite( + self::prepareBulkWriteCommand($args['models'], $options), + $options, + ); + case 'createChangeStream': assertArrayHasKey('pipeline', $args); assertIsArray($args['pipeline']); @@ -511,19 +535,8 @@ private function executeForCollection(Collection $collection) ); case 'mapReduce': - assertArrayHasKey('map', $args); - assertArrayHasKey('reduce', $args); - assertArrayHasKey('out', $args); - assertInstanceOf(Javascript::class, $args['map']); - assertInstanceOf(Javascript::class, $args['reduce']); - assertThat($args['out'], logicalOr(new IsType('string'), new IsType('array'), new IsType('object'))); - - return iterator_to_array($collection->mapReduce( - $args['map'], - $args['reduce'], - $args['out'], - array_diff_key($args, ['map' => 1, 'reduce' => 1, 'out' => 1]), - )); + Assert::markTestSkipped('mapReduce operation is not supported'); + break; case 'rename': assertArrayHasKey('to', $args); @@ -538,7 +551,7 @@ private function executeForCollection(Collection $collection) case 'createSearchIndex': assertArrayHasKey('model', $args); assertIsObject($args['model']); - assertObjectHasAttribute('definition', $args['model']); + assertObjectHasProperty('definition', $args['model']); assertInstanceOf(stdClass::class, $args['model']->definition); /* Note: tests specify options within "model". A top-level @@ -774,6 +787,12 @@ private function executeForBucket(Bucket $bucket) return $bucket->delete($args['id']); + case 'deleteByName': + assertArrayHasKey('filename', $args); + assertIsString($args['filename']); + + return $bucket->deleteByName($args['filename']); + case 'downloadByName': assertArrayHasKey('filename', $args); assertIsString($args['filename']); @@ -788,6 +807,23 @@ private function executeForBucket(Bucket $bucket) return stream_get_contents($bucket->openDownloadStream($args['id'])); + case 'rename': + assertArrayHasKey('id', $args); + assertArrayHasKey('newFilename', $args); + assertIsString($args['newFilename']); + + $bucket->rename($args['id'], $args['newFilename']); + + return null; + + case 'renameByName': + assertArrayHasKey('filename', $args); + assertArrayHasKey('newFilename', $args); + assertIsString($args['filename']); + assertIsString($args['newFilename']); + + return $bucket->renameByName($args['filename'], $args['newFilename']); + case 'uploadWithId': assertArrayHasKey('id', $args); $args['_id'] = $args['id']; @@ -811,6 +847,8 @@ private function executeForBucket(Bucket $bucket) private function executeForTestRunner() { + $this->skipIfOperationIsNotSupported(self::OBJECT_TEST_RUNNER); + $args = $this->prepareArguments(); Util::assertArgumentsBySchema(self::OBJECT_TEST_RUNNER, $this->name, $args); @@ -963,6 +1001,92 @@ private function prepareArguments(): array return Util::prepareCommonOptions($args); } + private function skipIfOperationIsNotSupported(string $executingObjectName): void + { + $skipReason = self::$unsupportedOperations[$executingObjectName][$this->name] ?? null; + if (! $skipReason) { + return; + } + + Assert::markTestSkipped($skipReason); + } + + private static function prepareBulkWriteCommand(array $models, array $options): BulkWriteCommand + { + $bulk = new BulkWriteCommand($options); + + foreach ($models as $model) { + $model = (array) $model; + assertCount(1, $model); + + $type = key($model); + $args = current($model); + assertIsObject($args); + $args = (array) $args; + + assertArrayHasKey('namespace', $args); + assertIsString($args['namespace']); + + switch ($type) { + case 'deleteMany': + case 'deleteOne': + assertArrayHasKey('filter', $args); + assertInstanceOf(stdClass::class, $args['filter']); + + $bulk->{$type}( + $args['namespace'], + $args['filter'], + array_diff_key($args, ['namespace' => 1, 'filter' => 1]), + ); + break; + + case 'insertOne': + assertArrayHasKey('document', $args); + assertInstanceOf(stdClass::class, $args['document']); + + $bulk->insertOne( + $args['namespace'], + $args['document'], + ); + break; + + case 'replaceOne': + assertArrayHasKey('filter', $args); + assertArrayHasKey('replacement', $args); + assertInstanceOf(stdClass::class, $args['filter']); + assertInstanceOf(stdClass::class, $args['replacement']); + + $bulk->replaceOne( + $args['namespace'], + $args['filter'], + $args['replacement'], + array_diff_key($args, ['namespace' => 1, 'filter' => 1, 'replacement' => 1]), + ); + break; + + case 'updateMany': + case 'updateOne': + assertArrayHasKey('filter', $args); + assertArrayHasKey('update', $args); + assertInstanceOf(stdClass::class, $args['filter']); + assertThat($args['update'], logicalOr(new IsType('array'), new IsType('object'))); + + $bulk->{$type}( + $args['namespace'], + $args['filter'], + $args['update'], + array_diff_key($args, ['namespace' => 1, 'filter' => 1, 'update' => 1]), + ); + break; + + default: + Assert::fail('Unsupported bulk write model: ' . $type); + } + } + + return $bulk; + } + private static function prepareBulkWriteRequest(stdClass $request): array { $request = (array) $request; @@ -988,6 +1112,7 @@ private static function prepareBulkWriteRequest(stdClass $request): array case 'insertOne': assertArrayHasKey('document', $args); + assertInstanceOf(stdClass::class, $args['document']); return ['insertOne' => [$args['document']]]; @@ -1054,7 +1179,7 @@ private static function prepareUploadArguments(array $args): array { $source = $args['source'] ?? null; assertIsObject($source); - assertObjectHasAttribute('$$hexBytes', $source); + assertObjectHasProperty('$$hexBytes', $source); Util::assertHasOnlyKeys($source, ['$$hexBytes']); $hexBytes = $source->{'$$hexBytes'}; assertIsString($hexBytes); diff --git a/tests/UnifiedSpecTests/RunOnRequirement.php b/tests/UnifiedSpecTests/RunOnRequirement.php index ba00e15a8..9dff581db 100644 --- a/tests/UnifiedSpecTests/RunOnRequirement.php +++ b/tests/UnifiedSpecTests/RunOnRequirement.php @@ -104,7 +104,7 @@ public function __construct(stdClass $o) } } - public function isSatisfied(string $serverVersion, string $topology, ServerParameterHelper $serverParameters, bool $isAuthenticated, bool $isServerless, bool $isClientSideEncryptionSupported): bool + public function isSatisfied(string $serverVersion, string $topology, ServerParameterHelper $serverParameters, bool $isAuthenticated, bool $isClientSideEncryptionSupported): bool { if (isset($this->minServerVersion) && version_compare($serverVersion, $this->minServerVersion, '<')) { return false; @@ -131,14 +131,8 @@ public function isSatisfied(string $serverVersion, string $topology, ServerParam return false; } - if (isset($this->serverless)) { - if (! $isServerless && $this->serverless === self::SERVERLESS_REQUIRE) { - return false; - } - - if ($isServerless && $this->serverless === self::SERVERLESS_FORBID) { - return false; - } + if (isset($this->serverless) && $this->serverless === self::SERVERLESS_REQUIRE) { + return false; } if (isset($this->csfle) && $isClientSideEncryptionSupported !== $this->csfle) { diff --git a/tests/UnifiedSpecTests/ServerParameterHelper.php b/tests/UnifiedSpecTests/ServerParameterHelper.php index 8f716fa67..b0afd5684 100644 --- a/tests/UnifiedSpecTests/ServerParameterHelper.php +++ b/tests/UnifiedSpecTests/ServerParameterHelper.php @@ -10,8 +10,6 @@ final class ServerParameterHelper { - private Client $client; - /** @var array */ private array $parameters = []; @@ -19,13 +17,11 @@ final class ServerParameterHelper private bool $allParametersFetched = false; - public function __construct(Client $client) + public function __construct(private Client $client) { - $this->client = $client; } - /** @return mixed */ - public function __get(string $parameter) + public function __get(string $parameter): mixed { if (! array_key_exists($parameter, $this->parameters)) { $this->fetchParameter($parameter); @@ -68,7 +64,7 @@ private function fetchAllParameters(): void $this->parameters = $cursor->toArray()[0]; $this->allParametersFetched = true; - } catch (CommandException $e) { + } catch (CommandException) { $this->fetchAllParametersFailed = true; } } diff --git a/tests/UnifiedSpecTests/UnifiedSpecTest.php b/tests/UnifiedSpecTests/UnifiedSpecTest.php index e07e04f43..cbf504bc5 100644 --- a/tests/UnifiedSpecTests/UnifiedSpecTest.php +++ b/tests/UnifiedSpecTests/UnifiedSpecTest.php @@ -5,159 +5,76 @@ use Exception; use Generator; use MongoDB\Tests\FunctionalTestCase; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\SkippedTest; use PHPUnit\Framework\Warning; -use function basename; -use function dirname; +use function array_flip; use function glob; +use function str_starts_with; +use function strtolower; /** * Unified test format spec tests. * - * @see https://github.com/mongodb/specifications/blob/master/source/unified-test-format/unified-test-format.rst + * @see https://github.com/mongodb/specifications/blob/master/source/unified-test-format/unified-test-format.md */ class UnifiedSpecTest extends FunctionalTestCase { + /** + * Incomplete test groups are listed here. Any data set that starts with a + * string listed in this index will be skipped with the message given as + * value. + * + * @var array + */ + private static array $incompleteTestGroups = [ + // Spec tests for named KMS providers depends on unimplemented functionality from UTF schema 1.18 + 'client-side-encryption/namedKMS' => 'UTF schema 1.18 is not supported (PHPLIB-1328)', + // Many load balancer tests use CMAP events and/or assertNumberConnectionsCheckedOut + 'load-balancers/cursors are correctly pinned to connections for load-balanced clusters' => 'PHPC does not implement CMAP', + 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters' => 'PHPC does not implement CMAP', + 'load-balancers/state change errors are correctly handled' => 'PHPC does not implement CMAP', + 'load-balancers/wait queue timeout errors include details about checked out connections' => 'PHPC does not implement CMAP', + // mongoc_cluster_stream_for_server does not retry handshakes (CDRIVER-4532, PHPLIB-1033, PHPLIB-1042) + 'retryable-reads/retryable reads handshake failures' => 'Handshakes are not retried (CDRIVER-4532)', + 'retryable-writes/retryable writes handshake failures' => 'Handshakes are not retried (CDRIVER-4532)', + 'crud/bypassDocumentValidation' => 'bypassDocumentValidation is handled by libmongoc (PHPLIB-1576)', + // The rawData option will not be implemented + 'collection-management/listCollections-rawData' => 'rawData option will not be implemented', + 'crud/aggregate-rawData' => 'rawData option will not be implemented', + 'crud/BulkWrite deleteMany-rawData' => 'rawData option will not be implemented', + 'crud/BulkWrite deleteOne-rawData' => 'rawData option will not be implemented', + 'crud/BulkWrite replaceOne-rawData' => 'rawData option will not be implemented', + 'crud/BulkWrite updateMany-rawData' => 'rawData option will not be implemented', + 'crud/BulkWrite updateOne-rawData' => 'rawData option will not be implemented', + 'crud/client bulkWrite delete-rawData' => 'rawData option will not be implemented', + 'crud/client bulkWrite replaceOne-rawData' => 'rawData option will not be implemented', + 'crud/client bulkWrite update-rawData' => 'rawData option will not be implemented', + 'crud/count-rawData' => 'rawData option will not be implemented', + 'crud/countDocuments-rawData' => 'rawData option will not be implemented', + 'crud/db-aggregate-rawData' => 'rawData option will not be implemented', + 'crud/deleteMany-rawData' => 'rawData option will not be implemented', + 'crud/deleteOne-rawData' => 'rawData option will not be implemented', + 'crud/distinct-rawData' => 'rawData option will not be implemented', + 'crud/estimatedDocumentCount-rawData' => 'rawData option will not be implemented', + 'crud/find-rawData' => 'rawData option will not be implemented', + 'crud/findOneAndDelete-rawData' => 'rawData option will not be implemented', + 'crud/findOneAndReplace-rawData' => 'rawData option will not be implemented', + 'crud/findOneAndUpdate-rawData' => 'rawData option will not be implemented', + 'crud/insertMany-rawData' => 'rawData option will not be implemented', + 'crud/insertOne-rawData' => 'rawData option will not be implemented', + 'crud/replaceOne-rawData' => 'rawData option will not be implemented', + 'crud/updateMany-rawData' => 'rawData option will not be implemented', + 'crud/updateOne-rawData' => 'rawData option will not be implemented', + 'index-management/index management-rawData' => 'rawData option will not be implemented', + ]; + + /** @var array */ private static array $incompleteTests = [ // Many load balancer tests use CMAP events and/or assertNumberConnectionsCheckedOut - 'load-balancers/cursors are correctly pinned to connections for load-balanced clusters: no connection is pinned if all documents are returned in the initial batch' => 'PHPC does not implement CMAP', - 'load-balancers/cursors are correctly pinned to connections for load-balanced clusters: pinned connections are returned when the cursor is drained' => 'PHPC does not implement CMAP', - 'load-balancers/cursors are correctly pinned to connections for load-balanced clusters: pinned connections are returned to the pool when the cursor is closed' => 'PHPC does not implement CMAP', - 'load-balancers/cursors are correctly pinned to connections for load-balanced clusters: pinned connections are not returned after an network error during getMore' => 'PHPC does not implement CMAP', - 'load-balancers/cursors are correctly pinned to connections for load-balanced clusters: pinned connections are returned after a network error during a killCursors request' => 'PHPC does not implement CMAP', - 'load-balancers/cursors are correctly pinned to connections for load-balanced clusters: pinned connections are not returned to the pool after a non-network error on getMore' => 'PHPC does not implement CMAP', - 'load-balancers/cursors are correctly pinned to connections for load-balanced clusters: aggregate pins the cursor to a connection' => 'PHPC does not implement CMAP', - 'load-balancers/cursors are correctly pinned to connections for load-balanced clusters: listCollections pins the cursor to a connection' => 'PHPC does not implement CMAP', - 'load-balancers/cursors are correctly pinned to connections for load-balanced clusters: listIndexes pins the cursor to a connection' => 'PHPC does not implement CMAP', - 'load-balancers/cursors are correctly pinned to connections for load-balanced clusters: change streams pin to a connection' => 'PHPC does not implement CMAP', 'load-balancers/monitoring events include correct fields: poolClearedEvent events include serviceId' => 'PHPC does not implement CMAP', - 'load-balancers/state change errors are correctly handled: only connections for a specific serviceId are closed when pools are cleared' => 'PHPC does not implement CMAP', - 'load-balancers/state change errors are correctly handled: errors during the initial connection hello are ignored' => 'PHPC does not implement CMAP', - 'load-balancers/state change errors are correctly handled: errors during authentication are processed' => 'PHPC does not implement CMAP', - 'load-balancers/state change errors are correctly handled: stale errors are ignored' => 'PHPC does not implement CMAP', - 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters: all operations go to the same mongos' => 'PHPC does not implement CMAP', - 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters: transaction can be committed multiple times' => 'PHPC does not implement CMAP', - 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters: pinned connection is not released after a non-transient CRUD error' => 'PHPC does not implement CMAP', - 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters: pinned connection is not released after a non-transient commit error' => 'PHPC does not implement CMAP', - 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters: pinned connection is released after a non-transient abort error' => 'PHPC does not implement CMAP', - 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters: pinned connection is released after a transient non-network CRUD error' => 'PHPC does not implement CMAP', - 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters: pinned connection is released after a transient network CRUD error' => 'PHPC does not implement CMAP', - 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters: pinned connection is released after a transient non-network commit error' => 'PHPC does not implement CMAP', - 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters: pinned connection is released after a transient network commit error' => 'PHPC does not implement CMAP', - 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters: pinned connection is released after a transient non-network abort error' => 'PHPC does not implement CMAP', - 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters: pinned connection is released after a transient network abort error' => 'PHPC does not implement CMAP', - 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters: pinned connection is released on successful abort' => 'PHPC does not implement CMAP', - 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters: pinned connection is returned when a new transaction is started' => 'PHPC does not implement CMAP', - 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters: pinned connection is returned when a non-transaction operation uses the session' => 'PHPC does not implement CMAP', - 'load-balancers/transactions are correctly pinned to connections for load-balanced clusters: a connection can be shared by a transaction and a cursor' => 'PHPC does not implement CMAP', - 'load-balancers/wait queue timeout errors include details about checked out connections: wait queue timeout errors include cursor statistics' => 'PHPC does not implement CMAP', - 'load-balancers/wait queue timeout errors include details about checked out connections: wait queue timeout errors include transaction statistics' => 'PHPC does not implement CMAP', - // listDatabaseObjects is not implemented - 'retryable-reads/listDatabaseObjects-serverErrors: ListDatabaseObjects succeeds after InterruptedAtShutdown' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects-serverErrors: ListDatabaseObjects succeeds after InterruptedDueToReplStateChange' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects-serverErrors: ListDatabaseObjects succeeds after NotWritablePrimary' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects-serverErrors: ListDatabaseObjects succeeds after NotPrimaryNoSecondaryOk' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects-serverErrors: ListDatabaseObjects succeeds after NotPrimaryOrSecondary' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects-serverErrors: ListDatabaseObjects succeeds after PrimarySteppedDown' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects-serverErrors: ListDatabaseObjects succeeds after ShutdownInProgress' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects-serverErrors: ListDatabaseObjects succeeds after HostNotFound' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects-serverErrors: ListDatabaseObjects succeeds after HostUnreachable' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects-serverErrors: ListDatabaseObjects succeeds after NetworkTimeout' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects-serverErrors: ListDatabaseObjects succeeds after SocketException' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects-serverErrors: ListDatabaseObjects fails after two NotWritablePrimary errors' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects-serverErrors: ListDatabaseObjects fails after NotWritablePrimary when retryReads is false' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects: ListDatabaseObjects succeeds on first attempt' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects: ListDatabaseObjects succeeds on second attempt' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects: ListDatabaseObjects fails on first attempt' => 'listDatabaseObjects is not implemented', - 'retryable-reads/listDatabaseObjects: ListDatabaseObjects fails on second attempt' => 'listDatabaseObjects is not implemented', - // listCollectionObjects is not implemented - 'retryable-reads/listCollectionObjects-serverErrors: ListCollectionObjects succeeds after InterruptedAtShutdown' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects-serverErrors: ListCollectionObjects succeeds after InterruptedDueToReplStateChange' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects-serverErrors: ListCollectionObjects succeeds after NotWritablePrimary' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects-serverErrors: ListCollectionObjects succeeds after NotPrimaryNoSecondaryOk' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects-serverErrors: ListCollectionObjects succeeds after NotPrimaryOrSecondary' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects-serverErrors: ListCollectionObjects succeeds after PrimarySteppedDown' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects-serverErrors: ListCollectionObjects succeeds after ShutdownInProgress' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects-serverErrors: ListCollectionObjects succeeds after HostNotFound' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects-serverErrors: ListCollectionObjects succeeds after HostUnreachable' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects-serverErrors: ListCollectionObjects succeeds after NetworkTimeout' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects-serverErrors: ListCollectionObjects succeeds after SocketException' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects-serverErrors: ListCollectionObjects fails after two NotWritablePrimary errors' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects-serverErrors: ListCollectionObjects fails after NotWritablePrimary when retryReads is false' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects: ListCollectionObjects succeeds on first attempt' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects: ListCollectionObjects succeeds on second attempt' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects: ListCollectionObjects fails on first attempt' => 'listCollectionObjects is not implemented', - 'retryable-reads/listCollectionObjects: ListCollectionObjects fails on second attempt' => 'listCollectionObjects is not implemented', - // listIndexNames is not implemented - 'retryable-reads/listIndexNames-serverErrors: ListIndexNames succeeds after InterruptedAtShutdown' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames-serverErrors: ListIndexNames succeeds after InterruptedDueToReplStateChange' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames-serverErrors: ListIndexNames succeeds after NotWritablePrimary' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames-serverErrors: ListIndexNames succeeds after NotPrimaryNoSecondaryOk' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames-serverErrors: ListIndexNames succeeds after NotPrimaryOrSecondary' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames-serverErrors: ListIndexNames succeeds after PrimarySteppedDown' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames-serverErrors: ListIndexNames succeeds after ShutdownInProgress' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames-serverErrors: ListIndexNames succeeds after HostNotFound' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames-serverErrors: ListIndexNames succeeds after HostUnreachable' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames-serverErrors: ListIndexNames succeeds after NetworkTimeout' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames-serverErrors: ListIndexNames succeeds after SocketException' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames-serverErrors: ListIndexNames fails after two NotWritablePrimary errors' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames-serverErrors: ListIndexNames fails after NotWritablePrimary when retryReads is false' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames: ListIndexNames succeeds on first attempt' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames: ListIndexNames succeeds on second attempt' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames: ListIndexNames fails on first attempt' => 'listIndexNames is not implemented', - 'retryable-reads/listIndexNames: ListIndexNames fails on second attempt' => 'listIndexNames is not implemented', - // mongoc_cluster_stream_for_server does not retry handshakes (CDRIVER-4532, PHPLIB-1033, PHPLIB-1042) - 'retryable-reads/retryable reads handshake failures: client.listDatabases succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: client.listDatabases succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: client.listDatabaseNames succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: client.listDatabaseNames succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: client.createChangeStream succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: client.createChangeStream succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: database.aggregate succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: database.aggregate succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: database.listCollections succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: database.listCollections succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: database.listCollectionNames succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: database.listCollectionNames succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: database.createChangeStream succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: database.createChangeStream succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.aggregate succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.aggregate succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.countDocuments succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.countDocuments succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.estimatedDocumentCount succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.estimatedDocumentCount succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.distinct succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.distinct succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.find succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.find succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.findOne succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.findOne succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.listIndexes succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.listIndexes succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.listIndexNames succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.listIndexNames succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.createChangeStream succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-reads/retryable reads handshake failures: collection.createChangeStream succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.insertOne succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.insertOne succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.insertMany succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.insertMany succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.deleteOne succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.deleteOne succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.replaceOne succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.replaceOne succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.updateOne succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.updateOne succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.findOneAndDelete succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.findOneAndDelete succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.findOneAndReplace succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.findOneAndReplace succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.findOneAndUpdate succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.findOneAndUpdate succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.bulkWrite succeeds after retryable handshake network error' => 'Handshakes are not retried (CDRIVER-4532)', - 'retryable-writes/retryable writes handshake failures: collection.bulkWrite succeeds after retryable handshake server error (ShutdownInProgress)' => 'Handshakes are not retried (CDRIVER-4532)', // Skips dating back to legacy transaction tests 'transactions/mongos-recovery-token: commitTransaction retry fails on new mongos' => 'isMaster failpoints cannot be disabled', 'transactions/pin-mongos: remain pinned after non-transient error on commit' => 'Blocked on DRIVERS-2104', @@ -167,31 +84,27 @@ class UnifiedSpecTest extends FunctionalTestCase 'valid-pass/entity-client-cmap-events: events are captured during an operation' => 'PHPC does not implement CMAP', 'valid-pass/expectedEventsForClient-eventType: eventType can be set to command and cmap' => 'PHPC does not implement CMAP', 'valid-pass/expectedEventsForClient-eventType: eventType defaults to command if unset' => 'PHPC does not implement CMAP', - // CSOT is not yet implemented (PHPC-1760) - 'valid-pass/collectionData-createOptions: collection is created with the correct options' => 'CSOT is not yet implemented (PHPC-1760)', - 'valid-pass/createEntities-operation: createEntities operation' => 'CSOT is not yet implemented (PHPC-1760)', - 'valid-pass/entity-cursor-iterateOnce: iterateOnce' => 'CSOT is not yet implemented (PHPC-1760)', - 'valid-pass/matches-lte-operator: special lte matching operator' => 'CSOT is not yet implemented (PHPC-1760)', - // commandCursor API is not yet implemented (PHPLIB-1077) - 'valid-pass/entity-commandCursor: runCursorCommand creates and exhausts cursor by running getMores' => 'commandCursor API is not yet implemented (PHPLIB-1077)', - 'valid-pass/entity-commandCursor: createCommandCursor creates a cursor and stores it as an entity that can be iterated one document at a time' => 'commandCursor API is not yet implemented (PHPLIB-1077)', - 'valid-pass/entity-commandCursor: createCommandCursor\'s cursor can be closed and will perform a killCursors operation' => 'commandCursor API is not yet implemented (PHPLIB-1077)', // libmongoc always adds readConcern to aggregate command 'index-management/search index operations ignore read and write concern: listSearchIndexes ignores read and write concern' => 'libmongoc appends readConcern to aggregate command', - // Tests need updating of the spec test - 'crud/aggregate-write-readPreference: Aggregate with $out includes read preference for 5.0+ server' => 'PHPLIB-1458', - 'crud/aggregate-write-readPreference: Aggregate with $out omits read preference for pre-5.0 server' => 'PHPLIB-1458', - 'crud/aggregate-write-readPreference: Aggregate with $merge includes read preference for 5.0+ server' => 'PHPLIB-1458', - 'crud/aggregate-write-readPreference: Aggregate with $merge omits read preference for pre-5.0 server' => 'PHPLIB-1458', - 'crud/db-aggregate-write-readPreference: Database-level aggregate with $out includes read preference for 5.0+ server' => 'PHPLIB-1458', - 'crud/db-aggregate-write-readPreference: Database-level aggregate with $out omits read preference for pre-5.0 server' => 'PHPLIB-1458', - 'crud/db-aggregate-write-readPreference: Database-level aggregate with $merge includes read preference for 5.0+ server' => 'PHPLIB-1458', - 'crud/db-aggregate-write-readPreference: Database-level aggregate with $merge omits read preference for pre-5.0 server' => 'PHPLIB-1458', + // Uses an invalid object name + 'run-command/runCursorCommand: does not close the cursor when receiving an empty batch' => 'Uses an invalid object name', ]; + /** + * Any tests with duplicate names are skipped here. While test names should + * not be reused in spec tests, this offers a way to skip such tests until + * the name is changed. + * + * @var array + */ + private static array $duplicateTests = []; + /** * Any tests that rely on session pinning (including targetedFailPoint) must - * be skipped since libmongoc does not pin on load-balanced toplogies. */ + * be skipped since libmongoc does not pin on load-balanced toplogies. + * + * @var array + */ private static array $incompleteLoadBalancerTests = [ 'transactions/mongos-recovery-token: commitTransaction explicit retries include recoveryToken' => 'libmongoc omits recoveryToken for load-balanced topology (CDRIVER-4718)', 'transactions/pin-mongos: multiple commits' => 'libmongoc does not pin for load-balanced topology', @@ -199,6 +112,8 @@ class UnifiedSpecTest extends FunctionalTestCase private static UnifiedTestRunner $runner; + private static string $testDir = __DIR__ . '/../specifications/source'; + public static function setUpBeforeClass(): void { parent::setUpBeforeClass(); @@ -219,244 +134,193 @@ public function setUp(): void if ($this->isLoadBalanced() && isset(self::$incompleteLoadBalancerTests[$this->dataDescription()])) { $this->markTestIncomplete(self::$incompleteLoadBalancerTests[$this->dataDescription()]); } - } - /** - * @dataProvider provideAtlasDataLakeTests - * @group atlas-data-lake - */ - public function testAtlasDataLake(UnifiedTestCase $test): void - { - if (! $this->isAtlasDataLake()) { - $this->markTestSkipped('Server is not Atlas Data Lake'); + foreach (self::$incompleteTestGroups as $testGroup => $reason) { + if (str_starts_with(strtolower($this->dataDescription()), strtolower($testGroup))) { + $this->markTestIncomplete($reason); + } } - - self::$runner->run($test); } - public function provideAtlasDataLakeTests() - { - return $this->provideTests(__DIR__ . '/atlas-data-lake/*.json'); - } - - /** - * @dataProvider provideChangeStreamsTests - * @group serverless - */ + #[DataProvider('provideChangeStreamsTests')] public function testChangeStreams(UnifiedTestCase $test): void { self::$runner->run($test); } - public function provideChangeStreamsTests() + public static function provideChangeStreamsTests(): Generator { - return $this->provideTests(__DIR__ . '/change-streams/*.json'); + return self::provideTests('change-streams/tests/unified', 'change-streams'); } - /** - * @dataProvider provideClientSideEncryptionTests - * @group csfle - * @group serverless - */ + #[DataProvider('provideClientSideEncryptionTests')] + #[Group('csfle')] public function testClientSideEncryption(UnifiedTestCase $test): void { self::$runner->run($test); } - public function provideClientSideEncryptionTests() + public static function provideClientSideEncryptionTests(): Generator { - return $this->provideTests(__DIR__ . '/client-side-encryption/*.json'); + return self::provideTests('client-side-encryption/tests/unified', 'client-side-encryption'); } - /** - * @dataProvider provideCollectionManagementTests - * @group serverless - */ + #[DataProvider('provideCollectionManagementTests')] public function testCollectionManagement(UnifiedTestCase $test): void { self::$runner->run($test); } - public function provideCollectionManagementTests() + public static function provideCollectionManagementTests(): Generator { - return $this->provideTests(__DIR__ . '/collection-management/*.json'); + return self::provideTests('collection-management/tests', 'collection-management'); } - /** - * @dataProvider provideCommandMonitoringTests - * @group serverless - */ + #[DataProvider('provideCommandMonitoringTests')] public function testCommandMonitoring(UnifiedTestCase $test): void { self::$runner->run($test); } - public function provideCommandMonitoringTests() + public static function provideCommandMonitoringTests(): Generator { - return $this->provideTests(__DIR__ . '/command-monitoring/*.json'); + return self::provideTests('command-logging-and-monitoring/tests/monitoring', 'command-monitoring'); } - /** - * @dataProvider provideCrudTests - * @group serverless - */ + #[DataProvider('provideCrudTests')] public function testCrud(UnifiedTestCase $test): void { self::$runner->run($test); } - public function provideCrudTests() + public static function provideCrudTests(): Generator { - return $this->provideTests(__DIR__ . '/crud/*.json'); + return self::provideTests('crud/tests/unified', 'crud'); } - /** - * @dataProvider provideGridFSTests - * @group serverless - */ + #[DataProvider('provideGridFSTests')] public function testGridFS(UnifiedTestCase $test): void { self::$runner->run($test); } - public function provideGridFSTests() + public static function provideGridFSTests(): Generator { - return $this->provideTests(__DIR__ . '/gridfs/*.json'); + return self::provideTests('gridfs/tests', 'gridfs'); } - /** - * @dataProvider provideLoadBalancers - * @group serverless - */ + #[DataProvider('provideLoadBalancers')] public function testLoadBalancers(UnifiedTestCase $test): void { self::$runner->run($test); } - public function provideLoadBalancers() + public static function provideLoadBalancers(): Generator { - return $this->provideTests(__DIR__ . '/load-balancers/*.json'); + return self::provideTests('load-balancers/tests', 'load-balancers'); } - /** @dataProvider provideReadWriteConcernTests */ + #[DataProvider('provideReadWriteConcernTests')] public function testReadWriteConcern(UnifiedTestCase $test): void { self::$runner->run($test); } - public function provideReadWriteConcernTests() + public static function provideReadWriteConcernTests(): Generator { - return $this->provideTests(__DIR__ . '/read-write-concern/*.json'); + return self::provideTests('read-write-concern/tests/operation', 'read-write-concern'); } - /** - * @dataProvider provideRetryableReadsTests - * @group serverless - */ + #[DataProvider('provideRetryableReadsTests')] public function testRetryableReads(UnifiedTestCase $test): void { self::$runner->run($test); } - public function provideRetryableReadsTests() + public static function provideRetryableReadsTests(): Generator { - return $this->provideTests(__DIR__ . '/retryable-reads/*.json'); + return self::provideTests('retryable-reads/tests/unified', 'retryable-reads'); } - /** - * @dataProvider provideRetryableWritesTests - * @group serverless - */ + #[DataProvider('provideRetryableWritesTests')] public function testRetryableWrites(UnifiedTestCase $test): void { self::$runner->run($test); } - public function provideRetryableWritesTests() + public static function provideRetryableWritesTests(): Generator { - return $this->provideTests(__DIR__ . '/retryable-writes/*.json'); + return self::provideTests('retryable-writes/tests/unified', 'retryable-writes'); } - /** - * @dataProvider provideRunCommandTests - * @group serverless - */ + #[DataProvider('provideRunCommandTests')] public function testRunCommand(UnifiedTestCase $test): void { self::$runner->run($test); } - public function provideRunCommandTests() + public static function provideRunCommandTests(): Generator { - return $this->provideTests(__DIR__ . '/run-command/*.json'); + return self::provideTests('run-command/tests/unified', 'run-command'); } - /** - * @dataProvider provideSessionsTests - * @group serverless - */ + #[DataProvider('provideSessionsTests')] public function testSessions(UnifiedTestCase $test): void { self::$runner->run($test); } - public function provideSessionsTests() + public static function provideSessionsTests(): Generator { - return $this->provideTests(__DIR__ . '/sessions/*.json'); + return self::provideTests('sessions/tests', 'sessions'); } - /** - * @dataProvider provideTransactionsTests - * @group serverless - */ + #[DataProvider('provideTransactionsTests')] public function testTransactions(UnifiedTestCase $test): void { self::$runner->run($test); } - public function provideTransactionsTests() + public static function provideTransactionsTests(): Generator { - return $this->provideTests(__DIR__ . '/transactions/*.json'); + return self::provideTests('transactions/tests/unified', 'transactions'); } - /** @dataProvider provideTransactionsConvenientApiTests */ + #[DataProvider('provideTransactionsConvenientApiTests')] public function testTransactionsConvenientApi(UnifiedTestCase $test): void { self::$runner->run($test); } - public function provideTransactionsConvenientApiTests() + public static function provideTransactionsConvenientApiTests(): Generator { - return $this->provideTests(__DIR__ . '/transactions-convenient-api/*.json'); + return self::provideTests('transactions-convenient-api/tests/unified', 'transactions-convenient-api'); } - /** - * @dataProvider provideVersionedApiTests - * @group serverless - * @group versioned-api - */ + #[DataProvider('provideVersionedApiTests')] + #[Group('versioned-api')] public function testVersionedApi(UnifiedTestCase $test): void { self::$runner->run($test); } - public function provideVersionedApiTests() + public static function provideVersionedApiTests(): Generator { - return $this->provideTests(__DIR__ . '/versioned-api/*.json'); + return self::provideTests('versioned-api/tests', 'versioned-api'); } - /** @dataProvider providePassingTests */ + #[DataProvider('providePassingTests')] public function testPassingTests(UnifiedTestCase $test): void { self::$runner->run($test); } - public function providePassingTests() + public static function providePassingTests(): Generator { - yield from $this->provideTests(__DIR__ . '/valid-pass/*.json'); + yield from self::provideTests('unified-test-format/tests/valid-pass', 'valid-pass'); } - /** @dataProvider provideFailingTests */ + #[DataProvider('provideFailingTests')] public function testFailingTests(UnifiedTestCase $test): void { // Cannot use expectException(), as it ignores PHPUnit Exceptions @@ -489,12 +353,12 @@ public function testFailingTests(UnifiedTestCase $test): void $this->assertTrue($failed, 'Expected test to throw an exception'); } - public function provideFailingTests() + public static function provideFailingTests(): Generator { - yield from $this->provideTests(__DIR__ . '/valid-fail/*.json'); + yield from self::provideTests('unified-test-format/tests/valid-fail', 'valid-fail'); } - /** @dataProvider provideIndexManagementTests */ + #[DataProvider('provideIndexManagementTests')] public function testIndexManagement(UnifiedTestCase $test): void { if (self::isAtlas()) { @@ -508,18 +372,26 @@ public function testIndexManagement(UnifiedTestCase $test): void self::$runner->run($test); } - public function provideIndexManagementTests() + public static function provideIndexManagementTests(): Generator { - yield from $this->provideTests(__DIR__ . '/index-management/*.json'); + yield from self::provideTests('index-management/tests', 'index-management'); } - private function provideTests(string $pattern): Generator + private static function provideTests(string $directory, string $testGroup): Generator { - foreach (glob($pattern) as $filename) { - $group = basename(dirname($filename)); + $pattern = self::$testDir . '/' . $directory . '/*.json'; + + $duplicateTests = array_flip(self::$duplicateTests); + foreach (glob($pattern) as $filename) { foreach (UnifiedTestCase::fromFile($filename) as $name => $test) { - yield $group . '/' . $name => [$test]; + $testKey = $testGroup . '/' . $name; + + if (isset($duplicateTests[$testKey])) { + continue; + } + + yield $testKey => [$test]; } } } diff --git a/tests/UnifiedSpecTests/UnifiedTestCase.php b/tests/UnifiedSpecTests/UnifiedTestCase.php index 3df7e842e..9b12445d7 100644 --- a/tests/UnifiedSpecTests/UnifiedTestCase.php +++ b/tests/UnifiedSpecTests/UnifiedTestCase.php @@ -20,27 +20,12 @@ * within a JSON object conforming to the unified test format's JSON schema. * This test case may be executed by UnifiedTestRunner::run(). * - * @see https://github.com/mongodb/specifications/blob/master/source/unified-test-format/unified-test-format.rst + * @see https://github.com/mongodb/specifications/blob/master/source/unified-test-format/unified-test-format.md */ final class UnifiedTestCase implements IteratorAggregate { - private stdClass $test; - - private string $schemaVersion; - - private ?array $runOnRequirements = null; - - private ?array $createEntities = null; - - private ?array $initialData = null; - - private function __construct(stdClass $test, string $schemaVersion, ?array $runOnRequirements = null, ?array $createEntities = null, ?array $initialData = null) + private function __construct(private stdClass $test, private string $schemaVersion, private ?array $runOnRequirements = null, private ?array $createEntities = null, private ?array $initialData = null) { - $this->test = $test; - $this->schemaVersion = $schemaVersion; - $this->runOnRequirements = $runOnRequirements; - $this->createEntities = $createEntities; - $this->initialData = $initialData; } /** diff --git a/tests/UnifiedSpecTests/UnifiedTestRunner.php b/tests/UnifiedSpecTests/UnifiedTestRunner.php index f816d8456..3069636b7 100644 --- a/tests/UnifiedSpecTests/UnifiedTestRunner.php +++ b/tests/UnifiedSpecTests/UnifiedTestRunner.php @@ -20,7 +20,6 @@ use function call_user_func; use function count; use function explode; -use function filter_var; use function gc_collect_cycles; use function getenv; use function implode; @@ -41,12 +40,10 @@ use function substr_replace; use function version_compare; -use const FILTER_VALIDATE_BOOLEAN; - /** * Unified test runner. * - * @see https://github.com/mongodb/specifications/blob/master/source/unified-test-format/unified-test-format.rst + * @see https://github.com/mongodb/specifications/blob/master/source/unified-test-format/unified-test-format.md */ final class UnifiedTestRunner { @@ -58,18 +55,21 @@ final class UnifiedTestRunner /** * Support for the following schema versions is incomplete: * - * - 1.9: Only createEntities operation is implemented + * - 1.9: collectionOrDatabaseOptions.timeoutMS and expectedError.isTimeoutError are not implemented * - 1.10: Not implemented * - 1.11: Not implemented, but CMAP is not applicable - * - 1.13: Not implemented + * - 1.13: Only $$matchAsDocument and $$matchAsRoot is implemented * - 1.14: Not implemented + * - 1.16: Not implemented + * - 1.17: Not implemented + * - 1.18: Not implemented + * - 1.19: Not implemented + * - 1.20: Not implemented */ - public const MAX_SCHEMA_VERSION = '1.15'; + public const MAX_SCHEMA_VERSION = '1.21'; private Client $internalClient; - private string $internalClientUri; - private bool $allowKillAllSessions = true; private ?EntityMap $entityMap = null; @@ -79,10 +79,9 @@ final class UnifiedTestRunner private ServerParameterHelper $serverParameterHelper; - public function __construct(string $internalClientUri) + public function __construct(private string $internalClientUri) { $this->internalClient = FunctionalTestCase::createTestClient($internalClientUri); - $this->internalClientUri = $internalClientUri; /* Atlas prohibits killAllSessions. Inspect the connection string to * determine if we should avoid calling killAllSessions(). This does @@ -90,7 +89,7 @@ public function __construct(string $internalClientUri) * * Atlas Data Lake also does not support killAllSessions. */ - if ($this->isServerless() || FunctionalTestCase::isAtlas($internalClientUri) || $this->isAtlasDataLake()) { + if (FunctionalTestCase::isAtlas($internalClientUri) || $this->isAtlasDataLake()) { $this->allowKillAllSessions = false; } @@ -250,7 +249,6 @@ private function checkRunOnRequirements(array $runOnRequirements): void $this->getTopology(), $this->serverParameterHelper, $this->isAuthenticated(), - $this->isServerless(), $this->isClientSideEncryptionSupported(), ]; } @@ -297,25 +295,16 @@ private function getServerVersion(): string */ private function getTopology(): string { - switch ($this->getPrimaryServer()->getType()) { - case Server::TYPE_STANDALONE: - return RunOnRequirement::TOPOLOGY_SINGLE; - - case Server::TYPE_RS_PRIMARY: - return RunOnRequirement::TOPOLOGY_REPLICASET; - - case Server::TYPE_MONGOS: - /* Since MongoDB 3.6, all sharded clusters use replica sets. The - * unified test format deprecated use of "sharded-replicaset" in - * tests but we should still identify as such. */ - return RunOnRequirement::TOPOLOGY_SHARDED_REPLICASET; - - case Server::TYPE_LOAD_BALANCER: - return RunOnRequirement::TOPOLOGY_LOAD_BALANCED; - - default: - throw new UnexpectedValueException('Topology is neither single nor RS nor sharded'); - } + return match ($this->getPrimaryServer()->getType()) { + Server::TYPE_STANDALONE => RunOnRequirement::TOPOLOGY_SINGLE, + Server::TYPE_RS_PRIMARY => RunOnRequirement::TOPOLOGY_REPLICASET, + /* Since MongoDB 3.6, all sharded clusters use replica sets. The + * unified test format deprecated use of "sharded-replicaset" in + * tests but we should still identify as such. */ + Server::TYPE_MONGOS => RunOnRequirement::TOPOLOGY_SHARDED_REPLICASET, + Server::TYPE_LOAD_BALANCER => RunOnRequirement::TOPOLOGY_LOAD_BALANCED, + default => throw new UnexpectedValueException('Topology is neither single nor RS nor sharded'), + }; } private function isAtlasDataLake(): bool @@ -328,10 +317,6 @@ private function isAtlasDataLake(): bool /** * Return whether the connection is authenticated. - * - * Note: if the connectionStatus command is not portable for serverless, it - * may be necessary to rewrite this to instead inspect the connection string - * or consult an environment variable, as is done in libmongoc. */ private function isAuthenticated(): bool { @@ -365,16 +350,6 @@ private function isClientSideEncryptionSupported(): bool return FunctionalTestCase::isCryptSharedLibAvailable() || FunctionalTestCase::isMongocryptdAvailable(); } - /** - * Return whether serverless (i.e. proxy as mongos) is being utilized. - */ - private function isServerless(): bool - { - $isServerless = getenv('MONGODB_IS_SERVERLESS'); - - return $isServerless !== false ? filter_var($isServerless, FILTER_VALIDATE_BOOLEAN) : false; - } - /** * Checks is a test format schema version is supported. */ @@ -481,7 +456,7 @@ private function isAdvanceClusterTimeNeeded(array $operations): bool /** * Work around potential error executing distinct on sharded clusters. * - * @see https://github.com/mongodb/specifications/blob/master/source/unified-test-format/unified-test-format.rst#staledbversion-errors-on-sharded-clusters + * @see https://github.com/mongodb/specifications/blob/master/source/unified-test-format/unified-test-format.md#staledbversion-errors-on-sharded-clusters */ private function preventStaleDbVersionError(array $operations, Context $context): void { @@ -542,7 +517,7 @@ private function createContext(): Context $context->setUrisForUseMultipleMongoses($singleMongosUri, $multiMongosUri); } - if ($this->getPrimaryServer()->getType() === Server::TYPE_LOAD_BALANCER && ! $this->isServerless()) { + if ($this->getPrimaryServer()->getType() === Server::TYPE_LOAD_BALANCER) { $singleMongosUri = getenv('MONGODB_SINGLE_MONGOS_LB_URI'); $multiMongosUri = getenv('MONGODB_MULTI_MONGOS_LB_URI'); diff --git a/tests/UnifiedSpecTests/Util.php b/tests/UnifiedSpecTests/Util.php index 4f2fb22f1..e134cb109 100644 --- a/tests/UnifiedSpecTests/Util.php +++ b/tests/UnifiedSpecTests/Util.php @@ -58,6 +58,7 @@ final class Util 'loop' => ['operations', 'storeErrorsAsEntity', 'storeFailuresAsEntity', 'storeSuccessesAsEntity', 'storeIterationsAsEntity'], ], Client::class => [ + 'clientBulkWrite' => ['models', 'bypassDocumentValidation', 'comment', 'let', 'ordered', 'session', 'verboseResults', 'writeConcern'], 'createChangeStream' => ['pipeline', 'session', 'fullDocument', 'resumeAfter', 'startAfter', 'startAtOperationTime', 'batchSize', 'collation', 'maxAwaitTimeMS', 'showExpandedEvents'], 'listDatabaseNames' => ['authorizedDatabases', 'filter', 'maxTimeMS', 'session'], 'listDatabases' => ['authorizedDatabases', 'filter', 'maxTimeMS', 'session'], @@ -75,7 +76,7 @@ final class Util Database::class => [ 'aggregate' => ['pipeline', 'session', 'allowDiskUse', 'batchSize', 'bypassDocumentValidation', 'collation', 'comment', 'explain', 'hint', 'let', 'maxAwaitTimeMS', 'maxTimeMS'], 'createChangeStream' => ['pipeline', 'session', 'fullDocument', 'resumeAfter', 'startAfter', 'startAtOperationTime', 'batchSize', 'collation', 'maxAwaitTimeMS', 'showExpandedEvents'], - 'createCollection' => ['collection', 'session', 'autoIndexId', 'capped', 'changeStreamPreAndPostImages', 'clusteredIndex', 'collation', 'expireAfterSeconds', 'flags', 'indexOptionDefaults', 'max', 'maxTimeMS', 'pipeline', 'size', 'storageEngine', 'timeseries', 'validationAction', 'validationLevel', 'validator', 'viewOn'], + 'createCollection' => ['collection', 'session', 'capped', 'changeStreamPreAndPostImages', 'clusteredIndex', 'collation', 'expireAfterSeconds', 'indexOptionDefaults', 'max', 'maxTimeMS', 'pipeline', 'size', 'storageEngine', 'timeseries', 'validationAction', 'validationLevel', 'validator', 'viewOn'], 'dropCollection' => ['collection', 'session'], 'listCollectionNames' => ['authorizedCollections', 'filter', 'maxTimeMS', 'session'], 'listCollections' => ['authorizedCollections', 'filter', 'maxTimeMS', 'session'], @@ -87,7 +88,7 @@ final class Util 'aggregate' => ['pipeline', 'session', 'allowDiskUse', 'batchSize', 'bypassDocumentValidation', 'collation', 'comment', 'explain', 'hint', 'let', 'maxAwaitTimeMS', 'maxTimeMS'], 'bulkWrite' => ['let', 'requests', 'session', 'ordered', 'bypassDocumentValidation', 'comment'], 'createChangeStream' => ['pipeline', 'session', 'fullDocument', 'fullDocumentBeforeChange', 'resumeAfter', 'startAfter', 'startAtOperationTime', 'batchSize', 'collation', 'maxAwaitTimeMS', 'comment', 'showExpandedEvents'], - 'createFindCursor' => ['filter', 'session', 'allowDiskUse', 'allowPartialResults', 'batchSize', 'collation', 'comment', 'cursorType', 'hint', 'limit', 'max', 'maxAwaitTimeMS', 'maxScan', 'maxTimeMS', 'min', 'modifiers', 'noCursorTimeout', 'oplogReplay', 'projection', 'returnKey', 'showRecordId', 'skip', 'snapshot', 'sort'], + 'createFindCursor' => ['filter', 'session', 'allowDiskUse', 'allowPartialResults', 'batchSize', 'collation', 'comment', 'cursorType', 'hint', 'limit', 'max', 'maxAwaitTimeMS', 'maxTimeMS', 'min', 'noCursorTimeout', 'projection', 'returnKey', 'showRecordId', 'skip', 'sort'], 'createIndex' => ['keys', 'comment', 'commitQuorum', 'maxTimeMS', 'name', 'session', 'unique'], 'createSearchIndex' => ['model'], 'createSearchIndexes' => ['models'], @@ -98,17 +99,17 @@ final class Util 'deleteMany' => ['let', 'filter', 'session', 'collation', 'hint', 'comment'], 'deleteOne' => ['let', 'filter', 'session', 'collation', 'hint', 'comment'], 'findOneAndDelete' => ['let', 'filter', 'session', 'projection', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'maxTimeMS', 'new', 'sort', 'update', 'upsert', 'comment'], - 'distinct' => ['fieldName', 'filter', 'session', 'collation', 'maxTimeMS', 'comment'], + 'distinct' => ['fieldName', 'filter', 'session', 'collation', 'maxTimeMS', 'comment', 'hint'], 'drop' => ['session', 'comment'], 'dropSearchIndex' => ['name'], - 'find' => ['let', 'filter', 'session', 'allowDiskUse', 'allowPartialResults', 'batchSize', 'collation', 'comment', 'cursorType', 'hint', 'limit', 'max', 'maxAwaitTimeMS', 'maxScan', 'maxTimeMS', 'min', 'modifiers', 'noCursorTimeout', 'oplogReplay', 'projection', 'returnKey', 'showRecordId', 'skip', 'snapshot', 'sort'], - 'findOne' => ['let', 'filter', 'session', 'allowDiskUse', 'allowPartialResults', 'batchSize', 'collation', 'comment', 'cursorType', 'hint', 'max', 'maxAwaitTimeMS', 'maxScan', 'maxTimeMS', 'min', 'modifiers', 'noCursorTimeout', 'oplogReplay', 'projection', 'returnKey', 'showRecordId', 'skip', 'snapshot', 'sort'], + 'find' => ['let', 'filter', 'session', 'allowDiskUse', 'allowPartialResults', 'batchSize', 'collation', 'comment', 'cursorType', 'hint', 'limit', 'max', 'maxAwaitTimeMS', 'maxTimeMS', 'min', 'noCursorTimeout', 'projection', 'returnKey', 'showRecordId', 'skip', 'sort'], + 'findOne' => ['let', 'filter', 'session', 'allowDiskUse', 'allowPartialResults', 'batchSize', 'collation', 'comment', 'cursorType', 'hint', 'max', 'maxAwaitTimeMS', 'maxTimeMS', 'min', 'noCursorTimeout', 'projection', 'returnKey', 'showRecordId', 'skip', 'sort'], 'findOneAndReplace' => ['let', 'returnDocument', 'filter', 'replacement', 'session', 'projection', 'returnDocument', 'upsert', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'maxTimeMS', 'new', 'remove', 'sort', 'comment'], 'rename' => ['to', 'comment', 'dropTarget'], - 'replaceOne' => ['let', 'filter', 'replacement', 'session', 'upsert', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'comment'], + 'replaceOne' => ['let', 'filter', 'replacement', 'session', 'upsert', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'comment', 'sort'], 'findOneAndUpdate' => ['let', 'returnDocument', 'filter', 'update', 'session', 'upsert', 'projection', 'remove', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'maxTimeMS', 'sort', 'comment'], 'updateMany' => ['let', 'filter', 'update', 'session', 'upsert', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'comment'], - 'updateOne' => ['let', 'filter', 'update', 'session', 'upsert', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'comment'], + 'updateOne' => ['let', 'filter', 'update', 'session', 'upsert', 'arrayFilters', 'bypassDocumentValidation', 'collation', 'hint', 'comment', 'sort'], 'updateSearchIndex' => ['name', 'definition'], 'insertMany' => ['documents', 'session', 'ordered', 'bypassDocumentValidation', 'comment'], 'insertOne' => ['document', 'session', 'bypassDocumentValidation', 'comment'], @@ -132,10 +133,14 @@ final class Util ], Bucket::class => [ 'delete' => ['id'], + 'deleteByName' => ['filename'], 'downloadByName' => ['filename', 'revision'], 'download' => ['id'], - 'uploadWithId' => ['id', 'filename', 'source', 'chunkSizeBytes', 'disableMD5', 'contentType', 'metadata'], - 'upload' => ['filename', 'source', 'chunkSizeBytes', 'disableMD5', 'contentType', 'metadata'], + 'rename' => ['id', 'newFilename'], + 'renameByName' => ['filename', 'newFilename'], + // "disableMD5" is ignored but allowed for backward compatibility + 'uploadWithId' => ['id', 'filename', 'source', 'chunkSizeBytes', 'disableMD5', 'metadata'], + 'upload' => ['filename', 'source', 'chunkSizeBytes', 'disableMD5', 'metadata'], ], ]; diff --git a/tests/UnifiedSpecTests/atlas-data-lake/aggregate.json b/tests/UnifiedSpecTests/atlas-data-lake/aggregate.json deleted file mode 100644 index 68a3467c7..000000000 --- a/tests/UnifiedSpecTests/atlas-data-lake/aggregate.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "description": "aggregate", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "test" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "driverdata" - } - } - ], - "tests": [ - { - "description": "Aggregate with pipeline (project, sort, limit)", - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 0 - } - }, - { - "$sort": { - "a": 1 - } - }, - { - "$limit": 2 - } - ] - }, - "expectResult": [ - { - "a": 1, - "b": 2, - "c": 3 - }, - { - "a": 2, - "b": 3, - "c": 4 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "driverdata" - }, - "commandName": "aggregate", - "databaseName": "test" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/atlas-data-lake/estimatedDocumentCount.json b/tests/UnifiedSpecTests/atlas-data-lake/estimatedDocumentCount.json deleted file mode 100644 index b7515a441..000000000 --- a/tests/UnifiedSpecTests/atlas-data-lake/estimatedDocumentCount.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "description": "estimatedDocumentCount", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "test" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "driverdata" - } - } - ], - "tests": [ - { - "description": "estimatedDocumentCount succeeds", - "operations": [ - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectResult": 15 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "driverdata" - }, - "commandName": "count", - "databaseName": "test" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/atlas-data-lake/find.json b/tests/UnifiedSpecTests/atlas-data-lake/find.json deleted file mode 100644 index d0652dc72..000000000 --- a/tests/UnifiedSpecTests/atlas-data-lake/find.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "description": "find", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "test" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "driverdata" - } - } - ], - "tests": [ - { - "description": "Find with projection and sort", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "b": { - "$gt": 5 - } - }, - "projection": { - "_id": 0 - }, - "sort": { - "a": 1 - }, - "limit": 5 - }, - "expectResult": [ - { - "a": 5, - "b": 6, - "c": 7 - }, - { - "a": 6, - "b": 7, - "c": 8 - }, - { - "a": 7, - "b": 8, - "c": 9 - }, - { - "a": 8, - "b": 9, - "c": 10 - }, - { - "a": 9, - "b": 10, - "c": 11 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "driverdata" - }, - "commandName": "find", - "databaseName": "test" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/atlas-data-lake/getMore.json b/tests/UnifiedSpecTests/atlas-data-lake/getMore.json deleted file mode 100644 index 109b6d3d8..000000000 --- a/tests/UnifiedSpecTests/atlas-data-lake/getMore.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "description": "getMore", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "test" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "driverdata" - } - } - ], - "tests": [ - { - "description": "A successful find event with getMore", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "a": { - "$gte": 2 - } - }, - "sort": { - "a": 1 - }, - "batchSize": 3, - "limit": 4 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "driverdata", - "filter": { - "a": { - "$gte": 2 - } - }, - "sort": { - "a": 1 - }, - "batchSize": 3, - "limit": 4 - }, - "commandName": "find", - "databaseName": "test" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": { - "$$type": "string" - }, - "batchSize": 1 - }, - "commandName": "getMore", - "databaseName": "cursors" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/atlas-data-lake/listCollections.json b/tests/UnifiedSpecTests/atlas-data-lake/listCollections.json deleted file mode 100644 index 642e7ed32..000000000 --- a/tests/UnifiedSpecTests/atlas-data-lake/listCollections.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "description": "listCollections", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "test" - } - } - ], - "tests": [ - { - "description": "ListCollections succeeds", - "operations": [ - { - "object": "database0", - "name": "listCollections" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - }, - "commandName": "listCollections", - "databaseName": "test" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/atlas-data-lake/listDatabases.json b/tests/UnifiedSpecTests/atlas-data-lake/listDatabases.json deleted file mode 100644 index 64506ee54..000000000 --- a/tests/UnifiedSpecTests/atlas-data-lake/listDatabases.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "description": "listDatabases", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - } - ], - "tests": [ - { - "description": "ListCollections succeeds", - "operations": [ - { - "object": "client0", - "name": "listDatabases" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - }, - "commandName": "listDatabases", - "databaseName": "admin" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/atlas-data-lake/runCommand.json b/tests/UnifiedSpecTests/atlas-data-lake/runCommand.json deleted file mode 100644 index 325b6b3f3..000000000 --- a/tests/UnifiedSpecTests/atlas-data-lake/runCommand.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "description": "runCommand", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "test" - } - } - ], - "tests": [ - { - "description": "ping succeeds using runCommand", - "operations": [ - { - "object": "database0", - "name": "runCommand", - "arguments": { - "command": { - "ping": 1 - }, - "commandName": "ping" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "commandName": "ping", - "databaseName": "test" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/change-streams/change-streams-clusterTime.json b/tests/UnifiedSpecTests/change-streams/change-streams-clusterTime.json deleted file mode 100644 index 2b09e548f..000000000 --- a/tests/UnifiedSpecTests/change-streams/change-streams-clusterTime.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "description": "change-streams-clusterTime", - "schemaVersion": "1.4", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - } - ], - "runOnRequirements": [ - { - "minServerVersion": "4.0.0", - "topologies": [ - "replicaset", - "load-balanced", - "sharded" - ], - "serverless": "forbid" - } - ], - "initialData": [ - { - "collectionName": "collection0", - "databaseName": "database0", - "documents": [] - } - ], - "tests": [ - { - "description": "clusterTime is present", - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "ns": { - "db": "database0", - "coll": "collection0" - }, - "clusterTime": { - "$$exists": true - } - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/change-streams/change-streams-disambiguatedPaths.json b/tests/UnifiedSpecTests/change-streams/change-streams-disambiguatedPaths.json deleted file mode 100644 index e6cc5ef66..000000000 --- a/tests/UnifiedSpecTests/change-streams/change-streams-disambiguatedPaths.json +++ /dev/null @@ -1,251 +0,0 @@ -{ - "description": "disambiguatedPaths", - "schemaVersion": "1.4", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - } - ], - "runOnRequirements": [ - { - "minServerVersion": "6.1.0", - "topologies": [ - "replicaset", - "load-balanced", - "sharded" - ], - "serverless": "forbid" - } - ], - "initialData": [ - { - "collectionName": "collection0", - "databaseName": "database0", - "documents": [] - } - ], - "tests": [ - { - "description": "disambiguatedPaths is not present when showExpandedEvents is false/unset", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": { - "1": 1 - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "a.1": 2 - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "update", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "updateDescription": { - "updatedFields": { - "$$exists": true - }, - "removedFields": { - "$$exists": true - }, - "truncatedArrays": { - "$$exists": true - }, - "disambiguatedPaths": { - "$$exists": false - } - } - } - } - ] - }, - { - "description": "disambiguatedPaths is present on updateDescription when an ambiguous path is present", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": { - "1": 1 - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "showExpandedEvents": true - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "a.1": 2 - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "update", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "updateDescription": { - "updatedFields": { - "$$exists": true - }, - "removedFields": { - "$$exists": true - }, - "truncatedArrays": { - "$$exists": true - }, - "disambiguatedPaths": { - "a.1": [ - "a", - "1" - ] - } - } - } - } - ] - }, - { - "description": "disambiguatedPaths returns array indices as integers", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": [ - { - "1": 1 - } - ] - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "showExpandedEvents": true - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "a.0.1": 2 - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "update", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "updateDescription": { - "updatedFields": { - "$$exists": true - }, - "removedFields": { - "$$exists": true - }, - "truncatedArrays": { - "$$exists": true - }, - "disambiguatedPaths": { - "a.0.1": [ - "a", - { - "$$type": "int" - }, - "1" - ] - } - } - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/change-streams/change-streams-errors.json b/tests/UnifiedSpecTests/change-streams/change-streams-errors.json deleted file mode 100644 index 65e99e541..000000000 --- a/tests/UnifiedSpecTests/change-streams/change-streams-errors.json +++ /dev/null @@ -1,246 +0,0 @@ -{ - "description": "change-streams-errors", - "schemaVersion": "1.7", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ], - "useMultipleMongoses": false - } - }, - { - "client": { - "id": "globalClient", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - }, - { - "database": { - "id": "globalDatabase0", - "client": "globalClient", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "globalCollection0", - "database": "globalDatabase0", - "collectionName": "collection0" - } - } - ], - "initialData": [ - { - "collectionName": "collection0", - "databaseName": "database0", - "documents": [] - } - ], - "tests": [ - { - "description": "The watch helper must not throw a custom exception when executed against a single server topology, but instead depend on a server error", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "topologies": [ - "single" - ] - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "expectError": { - "errorCode": 40573 - } - } - ] - }, - { - "description": "Change Stream should error when an invalid aggregation stage is passed in", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "topologies": [ - "replicaset" - ] - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$unsupported": "foo" - } - ] - }, - "expectError": { - "errorCode": 40324 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - }, - { - "$unsupported": "foo" - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "Change Stream should error when _id is projected out", - "runOnRequirements": [ - { - "minServerVersion": "4.1.11", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 0 - } - } - ] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "z": 3 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectError": { - "errorCode": 280 - } - } - ] - }, - { - "description": "change stream errors on ElectionInProgress", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 216, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "z": 3 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectError": { - "errorCode": 216 - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/change-streams/change-streams-pre_and_post_images.json b/tests/UnifiedSpecTests/change-streams/change-streams-pre_and_post_images.json deleted file mode 100644 index e62fc0345..000000000 --- a/tests/UnifiedSpecTests/change-streams/change-streams-pre_and_post_images.json +++ /dev/null @@ -1,827 +0,0 @@ -{ - "description": "change-streams-pre_and_post_images", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "6.0.0", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ], - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "collMod", - "insert", - "update", - "getMore", - "killCursors" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "change-stream-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "change-stream-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ], - "tests": [ - { - "description": "fullDocument:whenAvailable with changeStreamPreAndPostImages enabled", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "collMod", - "command": { - "collMod": "test", - "changeStreamPreAndPostImages": { - "enabled": true - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "fullDocument": "whenAvailable" - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "update", - "ns": { - "db": "change-stream-tests", - "coll": "test" - }, - "updateDescription": { - "$$type": "object" - }, - "fullDocument": { - "_id": 1, - "x": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$changeStream": { - "fullDocument": "whenAvailable" - } - } - ] - } - } - } - ] - } - ] - }, - { - "description": "fullDocument:whenAvailable with changeStreamPreAndPostImages disabled", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "collMod", - "command": { - "collMod": "test", - "changeStreamPreAndPostImages": { - "enabled": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "fullDocument": "whenAvailable" - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "update", - "ns": { - "db": "change-stream-tests", - "coll": "test" - }, - "updateDescription": { - "$$type": "object" - }, - "fullDocument": null - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$changeStream": { - "fullDocument": "whenAvailable" - } - } - ] - } - } - } - ] - } - ] - }, - { - "description": "fullDocument:required with changeStreamPreAndPostImages enabled", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "collMod", - "command": { - "collMod": "test", - "changeStreamPreAndPostImages": { - "enabled": true - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "fullDocument": "required" - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "update", - "ns": { - "db": "change-stream-tests", - "coll": "test" - }, - "updateDescription": { - "$$type": "object" - }, - "fullDocument": { - "_id": 1, - "x": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$changeStream": { - "fullDocument": "required" - } - } - ] - } - } - } - ] - } - ] - }, - { - "description": "fullDocument:required with changeStreamPreAndPostImages disabled", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "collMod", - "command": { - "collMod": "test", - "changeStreamPreAndPostImages": { - "enabled": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "fullDocument": "required" - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$changeStream": { - "fullDocument": "required" - } - } - ] - } - } - } - ] - } - ] - }, - { - "description": "fullDocumentBeforeChange:whenAvailable with changeStreamPreAndPostImages enabled", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "collMod", - "command": { - "collMod": "test", - "changeStreamPreAndPostImages": { - "enabled": true - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "fullDocumentBeforeChange": "whenAvailable" - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "update", - "ns": { - "db": "change-stream-tests", - "coll": "test" - }, - "updateDescription": { - "$$type": "object" - }, - "fullDocumentBeforeChange": { - "_id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$changeStream": { - "fullDocumentBeforeChange": "whenAvailable" - } - } - ] - } - } - } - ] - } - ] - }, - { - "description": "fullDocumentBeforeChange:whenAvailable with changeStreamPreAndPostImages disabled", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "collMod", - "command": { - "collMod": "test", - "changeStreamPreAndPostImages": { - "enabled": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "fullDocumentBeforeChange": "whenAvailable" - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "update", - "ns": { - "db": "change-stream-tests", - "coll": "test" - }, - "updateDescription": { - "$$type": "object" - }, - "fullDocumentBeforeChange": null - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$changeStream": { - "fullDocumentBeforeChange": "whenAvailable" - } - } - ] - } - } - } - ] - } - ] - }, - { - "description": "fullDocumentBeforeChange:required with changeStreamPreAndPostImages enabled", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "collMod", - "command": { - "collMod": "test", - "changeStreamPreAndPostImages": { - "enabled": true - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "fullDocumentBeforeChange": "required" - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "update", - "ns": { - "db": "change-stream-tests", - "coll": "test" - }, - "updateDescription": { - "$$type": "object" - }, - "fullDocumentBeforeChange": { - "_id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$changeStream": { - "fullDocumentBeforeChange": "required" - } - } - ] - } - } - } - ] - } - ] - }, - { - "description": "fullDocumentBeforeChange:required with changeStreamPreAndPostImages disabled", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "collMod", - "command": { - "collMod": "test", - "changeStreamPreAndPostImages": { - "enabled": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "fullDocumentBeforeChange": "required" - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$changeStream": { - "fullDocumentBeforeChange": "required" - } - } - ] - } - } - } - ] - } - ] - }, - { - "description": "fullDocumentBeforeChange:off with changeStreamPreAndPostImages enabled", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "collMod", - "command": { - "collMod": "test", - "changeStreamPreAndPostImages": { - "enabled": true - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "fullDocumentBeforeChange": "off" - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "update", - "ns": { - "db": "change-stream-tests", - "coll": "test" - }, - "updateDescription": { - "$$type": "object" - }, - "fullDocumentBeforeChange": { - "$$exists": false - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$changeStream": { - "fullDocumentBeforeChange": "off" - } - } - ] - } - } - } - ] - } - ] - }, - { - "description": "fullDocumentBeforeChange:off with changeStreamPreAndPostImages disabled", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "collMod", - "command": { - "collMod": "test", - "changeStreamPreAndPostImages": { - "enabled": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "fullDocumentBeforeChange": "off" - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "update", - "ns": { - "db": "change-stream-tests", - "coll": "test" - }, - "updateDescription": { - "$$type": "object" - }, - "fullDocumentBeforeChange": { - "$$exists": false - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$changeStream": { - "fullDocumentBeforeChange": "off" - } - } - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/change-streams/change-streams-resume-allowlist.json b/tests/UnifiedSpecTests/change-streams/change-streams-resume-allowlist.json deleted file mode 100644 index 1ec72b432..000000000 --- a/tests/UnifiedSpecTests/change-streams/change-streams-resume-allowlist.json +++ /dev/null @@ -1,2348 +0,0 @@ -{ - "description": "change-streams-resume-allowlist", - "schemaVersion": "1.7", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ], - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ], - "useMultipleMongoses": false - } - }, - { - "client": { - "id": "globalClient", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - }, - { - "database": { - "id": "globalDatabase0", - "client": "globalClient", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "globalCollection0", - "database": "globalDatabase0", - "collectionName": "collection0" - } - } - ], - "tests": [ - { - "description": "change stream resumes after a network error", - "runOnRequirements": [ - { - "minServerVersion": "4.2" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "closeConnection": true - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after HostUnreachable", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 6, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after HostNotFound", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 7, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after NetworkTimeout", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 89, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after ShutdownInProgress", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 91, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after PrimarySteppedDown", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 189, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after ExceededTimeLimit", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 262, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after SocketException", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 9001, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after NotWritablePrimary", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 10107, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after InterruptedAtShutdown", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 11600, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after InterruptedDueToReplStateChange", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 11602, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after NotPrimaryNoSecondaryOk", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 13435, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after NotPrimaryOrSecondary", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 13436, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after StaleShardVersion", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 63, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after StaleEpoch", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 150, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after RetryChangeStream", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 234, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after FailedToSatisfyReadPreference", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 133, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after CursorNotFound", - "runOnRequirements": [ - { - "minServerVersion": "4.2" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 43, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/change-streams/change-streams-resume-errorLabels.json b/tests/UnifiedSpecTests/change-streams/change-streams-resume-errorLabels.json deleted file mode 100644 index 7fd70108f..000000000 --- a/tests/UnifiedSpecTests/change-streams/change-streams-resume-errorLabels.json +++ /dev/null @@ -1,2130 +0,0 @@ -{ - "description": "change-streams-resume-errorlabels", - "schemaVersion": "1.7", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ], - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ], - "useMultipleMongoses": false - } - }, - { - "client": { - "id": "globalClient", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - }, - { - "database": { - "id": "globalDatabase0", - "client": "globalClient", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "globalCollection0", - "database": "globalDatabase0", - "collectionName": "collection0" - } - } - ], - "tests": [ - { - "description": "change stream resumes after HostUnreachable", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 6, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after HostNotFound", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 7, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after NetworkTimeout", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 89, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after ShutdownInProgress", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 91, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after PrimarySteppedDown", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 189, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after ExceededTimeLimit", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 262, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after SocketException", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 9001, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after NotWritablePrimary", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 10107, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after InterruptedAtShutdown", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 11600, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after InterruptedDueToReplStateChange", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 11602, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after NotPrimaryNoSecondaryOk", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 13435, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after NotPrimaryOrSecondary", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 13436, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after StaleShardVersion", - "runOnRequirements": [ - { - "maxServerVersion": "6.0.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 63, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after StaleEpoch", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 150, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after RetryChangeStream", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 234, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after FailedToSatisfyReadPreference", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failGetMoreAfterCursorCheckout", - "mode": { - "times": 1 - }, - "data": { - "errorCode": 133, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes if error contains ResumableChangeStreamError", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 50, - "closeConnection": false, - "errorLabels": [ - "ResumableChangeStreamError" - ] - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream does not resume if error does not contain ResumableChangeStreamError", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 6, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectError": { - "errorCode": 6 - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/change-streams/change-streams-showExpandedEvents.json b/tests/UnifiedSpecTests/change-streams/change-streams-showExpandedEvents.json deleted file mode 100644 index b9594e0c1..000000000 --- a/tests/UnifiedSpecTests/change-streams/change-streams-showExpandedEvents.json +++ /dev/null @@ -1,516 +0,0 @@ -{ - "description": "change-streams-showExpandedEvents", - "schemaVersion": "1.7", - "runOnRequirements": [ - { - "minServerVersion": "6.0.0", - "topologies": [ - "replicaset", - "sharded" - ], - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ], - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - }, - { - "database": { - "id": "database1", - "client": "client0", - "databaseName": "database1" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "collection1" - } - }, - { - "database": { - "id": "shardedDb", - "client": "client0", - "databaseName": "shardedDb" - } - }, - { - "database": { - "id": "adminDb", - "client": "client0", - "databaseName": "admin" - } - }, - { - "collection": { - "id": "shardedCollection", - "database": "shardedDb", - "collectionName": "shardedCollection" - } - } - ], - "initialData": [ - { - "collectionName": "collection0", - "databaseName": "database0", - "documents": [] - } - ], - "tests": [ - { - "description": "when provided, showExpandedEvents is sent as a part of the aggregate command", - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "showExpandedEvents": true - }, - "saveResultAsEntity": "changeStream0" - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "showExpandedEvents": true - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "when omitted, showExpandedEvents is not sent as a part of the aggregate command", - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "showExpandedEvents": { - "$$exists": false - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "when showExpandedEvents is true, new fields on change stream events are handled appropriately", - "operations": [ - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "foo" - } - }, - { - "name": "createCollection", - "object": "database0", - "arguments": { - "collection": "foo" - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "showExpandedEvents": true - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "a": 1 - } - } - }, - { - "name": "createIndex", - "object": "collection0", - "arguments": { - "keys": { - "x": 1 - }, - "name": "x_1" - } - }, - { - "name": "rename", - "object": "collection0", - "arguments": { - "to": "foo", - "dropTarget": true - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "collectionUUID": { - "$$exists": true - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "createIndexes", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "operationDescription": { - "$$exists": true - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "rename", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "to": { - "db": "database0", - "coll": "foo" - }, - "operationDescription": { - "dropTarget": { - "$$exists": true - }, - "to": { - "db": "database0", - "coll": "foo" - } - } - } - } - ] - }, - { - "description": "when showExpandedEvents is true, createIndex events are reported", - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$match": { - "operationType": { - "$ne": "create" - } - } - } - ], - "showExpandedEvents": true - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "createIndex", - "object": "collection0", - "arguments": { - "keys": { - "x": 1 - }, - "name": "x_1" - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "createIndexes" - } - } - ] - }, - { - "description": "when showExpandedEvents is true, dropIndexes events are reported", - "operations": [ - { - "name": "createIndex", - "object": "collection0", - "arguments": { - "keys": { - "x": 1 - }, - "name": "x_1" - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "showExpandedEvents": true - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "dropIndex", - "object": "collection0", - "arguments": { - "name": "x_1" - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "dropIndexes" - } - } - ] - }, - { - "description": "when showExpandedEvents is true, create events are reported", - "operations": [ - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "foo" - } - }, - { - "name": "createChangeStream", - "object": "database0", - "arguments": { - "pipeline": [], - "showExpandedEvents": true - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "createCollection", - "object": "database0", - "arguments": { - "collection": "foo" - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "create" - } - } - ] - }, - { - "description": "when showExpandedEvents is true, create events on views are reported", - "operations": [ - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "foo" - } - }, - { - "name": "createChangeStream", - "object": "database0", - "arguments": { - "pipeline": [], - "showExpandedEvents": true - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "createCollection", - "object": "database0", - "arguments": { - "collection": "foo", - "viewOn": "testName" - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "create" - } - } - ] - }, - { - "description": "when showExpandedEvents is true, modify events are reported", - "operations": [ - { - "name": "createIndex", - "object": "collection0", - "arguments": { - "keys": { - "x": 1 - }, - "name": "x_2" - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "showExpandedEvents": true - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "runCommand", - "object": "database0", - "arguments": { - "command": { - "collMod": "collection0" - }, - "commandName": "collMod" - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "modify" - } - } - ] - }, - { - "description": "when showExpandedEvents is true, shardCollection events are reported", - "runOnRequirements": [ - { - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "name": "dropCollection", - "object": "shardedDb", - "arguments": { - "collection": "shardedCollection" - } - }, - { - "name": "createCollection", - "object": "shardedDb", - "arguments": { - "collection": "shardedCollection" - } - }, - { - "name": "createChangeStream", - "object": "shardedCollection", - "arguments": { - "pipeline": [], - "showExpandedEvents": true - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "runCommand", - "object": "adminDb", - "arguments": { - "command": { - "shardCollection": "shardedDb.shardedCollection", - "key": { - "_id": 1 - } - }, - "commandName": "shardCollection" - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "shardCollection" - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/change-streams/change-streams.json b/tests/UnifiedSpecTests/change-streams/change-streams.json deleted file mode 100644 index c8b60ed4e..000000000 --- a/tests/UnifiedSpecTests/change-streams/change-streams.json +++ /dev/null @@ -1,1795 +0,0 @@ -{ - "description": "change-streams", - "schemaVersion": "1.7", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset" - ], - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ], - "useMultipleMongoses": false - } - }, - { - "client": { - "id": "globalClient", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - }, - { - "database": { - "id": "database1", - "client": "client0", - "databaseName": "database1" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "collection1" - } - }, - { - "database": { - "id": "globalDatabase0", - "client": "globalClient", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "globalCollection0", - "database": "globalDatabase0", - "collectionName": "collection0" - } - }, - { - "database": { - "id": "globalDatabase1", - "client": "globalClient", - "databaseName": "database1" - } - }, - { - "collection": { - "id": "globalCollection1", - "database": "globalDatabase1", - "collectionName": "collection1" - } - }, - { - "collection": { - "id": "globalDb1Collection0", - "database": "globalDatabase1", - "collectionName": "collection0" - } - }, - { - "collection": { - "id": "globalDb0Collection1", - "database": "globalDatabase0", - "collectionName": "collection1" - } - } - ], - "initialData": [ - { - "collectionName": "collection0", - "databaseName": "database0", - "documents": [] - } - ], - "tests": [ - { - "description": "Test array truncation", - "runOnRequirements": [ - { - "minServerVersion": "4.7" - } - ], - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": 1, - "array": [ - "foo", - { - "a": "bar" - }, - 1, - 2, - 3 - ] - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "array": [ - "foo", - { - "a": "bar" - } - ] - } - } - ] - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "update", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "updateDescription": { - "updatedFields": {}, - "removedFields": [], - "truncatedArrays": [ - { - "field": "array", - "newSize": 2 - } - ] - } - } - } - ] - }, - { - "description": "Test with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "comment": { - "name": "test1" - } - }, - "saveResultAsEntity": "changeStream0" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "pipeline": [ - { - "$changeStream": {} - } - ], - "comment": { - "name": "test1" - } - } - } - } - ] - } - ] - }, - { - "description": "Test with document comment - pre 4.4", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "comment": { - "name": "test1" - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "pipeline": [ - { - "$changeStream": {} - } - ], - "comment": { - "name": "test1" - } - } - } - } - ] - } - ] - }, - { - "description": "Test with string comment", - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "comment": "comment" - }, - "saveResultAsEntity": "changeStream0" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "pipeline": [ - { - "$changeStream": {} - } - ], - "comment": "comment" - } - } - } - ] - } - ] - }, - { - "description": "Test that comment is set on getMore", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "comment": { - "key": "value" - } - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "pipeline": [ - { - "$changeStream": {} - } - ], - "comment": { - "key": "value" - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "collection0", - "documents": [ - { - "_id": 1, - "a": 1 - } - ] - } - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "collection0", - "comment": { - "key": "value" - } - }, - "commandName": "getMore", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "Test that comment is not set on getMore - pre 4.4", - "runOnRequirements": [ - { - "maxServerVersion": "4.3.99" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "comment": "comment" - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "pipeline": [ - { - "$changeStream": {} - } - ], - "comment": "comment" - } - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "collection0", - "documents": [ - { - "_id": 1, - "a": 1 - } - ] - } - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "collection0", - "comment": { - "$$exists": false - } - }, - "commandName": "getMore", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "to field is set in a rename change event", - "runOnRequirements": [ - { - "minServerVersion": "4.0.1" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "collection1" - } - }, - { - "name": "rename", - "object": "collection0", - "arguments": { - "to": "collection1" - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "rename", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "to": { - "db": "database0", - "coll": "collection1" - } - } - } - ] - }, - { - "description": "Test unknown operationType MUST NOT err", - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$project": { - "operationType": "addedInFutureMongoDBVersion", - "ns": 1 - } - } - ] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "addedInFutureMongoDBVersion", - "ns": { - "db": "database0", - "coll": "collection0" - } - } - } - ] - }, - { - "description": "Test newField added in response MUST NOT err", - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$project": { - "operationType": 1, - "ns": 1, - "newField": "newFieldValue" - } - } - ] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "newField": "newFieldValue" - } - } - ] - }, - { - "description": "Test new structure in ns document MUST NOT err", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "maxServerVersion": "5.2.99" - }, - { - "minServerVersion": "6.0" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$project": { - "operationType": "insert", - "ns.viewOn": "db.coll" - } - } - ] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "viewOn": "db.coll" - } - } - } - ] - }, - { - "description": "Test modified structure in ns document MUST NOT err", - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$project": { - "operationType": "insert", - "ns": { - "db": "$ns.db", - "coll": "$ns.coll", - "viewOn": "db.coll" - } - } - } - ] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0", - "viewOn": "db.coll" - } - } - } - ] - }, - { - "description": "Test server error on projecting out _id", - "runOnRequirements": [ - { - "minServerVersion": "4.2" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 0 - } - } - ] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectError": { - "errorCode": 280, - "errorCodeName": "ChangeStreamFatalError", - "errorLabelsContain": [ - "NonResumableChangeStreamError" - ] - } - } - ] - }, - { - "description": "Test projection in change stream returns expected fields", - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$project": { - "optype": "$operationType", - "ns": 1, - "newField": "value" - } - } - ] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "optype": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "newField": "value" - } - } - ] - }, - { - "description": "$changeStream must be the first stage in a change stream pipeline sent to the server", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "The server returns change stream responses in the specified server response format", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ] - }, - { - "description": "Executing a watch helper on a Collection results in notifications for changes to the specified collection", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalDb0Collection1", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "insertOne", - "object": "globalDb1Collection0", - "arguments": { - "document": { - "y": 2 - } - } - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "z": 3 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "z": 3, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "Change Stream should allow valid aggregate pipeline stages", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$match": { - "fullDocument.z": 3 - } - } - ] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "y": 2 - } - } - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "z": 3 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "z": 3, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - }, - { - "$match": { - "fullDocument.z": 3 - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "Executing a watch helper on a Database results in notifications for changes to all collections in the specified database.", - "runOnRequirements": [ - { - "minServerVersion": "3.8.0" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "database0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalDb0Collection1", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "insertOne", - "object": "globalDb1Collection0", - "arguments": { - "document": { - "y": 2 - } - } - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "z": 3 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection1" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "z": 3, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "Executing a watch helper on a MongoClient results in notifications for changes to all collections in all databases in the cluster.", - "runOnRequirements": [ - { - "minServerVersion": "3.8.0" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "client0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalDb0Collection1", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "insertOne", - "object": "globalDb1Collection0", - "arguments": { - "document": { - "y": 2 - } - } - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "z": 3 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection1" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "database1", - "coll": "collection0" - }, - "fullDocument": { - "y": 2, - "_id": { - "$$exists": true - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "z": 3, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "Test insert, update, replace, and delete event types", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "updateOne", - "object": "globalCollection0", - "arguments": { - "filter": { - "x": 1 - }, - "update": { - "$set": { - "x": 2 - } - } - } - }, - { - "name": "replaceOne", - "object": "globalCollection0", - "arguments": { - "filter": { - "x": 2 - }, - "replacement": { - "x": 3 - } - } - }, - { - "name": "deleteOne", - "object": "globalCollection0", - "arguments": { - "filter": { - "x": 3 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "update", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "updateDescription": { - "updatedFields": { - "x": 2 - }, - "removedFields": [], - "truncatedArrays": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "replace", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 3, - "_id": { - "$$exists": true - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "delete", - "ns": { - "db": "database0", - "coll": "collection0" - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "Test rename and invalidate event types", - "runOnRequirements": [ - { - "minServerVersion": "4.0.1" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "collection1" - } - }, - { - "name": "rename", - "object": "globalCollection0", - "arguments": { - "to": "collection1" - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "rename", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "to": { - "db": "database0", - "coll": "collection1" - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "invalidate" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "Test drop and invalidate event types", - "runOnRequirements": [ - { - "minServerVersion": "4.0.1" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "collection0" - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "drop", - "ns": { - "db": "database0", - "coll": "collection0" - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "invalidate" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "Test consecutive resume", - "runOnRequirements": [ - { - "minServerVersion": "4.1.7" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "getMore" - ], - "closeConnection": true - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "batchSize": 1 - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 2 - } - } - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 3 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 2, - "_id": { - "$$exists": true - } - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 3, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": { - "batchSize": 1 - }, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "Test wallTime field is set in a change event", - "runOnRequirements": [ - { - "minServerVersion": "6.0.0" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "wallTime": { - "$$exists": true - } - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/client-side-encryption/addKeyAltName.json b/tests/UnifiedSpecTests/client-side-encryption/addKeyAltName.json deleted file mode 100644 index f70bc572a..000000000 --- a/tests/UnifiedSpecTests/client-side-encryption/addKeyAltName.json +++ /dev/null @@ -1,609 +0,0 @@ -{ - "description": "addKeyAltName", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "local": { - "key": { - "$$placeholder": 1 - } - } - } - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "keyvault" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "datakeys" - } - } - ], - "initialData": [ - { - "databaseName": "keyvault", - "collectionName": "datakeys", - "documents": [ - { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - ] - } - ], - "tests": [ - { - "description": "add keyAltName to non-existent data key", - "operations": [ - { - "name": "addKeyAltName", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "AAAjYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltName": "new_key_alt_name" - }, - "expectResult": { - "$$unsetOrMatches": null - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "findAndModify": "datakeys", - "query": { - "_id": { - "$binary": { - "base64": "AAAjYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - } - }, - "update": { - "$addToSet": { - "keyAltNames": "new_key_alt_name" - } - }, - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "datakeys", - "databaseName": "keyvault", - "documents": [ - { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - ] - } - ] - }, - { - "description": "add new keyAltName to data key with no keyAltNames", - "operations": [ - { - "name": "addKeyAltName", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltName": "local_key" - }, - "expectResult": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": {}, - "projection": { - "_id": 0, - "keyAltNames": 1 - } - }, - "expectResult": [ - { - "keyAltNames": [ - "local_key" - ] - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "findAndModify": "datakeys", - "query": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - } - }, - "update": { - "$addToSet": { - "keyAltNames": "local_key" - } - }, - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - } - ] - } - ] - }, - { - "description": "add existing keyAltName to existing data key", - "operations": [ - { - "name": "addKeyAltName", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltName": "local_key" - }, - "expectResult": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - }, - { - "name": "addKeyAltName", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltName": "local_key" - }, - "expectResult": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "local_key" - ], - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": {}, - "projection": { - "_id": 0, - "keyAltNames": 1 - } - }, - "expectResult": [ - { - "keyAltNames": [ - "local_key" - ] - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "findAndModify": "datakeys", - "query": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - } - }, - "update": { - "$addToSet": { - "keyAltNames": "local_key" - } - }, - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "findAndModify": "datakeys", - "query": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - } - }, - "update": { - "$addToSet": { - "keyAltNames": "local_key" - } - }, - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - } - ] - } - ] - }, - { - "description": "add new keyAltName to data key with keyAltNames", - "operations": [ - { - "name": "addKeyAltName", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltName": "local_key" - }, - "expectResult": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - }, - { - "name": "addKeyAltName", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltName": "another_name" - }, - "expectResult": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "local_key" - ], - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - }, - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 0, - "keyAltNames": "$keyAltNames" - } - }, - { - "$unwind": "$keyAltNames" - }, - { - "$sort": { - "keyAltNames": 1 - } - } - ] - }, - "expectResult": [ - { - "keyAltNames": "another_name" - }, - { - "keyAltNames": "local_key" - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "findAndModify": "datakeys", - "query": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - } - }, - "update": { - "$addToSet": { - "keyAltNames": "local_key" - } - }, - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "findAndModify": "datakeys", - "query": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - } - }, - "update": { - "$addToSet": { - "keyAltNames": "another_name" - } - }, - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/client-side-encryption/createDataKey-kms_providers-invalid.json b/tests/UnifiedSpecTests/client-side-encryption/createDataKey-kms_providers-invalid.json deleted file mode 100644 index 2344a61a9..000000000 --- a/tests/UnifiedSpecTests/client-side-encryption/createDataKey-kms_providers-invalid.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "description": "createDataKey-kms_providers-invalid", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "aws": { - "accessKeyId": { - "$$placeholder": 1 - }, - "secretAccessKey": { - "$$placeholder": 1 - } - } - } - } - } - } - ], - "tests": [ - { - "description": "create data key without required master key fields", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "aws", - "opts": { - "masterKey": {} - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "create data key with invalid master key field", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "local", - "opts": { - "masterKey": { - "invalid": 1 - } - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "create data key with invalid master key", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "aws", - "opts": { - "masterKey": { - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "invalid" - } - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/client-side-encryption/createDataKey.json b/tests/UnifiedSpecTests/client-side-encryption/createDataKey.json deleted file mode 100644 index f99fa3dbc..000000000 --- a/tests/UnifiedSpecTests/client-side-encryption/createDataKey.json +++ /dev/null @@ -1,775 +0,0 @@ -{ - "description": "createDataKey", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "aws": { - "accessKeyId": { - "$$placeholder": 1 - }, - "secretAccessKey": { - "$$placeholder": 1 - } - }, - "azure": { - "tenantId": { - "$$placeholder": 1 - }, - "clientId": { - "$$placeholder": 1 - }, - "clientSecret": { - "$$placeholder": 1 - } - }, - "gcp": { - "email": { - "$$placeholder": 1 - }, - "privateKey": { - "$$placeholder": 1 - } - }, - "kmip": { - "endpoint": { - "$$placeholder": 1 - } - }, - "local": { - "key": { - "$$placeholder": 1 - } - } - } - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "keyvault" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "datakeys" - } - } - ], - "initialData": [ - { - "databaseName": "keyvault", - "collectionName": "datakeys", - "documents": [] - } - ], - "tests": [ - { - "description": "create data key with AWS KMS provider", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "aws", - "opts": { - "masterKey": { - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - } - } - }, - "expectResult": { - "$$type": "binData" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "insert": "datakeys", - "documents": [ - { - "_id": { - "$$type": "binData" - }, - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": { - "$$exists": true - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "create datakey with Azure KMS provider", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "azure", - "opts": { - "masterKey": { - "keyVaultEndpoint": "key-vault-csfle.vault.azure.net", - "keyName": "key-name-csfle" - } - } - }, - "expectResult": { - "$$type": "binData" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "insert": "datakeys", - "documents": [ - { - "_id": { - "$$type": "binData" - }, - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": { - "$$exists": true - }, - "masterKey": { - "provider": "azure", - "keyVaultEndpoint": "key-vault-csfle.vault.azure.net", - "keyName": "key-name-csfle" - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "create datakey with GCP KMS provider", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "gcp", - "opts": { - "masterKey": { - "projectId": "devprod-drivers", - "location": "global", - "keyRing": "key-ring-csfle", - "keyName": "key-name-csfle" - } - } - }, - "expectResult": { - "$$type": "binData" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "insert": "datakeys", - "documents": [ - { - "_id": { - "$$type": "binData" - }, - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": { - "$$exists": true - }, - "masterKey": { - "provider": "gcp", - "projectId": "devprod-drivers", - "location": "global", - "keyRing": "key-ring-csfle", - "keyName": "key-name-csfle" - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "create datakey with KMIP KMS provider", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "kmip" - }, - "expectResult": { - "$$type": "binData" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "insert": "datakeys", - "documents": [ - { - "_id": { - "$$type": "binData" - }, - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": { - "$$exists": true - }, - "masterKey": { - "provider": "kmip", - "keyId": { - "$$type": "string" - } - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "create datakey with KMIP delegated KMS provider", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "kmip", - "opts": { - "masterKey": { - "delegated": true - } - } - }, - "expectResult": { - "$$type": "binData" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "insert": "datakeys", - "documents": [ - { - "_id": { - "$$type": "binData" - }, - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": { - "$$exists": true - }, - "masterKey": { - "provider": "kmip", - "keyId": { - "$$type": "string" - }, - "delegated": true - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "create datakey with local KMS provider", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "local" - }, - "expectResult": { - "$$type": "binData" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "insert": "datakeys", - "documents": [ - { - "_id": { - "$$type": "binData" - }, - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": { - "$$exists": true - }, - "masterKey": { - "provider": "local" - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "create datakey with no keyAltName", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "local", - "opts": { - "keyAltNames": [] - } - }, - "expectResult": { - "$$type": "binData" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "insert": "datakeys", - "documents": [ - { - "_id": { - "$$type": "binData" - }, - "keyAltNames": { - "$$exists": false - }, - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": { - "$$type": "int" - }, - "masterKey": { - "$$type": "object" - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "create datakey with single keyAltName", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "local", - "opts": { - "keyAltNames": [ - "local_key" - ] - } - }, - "expectResult": { - "$$type": "binData" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "insert": "datakeys", - "documents": [ - { - "_id": { - "$$type": "binData" - }, - "keyAltNames": [ - "local_key" - ], - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": { - "$$type": "int" - }, - "masterKey": { - "$$type": "object" - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "create datakey with multiple keyAltNames", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "local", - "opts": { - "keyAltNames": [ - "abc", - "def" - ] - } - }, - "expectResult": { - "$$type": "binData" - } - }, - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 0, - "keyAltNames": 1 - } - }, - { - "$unwind": "$keyAltNames" - }, - { - "$sort": { - "keyAltNames": 1 - } - } - ] - }, - "expectResult": [ - { - "keyAltNames": "abc" - }, - { - "keyAltNames": "def" - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "insert": "datakeys", - "documents": [ - { - "_id": { - "$$type": "binData" - }, - "keyAltNames": { - "$$type": "array" - }, - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": { - "$$type": "int" - }, - "masterKey": { - "$$type": "object" - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - } - ] - } - ] - }, - { - "description": "create datakey with custom key material", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "local", - "opts": { - "keyMaterial": { - "$binary": { - "base64": "a2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFs", - "subType": "00" - } - } - } - }, - "expectResult": { - "$$type": "binData" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "insert": "datakeys", - "documents": [ - { - "_id": { - "$$type": "binData" - }, - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": { - "$$type": "int" - }, - "masterKey": { - "$$type": "object" - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "create datakey with invalid custom key material (too short)", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "local", - "opts": { - "keyMaterial": { - "$binary": { - "base64": "a2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFsa2V5X21hdGVyaWFs", - "subType": "00" - } - } - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/client-side-encryption/deleteKey.json b/tests/UnifiedSpecTests/client-side-encryption/deleteKey.json deleted file mode 100644 index 3a10fb082..000000000 --- a/tests/UnifiedSpecTests/client-side-encryption/deleteKey.json +++ /dev/null @@ -1,557 +0,0 @@ -{ - "description": "deleteKey", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "local": { - "key": { - "$$placeholder": 1 - } - } - } - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "keyvault" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "datakeys" - } - } - ], - "initialData": [ - { - "databaseName": "keyvault", - "collectionName": "datakeys", - "documents": [ - { - "_id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "aws_key" - ], - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gFXJqbF0Fy872MD7xl56D/2AAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDO7HPisPUlGzaio9vgIBEIB7/Qow46PMh/8JbEUbdXgTGhLfXPE+KIVW7T8s6YEMlGiRvMu7TV0QCIUJlSHPKZxzlJ2iwuz5yXeOag+EdY+eIQ0RKrsJ3b8UTisZYzGjfzZnxUKLzLoeXremtRCm3x47wCuHKd1dhh6FBbYt5TL2tDaj+vL2GBrKat2L", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - } - }, - { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - ] - } - ], - "tests": [ - { - "description": "delete non-existent data key", - "operations": [ - { - "name": "deleteKey", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "AAAzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - } - }, - "expectResult": { - "deletedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "delete": "datakeys", - "deletes": [ - { - "q": { - "_id": { - "$binary": { - "base64": "AAAzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - } - }, - "limit": 1 - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "datakeys", - "databaseName": "keyvault", - "documents": [ - { - "_id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "aws_key" - ], - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gFXJqbF0Fy872MD7xl56D/2AAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDO7HPisPUlGzaio9vgIBEIB7/Qow46PMh/8JbEUbdXgTGhLfXPE+KIVW7T8s6YEMlGiRvMu7TV0QCIUJlSHPKZxzlJ2iwuz5yXeOag+EdY+eIQ0RKrsJ3b8UTisZYzGjfzZnxUKLzLoeXremtRCm3x47wCuHKd1dhh6FBbYt5TL2tDaj+vL2GBrKat2L", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - } - }, - { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - ] - } - ] - }, - { - "description": "delete existing AWS data key", - "operations": [ - { - "name": "deleteKey", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - } - }, - "expectResult": { - "deletedCount": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "delete": "datakeys", - "deletes": [ - { - "q": { - "_id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - } - }, - "limit": 1 - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "datakeys", - "databaseName": "keyvault", - "documents": [ - { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - ] - } - ] - }, - { - "description": "delete existing local data key", - "operations": [ - { - "name": "deleteKey", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - } - }, - "expectResult": { - "deletedCount": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "delete": "datakeys", - "deletes": [ - { - "q": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - } - }, - "limit": 1 - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "datakeys", - "databaseName": "keyvault", - "documents": [ - { - "_id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "aws_key" - ], - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gFXJqbF0Fy872MD7xl56D/2AAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDO7HPisPUlGzaio9vgIBEIB7/Qow46PMh/8JbEUbdXgTGhLfXPE+KIVW7T8s6YEMlGiRvMu7TV0QCIUJlSHPKZxzlJ2iwuz5yXeOag+EdY+eIQ0RKrsJ3b8UTisZYzGjfzZnxUKLzLoeXremtRCm3x47wCuHKd1dhh6FBbYt5TL2tDaj+vL2GBrKat2L", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - } - } - ] - } - ] - }, - { - "description": "delete existing data key twice", - "operations": [ - { - "name": "deleteKey", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - } - }, - "expectResult": { - "deletedCount": 1 - } - }, - { - "name": "deleteKey", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - } - }, - "expectResult": { - "deletedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "delete": "datakeys", - "deletes": [ - { - "q": { - "_id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - } - }, - "limit": 1 - } - ], - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "delete": "datakeys", - "deletes": [ - { - "q": { - "_id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - } - }, - "limit": 1 - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "datakeys", - "databaseName": "keyvault", - "documents": [ - { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/client-side-encryption/getKey.json b/tests/UnifiedSpecTests/client-side-encryption/getKey.json deleted file mode 100644 index 2ea3fe735..000000000 --- a/tests/UnifiedSpecTests/client-side-encryption/getKey.json +++ /dev/null @@ -1,319 +0,0 @@ -{ - "description": "getKey", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "local": { - "key": { - "$$placeholder": 1 - } - } - } - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "keyvault" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "datakeys" - } - } - ], - "initialData": [ - { - "databaseName": "keyvault", - "collectionName": "datakeys", - "documents": [ - { - "_id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "aws_key" - ], - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gFXJqbF0Fy872MD7xl56D/2AAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDO7HPisPUlGzaio9vgIBEIB7/Qow46PMh/8JbEUbdXgTGhLfXPE+KIVW7T8s6YEMlGiRvMu7TV0QCIUJlSHPKZxzlJ2iwuz5yXeOag+EdY+eIQ0RKrsJ3b8UTisZYzGjfzZnxUKLzLoeXremtRCm3x47wCuHKd1dhh6FBbYt5TL2tDaj+vL2GBrKat2L", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - } - }, - { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - ] - } - ], - "tests": [ - { - "description": "get non-existent data key", - "operations": [ - { - "name": "getKey", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "AAAzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - } - }, - "expectResult": { - "$$unsetOrMatches": null - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": { - "_id": { - "$binary": { - "base64": "AAAzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - } - }, - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "get existing AWS data key", - "operations": [ - { - "name": "getKey", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - } - }, - "expectResult": { - "_id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "aws_key" - ], - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gFXJqbF0Fy872MD7xl56D/2AAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDO7HPisPUlGzaio9vgIBEIB7/Qow46PMh/8JbEUbdXgTGhLfXPE+KIVW7T8s6YEMlGiRvMu7TV0QCIUJlSHPKZxzlJ2iwuz5yXeOag+EdY+eIQ0RKrsJ3b8UTisZYzGjfzZnxUKLzLoeXremtRCm3x47wCuHKd1dhh6FBbYt5TL2tDaj+vL2GBrKat2L", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": { - "_id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - } - }, - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "get existing local data key", - "operations": [ - { - "name": "getKey", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - } - }, - "expectResult": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - } - }, - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/client-side-encryption/getKeyByAltName.json b/tests/UnifiedSpecTests/client-side-encryption/getKeyByAltName.json deleted file mode 100644 index 2505abc16..000000000 --- a/tests/UnifiedSpecTests/client-side-encryption/getKeyByAltName.json +++ /dev/null @@ -1,289 +0,0 @@ -{ - "description": "getKeyByAltName", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "local": { - "key": { - "$$placeholder": 1 - } - } - } - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "keyvault" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "datakeys" - } - } - ], - "initialData": [ - { - "databaseName": "keyvault", - "collectionName": "datakeys", - "documents": [ - { - "_id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "aws_key" - ], - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gFXJqbF0Fy872MD7xl56D/2AAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDO7HPisPUlGzaio9vgIBEIB7/Qow46PMh/8JbEUbdXgTGhLfXPE+KIVW7T8s6YEMlGiRvMu7TV0QCIUJlSHPKZxzlJ2iwuz5yXeOag+EdY+eIQ0RKrsJ3b8UTisZYzGjfzZnxUKLzLoeXremtRCm3x47wCuHKd1dhh6FBbYt5TL2tDaj+vL2GBrKat2L", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - } - }, - { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - ] - } - ], - "tests": [ - { - "description": "get non-existent data key", - "operations": [ - { - "name": "getKeyByAltName", - "object": "clientEncryption0", - "arguments": { - "keyAltName": "does_not_exist" - }, - "expectResult": { - "$$unsetOrMatches": null - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": { - "keyAltNames": "does_not_exist" - }, - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "get existing AWS data key", - "operations": [ - { - "name": "getKeyByAltName", - "object": "clientEncryption0", - "arguments": { - "keyAltName": "aws_key" - }, - "expectResult": { - "_id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "aws_key" - ], - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gFXJqbF0Fy872MD7xl56D/2AAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDO7HPisPUlGzaio9vgIBEIB7/Qow46PMh/8JbEUbdXgTGhLfXPE+KIVW7T8s6YEMlGiRvMu7TV0QCIUJlSHPKZxzlJ2iwuz5yXeOag+EdY+eIQ0RKrsJ3b8UTisZYzGjfzZnxUKLzLoeXremtRCm3x47wCuHKd1dhh6FBbYt5TL2tDaj+vL2GBrKat2L", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": { - "keyAltNames": "aws_key" - }, - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "get existing local data key", - "operations": [ - { - "name": "getKeyByAltName", - "object": "clientEncryption0", - "arguments": { - "keyAltName": "local_key" - }, - "expectResult": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": { - "keyAltNames": "local_key" - }, - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/client-side-encryption/getKeys.json b/tests/UnifiedSpecTests/client-side-encryption/getKeys.json deleted file mode 100644 index d94471235..000000000 --- a/tests/UnifiedSpecTests/client-side-encryption/getKeys.json +++ /dev/null @@ -1,260 +0,0 @@ -{ - "description": "getKeys", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "local": { - "key": { - "$$placeholder": 1 - } - } - } - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "keyvault" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "datakeys" - } - } - ], - "initialData": [ - { - "databaseName": "keyvault", - "collectionName": "datakeys", - "documents": [] - } - ], - "tests": [ - { - "description": "getKeys with zero key documents", - "operations": [ - { - "name": "getKeys", - "object": "clientEncryption0", - "expectResult": [] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": {}, - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "getKeys with single key documents", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "local", - "opts": { - "keyAltNames": [ - "abc" - ] - } - }, - "expectResult": { - "$$type": "binData" - } - }, - { - "name": "getKeys", - "object": "clientEncryption0", - "expectResult": [ - { - "_id": { - "$$type": "binData" - }, - "keyAltNames": [ - "abc" - ], - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": { - "$$type": "int" - }, - "masterKey": { - "$$type": "object" - } - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": {}, - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "getKeys with many key documents", - "operations": [ - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "local" - }, - "expectResult": { - "$$type": "binData" - } - }, - { - "name": "createDataKey", - "object": "clientEncryption0", - "arguments": { - "kmsProvider": "local" - }, - "expectResult": { - "$$type": "binData" - } - }, - { - "name": "getKeys", - "object": "clientEncryption0", - "expectResult": [ - { - "_id": { - "$$type": "binData" - }, - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": { - "$$type": "int" - }, - "masterKey": { - "$$type": "object" - } - }, - { - "_id": { - "$$type": "binData" - }, - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": { - "$$type": "int" - }, - "masterKey": { - "$$type": "object" - } - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": {}, - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/client-side-encryption/removeKeyAltName.json b/tests/UnifiedSpecTests/client-side-encryption/removeKeyAltName.json deleted file mode 100644 index 1b7077077..000000000 --- a/tests/UnifiedSpecTests/client-side-encryption/removeKeyAltName.json +++ /dev/null @@ -1,672 +0,0 @@ -{ - "description": "removeKeyAltName", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "local": { - "key": { - "$$placeholder": 1 - } - } - } - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "keyvault" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "datakeys" - } - } - ], - "initialData": [ - { - "databaseName": "keyvault", - "collectionName": "datakeys", - "documents": [ - { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "alternate_name", - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - ] - } - ], - "tests": [ - { - "description": "remove keyAltName from non-existent data key", - "operations": [ - { - "name": "removeKeyAltName", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "AAAjYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltName": "does_not_exist" - }, - "expectResult": { - "$$unsetOrMatches": null - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "findAndModify": "datakeys", - "query": { - "_id": { - "$binary": { - "base64": "AAAjYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - } - }, - "update": [ - { - "$set": { - "keyAltNames": { - "$cond": [ - { - "$eq": [ - "$keyAltNames", - [ - "does_not_exist" - ] - ] - }, - "$$REMOVE", - { - "$filter": { - "input": "$keyAltNames", - "cond": { - "$ne": [ - "$$this", - "does_not_exist" - ] - } - } - } - ] - } - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "datakeys", - "databaseName": "keyvault", - "documents": [ - { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "alternate_name", - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - ] - } - ] - }, - { - "description": "remove non-existent keyAltName from existing data key", - "operations": [ - { - "name": "removeKeyAltName", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltName": "does_not_exist" - }, - "expectResult": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "alternate_name", - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "findAndModify": "datakeys", - "query": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - } - }, - "update": [ - { - "$set": { - "keyAltNames": { - "$cond": [ - { - "$eq": [ - "$keyAltNames", - [ - "does_not_exist" - ] - ] - }, - "$$REMOVE", - { - "$filter": { - "input": "$keyAltNames", - "cond": { - "$ne": [ - "$$this", - "does_not_exist" - ] - } - } - } - ] - } - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "datakeys", - "databaseName": "keyvault", - "documents": [ - { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "alternate_name", - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - ] - } - ] - }, - { - "description": "remove an existing keyAltName from an existing data key", - "operations": [ - { - "name": "removeKeyAltName", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltName": "alternate_name" - }, - "expectResult": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "alternate_name", - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": {}, - "projection": { - "_id": 0, - "keyAltNames": 1 - } - }, - "expectResult": [ - { - "keyAltNames": [ - "local_key" - ] - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "findAndModify": "datakeys", - "query": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - } - }, - "update": [ - { - "$set": { - "keyAltNames": { - "$cond": [ - { - "$eq": [ - "$keyAltNames", - [ - "alternate_name" - ] - ] - }, - "$$REMOVE", - { - "$filter": { - "input": "$keyAltNames", - "cond": { - "$ne": [ - "$$this", - "alternate_name" - ] - } - } - } - ] - } - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - } - ] - } - ] - }, - { - "description": "remove the last keyAltName from an existing data key", - "operations": [ - { - "name": "removeKeyAltName", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltName": "alternate_name" - }, - "expectResult": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "alternate_name", - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - }, - { - "name": "removeKeyAltName", - "object": "clientEncryption0", - "arguments": { - "id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltName": "local_key" - }, - "expectResult": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "local_key" - ], - "keyMaterial": { - "$$type": "binData" - }, - "creationDate": { - "$$type": "date" - }, - "updateDate": { - "$$type": "date" - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "findAndModify": "datakeys", - "query": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - } - }, - "update": [ - { - "$set": { - "keyAltNames": { - "$cond": [ - { - "$eq": [ - "$keyAltNames", - [ - "alternate_name" - ] - ] - }, - "$$REMOVE", - { - "$filter": { - "input": "$keyAltNames", - "cond": { - "$ne": [ - "$$this", - "alternate_name" - ] - } - } - } - ] - } - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "findAndModify": "datakeys", - "query": { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - } - }, - "update": [ - { - "$set": { - "keyAltNames": { - "$cond": [ - { - "$eq": [ - "$keyAltNames", - [ - "local_key" - ] - ] - }, - "$$REMOVE", - { - "$filter": { - "input": "$keyAltNames", - "cond": { - "$ne": [ - "$$this", - "local_key" - ] - } - } - } - ] - } - } - } - ] - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/client-side-encryption/rewrapManyDataKey-decrypt_failure.json b/tests/UnifiedSpecTests/client-side-encryption/rewrapManyDataKey-decrypt_failure.json deleted file mode 100644 index 4c7d4e804..000000000 --- a/tests/UnifiedSpecTests/client-side-encryption/rewrapManyDataKey-decrypt_failure.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "description": "rewrapManyDataKey-decrypt_failure", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "aws": { - "accessKeyId": { - "$$placeholder": 1 - }, - "secretAccessKey": { - "$$placeholder": 1 - } - }, - "azure": { - "tenantId": { - "$$placeholder": 1 - }, - "clientId": { - "$$placeholder": 1 - }, - "clientSecret": { - "$$placeholder": 1 - } - }, - "gcp": { - "email": { - "$$placeholder": 1 - }, - "privateKey": { - "$$placeholder": 1 - } - }, - "kmip": { - "endpoint": { - "$$placeholder": 1 - } - }, - "local": { - "key": { - "$$placeholder": 1 - } - } - } - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "keyvault" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "datakeys" - } - } - ], - "initialData": [ - { - "databaseName": "keyvault", - "collectionName": "datakeys", - "documents": [ - { - "_id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "aws_key" - ], - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gFXJqbF0Fy872MD7xl56D/2AAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDO7HPisPUlGzaio9vgIBEIB7/Qow46PMh/8JbEUbdXgTGhLfXPE+KIVW7T8s6YEMlGiRvMu7TV0QCIUJlSHPKZxzlJ2iwuz5yXeOag+EdY+eIQ0RKrsJ3b8UTisZYzGjfzZnxUKLzLoeXremtRCm3x47wCuHKd1dhh6FBbYt5TL2tDaj+vL2GBrKat2L", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-2:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-2" - } - } - ] - } - ], - "tests": [ - { - "description": "rewrap data key that fails during decryption due to invalid masterKey", - "operations": [ - { - "name": "rewrapManyDataKey", - "object": "clientEncryption0", - "arguments": { - "filter": {}, - "opts": { - "provider": "local" - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "find", - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": {}, - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/client-side-encryption/rewrapManyDataKey-encrypt_failure.json b/tests/UnifiedSpecTests/client-side-encryption/rewrapManyDataKey-encrypt_failure.json deleted file mode 100644 index cd2d20c25..000000000 --- a/tests/UnifiedSpecTests/client-side-encryption/rewrapManyDataKey-encrypt_failure.json +++ /dev/null @@ -1,250 +0,0 @@ -{ - "description": "rewrapManyDataKey-encrypt_failure", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "aws": { - "accessKeyId": { - "$$placeholder": 1 - }, - "secretAccessKey": { - "$$placeholder": 1 - } - }, - "azure": { - "tenantId": { - "$$placeholder": 1 - }, - "clientId": { - "$$placeholder": 1 - }, - "clientSecret": { - "$$placeholder": 1 - } - }, - "gcp": { - "email": { - "$$placeholder": 1 - }, - "privateKey": { - "$$placeholder": 1 - } - }, - "kmip": { - "endpoint": { - "$$placeholder": 1 - } - }, - "local": { - "key": { - "$$placeholder": 1 - } - } - } - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "keyvault" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "datakeys" - } - } - ], - "initialData": [ - { - "databaseName": "keyvault", - "collectionName": "datakeys", - "documents": [ - { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - } - ] - } - ], - "tests": [ - { - "description": "rewrap with invalid masterKey for AWS KMS provider", - "operations": [ - { - "name": "rewrapManyDataKey", - "object": "clientEncryption0", - "arguments": { - "filter": {}, - "opts": { - "provider": "aws", - "masterKey": { - "key": "arn:aws:kms:us-east-2:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-2" - } - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "find", - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": {}, - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "rewrap with invalid masterKey for Azure KMS provider", - "operations": [ - { - "name": "rewrapManyDataKey", - "object": "clientEncryption0", - "arguments": { - "filter": {}, - "opts": { - "provider": "azure", - "masterKey": { - "keyVaultEndpoint": "invalid-vault-csfle.vault.azure.net", - "keyName": "invalid-name-csfle" - } - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "find", - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": {}, - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "rewrap with invalid masterKey for GCP KMS provider", - "operations": [ - { - "name": "rewrapManyDataKey", - "object": "clientEncryption0", - "arguments": { - "filter": {}, - "opts": { - "provider": "gcp", - "masterKey": { - "projectId": "devprod-drivers", - "location": "global", - "keyRing": "invalid-ring-csfle", - "keyName": "invalid-name-csfle" - } - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "find", - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": {}, - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/client-side-encryption/rewrapManyDataKey.json b/tests/UnifiedSpecTests/client-side-encryption/rewrapManyDataKey.json deleted file mode 100644 index 8803491db..000000000 --- a/tests/UnifiedSpecTests/client-side-encryption/rewrapManyDataKey.json +++ /dev/null @@ -1,1922 +0,0 @@ -{ - "description": "rewrapManyDataKey", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "aws": { - "accessKeyId": { - "$$placeholder": 1 - }, - "secretAccessKey": { - "$$placeholder": 1 - } - }, - "azure": { - "tenantId": { - "$$placeholder": 1 - }, - "clientId": { - "$$placeholder": 1 - }, - "clientSecret": { - "$$placeholder": 1 - } - }, - "gcp": { - "email": { - "$$placeholder": 1 - }, - "privateKey": { - "$$placeholder": 1 - } - }, - "kmip": { - "endpoint": { - "$$placeholder": 1 - } - }, - "local": { - "key": { - "$$placeholder": 1 - } - } - } - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "keyvault" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "datakeys" - } - } - ], - "initialData": [ - { - "databaseName": "keyvault", - "collectionName": "datakeys", - "documents": [ - { - "_id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "aws_key" - ], - "keyMaterial": { - "$binary": { - "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gFXJqbF0Fy872MD7xl56D/2AAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDO7HPisPUlGzaio9vgIBEIB7/Qow46PMh/8JbEUbdXgTGhLfXPE+KIVW7T8s6YEMlGiRvMu7TV0QCIUJlSHPKZxzlJ2iwuz5yXeOag+EdY+eIQ0RKrsJ3b8UTisZYzGjfzZnxUKLzLoeXremtRCm3x47wCuHKd1dhh6FBbYt5TL2tDaj+vL2GBrKat2L", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - } - }, - { - "_id": { - "$binary": { - "base64": "YXp1cmVhenVyZWF6dXJlYQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "azure_key" - ], - "keyMaterial": { - "$binary": { - "base64": "pr01l7qDygUkFE/0peFwpnNlv3iIy8zrQK38Q9i12UCN2jwZHDmfyx8wokiIKMb9kAleeY+vnt3Cf1MKu9kcDmI+KxbNDd+V3ytAAGzOVLDJr77CiWjF9f8ntkXRHrAY9WwnVDANYkDwXlyU0Y2GQFTiW65jiQhUtYLYH63Tk48SsJuQvnWw1Q+PzY8ga+QeVec8wbcThwtm+r2IHsCFnc72Gv73qq7weISw+O4mN08z3wOp5FOS2ZM3MK7tBGmPdBcktW7F8ODGsOQ1FU53OrWUnyX2aTi2ftFFFMWVHqQo7EYuBZHru8RRODNKMyQk0BFfKovAeTAVRv9WH9QU7g==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "azure", - "keyVaultEndpoint": "key-vault-csfle.vault.azure.net", - "keyName": "key-name-csfle" - } - }, - { - "_id": { - "$binary": { - "base64": "Z2NwZ2NwZ2NwZ2NwZ2NwZw==", - "subType": "04" - } - }, - "keyAltNames": [ - "gcp_key" - ], - "keyMaterial": { - "$binary": { - "base64": "CiQAIgLj0USbQtof/pYRLQO96yg/JEtZbD1UxKueaC37yzT5tTkSiQEAhClWB5ZCSgzHgxv8raWjNB4r7e8ePGdsmSuYTYmLC5oHHS/BdQisConzNKFaobEQZHamTCjyhy5NotKF8MWoo+dyfQApwI29+vAGyrUIQCXzKwRnNdNQ+lb3vJtS5bqvLTvSxKHpVca2kqyC9nhonV+u4qru5Q2bAqUgVFc8fL4pBuvlowZFTQ==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "gcp", - "projectId": "devprod-drivers", - "location": "global", - "keyRing": "key-ring-csfle", - "keyName": "key-name-csfle" - } - }, - { - "_id": { - "$binary": { - "base64": "a21pcGttaXBrbWlwa21pcA==", - "subType": "04" - } - }, - "keyAltNames": [ - "kmip_key" - ], - "keyMaterial": { - "$binary": { - "base64": "CklVctHzke4mcytd0TxGqvepkdkQN8NUF4+jV7aZQITAKdz6WjdDpq3lMt9nSzWGG2vAEfvRb3mFEVjV57qqGqxjq2751gmiMRHXz0btStbIK3mQ5xbY9kdye4tsixlCryEwQONr96gwlwKKI9Nubl9/8+uRF6tgYjje7Q7OjauEf1SrJwKcoQ3WwnjZmEqAug0kImCpJ/irhdqPzivRiA==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "kmip", - "keyId": "1" - } - }, - { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "keyAltNames": [ - "local_key" - ], - "keyMaterial": { - "$binary": { - "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "local" - } - }, - { - "_id": { - "$uuid": "7411e9af-c688-4df7-8143-5e60ae96cba5" - }, - "keyAltNames": [ - "kmip_delegated_key" - ], - "keyMaterial": { - "$binary": { - "base64": "5TLMFWlguBWe5GUESTvOVtkdBsCrynhnV72XRyZ66/nk+EP9/1oEp1t1sg0+vwCTqULHjBiUE6DRx2mYD/Eup1+u2Jgz9/+1sV1drXeOPALNPkSgiZiDbIb67zRi+wTABEcKcegJH+FhmSGxwUoQAiHCsCbcvia5P8tN1lt98YQ=", - "subType": "00" - } - }, - "creationDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "updateDate": { - "$date": { - "$numberLong": "1641024000000" - } - }, - "status": 1, - "masterKey": { - "provider": "kmip", - "keyId": "11", - "delegated": true - } - } - ] - } - ], - "tests": [ - { - "description": "no keys to rewrap due to no filter matches", - "operations": [ - { - "name": "rewrapManyDataKey", - "object": "clientEncryption0", - "arguments": { - "filter": { - "keyAltNames": "no_matching_keys" - }, - "opts": { - "provider": "local" - } - }, - "expectResult": { - "bulkWriteResult": { - "$$exists": false - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": { - "keyAltNames": "no_matching_keys" - }, - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "rewrap with new AWS KMS provider", - "operations": [ - { - "name": "rewrapManyDataKey", - "object": "clientEncryption0", - "arguments": { - "filter": { - "keyAltNames": { - "$ne": "aws_key" - } - }, - "opts": { - "provider": "aws", - "masterKey": { - "key": "arn:aws:kms:us-east-1:579766882180:key/061334ae-07a8-4ceb-a813-8135540e837d", - "region": "us-east-1" - } - } - }, - "expectResult": { - "bulkWriteResult": { - "insertedCount": 0, - "matchedCount": 5, - "modifiedCount": 5, - "deletedCount": 0, - "upsertedCount": 0, - "upsertedIds": {}, - "insertedIds": { - "$$unsetOrMatches": {} - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": { - "keyAltNames": { - "$ne": "aws_key" - } - }, - "readConcern": { - "level": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "update": "datakeys", - "ordered": true, - "updates": [ - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/061334ae-07a8-4ceb-a813-8135540e837d", - "region": "us-east-1" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/061334ae-07a8-4ceb-a813-8135540e837d", - "region": "us-east-1" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/061334ae-07a8-4ceb-a813-8135540e837d", - "region": "us-east-1" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/061334ae-07a8-4ceb-a813-8135540e837d", - "region": "us-east-1" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/061334ae-07a8-4ceb-a813-8135540e837d", - "region": "us-east-1" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "rewrap with new Azure KMS provider", - "operations": [ - { - "name": "rewrapManyDataKey", - "object": "clientEncryption0", - "arguments": { - "filter": { - "keyAltNames": { - "$ne": "azure_key" - } - }, - "opts": { - "provider": "azure", - "masterKey": { - "keyVaultEndpoint": "key-vault-csfle.vault.azure.net", - "keyName": "key-name-csfle" - } - } - }, - "expectResult": { - "bulkWriteResult": { - "insertedCount": 0, - "matchedCount": 5, - "modifiedCount": 5, - "deletedCount": 0, - "upsertedCount": 0, - "upsertedIds": {}, - "insertedIds": { - "$$unsetOrMatches": {} - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": { - "keyAltNames": { - "$ne": "azure_key" - } - }, - "readConcern": { - "level": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "update": "datakeys", - "ordered": true, - "updates": [ - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "azure", - "keyVaultEndpoint": "key-vault-csfle.vault.azure.net", - "keyName": "key-name-csfle" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "azure", - "keyVaultEndpoint": "key-vault-csfle.vault.azure.net", - "keyName": "key-name-csfle" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "azure", - "keyVaultEndpoint": "key-vault-csfle.vault.azure.net", - "keyName": "key-name-csfle" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "azure", - "keyVaultEndpoint": "key-vault-csfle.vault.azure.net", - "keyName": "key-name-csfle" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "azure", - "keyVaultEndpoint": "key-vault-csfle.vault.azure.net", - "keyName": "key-name-csfle" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "rewrap with new GCP KMS provider", - "operations": [ - { - "name": "rewrapManyDataKey", - "object": "clientEncryption0", - "arguments": { - "filter": { - "keyAltNames": { - "$ne": "gcp_key" - } - }, - "opts": { - "provider": "gcp", - "masterKey": { - "projectId": "devprod-drivers", - "location": "global", - "keyRing": "key-ring-csfle", - "keyName": "key-name-csfle" - } - } - }, - "expectResult": { - "bulkWriteResult": { - "insertedCount": 0, - "matchedCount": 5, - "modifiedCount": 5, - "deletedCount": 0, - "upsertedCount": 0, - "upsertedIds": {}, - "insertedIds": { - "$$unsetOrMatches": {} - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": { - "keyAltNames": { - "$ne": "gcp_key" - } - }, - "readConcern": { - "level": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "update": "datakeys", - "ordered": true, - "updates": [ - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "gcp", - "projectId": "devprod-drivers", - "location": "global", - "keyRing": "key-ring-csfle", - "keyName": "key-name-csfle" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "gcp", - "projectId": "devprod-drivers", - "location": "global", - "keyRing": "key-ring-csfle", - "keyName": "key-name-csfle" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "gcp", - "projectId": "devprod-drivers", - "location": "global", - "keyRing": "key-ring-csfle", - "keyName": "key-name-csfle" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "gcp", - "projectId": "devprod-drivers", - "location": "global", - "keyRing": "key-ring-csfle", - "keyName": "key-name-csfle" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "gcp", - "projectId": "devprod-drivers", - "location": "global", - "keyRing": "key-ring-csfle", - "keyName": "key-name-csfle" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "rewrap with new KMIP KMS provider", - "operations": [ - { - "name": "rewrapManyDataKey", - "object": "clientEncryption0", - "arguments": { - "filter": { - "keyAltNames": { - "$ne": "kmip_key" - } - }, - "opts": { - "provider": "kmip" - } - }, - "expectResult": { - "bulkWriteResult": { - "insertedCount": 0, - "matchedCount": 5, - "modifiedCount": 5, - "deletedCount": 0, - "upsertedCount": 0, - "upsertedIds": {}, - "insertedIds": { - "$$unsetOrMatches": {} - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": { - "keyAltNames": { - "$ne": "kmip_key" - } - }, - "readConcern": { - "level": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "update": "datakeys", - "ordered": true, - "updates": [ - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "kmip", - "keyId": { - "$$type": "string" - } - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "kmip", - "keyId": { - "$$type": "string" - } - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "kmip", - "keyId": { - "$$type": "string" - } - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "kmip", - "keyId": { - "$$type": "string" - } - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "kmip", - "keyId": { - "$$type": "string" - } - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "rewrap with new KMIP delegated KMS provider", - "operations": [ - { - "name": "rewrapManyDataKey", - "object": "clientEncryption0", - "arguments": { - "filter": { - "keyAltNames": { - "$ne": "kmip_delegated_key" - } - }, - "opts": { - "provider": "kmip", - "masterKey": { - "delegated": true - } - } - }, - "expectResult": { - "bulkWriteResult": { - "insertedCount": 0, - "matchedCount": 5, - "modifiedCount": 5, - "deletedCount": 0, - "upsertedCount": 0, - "upsertedIds": {}, - "insertedIds": { - "$$unsetOrMatches": {} - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": { - "keyAltNames": { - "$ne": "kmip_delegated_key" - } - }, - "readConcern": { - "level": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "update": "datakeys", - "ordered": true, - "updates": [ - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "kmip", - "delegated": true, - "keyId": { - "$$type": "string" - } - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "kmip", - "delegated": true, - "keyId": { - "$$type": "string" - } - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "kmip", - "delegated": true, - "keyId": { - "$$type": "string" - } - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "kmip", - "delegated": true, - "keyId": { - "$$type": "string" - } - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "kmip", - "delegated": true, - "keyId": { - "$$type": "string" - } - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "rewrap with new local KMS provider", - "operations": [ - { - "name": "rewrapManyDataKey", - "object": "clientEncryption0", - "arguments": { - "filter": { - "keyAltNames": { - "$ne": "local_key" - } - }, - "opts": { - "provider": "local" - } - }, - "expectResult": { - "bulkWriteResult": { - "insertedCount": 0, - "matchedCount": 5, - "modifiedCount": 5, - "deletedCount": 0, - "upsertedCount": 0, - "upsertedIds": {}, - "insertedIds": { - "$$unsetOrMatches": {} - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": { - "keyAltNames": { - "$ne": "local_key" - } - }, - "readConcern": { - "level": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "update": "datakeys", - "ordered": true, - "updates": [ - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "local" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "local" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "local" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "local" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "provider": "local" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - ] - }, - { - "description": "rewrap with current KMS provider", - "operations": [ - { - "name": "rewrapManyDataKey", - "object": "clientEncryption0", - "arguments": { - "filter": {} - }, - "expectResult": { - "bulkWriteResult": { - "insertedCount": 0, - "matchedCount": 6, - "modifiedCount": 6, - "deletedCount": 0, - "upsertedCount": 0, - "upsertedIds": {}, - "insertedIds": { - "$$unsetOrMatches": {} - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": {}, - "projection": { - "masterKey": 1 - }, - "sort": { - "keyAltNames": 1 - } - }, - "expectResult": [ - { - "_id": { - "$binary": { - "base64": "YXdzYXdzYXdzYXdzYXdzYQ==", - "subType": "04" - } - }, - "masterKey": { - "provider": "aws", - "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", - "region": "us-east-1" - } - }, - { - "_id": { - "$binary": { - "base64": "YXp1cmVhenVyZWF6dXJlYQ==", - "subType": "04" - } - }, - "masterKey": { - "provider": "azure", - "keyVaultEndpoint": "key-vault-csfle.vault.azure.net", - "keyName": "key-name-csfle" - } - }, - { - "_id": { - "$binary": { - "base64": "Z2NwZ2NwZ2NwZ2NwZ2NwZw==", - "subType": "04" - } - }, - "masterKey": { - "provider": "gcp", - "projectId": "devprod-drivers", - "location": "global", - "keyRing": "key-ring-csfle", - "keyName": "key-name-csfle" - } - }, - { - "_id": { - "$uuid": "7411e9af-c688-4df7-8143-5e60ae96cba5" - }, - "masterKey": { - "provider": "kmip", - "keyId": "11", - "delegated": true - } - }, - { - "_id": { - "$binary": { - "base64": "a21pcGttaXBrbWlwa21pcA==", - "subType": "04" - } - }, - "masterKey": { - "provider": "kmip", - "keyId": "1" - } - }, - { - "_id": { - "$binary": { - "base64": "bG9jYWxrZXlsb2NhbGtleQ==", - "subType": "04" - } - }, - "masterKey": { - "provider": "local" - } - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "find": "datakeys", - "filter": {}, - "readConcern": { - "level": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "databaseName": "keyvault", - "command": { - "update": "datakeys", - "ordered": true, - "updates": [ - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "$$type": "object" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "$$type": "object" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "$$type": "object" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "$$type": "object" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "$$type": "object" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$$type": "binData" - } - }, - "u": { - "$set": { - "masterKey": { - "$$type": "object" - }, - "keyMaterial": { - "$$type": "binData" - } - }, - "$currentDate": { - "updateDate": true - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/collection-management/clustered-indexes.json b/tests/UnifiedSpecTests/collection-management/clustered-indexes.json deleted file mode 100644 index 9db5ff06d..000000000 --- a/tests/UnifiedSpecTests/collection-management/clustered-indexes.json +++ /dev/null @@ -1,291 +0,0 @@ -{ - "description": "clustered-indexes", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "5.3", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "ci-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "ci-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "createCollection with clusteredIndex", - "operations": [ - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "test" - } - }, - { - "name": "createCollection", - "object": "database0", - "arguments": { - "collection": "test", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true, - "name": "test index" - } - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "databaseName": "ci-tests", - "collectionName": "test" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "drop": "test" - }, - "databaseName": "ci-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "create": "test", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true, - "name": "test index" - } - }, - "databaseName": "ci-tests" - } - } - ] - } - ] - }, - { - "description": "listCollections includes clusteredIndex", - "operations": [ - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "test" - } - }, - { - "name": "createCollection", - "object": "database0", - "arguments": { - "collection": "test", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true, - "name": "test index" - } - } - }, - { - "name": "listCollections", - "object": "database0", - "arguments": { - "filter": { - "name": { - "$eq": "test" - } - } - }, - "expectResult": [ - { - "name": "test", - "options": { - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true, - "name": "test index", - "v": { - "$$type": [ - "int", - "long" - ] - } - } - } - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "drop": "test" - }, - "databaseName": "ci-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "create": "test", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true, - "name": "test index" - } - }, - "databaseName": "ci-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1, - "filter": { - "name": { - "$eq": "test" - } - } - }, - "databaseName": "ci-tests" - } - } - ] - } - ] - }, - { - "description": "listIndexes returns the index", - "operations": [ - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "test" - } - }, - { - "name": "createCollection", - "object": "database0", - "arguments": { - "collection": "test", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true, - "name": "test index" - } - } - }, - { - "name": "listIndexes", - "object": "collection0", - "expectResult": [ - { - "key": { - "_id": 1 - }, - "name": "test index", - "clustered": true, - "unique": true, - "v": { - "$$type": [ - "int", - "long" - ] - } - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "drop": "test" - }, - "databaseName": "ci-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "create": "test", - "clusteredIndex": { - "key": { - "_id": 1 - }, - "unique": true, - "name": "test index" - } - }, - "databaseName": "ci-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "test" - }, - "databaseName": "ci-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/collection-management/createCollection-pre_and_post_images.json b/tests/UnifiedSpecTests/collection-management/createCollection-pre_and_post_images.json deleted file mode 100644 index f488deacd..000000000 --- a/tests/UnifiedSpecTests/collection-management/createCollection-pre_and_post_images.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "description": "createCollection-pre_and_post_images", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "6.0", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "papi-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "tests": [ - { - "description": "createCollection with changeStreamPreAndPostImages enabled", - "operations": [ - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "test" - } - }, - { - "name": "createCollection", - "object": "database0", - "arguments": { - "collection": "test", - "changeStreamPreAndPostImages": { - "enabled": true - } - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "databaseName": "papi-tests", - "collectionName": "test" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "drop": "test" - }, - "databaseName": "papi-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "create": "test", - "changeStreamPreAndPostImages": { - "enabled": true - } - }, - "databaseName": "papi-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/collection-management/modifyCollection-errorResponse.json b/tests/UnifiedSpecTests/collection-management/modifyCollection-errorResponse.json deleted file mode 100644 index aea71eb08..000000000 --- a/tests/UnifiedSpecTests/collection-management/modifyCollection-errorResponse.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "description": "modifyCollection-errorResponse", - "schemaVersion": "1.12", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "collMod-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "collMod-tests", - "documents": [ - { - "_id": 1, - "x": 1 - }, - { - "_id": 2, - "x": 1 - } - ] - } - ], - "tests": [ - { - "description": "modifyCollection prepareUnique violations are accessible", - "runOnRequirements": [ - { - "minServerVersion": "5.2" - } - ], - "operations": [ - { - "name": "createIndex", - "object": "collection0", - "arguments": { - "keys": { - "x": 1 - } - } - }, - { - "name": "modifyCollection", - "object": "database0", - "arguments": { - "collection": "test", - "index": { - "keyPattern": { - "x": 1 - }, - "prepareUnique": true - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 3, - "x": 1 - } - }, - "expectError": { - "errorCode": 11000 - } - }, - { - "name": "modifyCollection", - "object": "database0", - "arguments": { - "collection": "test", - "index": { - "keyPattern": { - "x": 1 - }, - "unique": true - } - }, - "expectError": { - "isClientError": false, - "errorCode": 359, - "errorResponse": { - "violations": [ - { - "ids": [ - 1, - 2 - ] - } - ] - } - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/collection-management/modifyCollection-pre_and_post_images.json b/tests/UnifiedSpecTests/collection-management/modifyCollection-pre_and_post_images.json deleted file mode 100644 index 8026faeb1..000000000 --- a/tests/UnifiedSpecTests/collection-management/modifyCollection-pre_and_post_images.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "description": "modifyCollection-pre_and_post_images", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "6.0", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "papi-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "tests": [ - { - "description": "modifyCollection to changeStreamPreAndPostImages enabled", - "operations": [ - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "test" - } - }, - { - "name": "createCollection", - "object": "database0", - "arguments": { - "collection": "test", - "changeStreamPreAndPostImages": { - "enabled": false - } - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "databaseName": "papi-tests", - "collectionName": "test" - } - }, - { - "name": "modifyCollection", - "object": "database0", - "arguments": { - "collection": "test", - "changeStreamPreAndPostImages": { - "enabled": true - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "drop": "test" - }, - "databaseName": "papi-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "create": "test", - "changeStreamPreAndPostImages": { - "enabled": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "collMod": "test", - "changeStreamPreAndPostImages": { - "enabled": true - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/collection-management/timeseries-collection.json b/tests/UnifiedSpecTests/collection-management/timeseries-collection.json deleted file mode 100644 index 2ee52eac4..000000000 --- a/tests/UnifiedSpecTests/collection-management/timeseries-collection.json +++ /dev/null @@ -1,320 +0,0 @@ -{ - "description": "timeseries-collection", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "ts-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "ts-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "createCollection with all options", - "operations": [ - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "test" - } - }, - { - "name": "createCollection", - "object": "database0", - "arguments": { - "collection": "test", - "expireAfterSeconds": 604800, - "timeseries": { - "timeField": "time", - "metaField": "meta", - "granularity": "minutes" - } - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "databaseName": "ts-tests", - "collectionName": "test" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "drop": "test" - }, - "databaseName": "ts-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "create": "test", - "expireAfterSeconds": 604800, - "timeseries": { - "timeField": "time", - "metaField": "meta", - "granularity": "minutes" - } - }, - "databaseName": "ts-tests" - } - } - ] - } - ] - }, - { - "description": "insertMany with duplicate ids", - "operations": [ - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "test" - } - }, - { - "name": "createCollection", - "object": "database0", - "arguments": { - "collection": "test", - "expireAfterSeconds": 604800, - "timeseries": { - "timeField": "time", - "metaField": "meta", - "granularity": "minutes" - } - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "databaseName": "ts-tests", - "collectionName": "test" - } - }, - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "documents": [ - { - "_id": 1, - "time": { - "$date": { - "$numberLong": "1552949630482" - } - } - }, - { - "_id": 1, - "time": { - "$date": { - "$numberLong": "1552949630483" - } - } - } - ] - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": {}, - "sort": { - "time": 1 - } - }, - "expectResult": [ - { - "_id": 1, - "time": { - "$date": { - "$numberLong": "1552949630482" - } - } - }, - { - "_id": 1, - "time": { - "$date": { - "$numberLong": "1552949630483" - } - } - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "drop": "test" - }, - "databaseName": "ts-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "create": "test", - "expireAfterSeconds": 604800, - "timeseries": { - "timeField": "time", - "metaField": "meta", - "granularity": "minutes" - } - }, - "databaseName": "ts-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1, - "time": { - "$date": { - "$numberLong": "1552949630482" - } - } - }, - { - "_id": 1, - "time": { - "$date": { - "$numberLong": "1552949630483" - } - } - } - ] - } - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": {}, - "sort": { - "time": 1 - } - }, - "databaseName": "ts-tests" - } - } - ] - } - ] - }, - { - "description": "createCollection with bucketing options", - "runOnRequirements": [ - { - "minServerVersion": "6.3" - } - ], - "operations": [ - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "test" - } - }, - { - "name": "createCollection", - "object": "database0", - "arguments": { - "collection": "test", - "timeseries": { - "timeField": "time", - "bucketMaxSpanSeconds": 3600, - "bucketRoundingSeconds": 3600 - } - } - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "databaseName": "ts-tests", - "collectionName": "test" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "drop": "test" - }, - "databaseName": "ts-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "create": "test", - "timeseries": { - "timeField": "time", - "bucketMaxSpanSeconds": 3600, - "bucketRoundingSeconds": 3600 - } - }, - "databaseName": "ts-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/command-monitoring/bulkWrite.json b/tests/UnifiedSpecTests/command-monitoring/bulkWrite.json deleted file mode 100644 index 49c728442..000000000 --- a/tests/UnifiedSpecTests/command-monitoring/bulkWrite.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "description": "bulkWrite", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "command-monitoring-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "command-monitoring-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "A successful mixed bulk write", - "operations": [ - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 4, - "x": 44 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 3 - }, - "update": { - "$set": { - "x": 333 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4, - "x": 44 - } - ], - "ordered": true - }, - "commandName": "insert", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 1 - }, - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 3 - }, - "u": { - "$set": { - "x": 333 - } - }, - "upsert": { - "$$unsetOrMatches": false - }, - "multi": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true - }, - "commandName": "update", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 1 - }, - "commandName": "update" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/command-monitoring/command.json b/tests/UnifiedSpecTests/command-monitoring/command.json deleted file mode 100644 index c28af95fe..000000000 --- a/tests/UnifiedSpecTests/command-monitoring/command.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "description": "command", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "command-monitoring-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "command-monitoring-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "A successful command", - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "command": { - "ping": 1 - }, - "commandName": "ping" - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "commandName": "ping", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1 - }, - "commandName": "ping" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/command-monitoring/deleteMany.json b/tests/UnifiedSpecTests/command-monitoring/deleteMany.json deleted file mode 100644 index 78ebad1f9..000000000 --- a/tests/UnifiedSpecTests/command-monitoring/deleteMany.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "description": "deleteMany", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "command-monitoring-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "command-monitoring-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "A successful deleteMany", - "operations": [ - { - "name": "deleteMany", - "object": "collection", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "limit": 0 - } - ], - "ordered": true - }, - "commandName": "delete", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 2 - }, - "commandName": "delete" - } - } - ] - } - ] - }, - { - "description": "A successful deleteMany with write errors", - "operations": [ - { - "name": "deleteMany", - "object": "collection", - "arguments": { - "filter": { - "_id": { - "$unsupported": 1 - } - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": { - "$unsupported": 1 - } - }, - "limit": 0 - } - ], - "ordered": true - }, - "commandName": "delete", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 0, - "writeErrors": { - "$$type": "array" - } - }, - "commandName": "delete" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/command-monitoring/deleteOne.json b/tests/UnifiedSpecTests/command-monitoring/deleteOne.json deleted file mode 100644 index 2420794fe..000000000 --- a/tests/UnifiedSpecTests/command-monitoring/deleteOne.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "description": "deleteOne", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "command-monitoring-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "command-monitoring-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "A successful deleteOne", - "operations": [ - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "limit": 1 - } - ], - "ordered": true - }, - "commandName": "delete", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 1 - }, - "commandName": "delete" - } - } - ] - } - ] - }, - { - "description": "A successful deleteOne with write errors", - "operations": [ - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "filter": { - "_id": { - "$unsupported": 1 - } - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": { - "$unsupported": 1 - } - }, - "limit": 1 - } - ], - "ordered": true - }, - "commandName": "delete", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 0, - "writeErrors": { - "$$type": "array" - } - }, - "commandName": "delete" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/command-monitoring/find.json b/tests/UnifiedSpecTests/command-monitoring/find.json deleted file mode 100644 index bc9668499..000000000 --- a/tests/UnifiedSpecTests/command-monitoring/find.json +++ /dev/null @@ -1,558 +0,0 @@ -{ - "description": "find", - "schemaVersion": "1.15", - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "command-monitoring-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "test" - } - } - ], - "_yamlAnchors": { - "namespace": "command-monitoring-tests.test" - }, - "initialData": [ - { - "collectionName": "test", - "databaseName": "command-monitoring-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - } - ] - } - ], - "tests": [ - { - "description": "A successful find with no options", - "operations": [ - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": 1 - } - }, - "commandName": "find", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "cursor": { - "id": 0, - "ns": "command-monitoring-tests.test", - "firstBatch": [ - { - "_id": 1, - "x": 11 - } - ] - } - }, - "commandName": "find", - "databaseName": "command-monitoring-tests" - } - } - ] - } - ] - }, - { - "description": "A successful find with options", - "operations": [ - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "sort": { - "x": -1 - }, - "projection": { - "_id": 0, - "x": 1 - }, - "skip": 2, - "comment": "test", - "hint": { - "_id": 1 - }, - "max": { - "_id": 6 - }, - "maxTimeMS": 6000, - "min": { - "_id": 0 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": { - "$gt": 1 - } - }, - "sort": { - "x": -1 - }, - "projection": { - "_id": 0, - "x": 1 - }, - "skip": 2, - "comment": "test", - "hint": { - "_id": 1 - }, - "max": { - "_id": 6 - }, - "maxTimeMS": 6000, - "min": { - "_id": 0 - } - }, - "commandName": "find", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "cursor": { - "id": 0, - "ns": "command-monitoring-tests.test", - "firstBatch": [ - { - "x": 33 - }, - { - "x": 22 - } - ] - } - }, - "commandName": "find", - "databaseName": "command-monitoring-tests" - } - } - ] - } - ] - }, - { - "description": "A successful find with showRecordId and returnKey", - "operations": [ - { - "name": "find", - "object": "collection", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "showRecordId": true, - "returnKey": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "showRecordId": true, - "returnKey": true - }, - "commandName": "find", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "cursor": { - "id": 0, - "ns": "command-monitoring-tests.test", - "firstBatch": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - }, - { - "_id": 5 - } - ] - } - }, - "commandName": "find", - "databaseName": "command-monitoring-tests" - } - } - ] - } - ] - }, - { - "description": "A successful find with a getMore", - "operations": [ - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": { - "$gte": 1 - } - }, - "sort": { - "_id": 1 - }, - "batchSize": 3 - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": { - "$gte": 1 - } - }, - "sort": { - "_id": 1 - }, - "batchSize": 3 - }, - "commandName": "find", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "cursor": { - "id": { - "$$type": [ - "int", - "long" - ] - }, - "ns": "command-monitoring-tests.test", - "firstBatch": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - }, - "commandName": "find", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "test", - "batchSize": 3 - }, - "commandName": "getMore", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "cursor": { - "id": 0, - "ns": "command-monitoring-tests.test", - "nextBatch": [ - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - } - ] - } - }, - "commandName": "getMore", - "databaseName": "command-monitoring-tests" - } - } - ] - } - ] - }, - { - "description": "A successful find event with a getmore and the server kills the cursor (<= 4.4)", - "runOnRequirements": [ - { - "minServerVersion": "3.1", - "maxServerVersion": "4.4.99", - "topologies": [ - "single", - "replicaset" - ] - } - ], - "operations": [ - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "_id": { - "$gte": 1 - } - }, - "sort": { - "_id": 1 - }, - "batchSize": 3, - "limit": 4 - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": { - "$gte": 1 - } - }, - "sort": { - "_id": 1 - }, - "batchSize": 3, - "limit": 4 - }, - "commandName": "find", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "cursor": { - "id": { - "$$type": [ - "int", - "long" - ] - }, - "ns": "command-monitoring-tests.test", - "firstBatch": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - }, - "commandName": "find", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "test", - "batchSize": 1 - }, - "commandName": "getMore", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "cursor": { - "id": 0, - "ns": "command-monitoring-tests.test", - "nextBatch": [ - { - "_id": 4, - "x": 44 - } - ] - } - }, - "commandName": "getMore", - "databaseName": "command-monitoring-tests" - } - } - ] - } - ] - }, - { - "description": "A failed find event", - "operations": [ - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "$or": true - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "$or": true - } - }, - "commandName": "find", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "find", - "databaseName": "command-monitoring-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/command-monitoring/insertMany.json b/tests/UnifiedSpecTests/command-monitoring/insertMany.json deleted file mode 100644 index a80a218c6..000000000 --- a/tests/UnifiedSpecTests/command-monitoring/insertMany.json +++ /dev/null @@ -1,148 +0,0 @@ -{ - "description": "insertMany", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "command-monitoring-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "command-monitoring-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "A successful insertMany", - "operations": [ - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "ordered": true - }, - "commandName": "insert", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 1 - }, - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "A successful insertMany with write errors", - "operations": [ - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1, - "x": 11 - } - ], - "ordered": true - }, - "commandName": "insert", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 0, - "writeErrors": { - "$$type": "array" - } - }, - "commandName": "insert" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/command-monitoring/insertOne.json b/tests/UnifiedSpecTests/command-monitoring/insertOne.json deleted file mode 100644 index 6ff732e41..000000000 --- a/tests/UnifiedSpecTests/command-monitoring/insertOne.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "description": "insertOne", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "command-monitoring-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "command-monitoring-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "A successful insertOne", - "operations": [ - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 2, - "x": 22 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "ordered": true - }, - "commandName": "insert", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 1 - }, - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "A successful insertOne with write errors", - "operations": [ - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1, - "x": 11 - } - ], - "ordered": true - }, - "commandName": "insert", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 0, - "writeErrors": { - "$$type": "array" - } - }, - "commandName": "insert" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/command-monitoring/pre-42-server-connection-id.json b/tests/UnifiedSpecTests/command-monitoring/pre-42-server-connection-id.json deleted file mode 100644 index 141fbe584..000000000 --- a/tests/UnifiedSpecTests/command-monitoring/pre-42-server-connection-id.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "description": "pre-42-server-connection-id", - "schemaVersion": "1.6", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "server-connection-id-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "databaseName": "server-connection-id-tests", - "collectionName": "coll", - "documents": [] - } - ], - "tests": [ - { - "description": "command events do not include server connection id", - "operations": [ - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "$or": true - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert", - "hasServerConnectionId": false - } - }, - { - "commandSucceededEvent": { - "commandName": "insert", - "hasServerConnectionId": false - } - }, - { - "commandStartedEvent": { - "commandName": "find", - "hasServerConnectionId": false - } - }, - { - "commandFailedEvent": { - "commandName": "find", - "hasServerConnectionId": false - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/command-monitoring/redacted-commands.json b/tests/UnifiedSpecTests/command-monitoring/redacted-commands.json deleted file mode 100644 index 4302ba890..000000000 --- a/tests/UnifiedSpecTests/command-monitoring/redacted-commands.json +++ /dev/null @@ -1,679 +0,0 @@ -{ - "description": "redacted-commands", - "schemaVersion": "1.5", - "runOnRequirements": [ - { - "minServerVersion": "5.0", - "auth": false - } - ], - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent" - ], - "observeSensitiveCommands": true - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "command-monitoring-tests" - } - } - ], - "tests": [ - { - "description": "authenticate", - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "authenticate", - "command": { - "authenticate": 1, - "mechanism": "MONGODB-X509", - "user": "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry", - "db": "$external" - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "authenticate", - "command": { - "authenticate": { - "$$exists": false - }, - "mechanism": { - "$$exists": false - }, - "user": { - "$$exists": false - }, - "db": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "saslStart", - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "saslStart", - "command": { - "saslStart": 1, - "payload": "definitely-invalid-payload", - "db": "admin" - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "saslStart", - "command": { - "saslStart": { - "$$exists": false - }, - "payload": { - "$$exists": false - }, - "db": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "saslContinue", - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "saslContinue", - "command": { - "saslContinue": 1, - "conversationId": 0, - "payload": "definitely-invalid-payload" - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "saslContinue", - "command": { - "saslContinue": { - "$$exists": false - }, - "conversationId": { - "$$exists": false - }, - "payload": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "getnonce", - "runOnRequirements": [ - { - "maxServerVersion": "6.1.99" - } - ], - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "getnonce", - "command": { - "getnonce": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "getnonce", - "command": { - "getnonce": { - "$$exists": false - } - } - } - }, - { - "commandSucceededEvent": { - "commandName": "getnonce", - "reply": { - "ok": { - "$$exists": false - }, - "nonce": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "createUser", - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "createUser", - "command": { - "createUser": "private", - "pwd": {}, - "roles": [] - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "createUser", - "command": { - "createUser": { - "$$exists": false - }, - "pwd": { - "$$exists": false - }, - "roles": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "updateUser", - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "updateUser", - "command": { - "updateUser": "private", - "pwd": {}, - "roles": [] - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "updateUser", - "command": { - "updateUser": { - "$$exists": false - }, - "pwd": { - "$$exists": false - }, - "roles": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "copydbgetnonce", - "runOnRequirements": [ - { - "maxServerVersion": "3.6.99" - } - ], - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "copydbgetnonce", - "command": { - "copydbgetnonce": "private" - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "copydbgetnonce", - "command": { - "copydbgetnonce": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "copydbsaslstart", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "copydbsaslstart", - "command": { - "copydbsaslstart": "private" - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "copydbsaslstart", - "command": { - "copydbsaslstart": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "copydb", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "copydb", - "command": { - "copydb": "private" - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "copydb", - "command": { - "copydb": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "hello with speculative authenticate", - "runOnRequirements": [ - { - "minServerVersion": "4.9" - } - ], - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "hello", - "command": { - "hello": 1, - "speculativeAuthenticate": { - "saslStart": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "hello", - "command": { - "hello": { - "$$exists": false - }, - "speculativeAuthenticate": { - "$$exists": false - } - } - } - }, - { - "commandSucceededEvent": { - "commandName": "hello", - "reply": { - "isWritablePrimary": { - "$$exists": false - }, - "speculativeAuthenticate": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "legacy hello with speculative authenticate", - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ismaster", - "command": { - "ismaster": 1, - "speculativeAuthenticate": { - "saslStart": 1 - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "isMaster", - "command": { - "isMaster": 1, - "speculativeAuthenticate": { - "saslStart": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "ismaster", - "command": { - "ismaster": { - "$$exists": false - }, - "speculativeAuthenticate": { - "$$exists": false - } - } - } - }, - { - "commandSucceededEvent": { - "commandName": "ismaster", - "reply": { - "ismaster": { - "$$exists": false - }, - "speculativeAuthenticate": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "commandName": "isMaster", - "command": { - "isMaster": { - "$$exists": false - }, - "speculativeAuthenticate": { - "$$exists": false - } - } - } - }, - { - "commandSucceededEvent": { - "commandName": "isMaster", - "reply": { - "ismaster": { - "$$exists": false - }, - "speculativeAuthenticate": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "hello without speculative authenticate is not redacted", - "runOnRequirements": [ - { - "minServerVersion": "4.9" - } - ], - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "hello", - "command": { - "hello": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "hello", - "command": { - "hello": 1 - } - } - }, - { - "commandSucceededEvent": { - "commandName": "hello", - "reply": { - "isWritablePrimary": { - "$$exists": true - } - } - } - } - ] - } - ] - }, - { - "description": "legacy hello without speculative authenticate is not redacted", - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ismaster", - "command": { - "ismaster": 1 - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "isMaster", - "command": { - "isMaster": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "ismaster", - "command": { - "ismaster": 1 - } - } - }, - { - "commandSucceededEvent": { - "commandName": "ismaster", - "reply": { - "ismaster": { - "$$exists": true - } - } - } - }, - { - "commandStartedEvent": { - "commandName": "isMaster", - "command": { - "isMaster": 1 - } - } - }, - { - "commandSucceededEvent": { - "commandName": "isMaster", - "reply": { - "ismaster": { - "$$exists": true - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/command-monitoring/server-connection-id.json b/tests/UnifiedSpecTests/command-monitoring/server-connection-id.json deleted file mode 100644 index a8f27637f..000000000 --- a/tests/UnifiedSpecTests/command-monitoring/server-connection-id.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "description": "server-connection-id", - "schemaVersion": "1.6", - "runOnRequirements": [ - { - "minServerVersion": "4.2" - } - ], - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "server-connection-id-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "databaseName": "server-connection-id-tests", - "collectionName": "coll", - "documents": [] - } - ], - "tests": [ - { - "description": "command events include server connection id", - "operations": [ - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": { - "$or": true - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert", - "hasServerConnectionId": true - } - }, - { - "commandSucceededEvent": { - "commandName": "insert", - "hasServerConnectionId": true - } - }, - { - "commandStartedEvent": { - "commandName": "find", - "hasServerConnectionId": true - } - }, - { - "commandFailedEvent": { - "commandName": "find", - "hasServerConnectionId": true - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/command-monitoring/unacknowledgedBulkWrite.json b/tests/UnifiedSpecTests/command-monitoring/unacknowledgedBulkWrite.json deleted file mode 100644 index 78ddde767..000000000 --- a/tests/UnifiedSpecTests/command-monitoring/unacknowledgedBulkWrite.json +++ /dev/null @@ -1,117 +0,0 @@ -{ - "description": "unacknowledgedBulkWrite", - "schemaVersion": "1.7", - "createEntities": [ - { - "client": { - "id": "client", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "command-monitoring-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "test", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "command-monitoring-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "A successful unordered bulk write with an unacknowledged write concern", - "operations": [ - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": "unorderedBulkWriteInsertW0", - "x": 44 - } - } - } - ], - "ordered": false - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": "unorderedBulkWriteInsertW0", - "x": 44 - } - ], - "ordered": false, - "writeConcern": { - "w": 0 - } - }, - "commandName": "insert", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": { - "$$exists": false - } - }, - "commandName": "insert" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/command-monitoring/updateMany.json b/tests/UnifiedSpecTests/command-monitoring/updateMany.json deleted file mode 100644 index b15434226..000000000 --- a/tests/UnifiedSpecTests/command-monitoring/updateMany.json +++ /dev/null @@ -1,188 +0,0 @@ -{ - "description": "updateMany", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "command-monitoring-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "command-monitoring-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "A successful updateMany", - "operations": [ - { - "name": "updateMany", - "object": "collection", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "upsert": { - "$$unsetOrMatches": false - }, - "multi": true - } - ], - "ordered": true - }, - "commandName": "update", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 2 - }, - "commandName": "update" - } - } - ] - } - ] - }, - { - "description": "A successful updateMany with write errors", - "operations": [ - { - "name": "updateMany", - "object": "collection", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$unsupported": { - "x": 1 - } - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$unsupported": { - "x": 1 - } - }, - "upsert": { - "$$unsetOrMatches": false - }, - "multi": true - } - ], - "ordered": true - }, - "commandName": "update", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 0, - "writeErrors": { - "$$type": "array" - } - }, - "commandName": "update" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/command-monitoring/updateOne.json b/tests/UnifiedSpecTests/command-monitoring/updateOne.json deleted file mode 100644 index a0ae99e88..000000000 --- a/tests/UnifiedSpecTests/command-monitoring/updateOne.json +++ /dev/null @@ -1,260 +0,0 @@ -{ - "description": "updateOne", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "command-monitoring-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "command-monitoring-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "A successful updateOne", - "operations": [ - { - "name": "updateOne", - "object": "collection", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "upsert": { - "$$unsetOrMatches": false - }, - "multi": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true - }, - "commandName": "update", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 1 - }, - "commandName": "update" - } - } - ] - } - ] - }, - { - "description": "A successful updateOne with upsert where the upserted id is not an ObjectId", - "operations": [ - { - "name": "updateOne", - "object": "collection", - "arguments": { - "filter": { - "_id": 4 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "upsert": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 4 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "upsert": true, - "multi": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true - }, - "commandName": "update", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 1, - "upserted": [ - { - "index": 0, - "_id": 4 - } - ] - }, - "commandName": "update" - } - } - ] - } - ] - }, - { - "description": "A successful updateOne with write errors", - "operations": [ - { - "name": "updateOne", - "object": "collection", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$unsupported": { - "x": 1 - } - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$unsupported": { - "x": 1 - } - }, - "upsert": { - "$$unsetOrMatches": false - }, - "multi": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true - }, - "commandName": "update", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 0, - "writeErrors": { - "$$type": "array" - } - }, - "commandName": "update" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/command-monitoring/writeConcernError.json b/tests/UnifiedSpecTests/command-monitoring/writeConcernError.json deleted file mode 100644 index 455e5422b..000000000 --- a/tests/UnifiedSpecTests/command-monitoring/writeConcernError.json +++ /dev/null @@ -1,155 +0,0 @@ -{ - "description": "writeConcernError", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset" - ], - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "command-monitoring-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "command-monitoring-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "A retryable write with write concern errors publishes success event", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91 - } - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 2, - "x": 22 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "ordered": true - }, - "commandName": "insert", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 1, - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91 - } - }, - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "ordered": true - }, - "commandName": "insert", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "n": 1 - }, - "commandName": "insert" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/aggregate-allowdiskuse.json b/tests/UnifiedSpecTests/crud/aggregate-allowdiskuse.json deleted file mode 100644 index 2e54175b8..000000000 --- a/tests/UnifiedSpecTests/crud/aggregate-allowdiskuse.json +++ /dev/null @@ -1,155 +0,0 @@ -{ - "description": "aggregate-allowdiskuse", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "Aggregate does not send allowDiskUse when value is not specified", - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": {} - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": {} - } - ], - "allowDiskUse": { - "$$exists": false - } - }, - "commandName": "aggregate", - "databaseName": "crud-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate sends allowDiskUse false when false is specified", - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": {} - } - ], - "allowDiskUse": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": {} - } - ], - "allowDiskUse": false - }, - "commandName": "aggregate", - "databaseName": "crud-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate sends allowDiskUse true when true is specified", - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": {} - } - ], - "allowDiskUse": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": {} - } - ], - "allowDiskUse": true - }, - "commandName": "aggregate", - "databaseName": "crud-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/aggregate-collation.json b/tests/UnifiedSpecTests/crud/aggregate-collation.json deleted file mode 100644 index e7f0c3a7f..000000000 --- a/tests/UnifiedSpecTests/crud/aggregate-collation.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "description": "aggregate-collation", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": "ping" - } - ] - } - ], - "tests": [ - { - "description": "Aggregate with collation", - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "x": "PING" - } - } - ], - "collation": { - "locale": "en_US", - "strength": 2 - } - }, - "expectResult": [ - { - "_id": 1, - "x": "ping" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/aggregate-let.json b/tests/UnifiedSpecTests/crud/aggregate-let.json deleted file mode 100644 index 039900920..000000000 --- a/tests/UnifiedSpecTests/crud/aggregate-let.json +++ /dev/null @@ -1,376 +0,0 @@ -{ - "description": "aggregate-let", - "schemaVersion": "1.4", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - }, - { - "collection": { - "id": "collection1", - "database": "database0", - "collectionName": "coll1" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - }, - { - "collectionName": "coll1", - "databaseName": "crud-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "Aggregate with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$match": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - } - }, - { - "$project": { - "_id": 0, - "x": "$$x", - "y": "$$y", - "rand": "$$rand" - } - } - ], - "let": { - "id": 1, - "x": "foo", - "y": { - "$literal": "$bar" - }, - "rand": { - "$rand": {} - } - } - }, - "expectResult": [ - { - "x": "foo", - "y": "$bar", - "rand": { - "$$type": "double" - } - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - } - }, - { - "$project": { - "_id": 0, - "x": "$$x", - "y": "$$y", - "rand": "$$rand" - } - } - ], - "let": { - "id": 1, - "x": "foo", - "y": { - "$literal": "$bar" - }, - "rand": { - "$rand": {} - } - } - } - } - } - ] - } - ] - }, - { - "description": "Aggregate with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "2.6.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": 1 - } - } - ], - "let": { - "x": "foo" - } - }, - "expectError": { - "errorContains": "unrecognized field 'let'", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "_id": 1 - } - } - ], - "let": { - "x": "foo" - } - } - } - } - ] - } - ] - }, - { - "description": "Aggregate to collection with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0", - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$match": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - } - }, - { - "$project": { - "_id": 1 - } - }, - { - "$out": "coll1" - } - ], - "let": { - "id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - } - }, - { - "$project": { - "_id": 1 - } - }, - { - "$out": "coll1" - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll1", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "Aggregate to collection with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "2.6.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$match": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - } - }, - { - "$project": { - "_id": 1 - } - }, - { - "$out": "coll1" - } - ], - "let": { - "id": 1 - } - }, - "expectError": { - "errorContains": "unrecognized field 'let'", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - } - }, - { - "$project": { - "_id": 1 - } - }, - { - "$out": "coll1" - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/aggregate-merge-errorResponse.json b/tests/UnifiedSpecTests/crud/aggregate-merge-errorResponse.json deleted file mode 100644 index 6c7305fd9..000000000 --- a/tests/UnifiedSpecTests/crud/aggregate-merge-errorResponse.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "description": "aggregate-merge-errorResponse", - "schemaVersion": "1.12", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 1 - }, - { - "_id": 2, - "x": 1 - } - ] - } - ], - "tests": [ - { - "description": "aggregate $merge DuplicateKey error is accessible", - "runOnRequirements": [ - { - "minServerVersion": "5.1", - "topologies": [ - "single", - "replicaset" - ] - } - ], - "operations": [ - { - "name": "aggregate", - "object": "database0", - "arguments": { - "pipeline": [ - { - "$documents": [ - { - "_id": 2, - "x": 1 - } - ] - }, - { - "$merge": { - "into": "test", - "whenMatched": "fail" - } - } - ] - }, - "expectError": { - "errorCode": 11000, - "errorResponse": { - "keyPattern": { - "_id": 1 - }, - "keyValue": { - "_id": 2 - } - } - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/aggregate-merge.json b/tests/UnifiedSpecTests/crud/aggregate-merge.json deleted file mode 100644 index ac61ceb8a..000000000 --- a/tests/UnifiedSpecTests/crud/aggregate-merge.json +++ /dev/null @@ -1,497 +0,0 @@ -{ - "description": "aggregate-merge", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.1.11" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_aggregate_merge" - } - }, - { - "collection": { - "id": "collection_readConcern_majority", - "database": "database0", - "collectionName": "test_aggregate_merge", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - } - } - }, - { - "collection": { - "id": "collection_readConcern_local", - "database": "database0", - "collectionName": "test_aggregate_merge", - "collectionOptions": { - "readConcern": { - "level": "local" - } - } - } - }, - { - "collection": { - "id": "collection_readConcern_available", - "database": "database0", - "collectionName": "test_aggregate_merge", - "collectionOptions": { - "readConcern": { - "level": "available" - } - } - } - } - ], - "initialData": [ - { - "collectionName": "test_aggregate_merge", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Aggregate with $merge", - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test_aggregate_merge", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "other_test_collection", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "Aggregate with $merge and batch size of 0", - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ], - "batchSize": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test_aggregate_merge", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ], - "cursor": {} - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "other_test_collection", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "Aggregate with $merge and majority readConcern", - "operations": [ - { - "object": "collection_readConcern_majority", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test_aggregate_merge", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ], - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "other_test_collection", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "Aggregate with $merge and local readConcern", - "operations": [ - { - "object": "collection_readConcern_local", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test_aggregate_merge", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ], - "readConcern": { - "level": "local" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "other_test_collection", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "Aggregate with $merge and available readConcern", - "operations": [ - { - "object": "collection_readConcern_available", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test_aggregate_merge", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_test_collection" - } - } - ], - "readConcern": { - "level": "available" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "other_test_collection", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/aggregate-out-readConcern.json b/tests/UnifiedSpecTests/crud/aggregate-out-readConcern.json deleted file mode 100644 index e293457c1..000000000 --- a/tests/UnifiedSpecTests/crud/aggregate-out-readConcern.json +++ /dev/null @@ -1,407 +0,0 @@ -{ - "description": "aggregate-out-readConcern", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.1.0", - "topologies": [ - "replicaset", - "sharded" - ], - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_aggregate_out_readconcern" - } - }, - { - "collection": { - "id": "collection_readConcern_majority", - "database": "database0", - "collectionName": "test_aggregate_out_readconcern", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - } - } - }, - { - "collection": { - "id": "collection_readConcern_local", - "database": "database0", - "collectionName": "test_aggregate_out_readconcern", - "collectionOptions": { - "readConcern": { - "level": "local" - } - } - } - }, - { - "collection": { - "id": "collection_readConcern_available", - "database": "database0", - "collectionName": "test_aggregate_out_readconcern", - "collectionOptions": { - "readConcern": { - "level": "available" - } - } - } - }, - { - "collection": { - "id": "collection_readConcern_linearizable", - "database": "database0", - "collectionName": "test_aggregate_out_readconcern", - "collectionOptions": { - "readConcern": { - "level": "linearizable" - } - } - } - } - ], - "initialData": [ - { - "collectionName": "test_aggregate_out_readconcern", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "readConcern majority with out stage", - "operations": [ - { - "object": "collection_readConcern_majority", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test_aggregate_out_readconcern", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "other_test_collection", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "readConcern local with out stage", - "operations": [ - { - "object": "collection_readConcern_local", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test_aggregate_out_readconcern", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "readConcern": { - "level": "local" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "other_test_collection", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "readConcern available with out stage", - "operations": [ - { - "object": "collection_readConcern_available", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test_aggregate_out_readconcern", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "readConcern": { - "level": "available" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "other_test_collection", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "readConcern linearizable with out stage", - "operations": [ - { - "object": "collection_readConcern_linearizable", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test_aggregate_out_readconcern", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "readConcern": { - "level": "linearizable" - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/aggregate-out.json b/tests/UnifiedSpecTests/crud/aggregate-out.json deleted file mode 100644 index db0d7918c..000000000 --- a/tests/UnifiedSpecTests/crud/aggregate-out.json +++ /dev/null @@ -1,143 +0,0 @@ -{ - "description": "aggregate-out", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "2.6", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Aggregate with $out", - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "batchSize": 2 - } - } - ], - "outcome": [ - { - "collectionName": "other_test_collection", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "Aggregate with $out and batch size of 0", - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_test_collection" - } - ], - "batchSize": 0 - } - } - ], - "outcome": [ - { - "collectionName": "other_test_collection", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/aggregate-write-readPreference.json b/tests/UnifiedSpecTests/crud/aggregate-write-readPreference.json deleted file mode 100644 index bc887e83c..000000000 --- a/tests/UnifiedSpecTests/crud/aggregate-write-readPreference.json +++ /dev/null @@ -1,460 +0,0 @@ -{ - "description": "aggregate-write-readPreference", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "_yamlAnchors": { - "readConcern": { - "level": "local" - }, - "writeConcern": { - "w": 1 - } - }, - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ], - "uriOptions": { - "readConcernLevel": "local", - "w": 1 - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "db0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0", - "collectionOptions": { - "readPreference": { - "mode": "secondaryPreferred", - "maxStalenessSeconds": 600 - } - } - } - }, - { - "collection": { - "id": "collection1", - "database": "database0", - "collectionName": "coll1" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - }, - { - "collectionName": "coll1", - "databaseName": "db0", - "documents": [] - } - ], - "tests": [ - { - "description": "Aggregate with $out includes read preference for 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0", - "serverless": "forbid" - } - ], - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - }, - { - "$out": "coll1" - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - }, - { - "$out": "coll1" - } - ], - "$readPreference": { - "mode": "secondaryPreferred", - "maxStalenessSeconds": 600 - }, - "readConcern": { - "level": "local" - }, - "writeConcern": { - "w": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll1", - "databaseName": "db0", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "Aggregate with $out omits read preference for pre-5.0 server", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.4.99", - "serverless": "forbid" - } - ], - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - }, - { - "$out": "coll1" - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - }, - { - "$out": "coll1" - } - ], - "$readPreference": { - "$$exists": false - }, - "readConcern": { - "level": "local" - }, - "writeConcern": { - "w": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll1", - "databaseName": "db0", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "Aggregate with $merge includes read preference for 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - }, - { - "$merge": { - "into": "coll1" - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - }, - { - "$merge": { - "into": "coll1" - } - } - ], - "$readPreference": { - "mode": "secondaryPreferred", - "maxStalenessSeconds": 600 - }, - "readConcern": { - "level": "local" - }, - "writeConcern": { - "w": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll1", - "databaseName": "db0", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "Aggregate with $merge omits read preference for pre-5.0 server", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - }, - { - "$merge": { - "into": "coll1" - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - }, - { - "$merge": { - "into": "coll1" - } - } - ], - "$readPreference": { - "$$exists": false - }, - "readConcern": { - "level": "local" - }, - "writeConcern": { - "w": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll1", - "databaseName": "db0", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/aggregate.json b/tests/UnifiedSpecTests/crud/aggregate.json deleted file mode 100644 index 55634f05f..000000000 --- a/tests/UnifiedSpecTests/crud/aggregate.json +++ /dev/null @@ -1,615 +0,0 @@ -{ - "description": "aggregate", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "aggregate-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "aggregate-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - }, - { - "_id": 6, - "x": 66 - } - ] - } - ], - "tests": [ - { - "description": "aggregate with multiple batches works", - "operations": [ - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "batchSize": 2 - }, - "object": "collection0", - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - }, - { - "_id": 6, - "x": 66 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "cursor": { - "batchSize": 2 - } - }, - "commandName": "aggregate", - "databaseName": "aggregate-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2 - }, - "commandName": "getMore", - "databaseName": "aggregate-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2 - }, - "commandName": "getMore", - "databaseName": "aggregate-tests" - } - } - ] - } - ] - }, - { - "description": "aggregate with a string comment", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0" - } - ], - "operations": [ - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "comment": "comment" - }, - "object": "collection0" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "comment": "comment" - } - } - } - ] - } - ] - }, - { - "description": "aggregate with a document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "comment": { - "content": "test" - } - }, - "object": "collection0" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "comment": { - "content": "test" - } - } - } - } - ] - } - ] - }, - { - "description": "aggregate with a document comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "comment": { - "content": "test" - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "comment": { - "content": "test" - } - }, - "commandName": "aggregate", - "databaseName": "aggregate-tests" - } - } - ] - } - ] - }, - { - "description": "aggregate with comment sets comment on getMore", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "batchSize": 2, - "comment": { - "content": "test" - } - }, - "object": "collection0", - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - }, - { - "_id": 6, - "x": 66 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "cursor": { - "batchSize": 2 - }, - "comment": { - "content": "test" - } - }, - "commandName": "aggregate", - "databaseName": "aggregate-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2, - "comment": { - "content": "test" - } - }, - "commandName": "getMore", - "databaseName": "aggregate-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2, - "comment": { - "content": "test" - } - }, - "commandName": "getMore", - "databaseName": "aggregate-tests" - } - } - ] - } - ] - }, - { - "description": "aggregate with comment does not set comment on getMore - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.3.99" - } - ], - "operations": [ - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "batchSize": 2, - "comment": "comment" - }, - "object": "collection0", - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - }, - { - "_id": 6, - "x": 66 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "cursor": { - "batchSize": 2 - }, - "comment": "comment" - }, - "commandName": "aggregate", - "databaseName": "aggregate-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2, - "comment": { - "$$exists": false - } - }, - "commandName": "getMore", - "databaseName": "aggregate-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2, - "comment": { - "$$exists": false - } - }, - "commandName": "getMore", - "databaseName": "aggregate-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate with multiple stages", - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "batchSize": 2 - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - }, - { - "_id": 6, - "x": 66 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-arrayFilters-clientError.json b/tests/UnifiedSpecTests/crud/bulkWrite-arrayFilters-clientError.json deleted file mode 100644 index 63815e323..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-arrayFilters-clientError.json +++ /dev/null @@ -1,151 +0,0 @@ -{ - "description": "bulkWrite-arrayFilters-clientError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "maxServerVersion": "3.5.5" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "crud-v2" - } - } - ], - "initialData": [ - { - "collectionName": "crud-v2", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite on server that doesn't support arrayFilters", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": {}, - "update": { - "$set": { - "y.0.b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 1 - } - ] - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "BulkWrite on server that doesn't support arrayFilters with arrayFilters on second op", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": {}, - "update": { - "$set": { - "y.0.b": 2 - } - } - } - }, - { - "updateMany": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 1 - } - ] - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-arrayFilters.json b/tests/UnifiedSpecTests/crud/bulkWrite-arrayFilters.json deleted file mode 100644 index bc4e7b9fc..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-arrayFilters.json +++ /dev/null @@ -1,364 +0,0 @@ -{ - "description": "bulkWrite-arrayFilters", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.5.6" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite updateOne with arrayFilters", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 3 - } - ] - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": {}, - "u": { - "$set": { - "y.$[i].b": 2 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - }, - "arrayFilters": [ - { - "i.b": 3 - } - ] - } - ], - "ordered": true - }, - "commandName": "update", - "databaseName": "crud-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 2 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - } - ] - } - ] - }, - { - "description": "BulkWrite updateMany with arrayFilters", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 1 - } - ] - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": {}, - "u": { - "$set": { - "y.$[i].b": 2 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - }, - "arrayFilters": [ - { - "i.b": 1 - } - ] - } - ], - "ordered": true - }, - "commandName": "update", - "databaseName": "crud-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 2 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 2 - } - ] - } - ] - } - ] - }, - { - "description": "BulkWrite with arrayFilters", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 3 - } - ] - } - }, - { - "updateMany": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 1 - } - ] - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 3, - "modifiedCount": 3, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 2 - }, - { - "b": 2 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 2 - } - ] - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-collation.json b/tests/UnifiedSpecTests/crud/bulkWrite-collation.json deleted file mode 100644 index fe54b1a1e..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-collation.json +++ /dev/null @@ -1,254 +0,0 @@ -{ - "description": "bulkWrite-collation", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": "ping" - }, - { - "_id": 3, - "x": "pINg" - }, - { - "_id": 4, - "x": "pong" - }, - { - "_id": 5, - "x": "pONg" - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite with delete operations and collation", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "x": "PING" - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - } - }, - { - "deleteOne": { - "filter": { - "x": "PING" - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - } - }, - { - "deleteMany": { - "filter": { - "x": "PONG" - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 4, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "BulkWrite with update operations and collation", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "x": "ping" - }, - "update": { - "$set": { - "x": "PONG" - } - }, - "collation": { - "locale": "en_US", - "strength": 3 - } - } - }, - { - "updateOne": { - "filter": { - "x": "ping" - }, - "update": { - "$set": { - "x": "PONG" - } - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - } - }, - { - "replaceOne": { - "filter": { - "x": "ping" - }, - "replacement": { - "_id": 6, - "x": "ping" - }, - "upsert": true, - "collation": { - "locale": "en_US", - "strength": 3 - } - } - }, - { - "updateMany": { - "filter": { - "x": "pong" - }, - "update": { - "$set": { - "x": "PONG" - } - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 6, - "modifiedCount": 4, - "upsertedCount": 1, - "upsertedIds": { - "2": 6 - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": "PONG" - }, - { - "_id": 3, - "x": "PONG" - }, - { - "_id": 4, - "x": "PONG" - }, - { - "_id": 5, - "x": "PONG" - }, - { - "_id": 6, - "x": "ping" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-comment.json b/tests/UnifiedSpecTests/crud/bulkWrite-comment.json deleted file mode 100644 index 0b2addc85..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-comment.json +++ /dev/null @@ -1,519 +0,0 @@ -{ - "description": "bulkWrite-comment", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "BulkWrite_comment" - } - } - ], - "initialData": [ - { - "collectionName": "BulkWrite_comment", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite with string comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 5, - "x": "inserted" - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": "replaced" - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$set": { - "x": "updated" - } - } - } - }, - { - "deleteOne": { - "filter": { - "_id": 3 - } - } - } - ], - "comment": "comment" - }, - "expectResult": { - "deletedCount": 1, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 5 - } - }, - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "BulkWrite_comment", - "documents": [ - { - "_id": 5, - "x": "inserted" - } - ], - "ordered": true, - "comment": "comment" - } - } - }, - { - "commandStartedEvent": { - "command": { - "update": "BulkWrite_comment", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "_id": 1, - "x": "replaced" - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": 2 - }, - "u": { - "$set": { - "x": "updated" - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true, - "comment": "comment" - } - } - }, - { - "commandStartedEvent": { - "command": { - "delete": "BulkWrite_comment", - "deletes": [ - { - "q": { - "_id": 3 - }, - "limit": 1 - } - ], - "ordered": true, - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "BulkWrite_comment", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": "replaced" - }, - { - "_id": 2, - "x": "updated" - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": "inserted" - } - ] - } - ] - }, - { - "description": "BulkWrite with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 5, - "x": "inserted" - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": "replaced" - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$set": { - "x": "updated" - } - } - } - }, - { - "deleteOne": { - "filter": { - "_id": 3 - } - } - } - ], - "comment": { - "key": "value" - } - }, - "expectResult": { - "deletedCount": 1, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 5 - } - }, - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "BulkWrite_comment", - "documents": [ - { - "_id": 5, - "x": "inserted" - } - ], - "ordered": true, - "comment": { - "key": "value" - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "update": "BulkWrite_comment", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "_id": 1, - "x": "replaced" - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": 2 - }, - "u": { - "$set": { - "x": "updated" - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true, - "comment": { - "key": "value" - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "delete": "BulkWrite_comment", - "deletes": [ - { - "q": { - "_id": 3 - }, - "limit": 1 - } - ], - "ordered": true, - "comment": { - "key": "value" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "BulkWrite_comment", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": "replaced" - }, - { - "_id": 2, - "x": "updated" - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": "inserted" - } - ] - } - ] - }, - { - "description": "BulkWrite with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 5, - "x": "inserted" - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": "replaced" - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$set": { - "x": "updated" - } - } - } - }, - { - "deleteOne": { - "filter": { - "_id": 3 - } - } - } - ], - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "BulkWrite_comment", - "documents": [ - { - "_id": 5, - "x": "inserted" - } - ], - "ordered": true, - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "BulkWrite_comment", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-delete-hint-clientError.json b/tests/UnifiedSpecTests/crud/bulkWrite-delete-hint-clientError.json deleted file mode 100644 index 2961b55dc..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-delete-hint-clientError.json +++ /dev/null @@ -1,193 +0,0 @@ -{ - "description": "bulkWrite-delete-hint-clientError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "maxServerVersion": "3.3.99" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "BulkWrite_delete_hint" - } - } - ], - "initialData": [ - { - "collectionName": "BulkWrite_delete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite deleteOne with hints unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - } - }, - { - "deleteOne": { - "filter": { - "_id": 2 - }, - "hint": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "BulkWrite_delete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "BulkWrite deleteMany with hints unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteMany": { - "filter": { - "_id": { - "$lt": 3 - } - }, - "hint": "_id_" - } - }, - { - "deleteMany": { - "filter": { - "_id": { - "$gte": 4 - } - }, - "hint": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "BulkWrite_delete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-delete-hint-serverError.json b/tests/UnifiedSpecTests/crud/bulkWrite-delete-hint-serverError.json deleted file mode 100644 index fa9952209..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-delete-hint-serverError.json +++ /dev/null @@ -1,252 +0,0 @@ -{ - "description": "bulkWrite-delete-hint-serverError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.3.3" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "BulkWrite_delete_hint" - } - } - ], - "initialData": [ - { - "collectionName": "BulkWrite_delete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite deleteOne with hints unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - } - }, - { - "deleteOne": { - "filter": { - "_id": 2 - }, - "hint": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "BulkWrite_delete_hint", - "deletes": [ - { - "q": { - "_id": 1 - }, - "hint": "_id_", - "limit": 1 - }, - { - "q": { - "_id": 2 - }, - "hint": { - "_id": 1 - }, - "limit": 1 - } - ], - "ordered": true - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "BulkWrite_delete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "BulkWrite deleteMany with hints unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteMany": { - "filter": { - "_id": { - "$lt": 3 - } - }, - "hint": "_id_" - } - }, - { - "deleteMany": { - "filter": { - "_id": { - "$gte": 4 - } - }, - "hint": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "BulkWrite_delete_hint", - "deletes": [ - { - "q": { - "_id": { - "$lt": 3 - } - }, - "hint": "_id_", - "limit": 0 - }, - { - "q": { - "_id": { - "$gte": 4 - } - }, - "hint": { - "_id": 1 - }, - "limit": 0 - } - ], - "ordered": true - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "BulkWrite_delete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-delete-hint.json b/tests/UnifiedSpecTests/crud/bulkWrite-delete-hint.json deleted file mode 100644 index 9fcdecefd..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-delete-hint.json +++ /dev/null @@ -1,247 +0,0 @@ -{ - "description": "bulkWrite-delete-hint", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.3.4" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "BulkWrite_delete_hint" - } - } - ], - "initialData": [ - { - "collectionName": "BulkWrite_delete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite deleteOne with hints", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - } - }, - { - "deleteOne": { - "filter": { - "_id": 2 - }, - "hint": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 2, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "BulkWrite_delete_hint", - "deletes": [ - { - "q": { - "_id": 1 - }, - "hint": "_id_", - "limit": 1 - }, - { - "q": { - "_id": 2 - }, - "hint": { - "_id": 1 - }, - "limit": 1 - } - ], - "ordered": true - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "BulkWrite_delete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "BulkWrite deleteMany with hints", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteMany": { - "filter": { - "_id": { - "$lt": 3 - } - }, - "hint": "_id_" - } - }, - { - "deleteMany": { - "filter": { - "_id": { - "$gte": 4 - } - }, - "hint": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 3, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "BulkWrite_delete_hint", - "deletes": [ - { - "q": { - "_id": { - "$lt": 3 - } - }, - "hint": "_id_", - "limit": 0 - }, - { - "q": { - "_id": { - "$gte": 4 - } - }, - "hint": { - "_id": 1 - }, - "limit": 0 - } - ], - "ordered": true - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "BulkWrite_delete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-deleteMany-hint-unacknowledged.json b/tests/UnifiedSpecTests/crud/bulkWrite-deleteMany-hint-unacknowledged.json deleted file mode 100644 index 2dda9486e..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-deleteMany-hint-unacknowledged.json +++ /dev/null @@ -1,269 +0,0 @@ -{ - "description": "bulkWrite-deleteMany-hint-unacknowledged", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "db0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Unacknowledged deleteMany with hint string fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged deleteMany with hint document fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged deleteMany with hint string on 4.4+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - } - } - ] - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "$$type": [ - "string", - "object" - ] - }, - "limit": 0 - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - }, - { - "description": "Unacknowledged deleteMany with hint document on 4.4+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ] - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "$$type": [ - "string", - "object" - ] - }, - "limit": 0 - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-deleteMany-let.json b/tests/UnifiedSpecTests/crud/bulkWrite-deleteMany-let.json deleted file mode 100644 index 45c20ea49..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-deleteMany-let.json +++ /dev/null @@ -1,200 +0,0 @@ -{ - "description": "BulkWrite deleteMany-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite deleteMany with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteMany": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - } - } - } - ], - "let": { - "id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "limit": 0 - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "BulkWrite deleteMany with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - } - } - } - ], - "let": { - "id": 1 - } - }, - "expectError": { - "errorContains": "'delete.let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "limit": 1 - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-deleteOne-hint-unacknowledged.json b/tests/UnifiedSpecTests/crud/bulkWrite-deleteOne-hint-unacknowledged.json deleted file mode 100644 index aadf6d9e9..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-deleteOne-hint-unacknowledged.json +++ /dev/null @@ -1,265 +0,0 @@ -{ - "description": "bulkWrite-deleteOne-hint-unacknowledged", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "db0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "Unacknowledged deleteOne with hint string fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged deleteOne with hint document fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged deleteOne with hint string on 4.4+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - } - } - ] - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "$$type": [ - "string", - "object" - ] - }, - "limit": 1 - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - }, - { - "description": "Unacknowledged deleteOne with hint document on 4.4+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ] - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "$$type": [ - "string", - "object" - ] - }, - "limit": 1 - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-deleteOne-let.json b/tests/UnifiedSpecTests/crud/bulkWrite-deleteOne-let.json deleted file mode 100644 index f3268163c..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-deleteOne-let.json +++ /dev/null @@ -1,200 +0,0 @@ -{ - "description": "BulkWrite deleteOne-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite deleteOne with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - } - } - } - ], - "let": { - "id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "limit": 1 - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "BulkWrite deleteOne with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.9" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - } - } - } - ], - "let": { - "id": 1 - } - }, - "expectError": { - "errorContains": "'delete.let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "limit": 1 - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-errorResponse.json b/tests/UnifiedSpecTests/crud/bulkWrite-errorResponse.json deleted file mode 100644 index 157637c71..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-errorResponse.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "description": "bulkWrite-errorResponse", - "schemaVersion": "1.12", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "tests": [ - { - "description": "bulkWrite operations support errorResponse assertions", - "runOnRequirements": [ - { - "minServerVersion": "4.0.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.2.0", - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 8 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "errorCode": 8, - "errorResponse": { - "code": 8 - } - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-insertOne-dots_and_dollars.json b/tests/UnifiedSpecTests/crud/bulkWrite-insertOne-dots_and_dollars.json deleted file mode 100644 index 92bbb1aaf..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-insertOne-dots_and_dollars.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "description": "bulkWrite-insertOne-dots_and_dollars", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "Inserting document with top-level dollar-prefixed key on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 1, - "$a": 1 - } - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 - } - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "$a": 1 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "$a": 1 - } - ] - } - ] - }, - { - "description": "Inserting document with top-level dollar-prefixed key on pre-5.0 server yields server-side error", - "runOnRequirements": [ - { - "maxServerVersion": "4.99" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 1, - "$a": 1 - } - } - } - ] - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "$a": 1 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [] - } - ] - }, - { - "description": "Inserting document with top-level dotted key", - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 1, - "a.b": 1 - } - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 - } - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "a.b": 1 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a.b": 1 - } - ] - } - ] - }, - { - "description": "Inserting document with dollar-prefixed key in embedded doc", - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 1, - "a": { - "$b": 1 - } - } - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 - } - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "a": { - "$b": 1 - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a": { - "$b": 1 - } - } - ] - } - ] - }, - { - "description": "Inserting document with dotted key in embedded doc", - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 1, - "a": { - "b.c": 1 - } - } - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 - } - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "a": { - "b.c": 1 - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a": { - "b.c": 1 - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-replaceOne-dots_and_dollars.json b/tests/UnifiedSpecTests/crud/bulkWrite-replaceOne-dots_and_dollars.json deleted file mode 100644 index fce647d8f..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-replaceOne-dots_and_dollars.json +++ /dev/null @@ -1,532 +0,0 @@ -{ - "description": "bulkWrite-replaceOne-dots_and_dollars", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ], - "tests": [ - { - "description": "Replacing document with top-level dotted key on 3.6+ server", - "runOnRequirements": [ - { - "minServerVersion": "3.6" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a.b": 1 - } - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "_id": 1, - "a.b": 1 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a.b": 1 - } - ] - } - ] - }, - { - "description": "Replacing document with top-level dotted key on pre-3.6 server yields server-side error", - "runOnRequirements": [ - { - "maxServerVersion": "3.4.99" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a.b": 1 - } - } - } - ] - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "_id": 1, - "a.b": 1 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "Replacing document with dollar-prefixed key in embedded doc on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a": { - "$b": 1 - } - } - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "_id": 1, - "a": { - "$b": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a": { - "$b": 1 - } - } - ] - } - ] - }, - { - "description": "Replacing document with dollar-prefixed key in embedded doc on pre-5.0 server yields server-side error", - "runOnRequirements": [ - { - "maxServerVersion": "4.99" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a": { - "$b": 1 - } - } - } - } - ] - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "_id": 1, - "a": { - "$b": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "Replacing document with dotted key in embedded doc on 3.6+ server", - "runOnRequirements": [ - { - "minServerVersion": "3.6" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a": { - "b.c": 1 - } - } - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "_id": 1, - "a": { - "b.c": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a": { - "b.c": 1 - } - } - ] - } - ] - }, - { - "description": "Replacing document with dotted key in embedded doc on pre-3.6 server yields server-side error", - "runOnRequirements": [ - { - "maxServerVersion": "3.4.99" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a": { - "b.c": 1 - } - } - } - } - ] - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "_id": 1, - "a": { - "b.c": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-replaceOne-hint-unacknowledged.json b/tests/UnifiedSpecTests/crud/bulkWrite-replaceOne-hint-unacknowledged.json deleted file mode 100644 index e54cd704d..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-replaceOne-hint-unacknowledged.json +++ /dev/null @@ -1,293 +0,0 @@ -{ - "description": "bulkWrite-replaceOne-hint-unacknowledged", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "db0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "Unacknowledged replaceOne with hint string fails with client-side error on pre-4.2 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": "_id_" - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged replaceOne with hint document fails with client-side error on pre-4.2 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged replaceOne with hint string on 4.2+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": "_id_" - } - } - ] - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "x": 111 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": { - "$$type": [ - "string", - "object" - ] - } - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - }, - { - "description": "Unacknowledged replaceOne with hint document on 4.2+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": { - "_id": 1 - } - } - } - ] - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "x": 111 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": { - "$$type": [ - "string", - "object" - ] - } - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-replaceOne-let.json b/tests/UnifiedSpecTests/crud/bulkWrite-replaceOne-let.json deleted file mode 100644 index 70f63837a..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-replaceOne-let.json +++ /dev/null @@ -1,226 +0,0 @@ -{ - "description": "BulkWrite replaceOne-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite replaceOne with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "replacement": { - "x": 3 - } - } - } - ], - "let": { - "id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "u": { - "x": 3 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 3 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "BulkWrite replaceOne with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.9" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "replacement": { - "x": 3 - } - } - } - ], - "let": { - "id": 1 - } - }, - "expectError": { - "errorContains": "'update.let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "u": { - "x": 3 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-update-hint-clientError.json b/tests/UnifiedSpecTests/crud/bulkWrite-update-hint-clientError.json deleted file mode 100644 index d5eb71c29..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-update-hint-clientError.json +++ /dev/null @@ -1,284 +0,0 @@ -{ - "description": "bulkWrite-update-hint-clientError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "maxServerVersion": "3.3.99" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_bulkwrite_update_hint" - } - } - ], - "initialData": [ - { - "collectionName": "test_bulkwrite_update_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite updateOne with update hints unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - }, - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "test_bulkwrite_update_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "BulkWrite updateMany with update hints unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "_id": { - "$lt": 3 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - }, - { - "updateMany": { - "filter": { - "_id": { - "$lt": 3 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "test_bulkwrite_update_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "BulkWrite replaceOne with update hints unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": 3 - }, - "replacement": { - "x": 333 - }, - "hint": "_id_" - } - }, - { - "replaceOne": { - "filter": { - "_id": 4 - }, - "replacement": { - "x": 444 - }, - "hint": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "test_bulkwrite_update_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-update-hint-serverError.json b/tests/UnifiedSpecTests/crud/bulkWrite-update-hint-serverError.json deleted file mode 100644 index b0f7e1b38..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-update-hint-serverError.json +++ /dev/null @@ -1,422 +0,0 @@ -{ - "description": "bulkWrite-update-hint-serverError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.1.9" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_bulkwrite_update_hint" - } - } - ], - "initialData": [ - { - "collectionName": "test_bulkwrite_update_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite updateOne with update hints unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - }, - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_bulkwrite_update_hint", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_", - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": 1 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_bulkwrite_update_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "BulkWrite updateMany with update hints unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "_id": { - "$lt": 3 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - }, - { - "updateMany": { - "filter": { - "_id": { - "$lt": 3 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_bulkwrite_update_hint", - "updates": [ - { - "q": { - "_id": { - "$lt": 3 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": "_id_", - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": { - "$lt": 3 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": { - "_id": 1 - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_bulkwrite_update_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "BulkWrite replaceOne with update hints unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": 3 - }, - "replacement": { - "x": 333 - }, - "hint": "_id_" - } - }, - { - "replaceOne": { - "filter": { - "_id": 4 - }, - "replacement": { - "x": 444 - }, - "hint": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_bulkwrite_update_hint", - "updates": [ - { - "q": { - "_id": 3 - }, - "u": { - "x": 333 - }, - "hint": "_id_", - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": 4 - }, - "u": { - "x": 444 - }, - "hint": { - "_id": 1 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_bulkwrite_update_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-update-hint.json b/tests/UnifiedSpecTests/crud/bulkWrite-update-hint.json deleted file mode 100644 index 420635989..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-update-hint.json +++ /dev/null @@ -1,445 +0,0 @@ -{ - "description": "bulkWrite-update-hint", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_bulkwrite_update_hint" - } - } - ], - "initialData": [ - { - "collectionName": "test_bulkwrite_update_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite updateOne with update hints", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - }, - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_bulkwrite_update_hint", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": "_id_" - }, - { - "q": { - "_id": 1 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": { - "_id": 1 - } - } - ], - "ordered": true - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_bulkwrite_update_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 13 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "BulkWrite updateMany with update hints", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "_id": { - "$lt": 3 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - }, - { - "updateMany": { - "filter": { - "_id": { - "$lt": 3 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 4, - "modifiedCount": 4, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_bulkwrite_update_hint", - "updates": [ - { - "q": { - "_id": { - "$lt": 3 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": "_id_" - }, - { - "q": { - "_id": { - "$lt": 3 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": { - "_id": 1 - } - } - ], - "ordered": true - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_bulkwrite_update_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 13 - }, - { - "_id": 2, - "x": 24 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "BulkWrite replaceOne with update hints", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": 3 - }, - "replacement": { - "x": 333 - }, - "hint": "_id_" - } - }, - { - "replaceOne": { - "filter": { - "_id": 4 - }, - "replacement": { - "x": 444 - }, - "hint": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_bulkwrite_update_hint", - "updates": [ - { - "q": { - "_id": 3 - }, - "u": { - "x": 333 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": "_id_" - }, - { - "q": { - "_id": 4 - }, - "u": { - "x": 444 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": { - "_id": 1 - } - } - ], - "ordered": true - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_bulkwrite_update_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 333 - }, - { - "_id": 4, - "x": 444 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-update-validation.json b/tests/UnifiedSpecTests/crud/bulkWrite-update-validation.json deleted file mode 100644 index f9bfda0ed..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-update-validation.json +++ /dev/null @@ -1,210 +0,0 @@ -{ - "description": "bulkWrite-update-validation", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite replaceOne prohibits atomic modifiers", - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": 1 - }, - "replacement": { - "$set": { - "x": 22 - } - } - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "BulkWrite updateOne requires atomic modifiers", - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "x": 22 - } - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "BulkWrite updateMany requires atomic modifiers", - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "x": 44 - } - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-updateMany-dots_and_dollars.json b/tests/UnifiedSpecTests/crud/bulkWrite-updateMany-dots_and_dollars.json deleted file mode 100644 index 35a5cdd52..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-updateMany-dots_and_dollars.json +++ /dev/null @@ -1,452 +0,0 @@ -{ - "description": "bulkWrite-updateMany-dots_and_dollars", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": {} - } - ] - } - ], - "tests": [ - { - "description": "Updating document to set top-level dollar-prefixed key on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ] - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ], - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": {}, - "$a": 1 - } - ] - } - ] - }, - { - "description": "Updating document to set top-level dotted key on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ] - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ], - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": {}, - "a.b": 1 - } - ] - } - ] - }, - { - "description": "Updating document to set dollar-prefixed key in embedded doc on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ] - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ], - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": { - "$a": 1 - } - } - ] - } - ] - }, - { - "description": "Updating document to set dotted key in embedded doc on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ] - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ], - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": { - "a.b": 1 - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-updateMany-hint-unacknowledged.json b/tests/UnifiedSpecTests/crud/bulkWrite-updateMany-hint-unacknowledged.json deleted file mode 100644 index 87478918d..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-updateMany-hint-unacknowledged.json +++ /dev/null @@ -1,305 +0,0 @@ -{ - "description": "bulkWrite-updateMany-hint-unacknowledged", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "db0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Unacknowledged updateMany with hint string fails with client-side error on pre-4.2 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged updateMany with hint document fails with client-side error on pre-4.2 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged updateMany with hint string on 4.2+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - } - ] - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": { - "$$type": [ - "string", - "object" - ] - } - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - }, - { - "description": "Unacknowledged updateMany with hint document on 4.2+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ] - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": { - "$$type": [ - "string", - "object" - ] - } - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-updateMany-let.json b/tests/UnifiedSpecTests/crud/bulkWrite-updateMany-let.json deleted file mode 100644 index fbeba1a60..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-updateMany-let.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "description": "BulkWrite updateMany-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 20 - }, - { - "_id": 2, - "x": 21 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite updateMany with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": [ - { - "$set": { - "x": 21 - } - } - ] - } - } - ], - "let": { - "id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "u": [ - { - "$set": { - "x": 21 - } - } - ], - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 21 - }, - { - "_id": 2, - "x": 21 - } - ] - } - ] - }, - { - "description": "BulkWrite updateMany with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.9" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": [ - { - "$set": { - "x": 21 - } - } - ] - } - } - ], - "let": { - "id": 1 - } - }, - "expectError": { - "errorContains": "'update.let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "u": [ - { - "$set": { - "x": 21 - } - } - ], - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 20 - }, - { - "_id": 2, - "x": 21 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-updateOne-dots_and_dollars.json b/tests/UnifiedSpecTests/crud/bulkWrite-updateOne-dots_and_dollars.json deleted file mode 100644 index cbbe113ce..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-updateOne-dots_and_dollars.json +++ /dev/null @@ -1,460 +0,0 @@ -{ - "description": "bulkWrite-updateOne-dots_and_dollars", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": {} - } - ] - } - ], - "tests": [ - { - "description": "Updating document to set top-level dollar-prefixed key on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ] - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ], - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": {}, - "$a": 1 - } - ] - } - ] - }, - { - "description": "Updating document to set top-level dotted key on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ] - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ], - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": {}, - "a.b": 1 - } - ] - } - ] - }, - { - "description": "Updating document to set dollar-prefixed key in embedded doc on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ] - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ], - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": { - "$a": 1 - } - } - ] - } - ] - }, - { - "description": "Updating document to set dotted key in embedded doc on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ] - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ], - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": { - "a.b": 1 - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-updateOne-hint-unacknowledged.json b/tests/UnifiedSpecTests/crud/bulkWrite-updateOne-hint-unacknowledged.json deleted file mode 100644 index 1345f6b53..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-updateOne-hint-unacknowledged.json +++ /dev/null @@ -1,305 +0,0 @@ -{ - "description": "bulkWrite-updateOne-hint-unacknowledged", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "db0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "Unacknowledged updateOne with hint string fails with client-side error on pre-4.2 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged updateOne with hint document fails with client-side error on pre-4.2 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged updateOne with hint string on 4.2+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - } - ] - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": { - "$$type": [ - "string", - "object" - ] - } - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - }, - { - "description": "Unacknowledged updateOne with hint document on 4.2+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ] - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": { - "$$type": [ - "string", - "object" - ] - } - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite-updateOne-let.json b/tests/UnifiedSpecTests/crud/bulkWrite-updateOne-let.json deleted file mode 100644 index 96783c782..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite-updateOne-let.json +++ /dev/null @@ -1,247 +0,0 @@ -{ - "description": "BulkWrite updateOne-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 20 - }, - { - "_id": 2, - "x": 21 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite updateOne with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": [ - { - "$set": { - "x": 22 - } - } - ] - } - } - ], - "let": { - "id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "u": [ - { - "$set": { - "x": 22 - } - } - ], - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 22 - }, - { - "_id": 2, - "x": 21 - } - ] - } - ] - }, - { - "description": "BulkWrite updateOne with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.9" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": [ - { - "$set": { - "x": 22 - } - } - ] - } - } - ], - "let": { - "id": 1 - } - }, - "expectError": { - "errorContains": "'update.let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "u": [ - { - "$set": { - "x": 22 - } - } - ], - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 20 - }, - { - "_id": 2, - "x": 21 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/bulkWrite.json b/tests/UnifiedSpecTests/crud/bulkWrite.json deleted file mode 100644 index 59b33cbac..000000000 --- a/tests/UnifiedSpecTests/crud/bulkWrite.json +++ /dev/null @@ -1,829 +0,0 @@ -{ - "description": "bulkWrite", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "2.6" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite with deleteOne operations", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "_id": 3 - } - } - }, - { - "deleteOne": { - "filter": { - "_id": 2 - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 1, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "BulkWrite with deleteMany operations", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteMany": { - "filter": { - "x": { - "$lt": 11 - } - } - } - }, - { - "deleteMany": { - "filter": { - "x": { - "$lte": 22 - } - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 2, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [] - } - ] - }, - { - "description": "BulkWrite with insertOne operations", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - }, - { - "insertOne": { - "document": { - "_id": 4, - "x": 44 - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 2, - "insertedIds": { - "$$unsetOrMatches": { - "0": 3, - "1": 4 - } - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "BulkWrite with replaceOne operations", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": 3 - }, - "replacement": { - "x": 33 - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 12 - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 3 - }, - "replacement": { - "x": 33 - }, - "upsert": true - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 1, - "upsertedIds": { - "2": 3 - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "BulkWrite with updateOne operations", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "_id": 0 - }, - "update": { - "$set": { - "x": 0 - } - } - } - }, - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 11 - } - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "updateOne": { - "filter": { - "_id": 3 - }, - "update": { - "$set": { - "x": 33 - } - }, - "upsert": true - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 2, - "modifiedCount": 1, - "upsertedCount": 1, - "upsertedIds": { - "3": 3 - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "BulkWrite with updateMany operations", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "x": { - "$lt": 11 - } - }, - "update": { - "$set": { - "x": 0 - } - } - } - }, - { - "updateMany": { - "filter": { - "x": { - "$lte": 22 - } - }, - "update": { - "$unset": { - "y": 1 - } - } - } - }, - { - "updateMany": { - "filter": { - "x": { - "$lte": 22 - } - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "updateMany": { - "filter": { - "_id": 3 - }, - "update": { - "$set": { - "x": 33 - } - }, - "upsert": true - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 4, - "modifiedCount": 2, - "upsertedCount": 1, - "upsertedIds": { - "3": 3 - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "BulkWrite with mixed ordered operations", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "updateMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "insertOne": { - "document": { - "_id": 4, - "x": 44 - } - } - }, - { - "deleteMany": { - "filter": { - "x": { - "$nin": [ - 24, - 34 - ] - } - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 4 - }, - "replacement": { - "_id": 4, - "x": 44 - }, - "upsert": true - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 2, - "insertedCount": 2, - "insertedIds": { - "$$unsetOrMatches": { - "0": 3, - "3": 4 - } - }, - "matchedCount": 3, - "modifiedCount": 3, - "upsertedCount": 1, - "upsertedIds": { - "5": 4 - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 2, - "x": 24 - }, - { - "_id": 3, - "x": 34 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "BulkWrite with mixed unordered operations", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "replaceOne": { - "filter": { - "_id": 3 - }, - "replacement": { - "_id": 3, - "x": 33 - }, - "upsert": true - } - }, - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "ordered": false - }, - "expectResult": { - "deletedCount": 1, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 1, - "upsertedIds": { - "0": 3 - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "BulkWrite continue-on-error behavior with unordered (preexisting duplicate key)", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - }, - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - }, - { - "insertOne": { - "document": { - "_id": 4, - "x": 44 - } - } - } - ], - "ordered": false - }, - "expectError": { - "isError": true, - "expectResult": { - "deletedCount": 0, - "insertedCount": 2, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "BulkWrite continue-on-error behavior with unordered (duplicate key in requests)", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - }, - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - }, - { - "insertOne": { - "document": { - "_id": 4, - "x": 44 - } - } - } - ], - "ordered": false - }, - "expectError": { - "isError": true, - "expectResult": { - "deletedCount": 0, - "insertedCount": 2, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/count-collation.json b/tests/UnifiedSpecTests/crud/count-collation.json deleted file mode 100644 index eef65e088..000000000 --- a/tests/UnifiedSpecTests/crud/count-collation.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "description": "count-collation", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": "ping" - } - ] - } - ], - "tests": [ - { - "description": "Count documents with collation", - "operations": [ - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": { - "x": "ping" - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - }, - "expectResult": 1 - } - ] - }, - { - "description": "Deprecated count with collation", - "operations": [ - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": { - "x": "ping" - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - }, - "expectResult": 1 - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/count-empty.json b/tests/UnifiedSpecTests/crud/count-empty.json deleted file mode 100644 index 29d8d76f6..000000000 --- a/tests/UnifiedSpecTests/crud/count-empty.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "description": "count-empty", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [] - } - ], - "tests": [ - { - "description": "Estimated document count with empty collection", - "operations": [ - { - "object": "collection0", - "name": "estimatedDocumentCount", - "arguments": {}, - "expectResult": 0 - } - ] - }, - { - "description": "Count documents with empty collection", - "operations": [ - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectResult": 0 - } - ] - }, - { - "description": "Deprecated count with empty collection", - "operations": [ - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectResult": 0 - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/count.json b/tests/UnifiedSpecTests/crud/count.json deleted file mode 100644 index 80fff5a30..000000000 --- a/tests/UnifiedSpecTests/crud/count.json +++ /dev/null @@ -1,148 +0,0 @@ -{ - "description": "count", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Estimated document count", - "operations": [ - { - "object": "collection0", - "name": "estimatedDocumentCount", - "arguments": {}, - "expectResult": 3 - } - ] - }, - { - "description": "Count documents without a filter", - "operations": [ - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectResult": 3 - } - ] - }, - { - "description": "Count documents with a filter", - "operations": [ - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": 2 - } - ] - }, - { - "description": "Count documents with skip and limit", - "operations": [ - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {}, - "skip": 1, - "limit": 3 - }, - "expectResult": 2 - } - ] - }, - { - "description": "Deprecated count without a filter", - "operations": [ - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectResult": 3 - } - ] - }, - { - "description": "Deprecated count with a filter", - "operations": [ - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": 2 - } - ] - }, - { - "description": "Deprecated count with skip and limit", - "operations": [ - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {}, - "skip": 1, - "limit": 3 - }, - "expectResult": 2 - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/countDocuments-comment.json b/tests/UnifiedSpecTests/crud/countDocuments-comment.json deleted file mode 100644 index e6c7ae817..000000000 --- a/tests/UnifiedSpecTests/crud/countDocuments-comment.json +++ /dev/null @@ -1,208 +0,0 @@ -{ - "description": "countDocuments-comment", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "countDocuments-comments-test" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "countDocuments-comments-test", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "countDocuments with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "name": "countDocuments", - "object": "collection0", - "arguments": { - "filter": {}, - "comment": { - "key": "value" - } - }, - "expectResult": 3 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ], - "comment": { - "key": "value" - } - }, - "commandName": "aggregate", - "databaseName": "countDocuments-comments-test" - } - } - ] - } - ] - }, - { - "description": "countDocuments with string comment", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0" - } - ], - "operations": [ - { - "name": "countDocuments", - "object": "collection0", - "arguments": { - "filter": {}, - "comment": "comment" - }, - "expectResult": 3 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ], - "comment": "comment" - }, - "commandName": "aggregate", - "databaseName": "countDocuments-comments-test" - } - } - ] - } - ] - }, - { - "description": "countDocuments with document comment on less than 4.4.0 - server error", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.3.99" - } - ], - "operations": [ - { - "name": "countDocuments", - "object": "collection0", - "arguments": { - "filter": {}, - "comment": { - "key": "value" - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ], - "comment": { - "key": "value" - } - }, - "commandName": "aggregate", - "databaseName": "countDocuments-comments-test" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/db-aggregate-write-readPreference.json b/tests/UnifiedSpecTests/crud/db-aggregate-write-readPreference.json deleted file mode 100644 index 2a81282de..000000000 --- a/tests/UnifiedSpecTests/crud/db-aggregate-write-readPreference.json +++ /dev/null @@ -1,446 +0,0 @@ -{ - "description": "db-aggregate-write-readPreference", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset" - ], - "serverless": "forbid" - } - ], - "_yamlAnchors": { - "readConcern": { - "level": "local" - }, - "writeConcern": { - "w": 1 - } - }, - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ], - "uriOptions": { - "readConcernLevel": "local", - "w": 1 - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "db0", - "databaseOptions": { - "readPreference": { - "mode": "secondaryPreferred", - "maxStalenessSeconds": 600 - } - } - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [] - } - ], - "tests": [ - { - "description": "Database-level aggregate with $out includes read preference for 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0", - "serverless": "forbid" - } - ], - "operations": [ - { - "object": "database0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - }, - { - "$addFields": { - "_id": 1 - } - }, - { - "$project": { - "_id": 1 - } - }, - { - "$out": "coll0" - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - }, - { - "$addFields": { - "_id": 1 - } - }, - { - "$project": { - "_id": 1 - } - }, - { - "$out": "coll0" - } - ], - "$readPreference": { - "mode": "secondaryPreferred", - "maxStalenessSeconds": 600 - }, - "readConcern": { - "level": "local" - }, - "writeConcern": { - "w": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "Database-level aggregate with $out omits read preference for pre-5.0 server", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.4.99", - "serverless": "forbid" - } - ], - "operations": [ - { - "object": "database0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - }, - { - "$addFields": { - "_id": 1 - } - }, - { - "$project": { - "_id": 1 - } - }, - { - "$out": "coll0" - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - }, - { - "$addFields": { - "_id": 1 - } - }, - { - "$project": { - "_id": 1 - } - }, - { - "$out": "coll0" - } - ], - "$readPreference": { - "$$exists": false - }, - "readConcern": { - "level": "local" - }, - "writeConcern": { - "w": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "Database-level aggregate with $merge includes read preference for 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "object": "database0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - }, - { - "$addFields": { - "_id": 1 - } - }, - { - "$project": { - "_id": 1 - } - }, - { - "$merge": { - "into": "coll0" - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - }, - { - "$addFields": { - "_id": 1 - } - }, - { - "$project": { - "_id": 1 - } - }, - { - "$merge": { - "into": "coll0" - } - } - ], - "$readPreference": { - "mode": "secondaryPreferred", - "maxStalenessSeconds": 600 - }, - "readConcern": { - "level": "local" - }, - "writeConcern": { - "w": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "Database-level aggregate with $merge omits read preference for pre-5.0 server", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "object": "database0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - }, - { - "$addFields": { - "_id": 1 - } - }, - { - "$project": { - "_id": 1 - } - }, - { - "$merge": { - "into": "coll0" - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - }, - { - "$addFields": { - "_id": 1 - } - }, - { - "$project": { - "_id": 1 - } - }, - { - "$merge": { - "into": "coll0" - } - } - ], - "$readPreference": { - "$$exists": false - }, - "readConcern": { - "level": "local" - }, - "writeConcern": { - "w": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/db-aggregate.json b/tests/UnifiedSpecTests/crud/db-aggregate.json deleted file mode 100644 index 5015405bf..000000000 --- a/tests/UnifiedSpecTests/crud/db-aggregate.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "description": "db-aggregate", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "admin" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "crud-v2" - } - } - ], - "tests": [ - { - "description": "Aggregate with $listLocalSessions", - "operations": [ - { - "object": "database0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - }, - { - "$addFields": { - "dummy": "dummy field" - } - }, - { - "$project": { - "_id": 0, - "dummy": 1 - } - } - ] - }, - "expectResult": [ - { - "dummy": "dummy field" - } - ] - } - ] - }, - { - "description": "Aggregate with $listLocalSessions and allowDiskUse", - "operations": [ - { - "object": "database0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - }, - { - "$addFields": { - "dummy": "dummy field" - } - }, - { - "$project": { - "_id": 0, - "dummy": 1 - } - } - ], - "allowDiskUse": true - }, - "expectResult": [ - { - "dummy": "dummy field" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteMany-collation.json b/tests/UnifiedSpecTests/crud/deleteMany-collation.json deleted file mode 100644 index 23d2f037c..000000000 --- a/tests/UnifiedSpecTests/crud/deleteMany-collation.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "description": "deleteMany-collation", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": "ping" - }, - { - "_id": 3, - "x": "pINg" - } - ] - } - ], - "tests": [ - { - "description": "DeleteMany when many documents match with collation", - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": { - "x": "PING" - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - }, - "expectResult": { - "deletedCount": 2 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteMany-comment.json b/tests/UnifiedSpecTests/crud/deleteMany-comment.json deleted file mode 100644 index 6abc5fd58..000000000 --- a/tests/UnifiedSpecTests/crud/deleteMany-comment.json +++ /dev/null @@ -1,245 +0,0 @@ -{ - "description": "deleteMany-comment", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2, - "name": "name2" - }, - { - "_id": 3, - "name": "name3" - } - ] - } - ], - "tests": [ - { - "description": "deleteMany with string comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "deleteMany", - "object": "collection0", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "comment": "comment" - }, - "expectResult": { - "deletedCount": 2 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "limit": 0 - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "deleteMany with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "deleteMany", - "object": "collection0", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "comment": { - "key": "value" - } - }, - "expectResult": { - "deletedCount": 2 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "limit": 0 - } - ], - "comment": { - "key": "value" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "deleteMany with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "deleteMany", - "object": "collection0", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "limit": 0 - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2, - "name": "name2" - }, - { - "_id": 3, - "name": "name3" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteMany-hint-clientError.json b/tests/UnifiedSpecTests/crud/deleteMany-hint-clientError.json deleted file mode 100644 index 66320122b..000000000 --- a/tests/UnifiedSpecTests/crud/deleteMany-hint-clientError.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "description": "deleteMany-hint-clientError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "maxServerVersion": "3.3.99" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "DeleteMany_hint" - } - } - ], - "initialData": [ - { - "collectionName": "DeleteMany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "DeleteMany with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "DeleteMany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "DeleteMany with hint document unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "DeleteMany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteMany-hint-serverError.json b/tests/UnifiedSpecTests/crud/deleteMany-hint-serverError.json deleted file mode 100644 index 88d4a6557..000000000 --- a/tests/UnifiedSpecTests/crud/deleteMany-hint-serverError.json +++ /dev/null @@ -1,190 +0,0 @@ -{ - "description": "deleteMany-hint-serverError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.3.3" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "DeleteMany_hint" - } - } - ], - "initialData": [ - { - "collectionName": "DeleteMany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "DeleteMany with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "DeleteMany_hint", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_", - "limit": 0 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "DeleteMany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "DeleteMany with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "DeleteMany_hint", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - }, - "limit": 0 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "DeleteMany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteMany-hint-unacknowledged.json b/tests/UnifiedSpecTests/crud/deleteMany-hint-unacknowledged.json deleted file mode 100644 index ab7e9c7c0..000000000 --- a/tests/UnifiedSpecTests/crud/deleteMany-hint-unacknowledged.json +++ /dev/null @@ -1,245 +0,0 @@ -{ - "description": "deleteMany-hint-unacknowledged", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "db0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Unacknowledged deleteMany with hint string fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged deleteMany with hint document fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged deleteMany with hint string on 4.4+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "$$type": [ - "string", - "object" - ] - }, - "limit": 0 - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - }, - { - "description": "Unacknowledged deleteMany with hint document on 4.4+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "$$type": [ - "string", - "object" - ] - }, - "limit": 0 - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteMany-hint.json b/tests/UnifiedSpecTests/crud/deleteMany-hint.json deleted file mode 100644 index 59d903d20..000000000 --- a/tests/UnifiedSpecTests/crud/deleteMany-hint.json +++ /dev/null @@ -1,173 +0,0 @@ -{ - "description": "deleteMany-hint", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.3.4" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "DeleteMany_hint" - } - } - ], - "initialData": [ - { - "collectionName": "DeleteMany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "DeleteMany with hint string", - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "expectResult": { - "deletedCount": 2 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "DeleteMany_hint", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_", - "limit": 0 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "DeleteMany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "DeleteMany with hint document", - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "deletedCount": 2 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "DeleteMany_hint", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - }, - "limit": 0 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "DeleteMany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteMany-let.json b/tests/UnifiedSpecTests/crud/deleteMany-let.json deleted file mode 100644 index 71bf26a01..000000000 --- a/tests/UnifiedSpecTests/crud/deleteMany-let.json +++ /dev/null @@ -1,201 +0,0 @@ -{ - "description": "deleteMany-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2, - "name": "name" - }, - { - "_id": 3, - "name": "name" - } - ] - } - ], - "tests": [ - { - "description": "deleteMany with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "deleteMany", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$name", - "$$name" - ] - } - }, - "let": { - "name": "name" - } - }, - "expectResult": { - "deletedCount": 2 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "$expr": { - "$eq": [ - "$name", - "$$name" - ] - } - }, - "limit": 0 - } - ], - "let": { - "name": "name" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "deleteMany with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "deleteMany", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$name", - "$$name" - ] - } - }, - "let": { - "name": "name" - } - }, - "expectError": { - "errorContains": "'delete.let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "$expr": { - "$eq": [ - "$name", - "$$name" - ] - } - }, - "limit": 0 - } - ], - "let": { - "name": "name" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2, - "name": "name" - }, - { - "_id": 3, - "name": "name" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteMany.json b/tests/UnifiedSpecTests/crud/deleteMany.json deleted file mode 100644 index 36cdff8dc..000000000 --- a/tests/UnifiedSpecTests/crud/deleteMany.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "description": "deleteMany", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "DeleteMany when many documents match", - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": { - "deletedCount": 2 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "DeleteMany when no document matches", - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": 4 - } - }, - "expectResult": { - "deletedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteOne-collation.json b/tests/UnifiedSpecTests/crud/deleteOne-collation.json deleted file mode 100644 index 44bab6e12..000000000 --- a/tests/UnifiedSpecTests/crud/deleteOne-collation.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "description": "deleteOne-collation", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": "ping" - }, - { - "_id": 3, - "x": "pINg" - } - ] - } - ], - "tests": [ - { - "description": "DeleteOne when many documents matches with collation", - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "x": "PING" - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - }, - "expectResult": { - "deletedCount": 1 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 3, - "x": "pINg" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteOne-comment.json b/tests/UnifiedSpecTests/crud/deleteOne-comment.json deleted file mode 100644 index 0f42b086a..000000000 --- a/tests/UnifiedSpecTests/crud/deleteOne-comment.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "description": "deleteOne-comment", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2, - "name": "name" - }, - { - "_id": 3, - "name": "name" - } - ] - } - ], - "tests": [ - { - "description": "deleteOne with string comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "comment": "comment" - }, - "expectResult": { - "deletedCount": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": 1 - }, - "limit": 1 - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 2, - "name": "name" - }, - { - "_id": 3, - "name": "name" - } - ] - } - ] - }, - { - "description": "deleteOne with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "comment": { - "key": "value" - } - }, - "expectResult": { - "deletedCount": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": 1 - }, - "limit": 1 - } - ], - "comment": { - "key": "value" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 2, - "name": "name" - }, - { - "_id": 3, - "name": "name" - } - ] - } - ] - }, - { - "description": "deleteOne with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": 1 - }, - "limit": 1 - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2, - "name": "name" - }, - { - "_id": 3, - "name": "name" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteOne-errorResponse.json b/tests/UnifiedSpecTests/crud/deleteOne-errorResponse.json deleted file mode 100644 index 1f3a266f1..000000000 --- a/tests/UnifiedSpecTests/crud/deleteOne-errorResponse.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "description": "deleteOne-errorResponse", - "schemaVersion": "1.12", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "tests": [ - { - "description": "delete operations support errorResponse assertions", - "runOnRequirements": [ - { - "minServerVersion": "4.0.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.2.0", - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 8 - } - } - } - }, - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorCode": 8, - "errorResponse": { - "code": 8 - } - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteOne-hint-clientError.json b/tests/UnifiedSpecTests/crud/deleteOne-hint-clientError.json deleted file mode 100644 index cf629f59e..000000000 --- a/tests/UnifiedSpecTests/crud/deleteOne-hint-clientError.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "description": "deleteOne-hint-clientError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "maxServerVersion": "3.3.99" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "DeleteOne_hint" - } - } - ], - "initialData": [ - { - "collectionName": "DeleteOne_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "DeleteOne with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "DeleteOne_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "DeleteOne with hint document unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "DeleteOne_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteOne-hint-serverError.json b/tests/UnifiedSpecTests/crud/deleteOne-hint-serverError.json deleted file mode 100644 index 15541ed85..000000000 --- a/tests/UnifiedSpecTests/crud/deleteOne-hint-serverError.json +++ /dev/null @@ -1,170 +0,0 @@ -{ - "description": "deleteOne-hint-serverError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.3.3" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "DeleteOne_hint" - } - } - ], - "initialData": [ - { - "collectionName": "DeleteOne_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "DeleteOne with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "DeleteOne_hint", - "deletes": [ - { - "q": { - "_id": 1 - }, - "hint": "_id_", - "limit": 1 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "DeleteOne_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "DeleteOne with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "DeleteOne_hint", - "deletes": [ - { - "q": { - "_id": 1 - }, - "hint": { - "_id": 1 - }, - "limit": 1 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "DeleteOne_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteOne-hint-unacknowledged.json b/tests/UnifiedSpecTests/crud/deleteOne-hint-unacknowledged.json deleted file mode 100644 index 1782f0f52..000000000 --- a/tests/UnifiedSpecTests/crud/deleteOne-hint-unacknowledged.json +++ /dev/null @@ -1,241 +0,0 @@ -{ - "description": "deleteOne-hint-unacknowledged", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "db0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "Unacknowledged deleteOne with hint string fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged deleteOne with hint document fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged deleteOne with hint string on 4.4+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "$$type": [ - "string", - "object" - ] - }, - "limit": 1 - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - }, - { - "description": "Unacknowledged deleteOne with hint document on 4.4+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "$$type": [ - "string", - "object" - ] - }, - "limit": 1 - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteOne-hint.json b/tests/UnifiedSpecTests/crud/deleteOne-hint.json deleted file mode 100644 index bcc4bc234..000000000 --- a/tests/UnifiedSpecTests/crud/deleteOne-hint.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "description": "deleteOne-hint", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.3.4" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "DeleteOne_hint" - } - } - ], - "initialData": [ - { - "collectionName": "DeleteOne_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "DeleteOne with hint string", - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - }, - "expectResult": { - "deletedCount": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "DeleteOne_hint", - "deletes": [ - { - "q": { - "_id": 1 - }, - "hint": "_id_", - "limit": 1 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "DeleteOne_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "deleteOne with hint document", - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "deletedCount": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "DeleteOne_hint", - "deletes": [ - { - "q": { - "_id": 1 - }, - "hint": { - "_id": 1 - }, - "limit": 1 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "DeleteOne_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteOne-let.json b/tests/UnifiedSpecTests/crud/deleteOne-let.json deleted file mode 100644 index 971868223..000000000 --- a/tests/UnifiedSpecTests/crud/deleteOne-let.json +++ /dev/null @@ -1,191 +0,0 @@ -{ - "description": "deleteOne-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "deleteOne with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "let": { - "id": 1 - } - }, - "expectResult": { - "deletedCount": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "limit": 1 - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "deleteOne with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "let": { - "id": 1 - } - }, - "expectError": { - "errorContains": "'delete.let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "limit": 1 - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/deleteOne.json b/tests/UnifiedSpecTests/crud/deleteOne.json deleted file mode 100644 index 8177b2fb6..000000000 --- a/tests/UnifiedSpecTests/crud/deleteOne.json +++ /dev/null @@ -1,136 +0,0 @@ -{ - "description": "deleteOne", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "DeleteOne when many documents match", - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": { - "deletedCount": 1 - } - } - ] - }, - { - "description": "DeleteOne when one document matches", - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 2 - } - }, - "expectResult": { - "deletedCount": 1 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "DeleteOne when no documents match", - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 4 - } - }, - "expectResult": { - "deletedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/distinct-collation.json b/tests/UnifiedSpecTests/crud/distinct-collation.json deleted file mode 100644 index e40cb0b2c..000000000 --- a/tests/UnifiedSpecTests/crud/distinct-collation.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "description": "distinct-collation", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "string": "PING" - }, - { - "_id": 2, - "string": "ping" - } - ] - } - ], - "tests": [ - { - "description": "Distinct with a collation", - "operations": [ - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "string", - "filter": {}, - "collation": { - "locale": "en_US", - "strength": 2 - } - }, - "expectResult": [ - "PING" - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/distinct-comment.json b/tests/UnifiedSpecTests/crud/distinct-comment.json deleted file mode 100644 index 11bce9ac9..000000000 --- a/tests/UnifiedSpecTests/crud/distinct-comment.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "description": "distinct-comment", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "distinct-comment-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "distinct-comment-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "distinct with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4.14" - } - ], - "operations": [ - { - "name": "distinct", - "object": "collection0", - "arguments": { - "fieldName": "x", - "filter": {}, - "comment": { - "key": "value" - } - }, - "expectResult": [ - 11, - 22, - 33 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll0", - "key": "x", - "query": {}, - "comment": { - "key": "value" - } - }, - "commandName": "distinct", - "databaseName": "distinct-comment-tests" - } - } - ] - } - ] - }, - { - "description": "distinct with string comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "name": "distinct", - "object": "collection0", - "arguments": { - "fieldName": "x", - "filter": {}, - "comment": "comment" - }, - "expectResult": [ - 11, - 22, - 33 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll0", - "key": "x", - "query": {}, - "comment": "comment" - }, - "commandName": "distinct", - "databaseName": "distinct-comment-tests" - } - } - ] - } - ] - }, - { - "description": "distinct with document comment - pre 4.4, server error", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.4.13" - } - ], - "operations": [ - { - "name": "distinct", - "object": "collection0", - "arguments": { - "fieldName": "x", - "filter": {}, - "comment": { - "key": "value" - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll0", - "key": "x", - "query": {}, - "comment": { - "key": "value" - } - }, - "commandName": "distinct", - "databaseName": "distinct-comment-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/distinct.json b/tests/UnifiedSpecTests/crud/distinct.json deleted file mode 100644 index 9accffabc..000000000 --- a/tests/UnifiedSpecTests/crud/distinct.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "description": "distinct", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Distinct without a filter", - "operations": [ - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": {} - }, - "expectResult": [ - 11, - 22, - 33 - ] - } - ] - }, - { - "description": "Distinct with a filter", - "operations": [ - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": [ - 22, - 33 - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/estimatedDocumentCount-comment.json b/tests/UnifiedSpecTests/crud/estimatedDocumentCount-comment.json deleted file mode 100644 index 6c0adacc8..000000000 --- a/tests/UnifiedSpecTests/crud/estimatedDocumentCount-comment.json +++ /dev/null @@ -1,170 +0,0 @@ -{ - "description": "estimatedDocumentCount-comment", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "edc-comment-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "edc-comment-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "estimatedDocumentCount with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4.14" - } - ], - "operations": [ - { - "name": "estimatedDocumentCount", - "object": "collection0", - "arguments": { - "comment": { - "key": "value" - } - }, - "expectResult": 3 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll0", - "comment": { - "key": "value" - } - }, - "commandName": "count", - "databaseName": "edc-comment-tests" - } - } - ] - } - ] - }, - { - "description": "estimatedDocumentCount with string comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "name": "estimatedDocumentCount", - "object": "collection0", - "arguments": { - "comment": "comment" - }, - "expectResult": 3 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll0", - "comment": "comment" - }, - "commandName": "count", - "databaseName": "edc-comment-tests" - } - } - ] - } - ] - }, - { - "description": "estimatedDocumentCount with document comment - pre 4.4.14, server error", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.4.13", - "topologies": [ - "single", - "replicaset" - ] - } - ], - "operations": [ - { - "name": "estimatedDocumentCount", - "object": "collection0", - "arguments": { - "comment": { - "key": "value" - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll0", - "comment": { - "key": "value" - } - }, - "commandName": "count", - "databaseName": "edc-comment-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/estimatedDocumentCount.json b/tests/UnifiedSpecTests/crud/estimatedDocumentCount.json deleted file mode 100644 index 1b650c1cb..000000000 --- a/tests/UnifiedSpecTests/crud/estimatedDocumentCount.json +++ /dev/null @@ -1,357 +0,0 @@ -{ - "description": "estimatedDocumentCount", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "edc-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - }, - { - "collection": { - "id": "collection1", - "database": "database0", - "collectionName": "coll1" - } - }, - { - "collection": { - "id": "collection0View", - "database": "database0", - "collectionName": "coll0view" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "edc-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "estimatedDocumentCount always uses count", - "operations": [ - { - "name": "estimatedDocumentCount", - "object": "collection0", - "expectResult": 3 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll0" - }, - "commandName": "count", - "databaseName": "edc-tests" - } - } - ] - } - ] - }, - { - "description": "estimatedDocumentCount with maxTimeMS", - "operations": [ - { - "name": "estimatedDocumentCount", - "object": "collection0", - "arguments": { - "maxTimeMS": 6000 - }, - "expectResult": 3 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll0", - "maxTimeMS": 6000 - }, - "commandName": "count", - "databaseName": "edc-tests" - } - } - ] - } - ] - }, - { - "description": "estimatedDocumentCount on non-existent collection", - "operations": [ - { - "name": "estimatedDocumentCount", - "object": "collection1", - "expectResult": 0 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll1" - }, - "commandName": "count", - "databaseName": "edc-tests" - } - } - ] - } - ] - }, - { - "description": "estimatedDocumentCount errors correctly--command error", - "runOnRequirements": [ - { - "minServerVersion": "4.0.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.2.0", - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 8 - } - } - } - }, - { - "name": "estimatedDocumentCount", - "object": "collection0", - "expectError": { - "errorCode": 8 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll0" - }, - "commandName": "count", - "databaseName": "edc-tests" - } - } - ] - } - ] - }, - { - "description": "estimatedDocumentCount errors correctly--socket error", - "runOnRequirements": [ - { - "minServerVersion": "4.0.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.2.0", - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "closeConnection": true - } - } - } - }, - { - "name": "estimatedDocumentCount", - "object": "collection0", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll0" - }, - "commandName": "count", - "databaseName": "edc-tests" - } - } - ] - } - ] - }, - { - "description": "estimatedDocumentCount works correctly on views", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0" - } - ], - "operations": [ - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "coll0view" - } - }, - { - "name": "createCollection", - "object": "database0", - "arguments": { - "collection": "coll0view", - "viewOn": "coll0", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ] - } - }, - { - "name": "estimatedDocumentCount", - "object": "collection0View", - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "drop": "coll0view" - }, - "commandName": "drop", - "databaseName": "edc-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "create": "coll0view", - "viewOn": "coll0", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ] - }, - "commandName": "create", - "databaseName": "edc-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll0view" - }, - "commandName": "count", - "databaseName": "edc-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/find-allowdiskuse-clientError.json b/tests/UnifiedSpecTests/crud/find-allowdiskuse-clientError.json deleted file mode 100644 index 5bd954e79..000000000 --- a/tests/UnifiedSpecTests/crud/find-allowdiskuse-clientError.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "description": "find-allowdiskuse-clientError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "maxServerVersion": "3.0.99" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_find_allowdiskuse_clienterror" - } - } - ], - "tests": [ - { - "description": "Find fails when allowDiskUse true is specified against pre 3.2 server", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": true - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Find fails when allowDiskUse false is specified against pre 3.2 server", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": false - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/find-allowdiskuse-serverError.json b/tests/UnifiedSpecTests/crud/find-allowdiskuse-serverError.json deleted file mode 100644 index dc58f8f0e..000000000 --- a/tests/UnifiedSpecTests/crud/find-allowdiskuse-serverError.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "description": "find-allowdiskuse-serverError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.2", - "maxServerVersion": "4.3.0" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_find_allowdiskuse_servererror" - } - } - ], - "tests": [ - { - "description": "Find fails when allowDiskUse true is specified against pre 4.4 server (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": true - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test_find_allowdiskuse_servererror", - "filter": {}, - "allowDiskUse": true - } - } - } - ] - } - ] - }, - { - "description": "Find fails when allowDiskUse false is specified against pre 4.4 server (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": false - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test_find_allowdiskuse_servererror", - "filter": {}, - "allowDiskUse": false - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/find-allowdiskuse.json b/tests/UnifiedSpecTests/crud/find-allowdiskuse.json deleted file mode 100644 index eb238ab93..000000000 --- a/tests/UnifiedSpecTests/crud/find-allowdiskuse.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "description": "find-allowdiskuse", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_find_allowdiskuse" - } - } - ], - "tests": [ - { - "description": "Find does not send allowDiskUse when value is not specified", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test_find_allowdiskuse", - "allowDiskUse": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "Find sends allowDiskUse false when false is specified", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test_find_allowdiskuse", - "allowDiskUse": false - } - } - } - ] - } - ] - }, - { - "description": "Find sends allowDiskUse true when true is specified", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test_find_allowdiskuse", - "allowDiskUse": true - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/find-collation.json b/tests/UnifiedSpecTests/crud/find-collation.json deleted file mode 100644 index 13b105ad5..000000000 --- a/tests/UnifiedSpecTests/crud/find-collation.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "description": "find-collation", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": "ping" - } - ] - } - ], - "tests": [ - { - "description": "Find with a collation", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "x": "PING" - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - }, - "expectResult": [ - { - "_id": 1, - "x": "ping" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/find-comment.json b/tests/UnifiedSpecTests/crud/find-comment.json deleted file mode 100644 index 600a3723f..000000000 --- a/tests/UnifiedSpecTests/crud/find-comment.json +++ /dev/null @@ -1,403 +0,0 @@ -{ - "description": "find-comment", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - }, - { - "_id": 6, - "x": 66 - } - ] - } - ], - "tests": [ - { - "description": "find with string comment", - "runOnRequirements": [ - { - "minServerVersion": "3.6" - } - ], - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "comment": "comment" - }, - "expectResult": [ - { - "_id": 1 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": { - "_id": 1 - }, - "comment": "comment" - } - } - } - ] - } - ] - }, - { - "description": "find with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "comment": { - "key": "value" - } - }, - "expectResult": [ - { - "_id": 1 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": { - "_id": 1 - }, - "comment": { - "key": "value" - } - } - } - } - ] - } - ] - }, - { - "description": "find with document comment - pre 4.4", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99", - "minServerVersion": "3.6" - } - ], - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "comment": { - "key": "value" - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": { - "_id": 1 - }, - "comment": { - "key": "value" - } - } - } - } - ] - } - ] - }, - { - "description": "find with comment sets comment on getMore", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "batchSize": 2, - "comment": { - "key": "value" - } - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - }, - { - "_id": 6, - "x": 66 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": { - "_id": { - "$gt": 1 - } - }, - "batchSize": 2, - "comment": { - "key": "value" - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2, - "comment": { - "key": "value" - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2, - "comment": { - "key": "value" - } - } - } - } - ] - } - ] - }, - { - "description": "find with comment does not set comment on getMore - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.3.99" - } - ], - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "batchSize": 2, - "comment": "comment" - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - }, - { - "_id": 6, - "x": 66 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": { - "_id": { - "$gt": 1 - } - }, - "batchSize": 2, - "comment": "comment" - } - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2, - "comment": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2, - "comment": { - "$$exists": false - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/find-let.json b/tests/UnifiedSpecTests/crud/find-let.json deleted file mode 100644 index 4e9c9c99f..000000000 --- a/tests/UnifiedSpecTests/crud/find-let.json +++ /dev/null @@ -1,148 +0,0 @@ -{ - "description": "find-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "Find with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "let": { - "id": 1 - } - }, - "expectResult": [ - { - "_id": 1 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "let": { - "id": 1 - } - } - } - } - ] - } - ] - }, - { - "description": "Find with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "let": { - "x": 1 - } - }, - "expectError": { - "errorContains": "Unrecognized field 'let'", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": { - "_id": 1 - }, - "let": { - "x": 1 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/find.json b/tests/UnifiedSpecTests/crud/find.json deleted file mode 100644 index 6bf1e4e44..000000000 --- a/tests/UnifiedSpecTests/crud/find.json +++ /dev/null @@ -1,242 +0,0 @@ -{ - "description": "find", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "find-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "find-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - }, - { - "_id": 6, - "x": 66 - } - ] - } - ], - "tests": [ - { - "description": "find with multiple batches works", - "operations": [ - { - "name": "find", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "batchSize": 2 - }, - "object": "collection0", - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - }, - { - "_id": 6, - "x": 66 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": { - "_id": { - "$gt": 1 - } - }, - "batchSize": 2 - }, - "commandName": "find", - "databaseName": "find-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2 - }, - "commandName": "getMore", - "databaseName": "find-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2 - }, - "commandName": "getMore", - "databaseName": "find-tests" - } - } - ] - } - ] - }, - { - "description": "Find with filter", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "Find with filter, sort, skip, and limit", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "_id": { - "$gt": 2 - } - }, - "sort": { - "_id": 1 - }, - "skip": 2, - "limit": 2 - }, - "expectResult": [ - { - "_id": 5, - "x": 55 - }, - { - "_id": 6, - "x": 66 - } - ] - } - ] - }, - { - "description": "Find with limit, sort, and batchsize", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4, - "batchSize": 2 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndDelete-collation.json b/tests/UnifiedSpecTests/crud/findOneAndDelete-collation.json deleted file mode 100644 index a0452876a..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndDelete-collation.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "description": "findOneAndDelete-collation", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": "ping" - }, - { - "_id": 3, - "x": "pINg" - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndDelete when one document matches with collation", - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 2, - "x": "PING" - }, - "projection": { - "x": 1, - "_id": 0 - }, - "sort": { - "x": 1 - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - }, - "expectResult": { - "x": "ping" - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 3, - "x": "pINg" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndDelete-comment.json b/tests/UnifiedSpecTests/crud/findOneAndDelete-comment.json deleted file mode 100644 index 6853b9cc2..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndDelete-comment.json +++ /dev/null @@ -1,211 +0,0 @@ -{ - "description": "findOneAndDelete-comment", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "findOneAndDelete with string comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "findOneAndDelete", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "comment": "comment" - }, - "expectResult": { - "_id": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "remove": true, - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "findOneAndDelete with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "findOneAndDelete", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "comment": { - "key": "value" - } - }, - "expectResult": { - "_id": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "remove": true, - "comment": { - "key": "value" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "findOneAndDelete with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "findOneAndDelete", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "remove": true, - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndDelete-hint-clientError.json b/tests/UnifiedSpecTests/crud/findOneAndDelete-hint-clientError.json deleted file mode 100644 index c6ff46786..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndDelete-hint-clientError.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "description": "findOneAndDelete-hint-clientError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "findOneAndDelete_hint" - } - } - ], - "initialData": [ - { - "collectionName": "findOneAndDelete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndDelete with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "findOneAndDelete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndDelete with hint document", - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "findOneAndDelete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndDelete-hint-serverError.json b/tests/UnifiedSpecTests/crud/findOneAndDelete-hint-serverError.json deleted file mode 100644 index b87410272..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndDelete-hint-serverError.json +++ /dev/null @@ -1,162 +0,0 @@ -{ - "description": "findOneAndDelete-hint-serverError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.3.3" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "findOneAndDelete_hint" - } - } - ], - "initialData": [ - { - "collectionName": "findOneAndDelete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndDelete with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "findOneAndDelete_hint", - "query": { - "_id": 1 - }, - "hint": "_id_", - "remove": true - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "findOneAndDelete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndDelete with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "findOneAndDelete_hint", - "query": { - "_id": 1 - }, - "hint": { - "_id": 1 - }, - "remove": true - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "findOneAndDelete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndDelete-hint-unacknowledged.json b/tests/UnifiedSpecTests/crud/findOneAndDelete-hint-unacknowledged.json deleted file mode 100644 index 077f9892b..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndDelete-hint-unacknowledged.json +++ /dev/null @@ -1,225 +0,0 @@ -{ - "description": "findOneAndDelete-hint-unacknowledged", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "db0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "Unacknowledged findOneAndDelete with hint string fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged findOneAndDelete with hint document fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged findOneAndDelete with hint string on 4.4+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "expectResult": { - "$$unsetOrMatches": null - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": { - "$gt": 1 - } - }, - "remove": true, - "hint": { - "$$type": [ - "string", - "object" - ] - }, - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - }, - { - "description": "Unacknowledged findOneAndDelete with hint document on 4.4+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": null - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": { - "$gt": 1 - } - }, - "remove": true, - "hint": { - "$$type": [ - "string", - "object" - ] - }, - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndDelete-hint.json b/tests/UnifiedSpecTests/crud/findOneAndDelete-hint.json deleted file mode 100644 index 8b53f2bd3..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndDelete-hint.json +++ /dev/null @@ -1,155 +0,0 @@ -{ - "description": "findOneAndDelete-hint", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.3.4" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "findOneAndDelete_hint" - } - } - ], - "initialData": [ - { - "collectionName": "findOneAndDelete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndDelete with hint string", - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": "_id_" - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "findOneAndDelete_hint", - "query": { - "_id": 1 - }, - "hint": "_id_", - "remove": true - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "findOneAndDelete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndDelete with hint document", - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 1 - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "findOneAndDelete_hint", - "query": { - "_id": 1 - }, - "hint": { - "_id": 1 - }, - "remove": true - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "findOneAndDelete_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndDelete-let.json b/tests/UnifiedSpecTests/crud/findOneAndDelete-let.json deleted file mode 100644 index ba8e681c0..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndDelete-let.json +++ /dev/null @@ -1,180 +0,0 @@ -{ - "description": "findOneAndDelete-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "findOneAndDelete with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "findOneAndDelete", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "let": { - "id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "remove": true, - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "findOneAndDelete with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "findOneAndDelete", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "let": { - "id": 1 - } - }, - "expectError": { - "errorContains": "field 'let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "remove": true, - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndDelete.json b/tests/UnifiedSpecTests/crud/findOneAndDelete.json deleted file mode 100644 index e434b3b74..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndDelete.json +++ /dev/null @@ -1,171 +0,0 @@ -{ - "description": "findOneAndDelete", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndDelete when many documents match", - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "projection": { - "x": 1, - "_id": 0 - }, - "sort": { - "x": 1 - } - }, - "expectResult": { - "x": 22 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "FindOneAndDelete when one document matches", - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 2 - }, - "projection": { - "x": 1, - "_id": 0 - }, - "sort": { - "x": 1 - } - }, - "expectResult": { - "x": 22 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "FindOneAndDelete when no documents match", - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": 4 - }, - "projection": { - "x": 1, - "_id": 0 - }, - "sort": { - "x": 1 - } - }, - "expectResult": null - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndReplace-collation.json b/tests/UnifiedSpecTests/crud/findOneAndReplace-collation.json deleted file mode 100644 index 0d60d5416..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndReplace-collation.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "description": "findOneAndReplace-collation", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": "ping" - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndReplace when one document matches with collation returning the document after modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "x": "PING" - }, - "replacement": { - "x": "pong" - }, - "projection": { - "x": 1, - "_id": 0 - }, - "returnDocument": "After", - "sort": { - "x": 1 - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - }, - "expectResult": { - "x": "pong" - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": "pong" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndReplace-comment.json b/tests/UnifiedSpecTests/crud/findOneAndReplace-comment.json deleted file mode 100644 index f817bb693..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndReplace-comment.json +++ /dev/null @@ -1,234 +0,0 @@ -{ - "description": "findOneAndReplace-comment", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "findOneAndReplace with string comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 5 - }, - "comment": "comment" - }, - "expectResult": { - "_id": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": { - "x": 5 - }, - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 5 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "findOneAndReplace with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 5 - }, - "comment": { - "key": "value" - } - }, - "expectResult": { - "_id": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": { - "x": 5 - }, - "comment": { - "key": "value" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 5 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "findOneAndReplace with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 5 - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": { - "x": 5 - }, - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndReplace-dots_and_dollars.json b/tests/UnifiedSpecTests/crud/findOneAndReplace-dots_and_dollars.json deleted file mode 100644 index 19ac447f8..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndReplace-dots_and_dollars.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "description": "findOneAndReplace-dots_and_dollars", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ], - "tests": [ - { - "description": "Replacing document with top-level dotted key on 3.6+ server", - "runOnRequirements": [ - { - "minServerVersion": "3.6" - } - ], - "operations": [ - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a.b": 1 - } - }, - "expectResult": { - "_id": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": { - "_id": 1, - "a.b": 1 - }, - "new": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a.b": 1 - } - ] - } - ] - }, - { - "description": "Replacing document with top-level dotted key on pre-3.6 server yields server-side error", - "runOnRequirements": [ - { - "maxServerVersion": "3.4.99" - } - ], - "operations": [ - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a.b": 1 - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": { - "_id": 1, - "a.b": 1 - }, - "new": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "Replacing document with dollar-prefixed key in embedded doc on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a": { - "$b": 1 - } - } - }, - "expectResult": { - "_id": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": { - "_id": 1, - "a": { - "$b": 1 - } - }, - "new": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a": { - "$b": 1 - } - } - ] - } - ] - }, - { - "description": "Replacing document with dollar-prefixed key in embedded doc on pre-5.0 server yields server-side error", - "runOnRequirements": [ - { - "maxServerVersion": "4.99" - } - ], - "operations": [ - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a": { - "$b": 1 - } - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": { - "_id": 1, - "a": { - "$b": 1 - } - }, - "new": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "Replacing document with dotted key in embedded doc on 3.6+ server", - "runOnRequirements": [ - { - "minServerVersion": "3.6" - } - ], - "operations": [ - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a": { - "b.c": 1 - } - } - }, - "expectResult": { - "_id": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": { - "_id": 1, - "a": { - "b.c": 1 - } - }, - "new": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a": { - "b.c": 1 - } - } - ] - } - ] - }, - { - "description": "Replacing document with dotted key in embedded doc on pre-3.6 server yields server-side error", - "runOnRequirements": [ - { - "maxServerVersion": "3.4.99" - } - ], - "operations": [ - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a": { - "b.c": 1 - } - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": { - "_id": 1, - "a": { - "b.c": 1 - } - }, - "new": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndReplace-hint-clientError.json b/tests/UnifiedSpecTests/crud/findOneAndReplace-hint-clientError.json deleted file mode 100644 index 6b07eb1f4..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndReplace-hint-clientError.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "description": "findOneAndReplace-hint-clientError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "findOneAndReplace_hint" - } - } - ], - "initialData": [ - { - "collectionName": "findOneAndReplace_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndReplace with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": "_id_" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "findOneAndReplace_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace with hint document unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "findOneAndReplace_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndReplace-hint-serverError.json b/tests/UnifiedSpecTests/crud/findOneAndReplace-hint-serverError.json deleted file mode 100644 index 7fbf5a0ea..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndReplace-hint-serverError.json +++ /dev/null @@ -1,172 +0,0 @@ -{ - "description": "findOneAndReplace-hint-serverError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.3.0" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "findOneAndReplace_hint" - } - } - ], - "initialData": [ - { - "collectionName": "findOneAndReplace_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndReplace with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": "_id_" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "findOneAndReplace_hint", - "query": { - "_id": 1 - }, - "update": { - "x": 33 - }, - "hint": "_id_" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "findOneAndReplace_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "findOneAndReplace_hint", - "query": { - "_id": 1 - }, - "update": { - "x": 33 - }, - "hint": { - "_id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "findOneAndReplace_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndReplace-hint-unacknowledged.json b/tests/UnifiedSpecTests/crud/findOneAndReplace-hint-unacknowledged.json deleted file mode 100644 index 8228d8a2a..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndReplace-hint-unacknowledged.json +++ /dev/null @@ -1,248 +0,0 @@ -{ - "description": "findOneAndReplace-hint-unacknowledged", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "db0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - }, - { - "collection": { - "id": "collection1", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "Unacknowledged findOneAndReplace with hint string fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": "_id_" - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged findOneAndReplace with hint document fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged findOneAndReplace with hint string on 4.4+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": "_id_" - }, - "expectResult": { - "$$unsetOrMatches": null - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": { - "$gt": 1 - } - }, - "update": { - "x": 111 - }, - "hint": { - "$$type": [ - "string", - "object" - ] - }, - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - }, - { - "description": "Unacknowledged findOneAndReplace with hint document on 4.4+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": null - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": { - "$gt": 1 - } - }, - "update": { - "x": 111 - }, - "hint": { - "$$type": [ - "string", - "object" - ] - }, - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndReplace-hint.json b/tests/UnifiedSpecTests/crud/findOneAndReplace-hint.json deleted file mode 100644 index d07c5921a..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndReplace-hint.json +++ /dev/null @@ -1,173 +0,0 @@ -{ - "description": "findOneAndReplace-hint", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "findOneAndReplace_hint" - } - } - ], - "initialData": [ - { - "collectionName": "findOneAndReplace_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndReplace with hint string", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": "_id_" - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "findOneAndReplace_hint", - "query": { - "_id": 1 - }, - "update": { - "x": 33 - }, - "hint": "_id_" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "findOneAndReplace_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 33 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace with hint document", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "findOneAndReplace_hint", - "query": { - "_id": 1 - }, - "update": { - "x": 33 - }, - "hint": { - "_id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "findOneAndReplace_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 33 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndReplace-let.json b/tests/UnifiedSpecTests/crud/findOneAndReplace-let.json deleted file mode 100644 index 5e5de44b3..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndReplace-let.json +++ /dev/null @@ -1,197 +0,0 @@ -{ - "description": "findOneAndReplace-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "findOneAndReplace with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "replacement": { - "x": "x" - }, - "let": { - "id": 1 - } - }, - "expectResult": { - "_id": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": { - "x": "x" - }, - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": "x" - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "findOneAndReplace with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "replacement": { - "x": "x" - }, - "let": { - "id": 1 - } - }, - "expectError": { - "errorContains": "field 'let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": { - "x": "x" - }, - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndReplace-upsert.json b/tests/UnifiedSpecTests/crud/findOneAndReplace-upsert.json deleted file mode 100644 index f1f18996c..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndReplace-upsert.json +++ /dev/null @@ -1,254 +0,0 @@ -{ - "description": "findOneAndReplace-upsert", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "2.6" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndReplace when no documents match without id specified with upsert returning the document before modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 4 - }, - "replacement": { - "x": 44 - }, - "projection": { - "x": 1, - "_id": 0 - }, - "upsert": true - }, - "expectResult": null - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace when no documents match without id specified with upsert returning the document after modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 4 - }, - "replacement": { - "x": 44 - }, - "projection": { - "x": 1, - "_id": 0 - }, - "returnDocument": "After", - "sort": { - "x": 1 - }, - "upsert": true - }, - "expectResult": { - "x": 44 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace when no documents match with id specified with upsert returning the document before modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 4 - }, - "replacement": { - "_id": 4, - "x": 44 - }, - "projection": { - "x": 1, - "_id": 0 - }, - "upsert": true - }, - "expectResult": null - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace when no documents match with id specified with upsert returning the document after modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 4 - }, - "replacement": { - "_id": 4, - "x": 44 - }, - "projection": { - "x": 1, - "_id": 0 - }, - "returnDocument": "After", - "sort": { - "x": 1 - }, - "upsert": true - }, - "expectResult": { - "x": 44 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndReplace.json b/tests/UnifiedSpecTests/crud/findOneAndReplace.json deleted file mode 100644 index a4731602c..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndReplace.json +++ /dev/null @@ -1,332 +0,0 @@ -{ - "description": "findOneAndReplace", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndReplace when many documents match returning the document before modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 32 - }, - "projection": { - "x": 1, - "_id": 0 - }, - "sort": { - "x": 1 - } - }, - "expectResult": { - "x": 22 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 32 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace when many documents match returning the document after modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 32 - }, - "projection": { - "x": 1, - "_id": 0 - }, - "returnDocument": "After", - "sort": { - "x": 1 - } - }, - "expectResult": { - "x": 32 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 32 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace when one document matches returning the document before modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 2 - }, - "replacement": { - "x": 32 - }, - "projection": { - "x": 1, - "_id": 0 - }, - "sort": { - "x": 1 - } - }, - "expectResult": { - "x": 22 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 32 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace when one document matches returning the document after modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 2 - }, - "replacement": { - "x": 32 - }, - "projection": { - "x": 1, - "_id": 0 - }, - "returnDocument": "After", - "sort": { - "x": 1 - } - }, - "expectResult": { - "x": 32 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 32 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace when no documents match returning the document before modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 4 - }, - "replacement": { - "x": 44 - }, - "projection": { - "x": 1, - "_id": 0 - }, - "sort": { - "x": 1 - } - }, - "expectResult": null - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace when no documents match returning the document after modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 4 - }, - "replacement": { - "x": 44 - }, - "projection": { - "x": 1, - "_id": 0 - }, - "returnDocument": "After", - "sort": { - "x": 1 - } - }, - "expectResult": null - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndUpdate-arrayFilters.json b/tests/UnifiedSpecTests/crud/findOneAndUpdate-arrayFilters.json deleted file mode 100644 index 6c99e4ff6..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndUpdate-arrayFilters.json +++ /dev/null @@ -1,251 +0,0 @@ -{ - "description": "findOneAndUpdate-arrayFilters", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.5.6" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndUpdate when no document matches arrayFilters", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 4 - } - ] - }, - "expectResult": { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate when one document matches arrayFilters", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 3 - } - ] - }, - "expectResult": { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 2 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate when multiple documents match arrayFilters", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 1 - } - ] - }, - "expectResult": { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 2 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndUpdate-collation.json b/tests/UnifiedSpecTests/crud/findOneAndUpdate-collation.json deleted file mode 100644 index 7a49347a3..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndUpdate-collation.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "description": "findOneAndUpdate-collation", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": "ping" - }, - { - "_id": 3, - "x": "pINg" - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndUpdate when many documents match with collation returning the document before modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "x": "PING" - }, - "update": { - "$set": { - "x": "pong" - } - }, - "projection": { - "x": 1, - "_id": 0 - }, - "sort": { - "_id": 1 - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - }, - "expectResult": { - "x": "ping" - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": "pong" - }, - { - "_id": 3, - "x": "pINg" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndUpdate-comment.json b/tests/UnifiedSpecTests/crud/findOneAndUpdate-comment.json deleted file mode 100644 index 6dec5b39e..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndUpdate-comment.json +++ /dev/null @@ -1,228 +0,0 @@ -{ - "description": "findOneAndUpdate-comment", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "findOneAndUpdate with string comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "x": 5 - } - } - ], - "comment": "comment" - }, - "expectResult": { - "_id": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": [ - { - "$set": { - "x": 5 - } - } - ], - "comment": "comment" - } - } - } - ] - } - ] - }, - { - "description": "findOneAndUpdate with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "x": 5 - } - } - ], - "comment": { - "key": "value" - } - }, - "expectResult": { - "_id": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": [ - { - "$set": { - "x": 5 - } - } - ], - "comment": { - "key": "value" - } - } - } - } - ] - } - ] - }, - { - "description": "findOneAndUpdate with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "x": 5 - } - } - ], - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": [ - { - "$set": { - "x": 5 - } - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndUpdate-dots_and_dollars.json b/tests/UnifiedSpecTests/crud/findOneAndUpdate-dots_and_dollars.json deleted file mode 100644 index 40eb54739..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndUpdate-dots_and_dollars.json +++ /dev/null @@ -1,380 +0,0 @@ -{ - "description": "findOneAndUpdate-dots_and_dollars", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": {} - } - ] - } - ], - "tests": [ - { - "description": "Updating document to set top-level dollar-prefixed key on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ] - }, - "expectResult": { - "_id": 1, - "foo": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ], - "new": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": {}, - "$a": 1 - } - ] - } - ] - }, - { - "description": "Updating document to set top-level dotted key on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ] - }, - "expectResult": { - "_id": 1, - "foo": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ], - "new": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": {}, - "a.b": 1 - } - ] - } - ] - }, - { - "description": "Updating document to set dollar-prefixed key in embedded doc on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ] - }, - "expectResult": { - "_id": 1, - "foo": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ], - "new": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": { - "$a": 1 - } - } - ] - } - ] - }, - { - "description": "Updating document to set dotted key in embedded doc on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ] - }, - "expectResult": { - "_id": 1, - "foo": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ], - "new": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": { - "a.b": 1 - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndUpdate-errorResponse.json b/tests/UnifiedSpecTests/crud/findOneAndUpdate-errorResponse.json deleted file mode 100644 index 5023a450f..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndUpdate-errorResponse.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "description": "findOneAndUpdate-errorResponse", - "schemaVersion": "1.12", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": "foo" - } - ] - } - ], - "tests": [ - { - "description": "findOneAndUpdate DuplicateKey error is accessible", - "runOnRequirements": [ - { - "minServerVersion": "4.2" - } - ], - "operations": [ - { - "name": "createIndex", - "object": "collection0", - "arguments": { - "keys": { - "x": 1 - }, - "unique": true - } - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 2 - }, - "update": { - "$set": { - "x": "foo" - } - }, - "upsert": true - }, - "expectError": { - "errorCode": 11000, - "errorResponse": { - "keyPattern": { - "x": 1 - }, - "keyValue": { - "x": "foo" - } - } - } - } - ] - }, - { - "description": "findOneAndUpdate document validation errInfo is accessible", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "modifyCollection", - "object": "database0", - "arguments": { - "collection": "test", - "validator": { - "x": { - "$type": "string" - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - }, - "expectError": { - "errorCode": 121, - "errorResponse": { - "errInfo": { - "failingDocumentId": 1, - "details": { - "$$type": "object" - } - } - } - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndUpdate-hint-clientError.json b/tests/UnifiedSpecTests/crud/findOneAndUpdate-hint-clientError.json deleted file mode 100644 index d0b51313c..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndUpdate-hint-clientError.json +++ /dev/null @@ -1,143 +0,0 @@ -{ - "description": "findOneAndUpdate-hint-clientError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "findOneAndUpdate_hint" - } - } - ], - "initialData": [ - { - "collectionName": "findOneAndUpdate_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndUpdate with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "findOneAndUpdate_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate with hint document unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "findOneAndUpdate_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndUpdate-hint-serverError.json b/tests/UnifiedSpecTests/crud/findOneAndUpdate-hint-serverError.json deleted file mode 100644 index 99fd9938f..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndUpdate-hint-serverError.json +++ /dev/null @@ -1,180 +0,0 @@ -{ - "description": "findOneAndUpdate-hint-serverError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.3.0" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "findOneAndUpdate_hint" - } - } - ], - "initialData": [ - { - "collectionName": "findOneAndUpdate_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndUpdate with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "findOneAndUpdate_hint", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "findOneAndUpdate_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "findOneAndUpdate_hint", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "findOneAndUpdate_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndUpdate-hint-unacknowledged.json b/tests/UnifiedSpecTests/crud/findOneAndUpdate-hint-unacknowledged.json deleted file mode 100644 index d116a06d0..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndUpdate-hint-unacknowledged.json +++ /dev/null @@ -1,253 +0,0 @@ -{ - "description": "findOneAndUpdate-hint-unacknowledged", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "db0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "Unacknowledged findOneAndUpdate with hint string fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged findOneAndUpdate with hint document fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged findOneAndUpdate with hint string on 4.4+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectResult": { - "$$unsetOrMatches": null - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "$$type": [ - "string", - "object" - ] - }, - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - }, - { - "description": "Unacknowledged findOneAndUpdate with hint document on 4.4+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.4.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": null - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "$$type": [ - "string", - "object" - ] - }, - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndUpdate-hint.json b/tests/UnifiedSpecTests/crud/findOneAndUpdate-hint.json deleted file mode 100644 index 5be6d2b3e..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndUpdate-hint.json +++ /dev/null @@ -1,181 +0,0 @@ -{ - "description": "findOneAndUpdate-hint", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "findOneAndUpdate_hint" - } - } - ], - "initialData": [ - { - "collectionName": "findOneAndUpdate_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndUpdate with hint string", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "findOneAndUpdate_hint", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "findOneAndUpdate_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate with hint document", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "findOneAndUpdate_hint", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "findOneAndUpdate_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndUpdate-let.json b/tests/UnifiedSpecTests/crud/findOneAndUpdate-let.json deleted file mode 100644 index 74d7d0e58..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndUpdate-let.json +++ /dev/null @@ -1,217 +0,0 @@ -{ - "description": "findOneAndUpdate-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "findOneAndUpdate with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": [ - { - "$set": { - "x": "$$x" - } - } - ], - "let": { - "id": 1, - "x": "foo" - } - }, - "expectResult": { - "_id": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": [ - { - "$set": { - "x": "$$x" - } - } - ], - "let": { - "id": 1, - "x": "foo" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": "foo" - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "findOneAndUpdate with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": [ - { - "$set": { - "x": "$$x" - } - } - ], - "let": { - "id": 1, - "x": "foo" - } - }, - "expectError": { - "errorContains": "field 'let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": [ - { - "$set": { - "x": "$$x" - } - } - ], - "let": { - "id": 1, - "x": "foo" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/findOneAndUpdate.json b/tests/UnifiedSpecTests/crud/findOneAndUpdate.json deleted file mode 100644 index d79cf8ac5..000000000 --- a/tests/UnifiedSpecTests/crud/findOneAndUpdate.json +++ /dev/null @@ -1,448 +0,0 @@ -{ - "description": "findOneAndUpdate", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndUpdate when many documents match returning the document before modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "projection": { - "x": 1, - "_id": 0 - }, - "sort": { - "x": 1 - } - }, - "expectResult": { - "x": 22 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate when many documents match returning the document after modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "projection": { - "x": 1, - "_id": 0 - }, - "returnDocument": "After", - "sort": { - "x": 1 - } - }, - "expectResult": { - "x": 23 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate when one document matches returning the document before modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "projection": { - "x": 1, - "_id": 0 - }, - "sort": { - "x": 1 - } - }, - "expectResult": { - "x": 22 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate when one document matches returning the document after modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "projection": { - "x": 1, - "_id": 0 - }, - "returnDocument": "After", - "sort": { - "x": 1 - } - }, - "expectResult": { - "x": 23 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate when no documents match returning the document before modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 4 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "projection": { - "x": 1, - "_id": 0 - }, - "sort": { - "x": 1 - } - }, - "expectResult": null - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate when no documents match with upsert returning the document before modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 4 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "projection": { - "x": 1, - "_id": 0 - }, - "upsert": true - }, - "expectResult": null - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 1 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate when no documents match returning the document after modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 4 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "projection": { - "x": 1, - "_id": 0 - }, - "returnDocument": "After", - "sort": { - "x": 1 - } - }, - "expectResult": null - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate when no documents match with upsert returning the document after modification", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 4 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "projection": { - "x": 1, - "_id": 0 - }, - "returnDocument": "After", - "sort": { - "x": 1 - }, - "upsert": true - }, - "expectResult": { - "x": 1 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/insertMany-comment.json b/tests/UnifiedSpecTests/crud/insertMany-comment.json deleted file mode 100644 index 2b4c80b3f..000000000 --- a/tests/UnifiedSpecTests/crud/insertMany-comment.json +++ /dev/null @@ -1,226 +0,0 @@ -{ - "description": "insertMany-comment", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "insertMany with string comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "comment": "comment" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "insertMany with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "comment": { - "key": "value" - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "comment": { - "key": "value" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "insertMany with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/insertMany-dots_and_dollars.json b/tests/UnifiedSpecTests/crud/insertMany-dots_and_dollars.json deleted file mode 100644 index eed8997df..000000000 --- a/tests/UnifiedSpecTests/crud/insertMany-dots_and_dollars.json +++ /dev/null @@ -1,338 +0,0 @@ -{ - "description": "insertMany-dots_and_dollars", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "Inserting document with top-level dollar-prefixed key on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "documents": [ - { - "_id": 1, - "$a": 1 - } - ] - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 - } - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "$a": 1 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "$a": 1 - } - ] - } - ] - }, - { - "description": "Inserting document with top-level dollar-prefixed key on pre-5.0 server yields server-side error", - "runOnRequirements": [ - { - "maxServerVersion": "4.99" - } - ], - "operations": [ - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "documents": [ - { - "_id": 1, - "$a": 1 - } - ] - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "$a": 1 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [] - } - ] - }, - { - "description": "Inserting document with top-level dotted key", - "operations": [ - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "documents": [ - { - "_id": 1, - "a.b": 1 - } - ] - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 - } - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "a.b": 1 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a.b": 1 - } - ] - } - ] - }, - { - "description": "Inserting document with dollar-prefixed key in embedded doc", - "operations": [ - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "documents": [ - { - "_id": 1, - "a": { - "$b": 1 - } - } - ] - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 - } - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "a": { - "$b": 1 - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a": { - "$b": 1 - } - } - ] - } - ] - }, - { - "description": "Inserting document with dotted key in embedded doc", - "operations": [ - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "documents": [ - { - "_id": 1, - "a": { - "b.c": 1 - } - } - ] - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 - } - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "a": { - "b.c": 1 - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a": { - "b.c": 1 - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/insertMany.json b/tests/UnifiedSpecTests/crud/insertMany.json deleted file mode 100644 index 643b7f44d..000000000 --- a/tests/UnifiedSpecTests/crud/insertMany.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "description": "insertMany", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "InsertMany with non-existing documents", - "operations": [ - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "ordered": true - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 2, - "1": 3 - } - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "InsertMany continue-on-error behavior with unordered (preexisting duplicate key)", - "operations": [ - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "ordered": false - }, - "expectError": { - "isError": true, - "expectResult": { - "deletedCount": 0, - "insertedCount": 2, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "InsertMany continue-on-error behavior with unordered (duplicate key in requests)", - "operations": [ - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "ordered": false - }, - "expectError": { - "isError": true, - "expectResult": { - "deletedCount": 0, - "insertedCount": 2, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/insertOne-comment.json b/tests/UnifiedSpecTests/crud/insertOne-comment.json deleted file mode 100644 index dbd83d9f6..000000000 --- a/tests/UnifiedSpecTests/crud/insertOne-comment.json +++ /dev/null @@ -1,220 +0,0 @@ -{ - "description": "insertOne-comment", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "insertOne with string comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 2, - "x": 22 - }, - "comment": "comment" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "insertOne with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 2, - "x": 22 - }, - "comment": { - "key": "value" - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "comment": { - "key": "value" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "insertOne with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 2, - "x": 22 - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/insertOne-dots_and_dollars.json b/tests/UnifiedSpecTests/crud/insertOne-dots_and_dollars.json deleted file mode 100644 index fdc17af2e..000000000 --- a/tests/UnifiedSpecTests/crud/insertOne-dots_and_dollars.json +++ /dev/null @@ -1,614 +0,0 @@ -{ - "description": "insertOne-dots_and_dollars", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - }, - { - "collection": { - "id": "collection1", - "database": "database0", - "collectionName": "coll1", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "Inserting document with top-level dollar-prefixed key on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "$a": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "$a": 1 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "$a": 1 - } - ] - } - ] - }, - { - "description": "Inserting document with top-level dollar-prefixed key on pre-5.0 server yields server-side error", - "runOnRequirements": [ - { - "maxServerVersion": "4.99" - } - ], - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "$a": 1 - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "$a": 1 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [] - } - ] - }, - { - "description": "Inserting document with top-level dotted key", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a.b": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "a.b": 1 - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a.b": 1 - } - ] - } - ] - }, - { - "description": "Inserting document with dollar-prefixed key in embedded doc", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": { - "$b": 1 - } - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "a": { - "$b": 1 - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a": { - "$b": 1 - } - } - ] - } - ] - }, - { - "description": "Inserting document with dotted key in embedded doc", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": { - "b.c": 1 - } - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "a": { - "b.c": 1 - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a": { - "b.c": 1 - } - } - ] - } - ] - }, - { - "description": "Inserting document with dollar-prefixed key in _id yields server-side error", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": { - "$a": 1 - } - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": { - "$a": 1 - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [] - } - ] - }, - { - "description": "Inserting document with dotted key in _id on 3.6+ server", - "runOnRequirements": [ - { - "minServerVersion": "3.6" - } - ], - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": { - "a.b": 1 - } - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": { - "a.b": 1 - } - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": { - "a.b": 1 - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": { - "a.b": 1 - } - } - ] - } - ] - }, - { - "description": "Inserting document with dotted key in _id on pre-3.6 server yields server-side error", - "runOnRequirements": [ - { - "maxServerVersion": "3.4.99" - } - ], - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": { - "a.b": 1 - } - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": { - "a.b": 1 - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [] - } - ] - }, - { - "description": "Inserting document with DBRef-like keys", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": { - "$db": "foo" - } - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1, - "a": { - "$db": "foo" - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a": { - "$db": "foo" - } - } - ] - } - ] - }, - { - "description": "Unacknowledged write using dollar-prefixed or dotted keys may be silently rejected on pre-5.0 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.99" - } - ], - "operations": [ - { - "name": "insertOne", - "object": "collection1", - "arguments": { - "document": { - "_id": { - "$a": 1 - } - } - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll1", - "documents": [ - { - "_id": { - "$a": 1 - } - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/insertOne-errorResponse.json b/tests/UnifiedSpecTests/crud/insertOne-errorResponse.json deleted file mode 100644 index 04ea6a745..000000000 --- a/tests/UnifiedSpecTests/crud/insertOne-errorResponse.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "description": "insertOne-errorResponse", - "schemaVersion": "1.12", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "tests": [ - { - "description": "insert operations support errorResponse assertions", - "runOnRequirements": [ - { - "minServerVersion": "4.0.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.2.0", - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 8 - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1 - } - }, - "expectError": { - "errorCode": 8, - "errorResponse": { - "code": 8 - } - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/insertOne.json b/tests/UnifiedSpecTests/crud/insertOne.json deleted file mode 100644 index 1a9091347..000000000 --- a/tests/UnifiedSpecTests/crud/insertOne.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "description": "insertOne", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "InsertOne with a non-existing document", - "operations": [ - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 2, - "x": 22 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/replaceOne-collation.json b/tests/UnifiedSpecTests/crud/replaceOne-collation.json deleted file mode 100644 index dd76b9d61..000000000 --- a/tests/UnifiedSpecTests/crud/replaceOne-collation.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "description": "replaceOne-collation", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": "ping" - } - ] - } - ], - "tests": [ - { - "description": "ReplaceOne when one document matches with collation", - "operations": [ - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "x": "PING" - }, - "replacement": { - "_id": 2, - "x": "pong" - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": "pong" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/replaceOne-comment.json b/tests/UnifiedSpecTests/crud/replaceOne-comment.json deleted file mode 100644 index 88bee5d7b..000000000 --- a/tests/UnifiedSpecTests/crud/replaceOne-comment.json +++ /dev/null @@ -1,248 +0,0 @@ -{ - "description": "replaceOne-comment", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "ReplaceOne with string comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 22 - }, - "comment": "comment" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "x": 22 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 22 - } - ] - } - ] - }, - { - "description": "ReplaceOne with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 22 - }, - "comment": { - "key": "value" - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "x": 22 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "comment": { - "key": "value" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 22 - } - ] - } - ] - }, - { - "description": "ReplaceOne with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 22 - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "x": 22 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/replaceOne-dots_and_dollars.json b/tests/UnifiedSpecTests/crud/replaceOne-dots_and_dollars.json deleted file mode 100644 index d5003dc5e..000000000 --- a/tests/UnifiedSpecTests/crud/replaceOne-dots_and_dollars.json +++ /dev/null @@ -1,567 +0,0 @@ -{ - "description": "replaceOne-dots_and_dollars", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - }, - { - "collection": { - "id": "collection1", - "database": "database0", - "collectionName": "coll1", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ], - "tests": [ - { - "description": "Replacing document with top-level dotted key on 3.6+ server", - "runOnRequirements": [ - { - "minServerVersion": "3.6" - } - ], - "operations": [ - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a.b": 1 - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "_id": 1, - "a.b": 1 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a.b": 1 - } - ] - } - ] - }, - { - "description": "Replacing document with top-level dotted key on pre-3.6 server yields server-side error", - "runOnRequirements": [ - { - "maxServerVersion": "3.4.99" - } - ], - "operations": [ - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a.b": 1 - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "_id": 1, - "a.b": 1 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "Replacing document with dollar-prefixed key in embedded doc on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a": { - "$b": 1 - } - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "_id": 1, - "a": { - "$b": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a": { - "$b": 1 - } - } - ] - } - ] - }, - { - "description": "Replacing document with dollar-prefixed key in embedded doc on pre-5.0 server yields server-side error", - "runOnRequirements": [ - { - "maxServerVersion": "4.99" - } - ], - "operations": [ - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a": { - "$b": 1 - } - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "_id": 1, - "a": { - "$b": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "Replacing document with dotted key in embedded doc on 3.6+ server", - "runOnRequirements": [ - { - "minServerVersion": "3.6" - } - ], - "operations": [ - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a": { - "b.c": 1 - } - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "_id": 1, - "a": { - "b.c": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "a": { - "b.c": 1 - } - } - ] - } - ] - }, - { - "description": "Replacing document with dotted key in embedded doc on pre-3.6 server yields server-side error", - "runOnRequirements": [ - { - "maxServerVersion": "3.4.99" - } - ], - "operations": [ - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a": { - "b.c": 1 - } - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "_id": 1, - "a": { - "b.c": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "Unacknowledged write using dollar-prefixed or dotted keys may be silently rejected on pre-5.0 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.99" - } - ], - "operations": [ - { - "name": "replaceOne", - "object": "collection1", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "a": { - "$b": 1 - } - } - }, - "expectResult": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll1", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "_id": 1, - "a": { - "$b": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/replaceOne-hint-unacknowledged.json b/tests/UnifiedSpecTests/crud/replaceOne-hint-unacknowledged.json deleted file mode 100644 index 5c5dec64f..000000000 --- a/tests/UnifiedSpecTests/crud/replaceOne-hint-unacknowledged.json +++ /dev/null @@ -1,269 +0,0 @@ -{ - "description": "replaceOne-hint-unacknowledged", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "db0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "Unacknowledged replaceOne with hint string fails with client-side error on pre-4.2 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": "_id_" - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged replaceOne with hint document fails with client-side error on pre-4.2 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged replaceOne with hint string on 4.2+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": "_id_" - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "x": 111 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": { - "$$type": [ - "string", - "object" - ] - } - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - }, - { - "description": "Unacknowledged replaceOne with hint document on 4.2+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "x": 111 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": { - "$$type": [ - "string", - "object" - ] - } - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/replaceOne-hint.json b/tests/UnifiedSpecTests/crud/replaceOne-hint.json deleted file mode 100644 index 6926e9d8d..000000000 --- a/tests/UnifiedSpecTests/crud/replaceOne-hint.json +++ /dev/null @@ -1,203 +0,0 @@ -{ - "description": "replaceOne-hint", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_replaceone_hint" - } - } - ], - "initialData": [ - { - "collectionName": "test_replaceone_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "ReplaceOne with hint string", - "operations": [ - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": "_id_" - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_replaceone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "x": 111 - }, - "hint": "_id_", - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_replaceone_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 111 - } - ] - } - ] - }, - { - "description": "ReplaceOne with hint document", - "operations": [ - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_replaceone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "x": 111 - }, - "hint": { - "_id": 1 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_replaceone_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 111 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/replaceOne-let.json b/tests/UnifiedSpecTests/crud/replaceOne-let.json deleted file mode 100644 index e7a7ee65a..000000000 --- a/tests/UnifiedSpecTests/crud/replaceOne-let.json +++ /dev/null @@ -1,219 +0,0 @@ -{ - "description": "replaceOne-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "ReplaceOne with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "replacement": { - "x": "foo" - }, - "let": { - "id": 1 - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "u": { - "x": "foo" - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": "foo" - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "ReplaceOne with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "replacement": { - "x": "foo" - }, - "let": { - "id": 1 - } - }, - "expectError": { - "errorContains": "'update.let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "u": { - "x": "foo" - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "let": { - "id": 1 - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/replaceOne-validation.json b/tests/UnifiedSpecTests/crud/replaceOne-validation.json deleted file mode 100644 index 6f5b173e0..000000000 --- a/tests/UnifiedSpecTests/crud/replaceOne-validation.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "description": "replaceOne-validation", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "ReplaceOne prohibits atomic modifiers", - "operations": [ - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "$set": { - "x": 22 - } - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/replaceOne.json b/tests/UnifiedSpecTests/crud/replaceOne.json deleted file mode 100644 index bdb7556f2..000000000 --- a/tests/UnifiedSpecTests/crud/replaceOne.json +++ /dev/null @@ -1,259 +0,0 @@ -{ - "description": "replaceOne", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "2.6" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "ReplaceOne when many documents match", - "operations": [ - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ] - }, - { - "description": "ReplaceOne when one document matches", - "operations": [ - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 111 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "ReplaceOne when no documents match", - "operations": [ - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 4 - }, - "replacement": { - "_id": 4, - "x": 1 - } - }, - "expectResult": { - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "ReplaceOne with upsert when no documents match without an id specified", - "operations": [ - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 4 - }, - "replacement": { - "x": 1 - }, - "upsert": true - }, - "expectResult": { - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 1, - "upsertedId": 4 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 1 - } - ] - } - ] - }, - { - "description": "ReplaceOne with upsert when no documents match with an id specified", - "operations": [ - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 4 - }, - "replacement": { - "_id": 4, - "x": 1 - }, - "upsert": true - }, - "expectResult": { - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 1, - "upsertedId": 4 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateMany-arrayFilters.json b/tests/UnifiedSpecTests/crud/updateMany-arrayFilters.json deleted file mode 100644 index 8730caeb4..000000000 --- a/tests/UnifiedSpecTests/crud/updateMany-arrayFilters.json +++ /dev/null @@ -1,233 +0,0 @@ -{ - "description": "updateMany-arrayFilters", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.5.6" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - } - ] - } - ], - "tests": [ - { - "description": "UpdateMany when no documents match arrayFilters", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 4 - } - ] - }, - "expectResult": { - "matchedCount": 2, - "modifiedCount": 0, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - } - ] - } - ] - }, - { - "description": "UpdateMany when one document matches arrayFilters", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 3 - } - ] - }, - "expectResult": { - "matchedCount": 2, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 2 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - } - ] - } - ] - }, - { - "description": "UpdateMany when multiple documents match arrayFilters", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 1 - } - ] - }, - "expectResult": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 2 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 2 - } - ] - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateMany-collation.json b/tests/UnifiedSpecTests/crud/updateMany-collation.json deleted file mode 100644 index 0c780a3c2..000000000 --- a/tests/UnifiedSpecTests/crud/updateMany-collation.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "description": "updateMany-collation", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": "ping" - }, - { - "_id": 3, - "x": "pINg" - } - ] - } - ], - "tests": [ - { - "description": "UpdateMany when many documents match with collation", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": { - "x": "ping" - }, - "update": { - "$set": { - "x": "pong" - } - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - }, - "expectResult": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": "pong" - }, - { - "_id": 3, - "x": "pong" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateMany-comment.json b/tests/UnifiedSpecTests/crud/updateMany-comment.json deleted file mode 100644 index 88b8b67f5..000000000 --- a/tests/UnifiedSpecTests/crud/updateMany-comment.json +++ /dev/null @@ -1,254 +0,0 @@ -{ - "description": "updateMany-comment", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "UpdateMany with string comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 22 - } - }, - "comment": "comment" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$set": { - "x": 22 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 22 - } - ] - } - ] - }, - { - "description": "UpdateMany with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 22 - } - }, - "comment": { - "key": "value" - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$set": { - "x": 22 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "comment": { - "key": "value" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 22 - } - ] - } - ] - }, - { - "description": "UpdateMany with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 22 - } - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$set": { - "x": 22 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateMany-dots_and_dollars.json b/tests/UnifiedSpecTests/crud/updateMany-dots_and_dollars.json deleted file mode 100644 index 5d3b9d045..000000000 --- a/tests/UnifiedSpecTests/crud/updateMany-dots_and_dollars.json +++ /dev/null @@ -1,404 +0,0 @@ -{ - "description": "updateMany-dots_and_dollars", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": {} - } - ] - } - ], - "tests": [ - { - "description": "Updating document to set top-level dollar-prefixed key on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ] - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ], - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": {}, - "$a": 1 - } - ] - } - ] - }, - { - "description": "Updating document to set top-level dotted key on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ] - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ], - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": {}, - "a.b": 1 - } - ] - } - ] - }, - { - "description": "Updating document to set dollar-prefixed key in embedded doc on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ] - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ], - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": { - "$a": 1 - } - } - ] - } - ] - }, - { - "description": "Updating document to set dotted key in embedded doc on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ] - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ], - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": { - "a.b": 1 - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateMany-hint-clientError.json b/tests/UnifiedSpecTests/crud/updateMany-hint-clientError.json deleted file mode 100644 index 5da878e29..000000000 --- a/tests/UnifiedSpecTests/crud/updateMany-hint-clientError.json +++ /dev/null @@ -1,159 +0,0 @@ -{ - "description": "updateMany-hint-clientError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "maxServerVersion": "3.3.99" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_updatemany_hint" - } - } - ], - "initialData": [ - { - "collectionName": "test_updatemany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "UpdateMany with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "test_updatemany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "UpdateMany with hint document unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "test_updatemany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateMany-hint-serverError.json b/tests/UnifiedSpecTests/crud/updateMany-hint-serverError.json deleted file mode 100644 index c81f36b13..000000000 --- a/tests/UnifiedSpecTests/crud/updateMany-hint-serverError.json +++ /dev/null @@ -1,216 +0,0 @@ -{ - "description": "updateMany-hint-serverError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.1.9" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_updatemany_hint" - } - } - ], - "initialData": [ - { - "collectionName": "test_updatemany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "UpdateMany with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_updatemany_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": "_id_", - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_updatemany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "UpdateMany with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_updatemany_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": { - "_id": 1 - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_updatemany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateMany-hint-unacknowledged.json b/tests/UnifiedSpecTests/crud/updateMany-hint-unacknowledged.json deleted file mode 100644 index e83838aac..000000000 --- a/tests/UnifiedSpecTests/crud/updateMany-hint-unacknowledged.json +++ /dev/null @@ -1,281 +0,0 @@ -{ - "description": "updateMany-hint-unacknowledged", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "db0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Unacknowledged updateMany with hint string fails with client-side error on pre-4.2 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged updateMany with hint document fails with client-side error on pre-4.2 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged updateMany with hint string on 4.2+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": { - "$$type": [ - "string", - "object" - ] - } - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - }, - { - "description": "Unacknowledged updateMany with hint document on 4.2+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": { - "$$type": [ - "string", - "object" - ] - } - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateMany-hint.json b/tests/UnifiedSpecTests/crud/updateMany-hint.json deleted file mode 100644 index 929be5299..000000000 --- a/tests/UnifiedSpecTests/crud/updateMany-hint.json +++ /dev/null @@ -1,219 +0,0 @@ -{ - "description": "updateMany-hint", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_updatemany_hint" - } - } - ], - "initialData": [ - { - "collectionName": "test_updatemany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "UpdateMany with hint string", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectResult": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_updatemany_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": "_id_", - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_updatemany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 34 - } - ] - } - ] - }, - { - "description": "UpdateMany with hint document", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_updatemany_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "hint": { - "_id": 1 - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_updatemany_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 34 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateMany-let.json b/tests/UnifiedSpecTests/crud/updateMany-let.json deleted file mode 100644 index cff3bd4c7..000000000 --- a/tests/UnifiedSpecTests/crud/updateMany-let.json +++ /dev/null @@ -1,249 +0,0 @@ -{ - "description": "updateMany-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2, - "name": "name" - }, - { - "_id": 3, - "name": "name" - } - ] - } - ], - "tests": [ - { - "description": "updateMany with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$name", - "$$name" - ] - } - }, - "update": [ - { - "$set": { - "x": "$$x", - "y": "$$y" - } - } - ], - "let": { - "name": "name", - "x": "foo", - "y": { - "$literal": "bar" - } - } - }, - "expectResult": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "$expr": { - "$eq": [ - "$name", - "$$name" - ] - } - }, - "u": [ - { - "$set": { - "x": "$$x", - "y": "$$y" - } - } - ], - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "let": { - "name": "name", - "x": "foo", - "y": { - "$literal": "bar" - } - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2, - "name": "name", - "x": "foo", - "y": "bar" - }, - { - "_id": 3, - "name": "name", - "x": "foo", - "y": "bar" - } - ] - } - ] - }, - { - "description": "updateMany with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "x": "$$x" - } - } - ], - "let": { - "x": "foo" - } - }, - "expectError": { - "errorContains": "'update.let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$set": { - "x": "$$x" - } - } - ], - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "let": { - "x": "foo" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2, - "name": "name" - }, - { - "_id": 3, - "name": "name" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateMany-validation.json b/tests/UnifiedSpecTests/crud/updateMany-validation.json deleted file mode 100644 index e3e46a138..000000000 --- a/tests/UnifiedSpecTests/crud/updateMany-validation.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "description": "updateMany-validation", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "UpdateMany requires atomic modifiers", - "operations": [ - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "x": 44 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateMany.json b/tests/UnifiedSpecTests/crud/updateMany.json deleted file mode 100644 index 19b890592..000000000 --- a/tests/UnifiedSpecTests/crud/updateMany.json +++ /dev/null @@ -1,236 +0,0 @@ -{ - "description": "updateMany", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "2.6" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "UpdateMany when many documents match", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectResult": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 34 - } - ] - } - ] - }, - { - "description": "UpdateMany when one document matches", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "UpdateMany when no documents match", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": { - "_id": 4 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectResult": { - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "UpdateMany with upsert when no documents match", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": { - "_id": 4 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "upsert": true - }, - "expectResult": { - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 1, - "upsertedId": 4 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateOne-arrayFilters.json b/tests/UnifiedSpecTests/crud/updateOne-arrayFilters.json deleted file mode 100644 index be5d05b01..000000000 --- a/tests/UnifiedSpecTests/crud/updateOne-arrayFilters.json +++ /dev/null @@ -1,453 +0,0 @@ -{ - "description": "updateOne-arrayFilters", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.5.6" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - }, - { - "_id": 3, - "y": [ - { - "b": 5, - "c": [ - { - "d": 2 - }, - { - "d": 1 - } - ] - } - ] - } - ] - } - ], - "tests": [ - { - "description": "UpdateOne when no document matches arrayFilters", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 4 - } - ] - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 0, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - }, - { - "_id": 3, - "y": [ - { - "b": 5, - "c": [ - { - "d": 2 - }, - { - "d": 1 - } - ] - } - ] - } - ] - } - ] - }, - { - "description": "UpdateOne when one document matches arrayFilters", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 3 - } - ] - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 2 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - }, - { - "_id": 3, - "y": [ - { - "b": 5, - "c": [ - { - "d": 2 - }, - { - "d": 1 - } - ] - } - ] - } - ] - } - ] - }, - { - "description": "UpdateOne when multiple documents match arrayFilters", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": {}, - "update": { - "$set": { - "y.$[i].b": 2 - } - }, - "arrayFilters": [ - { - "i.b": 1 - } - ] - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 2 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - }, - { - "_id": 3, - "y": [ - { - "b": 5, - "c": [ - { - "d": 2 - }, - { - "d": 1 - } - ] - } - ] - } - ] - } - ] - }, - { - "description": "UpdateOne when no documents match multiple arrayFilters", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 3 - }, - "update": { - "$set": { - "y.$[i].c.$[j].d": 0 - } - }, - "arrayFilters": [ - { - "i.b": 5 - }, - { - "j.d": 3 - } - ] - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 0, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - }, - { - "_id": 3, - "y": [ - { - "b": 5, - "c": [ - { - "d": 2 - }, - { - "d": 1 - } - ] - } - ] - } - ] - } - ] - }, - { - "description": "UpdateOne when one document matches multiple arrayFilters", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 3 - }, - "update": { - "$set": { - "y.$[i].c.$[j].d": 0 - } - }, - "arrayFilters": [ - { - "i.b": 5 - }, - { - "j.d": 1 - } - ] - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "y": [ - { - "b": 3 - }, - { - "b": 1 - } - ] - }, - { - "_id": 2, - "y": [ - { - "b": 0 - }, - { - "b": 1 - } - ] - }, - { - "_id": 3, - "y": [ - { - "b": 5, - "c": [ - { - "d": 2 - }, - { - "d": 0 - } - ] - } - ] - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateOne-collation.json b/tests/UnifiedSpecTests/crud/updateOne-collation.json deleted file mode 100644 index a39be4605..000000000 --- a/tests/UnifiedSpecTests/crud/updateOne-collation.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "description": "updateOne-collation", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": "ping" - } - ] - } - ], - "tests": [ - { - "description": "UpdateOne when one document matches with collation", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "x": "PING" - }, - "update": { - "$set": { - "x": "pong" - } - }, - "collation": { - "locale": "en_US", - "strength": 2 - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": "pong" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateOne-comment.json b/tests/UnifiedSpecTests/crud/updateOne-comment.json deleted file mode 100644 index f4ee74db3..000000000 --- a/tests/UnifiedSpecTests/crud/updateOne-comment.json +++ /dev/null @@ -1,260 +0,0 @@ -{ - "description": "updateOne-comment", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "UpdateOne with string comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 22 - } - }, - "comment": "comment" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$set": { - "x": 22 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 22 - } - ] - } - ] - }, - { - "description": "UpdateOne with document comment", - "runOnRequirements": [ - { - "minServerVersion": "4.4" - } - ], - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 22 - } - }, - "comment": { - "key": "value" - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$set": { - "x": 22 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "comment": { - "key": "value" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 22 - } - ] - } - ] - }, - { - "description": "UpdateOne with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 22 - } - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$set": { - "x": 22 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateOne-dots_and_dollars.json b/tests/UnifiedSpecTests/crud/updateOne-dots_and_dollars.json deleted file mode 100644 index 798d522cb..000000000 --- a/tests/UnifiedSpecTests/crud/updateOne-dots_and_dollars.json +++ /dev/null @@ -1,412 +0,0 @@ -{ - "description": "updateOne-dots_and_dollars", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": {} - } - ] - } - ], - "tests": [ - { - "description": "Updating document to set top-level dollar-prefixed key on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ] - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ], - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": {}, - "$a": 1 - } - ] - } - ] - }, - { - "description": "Updating document to set top-level dotted key on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ] - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$replaceWith": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$$ROOT" - } - } - } - ], - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": {}, - "a.b": 1 - } - ] - } - ] - }, - { - "description": "Updating document to set dollar-prefixed key in embedded doc on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ] - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "$a" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ], - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": { - "$a": 1 - } - } - ] - } - ] - }, - { - "description": "Updating document to set dotted key in embedded doc on 5.0+ server", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ] - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$set": { - "foo": { - "$setField": { - "field": { - "$literal": "a.b" - }, - "value": 1, - "input": "$foo" - } - } - } - } - ], - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "foo": { - "a.b": 1 - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateOne-errorResponse.json b/tests/UnifiedSpecTests/crud/updateOne-errorResponse.json deleted file mode 100644 index 0ceddbc4f..000000000 --- a/tests/UnifiedSpecTests/crud/updateOne-errorResponse.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "description": "updateOne-errorResponse", - "schemaVersion": "1.12", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "tests": [ - { - "description": "update operations support errorResponse assertions", - "runOnRequirements": [ - { - "minServerVersion": "4.0.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.2.0", - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 8 - } - } - } - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - }, - "expectError": { - "errorCode": 8, - "errorResponse": { - "code": 8 - } - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateOne-hint-clientError.json b/tests/UnifiedSpecTests/crud/updateOne-hint-clientError.json deleted file mode 100644 index d4f1a5343..000000000 --- a/tests/UnifiedSpecTests/crud/updateOne-hint-clientError.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "description": "updateOne-hint-clientError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "maxServerVersion": "3.3.99" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_updateone_hint" - } - } - ], - "initialData": [ - { - "collectionName": "test_updateone_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "UpdateOne with hint string unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "test_updateone_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "UpdateOne with hint document unsupported (client-side error)", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "test_updateone_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateOne-hint-serverError.json b/tests/UnifiedSpecTests/crud/updateOne-hint-serverError.json deleted file mode 100644 index 05fb03331..000000000 --- a/tests/UnifiedSpecTests/crud/updateOne-hint-serverError.json +++ /dev/null @@ -1,208 +0,0 @@ -{ - "description": "updateOne-hint-serverError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.1.9" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_updateone_hint" - } - } - ], - "initialData": [ - { - "collectionName": "test_updateone_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "UpdateOne with hint string unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_updateone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_", - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_updateone_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "UpdateOne with hint document unsupported (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_updateone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_updateone_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateOne-hint-unacknowledged.json b/tests/UnifiedSpecTests/crud/updateOne-hint-unacknowledged.json deleted file mode 100644 index 859b0f92f..000000000 --- a/tests/UnifiedSpecTests/crud/updateOne-hint-unacknowledged.json +++ /dev/null @@ -1,281 +0,0 @@ -{ - "description": "updateOne-hint-unacknowledged", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "db0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "db0", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "Unacknowledged updateOne with hint string fails with client-side error on pre-4.2 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged updateOne with hint document fails with client-side error on pre-4.2 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.0.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged updateOne with hint string on 4.2+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": { - "$$type": [ - "string", - "object" - ] - } - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - }, - { - "description": "Unacknowledged updateOne with hint document on 4.2+ server", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "acknowledged": { - "$$unsetOrMatches": false - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - }, - "hint": { - "$$type": [ - "string", - "object" - ] - } - } - ], - "writeConcern": { - "w": 0 - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateOne-hint.json b/tests/UnifiedSpecTests/crud/updateOne-hint.json deleted file mode 100644 index 484e00757..000000000 --- a/tests/UnifiedSpecTests/crud/updateOne-hint.json +++ /dev/null @@ -1,211 +0,0 @@ -{ - "description": "updateOne-hint", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_updateone_hint" - } - } - ], - "initialData": [ - { - "collectionName": "test_updateone_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "UpdateOne with hint string", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_updateone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_", - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_updateone_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - } - ] - } - ] - }, - { - "description": "UpdateOne with hint document", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test_updateone_hint", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test_updateone_hint", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 23 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateOne-let.json b/tests/UnifiedSpecTests/crud/updateOne-let.json deleted file mode 100644 index e43b97935..000000000 --- a/tests/UnifiedSpecTests/crud/updateOne-let.json +++ /dev/null @@ -1,227 +0,0 @@ -{ - "description": "updateOne-let", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "UpdateOne with let option", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "update": [ - { - "$set": { - "x": "$$x" - } - } - ], - "let": { - "id": 1, - "x": "foo" - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "$expr": { - "$eq": [ - "$_id", - "$$id" - ] - } - }, - "u": [ - { - "$set": { - "x": "$$x" - } - } - ], - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "let": { - "id": 1, - "x": "foo" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": "foo" - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "UpdateOne with let option unsupported (server-side error)", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.4.99" - } - ], - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "x": "$$x" - } - } - ], - "let": { - "x": "foo" - } - }, - "expectError": { - "errorContains": "'update.let' is an unknown field", - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$set": { - "x": "$$x" - } - } - ], - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "let": { - "x": "foo" - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateOne-validation.json b/tests/UnifiedSpecTests/crud/updateOne-validation.json deleted file mode 100644 index 1464642c5..000000000 --- a/tests/UnifiedSpecTests/crud/updateOne-validation.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "description": "updateOne-validation", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "UpdateOne requires atomic modifiers", - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "x": 22 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateOne.json b/tests/UnifiedSpecTests/crud/updateOne.json deleted file mode 100644 index a3f559673..000000000 --- a/tests/UnifiedSpecTests/crud/updateOne.json +++ /dev/null @@ -1,216 +0,0 @@ -{ - "description": "updateOne", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "2.6" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v1" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "UpdateOne when many documents match", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ] - }, - { - "description": "UpdateOne when one document matches", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "UpdateOne when no documents match", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 4 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectResult": { - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "UpdateOne with upsert when no documents match", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 4 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "upsert": true - }, - "expectResult": { - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 1, - "upsertedId": 4 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "crud-v1", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/crud/updateWithPipelines.json b/tests/UnifiedSpecTests/crud/updateWithPipelines.json deleted file mode 100644 index 164f2f6a1..000000000 --- a/tests/UnifiedSpecTests/crud/updateWithPipelines.json +++ /dev/null @@ -1,494 +0,0 @@ -{ - "description": "updateWithPipelines", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.1.11" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 1, - "y": 1, - "t": { - "u": { - "v": 1 - } - } - }, - { - "_id": 2, - "x": 2, - "y": 1 - } - ] - } - ], - "tests": [ - { - "description": "UpdateOne using pipelines", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceRoot": { - "newRoot": "$t" - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$replaceRoot": { - "newRoot": "$t" - } - }, - { - "$addFields": { - "foo": 1 - } - } - ], - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - }, - "commandName": "update", - "databaseName": "crud-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "u": { - "v": 1 - }, - "foo": 1 - }, - { - "_id": 2, - "x": 2, - "y": 1 - } - ] - } - ] - }, - { - "description": "UpdateMany using pipelines", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": {}, - "update": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - }, - "expectResult": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": {}, - "u": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ], - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - }, - "commandName": "update", - "databaseName": "crud-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 1, - "foo": 1 - }, - { - "_id": 2, - "x": 2, - "foo": 1 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate using pipelines", - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "update": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - }, - "commandName": "findAndModify", - "databaseName": "crud-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 1, - "foo": 1 - }, - { - "_id": 2, - "x": 2, - "y": 1 - } - ] - } - ] - }, - { - "description": "UpdateOne in bulk write using pipelines", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$replaceRoot": { - "newRoot": "$t" - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - } - } - ] - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": [ - { - "$replaceRoot": { - "newRoot": "$t" - } - }, - { - "$addFields": { - "foo": 1 - } - } - ], - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - }, - "commandName": "update", - "databaseName": "crud-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "u": { - "v": 1 - }, - "foo": 1 - }, - { - "_id": 2, - "x": 2, - "y": 1 - } - ] - } - ] - }, - { - "description": "UpdateMany in bulk write using pipelines", - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": {}, - "update": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ] - } - } - ] - }, - "expectResult": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": {}, - "u": [ - { - "$project": { - "x": 1 - } - }, - { - "$addFields": { - "foo": 1 - } - } - ], - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ] - }, - "commandName": "update", - "databaseName": "crud-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 1, - "foo": 1 - }, - { - "_id": 2, - "x": 2, - "foo": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/gridfs/delete.json b/tests/UnifiedSpecTests/gridfs/delete.json deleted file mode 100644 index 7a4ec27f8..000000000 --- a/tests/UnifiedSpecTests/gridfs/delete.json +++ /dev/null @@ -1,799 +0,0 @@ -{ - "description": "gridfs-delete", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "gridfs-tests" - } - }, - { - "bucket": { - "id": "bucket0", - "database": "database0" - } - }, - { - "collection": { - "id": "bucket0_files_collection", - "database": "database0", - "collectionName": "fs.files" - } - }, - { - "collection": { - "id": "bucket0_chunks_collection", - "database": "database0", - "collectionName": "fs.chunks" - } - } - ], - "initialData": [ - { - "collectionName": "fs.files", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "length": 0, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "d41d8cd98f00b204e9800998ecf8427e", - "filename": "length-0", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000002" - }, - "length": 0, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "d41d8cd98f00b204e9800998ecf8427e", - "filename": "length-0-with-empty-chunk", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000003" - }, - "length": 2, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "c700ed4fdb1d27055aa3faa2c2432283", - "filename": "length-2", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000004" - }, - "length": 8, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "dd254cdc958e53abaa67da9f797125f5", - "filename": "length-8", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - } - ] - }, - { - "collectionName": "fs.chunks", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "files_id": { - "$oid": "000000000000000000000002" - }, - "n": 0, - "data": { - "$binary": { - "base64": "", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000002" - }, - "files_id": { - "$oid": "000000000000000000000003" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESI=", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000003" - }, - "files_id": { - "$oid": "000000000000000000000004" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESIzRA==", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000004" - }, - "files_id": { - "$oid": "000000000000000000000004" - }, - "n": 1, - "data": { - "$binary": { - "base64": "VWZ3iA==", - "subType": "00" - } - } - } - ] - } - ], - "tests": [ - { - "description": "delete when length is 0", - "operations": [ - { - "name": "delete", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - } - } - ], - "outcome": [ - { - "collectionName": "fs.files", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000002" - }, - "length": 0, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "d41d8cd98f00b204e9800998ecf8427e", - "filename": "length-0-with-empty-chunk", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000003" - }, - "length": 2, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "c700ed4fdb1d27055aa3faa2c2432283", - "filename": "length-2", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000004" - }, - "length": 8, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "dd254cdc958e53abaa67da9f797125f5", - "filename": "length-8", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - } - ] - }, - { - "collectionName": "fs.chunks", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "files_id": { - "$oid": "000000000000000000000002" - }, - "n": 0, - "data": { - "$binary": { - "base64": "", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000002" - }, - "files_id": { - "$oid": "000000000000000000000003" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESI=", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000003" - }, - "files_id": { - "$oid": "000000000000000000000004" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESIzRA==", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000004" - }, - "files_id": { - "$oid": "000000000000000000000004" - }, - "n": 1, - "data": { - "$binary": { - "base64": "VWZ3iA==", - "subType": "00" - } - } - } - ] - } - ] - }, - { - "description": "delete when length is 0 and there is one extra empty chunk", - "operations": [ - { - "name": "delete", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000002" - } - } - } - ], - "outcome": [ - { - "collectionName": "fs.files", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "length": 0, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "d41d8cd98f00b204e9800998ecf8427e", - "filename": "length-0", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000003" - }, - "length": 2, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "c700ed4fdb1d27055aa3faa2c2432283", - "filename": "length-2", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000004" - }, - "length": 8, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "dd254cdc958e53abaa67da9f797125f5", - "filename": "length-8", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - } - ] - }, - { - "collectionName": "fs.chunks", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000002" - }, - "files_id": { - "$oid": "000000000000000000000003" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESI=", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000003" - }, - "files_id": { - "$oid": "000000000000000000000004" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESIzRA==", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000004" - }, - "files_id": { - "$oid": "000000000000000000000004" - }, - "n": 1, - "data": { - "$binary": { - "base64": "VWZ3iA==", - "subType": "00" - } - } - } - ] - } - ] - }, - { - "description": "delete when length is 8", - "operations": [ - { - "name": "delete", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000004" - } - } - } - ], - "outcome": [ - { - "collectionName": "fs.files", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "length": 0, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "d41d8cd98f00b204e9800998ecf8427e", - "filename": "length-0", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000002" - }, - "length": 0, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "d41d8cd98f00b204e9800998ecf8427e", - "filename": "length-0-with-empty-chunk", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000003" - }, - "length": 2, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "c700ed4fdb1d27055aa3faa2c2432283", - "filename": "length-2", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - } - ] - }, - { - "collectionName": "fs.chunks", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "files_id": { - "$oid": "000000000000000000000002" - }, - "n": 0, - "data": { - "$binary": { - "base64": "", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000002" - }, - "files_id": { - "$oid": "000000000000000000000003" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESI=", - "subType": "00" - } - } - } - ] - } - ] - }, - { - "description": "delete when files entry does not exist", - "operations": [ - { - "name": "delete", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000000" - } - }, - "expectError": { - "isError": true - } - } - ], - "outcome": [ - { - "collectionName": "fs.files", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "length": 0, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "d41d8cd98f00b204e9800998ecf8427e", - "filename": "length-0", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000002" - }, - "length": 0, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "d41d8cd98f00b204e9800998ecf8427e", - "filename": "length-0-with-empty-chunk", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000003" - }, - "length": 2, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "c700ed4fdb1d27055aa3faa2c2432283", - "filename": "length-2", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000004" - }, - "length": 8, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "dd254cdc958e53abaa67da9f797125f5", - "filename": "length-8", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - } - ] - }, - { - "collectionName": "fs.chunks", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "files_id": { - "$oid": "000000000000000000000002" - }, - "n": 0, - "data": { - "$binary": { - "base64": "", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000002" - }, - "files_id": { - "$oid": "000000000000000000000003" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESI=", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000003" - }, - "files_id": { - "$oid": "000000000000000000000004" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESIzRA==", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000004" - }, - "files_id": { - "$oid": "000000000000000000000004" - }, - "n": 1, - "data": { - "$binary": { - "base64": "VWZ3iA==", - "subType": "00" - } - } - } - ] - } - ] - }, - { - "description": "delete when files entry does not exist and there are orphaned chunks", - "operations": [ - { - "name": "deleteOne", - "object": "bucket0_files_collection", - "arguments": { - "filter": { - "_id": { - "$oid": "000000000000000000000004" - } - } - }, - "expectResult": { - "deletedCount": 1 - } - }, - { - "name": "delete", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000004" - } - }, - "expectError": { - "isError": true - } - } - ], - "outcome": [ - { - "collectionName": "fs.files", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "length": 0, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "d41d8cd98f00b204e9800998ecf8427e", - "filename": "length-0", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000002" - }, - "length": 0, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "d41d8cd98f00b204e9800998ecf8427e", - "filename": "length-0-with-empty-chunk", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000003" - }, - "length": 2, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "c700ed4fdb1d27055aa3faa2c2432283", - "filename": "length-2", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - } - ] - }, - { - "collectionName": "fs.chunks", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "files_id": { - "$oid": "000000000000000000000002" - }, - "n": 0, - "data": { - "$binary": { - "base64": "", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000002" - }, - "files_id": { - "$oid": "000000000000000000000003" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESI=", - "subType": "00" - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/gridfs/download.json b/tests/UnifiedSpecTests/gridfs/download.json deleted file mode 100644 index 48d324621..000000000 --- a/tests/UnifiedSpecTests/gridfs/download.json +++ /dev/null @@ -1,558 +0,0 @@ -{ - "description": "gridfs-download", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "gridfs-tests" - } - }, - { - "bucket": { - "id": "bucket0", - "database": "database0" - } - }, - { - "collection": { - "id": "bucket0_files_collection", - "database": "database0", - "collectionName": "fs.files" - } - }, - { - "collection": { - "id": "bucket0_chunks_collection", - "database": "database0", - "collectionName": "fs.chunks" - } - } - ], - "initialData": [ - { - "collectionName": "fs.files", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "length": 0, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "d41d8cd98f00b204e9800998ecf8427e", - "filename": "length-0", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000002" - }, - "length": 0, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "d41d8cd98f00b204e9800998ecf8427e", - "filename": "length-0-with-empty-chunk", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000003" - }, - "length": 2, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "c700ed4fdb1d27055aa3faa2c2432283", - "filename": "length-2", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000004" - }, - "length": 8, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "dd254cdc958e53abaa67da9f797125f5", - "filename": "length-8", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000005" - }, - "length": 10, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "57d83cd477bfb1ccd975ab33d827a92b", - "filename": "length-10", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000006" - }, - "length": 2, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "c700ed4fdb1d27055aa3faa2c2432283", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - } - ] - }, - { - "collectionName": "fs.chunks", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "files_id": { - "$oid": "000000000000000000000002" - }, - "n": 0, - "data": { - "$binary": { - "base64": "", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000002" - }, - "files_id": { - "$oid": "000000000000000000000003" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESI=", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000003" - }, - "files_id": { - "$oid": "000000000000000000000004" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESIzRA==", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000004" - }, - "files_id": { - "$oid": "000000000000000000000004" - }, - "n": 1, - "data": { - "$binary": { - "base64": "VWZ3iA==", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000005" - }, - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESIzRA==", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000006" - }, - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 1, - "data": { - "$binary": { - "base64": "VWZ3iA==", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000007" - }, - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 2, - "data": { - "$binary": { - "base64": "mao=", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000008" - }, - "files_id": { - "$oid": "000000000000000000000006" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESI=", - "subType": "00" - } - } - } - ] - } - ], - "tests": [ - { - "description": "download when length is zero", - "operations": [ - { - "name": "download", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectResult": { - "$$matchesHexBytes": "" - } - } - ] - }, - { - "description": "download when length is zero and there is one empty chunk", - "operations": [ - { - "name": "download", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000002" - } - }, - "expectResult": { - "$$matchesHexBytes": "" - } - } - ] - }, - { - "description": "download when there is one chunk", - "operations": [ - { - "name": "download", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000003" - } - }, - "expectResult": { - "$$matchesHexBytes": "1122" - } - } - ] - }, - { - "description": "download when there are two chunks", - "operations": [ - { - "name": "download", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000004" - } - }, - "expectResult": { - "$$matchesHexBytes": "1122334455667788" - } - } - ] - }, - { - "description": "download when there are three chunks", - "operations": [ - { - "name": "download", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000005" - } - }, - "expectResult": { - "$$matchesHexBytes": "112233445566778899aa" - } - } - ] - }, - { - "description": "download when files entry does not exist", - "operations": [ - { - "name": "download", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000000" - } - }, - "expectError": { - "isError": true - } - } - ] - }, - { - "description": "download when an intermediate chunk is missing", - "operations": [ - { - "name": "deleteOne", - "object": "bucket0_chunks_collection", - "arguments": { - "filter": { - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 1 - } - }, - "expectResult": { - "deletedCount": 1 - } - }, - { - "name": "download", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000005" - } - }, - "expectError": { - "isError": true - } - } - ] - }, - { - "description": "download when final chunk is missing", - "operations": [ - { - "name": "deleteOne", - "object": "bucket0_chunks_collection", - "arguments": { - "filter": { - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 2 - } - }, - "expectResult": { - "deletedCount": 1 - } - }, - { - "name": "download", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000005" - } - }, - "expectError": { - "isError": true - } - } - ] - }, - { - "description": "download when an intermediate chunk is the wrong size", - "operations": [ - { - "name": "bulkWrite", - "object": "bucket0_chunks_collection", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 1 - }, - "update": { - "$set": { - "data": { - "$binary": { - "base64": "VWZ3", - "subType": "00" - } - } - } - } - } - }, - { - "updateOne": { - "filter": { - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 2 - }, - "update": { - "$set": { - "data": { - "$binary": { - "base64": "iJmq", - "subType": "00" - } - } - } - } - } - } - ] - }, - "expectResult": { - "matchedCount": 2, - "modifiedCount": 2 - } - }, - { - "name": "download", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000005" - } - }, - "expectError": { - "isError": true - } - } - ] - }, - { - "description": "download when final chunk is the wrong size", - "operations": [ - { - "name": "updateOne", - "object": "bucket0_chunks_collection", - "arguments": { - "filter": { - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 2 - }, - "update": { - "$set": { - "data": { - "$binary": { - "base64": "mQ==", - "subType": "00" - } - } - } - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1 - } - }, - { - "name": "download", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000005" - } - }, - "expectError": { - "isError": true - } - } - ] - }, - { - "description": "download legacy file with no name", - "operations": [ - { - "name": "download", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000006" - } - }, - "expectResult": { - "$$matchesHexBytes": "1122" - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/gridfs/downloadByName.json b/tests/UnifiedSpecTests/gridfs/downloadByName.json deleted file mode 100644 index cd4466395..000000000 --- a/tests/UnifiedSpecTests/gridfs/downloadByName.json +++ /dev/null @@ -1,330 +0,0 @@ -{ - "description": "gridfs-downloadByName", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "gridfs-tests" - } - }, - { - "bucket": { - "id": "bucket0", - "database": "database0" - } - }, - { - "collection": { - "id": "bucket0_files_collection", - "database": "database0", - "collectionName": "fs.files" - } - }, - { - "collection": { - "id": "bucket0_chunks_collection", - "database": "database0", - "collectionName": "fs.chunks" - } - } - ], - "initialData": [ - { - "collectionName": "fs.files", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "length": 1, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "47ed733b8d10be225eceba344d533586", - "filename": "abc", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000002" - }, - "length": 1, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-02T00:00:00.000Z" - }, - "md5": "b15835f133ff2e27c7cb28117bfae8f4", - "filename": "abc", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000003" - }, - "length": 1, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-03T00:00:00.000Z" - }, - "md5": "eccbc87e4b5ce2fe28308fd9f2a7baf3", - "filename": "abc", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000004" - }, - "length": 1, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-04T00:00:00.000Z" - }, - "md5": "f623e75af30e62bbd73d6df5b50bb7b5", - "filename": "abc", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - }, - { - "_id": { - "$oid": "000000000000000000000005" - }, - "length": 1, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-05T00:00:00.000Z" - }, - "md5": "4c614360da93c0a041b22e537de151eb", - "filename": "abc", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - } - ] - }, - { - "collectionName": "fs.chunks", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "files_id": { - "$oid": "000000000000000000000001" - }, - "n": 0, - "data": { - "$binary": { - "base64": "EQ==", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000002" - }, - "files_id": { - "$oid": "000000000000000000000002" - }, - "n": 0, - "data": { - "$binary": { - "base64": "Ig==", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000003" - }, - "files_id": { - "$oid": "000000000000000000000003" - }, - "n": 0, - "data": { - "$binary": { - "base64": "Mw==", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000004" - }, - "files_id": { - "$oid": "000000000000000000000004" - }, - "n": 0, - "data": { - "$binary": { - "base64": "RA==", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000005" - }, - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 0, - "data": { - "$binary": { - "base64": "VQ==", - "subType": "00" - } - } - } - ] - } - ], - "tests": [ - { - "description": "downloadByName defaults to latest revision (-1)", - "operations": [ - { - "name": "downloadByName", - "object": "bucket0", - "arguments": { - "filename": "abc" - }, - "expectResult": { - "$$matchesHexBytes": "55" - } - } - ] - }, - { - "description": "downloadByName when revision is 0", - "operations": [ - { - "name": "downloadByName", - "object": "bucket0", - "arguments": { - "filename": "abc", - "revision": 0 - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ] - }, - { - "description": "downloadByName when revision is 1", - "operations": [ - { - "name": "downloadByName", - "object": "bucket0", - "arguments": { - "filename": "abc", - "revision": 1 - }, - "expectResult": { - "$$matchesHexBytes": "22" - } - } - ] - }, - { - "description": "downloadByName when revision is 2", - "operations": [ - { - "name": "downloadByName", - "object": "bucket0", - "arguments": { - "filename": "abc", - "revision": 2 - }, - "expectResult": { - "$$matchesHexBytes": "33" - } - } - ] - }, - { - "description": "downloadByName when revision is -2", - "operations": [ - { - "name": "downloadByName", - "object": "bucket0", - "arguments": { - "filename": "abc", - "revision": -2 - }, - "expectResult": { - "$$matchesHexBytes": "44" - } - } - ] - }, - { - "description": "downloadByName when revision is -1", - "operations": [ - { - "name": "downloadByName", - "object": "bucket0", - "arguments": { - "filename": "abc", - "revision": -1 - }, - "expectResult": { - "$$matchesHexBytes": "55" - } - } - ] - }, - { - "description": "downloadByName when files entry does not exist", - "operations": [ - { - "name": "downloadByName", - "object": "bucket0", - "arguments": { - "filename": "xyz" - }, - "expectError": { - "isError": true - } - } - ] - }, - { - "description": "downloadByName when revision does not exist", - "operations": [ - { - "name": "downloadByName", - "object": "bucket0", - "arguments": { - "filename": "abc", - "revision": 999 - }, - "expectError": { - "isError": true - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/gridfs/upload-disableMD5.json b/tests/UnifiedSpecTests/gridfs/upload-disableMD5.json deleted file mode 100644 index d5a9d6f4a..000000000 --- a/tests/UnifiedSpecTests/gridfs/upload-disableMD5.json +++ /dev/null @@ -1,172 +0,0 @@ -{ - "description": "gridfs-upload-disableMD5", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "gridfs-tests" - } - }, - { - "bucket": { - "id": "bucket0", - "database": "database0" - } - }, - { - "collection": { - "id": "bucket0_files_collection", - "database": "database0", - "collectionName": "fs.files" - } - }, - { - "collection": { - "id": "bucket0_chunks_collection", - "database": "database0", - "collectionName": "fs.chunks" - } - } - ], - "initialData": [ - { - "collectionName": "fs.files", - "databaseName": "gridfs-tests", - "documents": [] - }, - { - "collectionName": "fs.chunks", - "databaseName": "gridfs-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "upload when length is 0 sans MD5", - "operations": [ - { - "name": "upload", - "object": "bucket0", - "arguments": { - "filename": "filename", - "source": { - "$$hexBytes": "" - }, - "chunkSizeBytes": 4, - "disableMD5": true - }, - "expectResult": { - "$$type": "objectId" - }, - "saveResultAsEntity": "uploadedObjectId" - }, - { - "name": "find", - "object": "bucket0_files_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "length": 0, - "chunkSize": 4, - "uploadDate": { - "$$type": "date" - }, - "md5": { - "$$exists": false - }, - "filename": "filename" - } - ] - }, - { - "name": "find", - "object": "bucket0_chunks_collection", - "arguments": { - "filter": {} - }, - "expectResult": [] - } - ] - }, - { - "description": "upload when length is 1 sans MD5", - "operations": [ - { - "name": "upload", - "object": "bucket0", - "arguments": { - "filename": "filename", - "source": { - "$$hexBytes": "11" - }, - "chunkSizeBytes": 4, - "disableMD5": true - }, - "expectResult": { - "$$type": "objectId" - }, - "saveResultAsEntity": "uploadedObjectId" - }, - { - "name": "find", - "object": "bucket0_files_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "length": 1, - "chunkSize": 4, - "uploadDate": { - "$$type": "date" - }, - "md5": { - "$$exists": false - }, - "filename": "filename" - } - ] - }, - { - "name": "find", - "object": "bucket0_chunks_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$type": "objectId" - }, - "files_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "n": 0, - "data": { - "$binary": { - "base64": "EQ==", - "subType": "00" - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/gridfs/upload.json b/tests/UnifiedSpecTests/gridfs/upload.json deleted file mode 100644 index 97e18d2bc..000000000 --- a/tests/UnifiedSpecTests/gridfs/upload.json +++ /dev/null @@ -1,616 +0,0 @@ -{ - "description": "gridfs-upload", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "gridfs-tests" - } - }, - { - "bucket": { - "id": "bucket0", - "database": "database0" - } - }, - { - "collection": { - "id": "bucket0_files_collection", - "database": "database0", - "collectionName": "fs.files" - } - }, - { - "collection": { - "id": "bucket0_chunks_collection", - "database": "database0", - "collectionName": "fs.chunks" - } - } - ], - "initialData": [ - { - "collectionName": "fs.files", - "databaseName": "gridfs-tests", - "documents": [] - }, - { - "collectionName": "fs.chunks", - "databaseName": "gridfs-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "upload when length is 0", - "operations": [ - { - "name": "upload", - "object": "bucket0", - "arguments": { - "filename": "filename", - "source": { - "$$hexBytes": "" - }, - "chunkSizeBytes": 4 - }, - "expectResult": { - "$$type": "objectId" - }, - "saveResultAsEntity": "uploadedObjectId" - }, - { - "name": "find", - "object": "bucket0_files_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "length": 0, - "chunkSize": 4, - "uploadDate": { - "$$type": "date" - }, - "md5": { - "$$unsetOrMatches": "d41d8cd98f00b204e9800998ecf8427e" - }, - "filename": "filename" - } - ] - }, - { - "name": "find", - "object": "bucket0_chunks_collection", - "arguments": { - "filter": {} - }, - "expectResult": [] - } - ] - }, - { - "description": "upload when length is 1", - "operations": [ - { - "name": "upload", - "object": "bucket0", - "arguments": { - "filename": "filename", - "source": { - "$$hexBytes": "11" - }, - "chunkSizeBytes": 4 - }, - "expectResult": { - "$$type": "objectId" - }, - "saveResultAsEntity": "uploadedObjectId" - }, - { - "name": "find", - "object": "bucket0_files_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "length": 1, - "chunkSize": 4, - "uploadDate": { - "$$type": "date" - }, - "md5": { - "$$unsetOrMatches": "47ed733b8d10be225eceba344d533586" - }, - "filename": "filename" - } - ] - }, - { - "name": "find", - "object": "bucket0_chunks_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$type": "objectId" - }, - "files_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "n": 0, - "data": { - "$binary": { - "base64": "EQ==", - "subType": "00" - } - } - } - ] - } - ] - }, - { - "description": "upload when length is 3", - "operations": [ - { - "name": "upload", - "object": "bucket0", - "arguments": { - "filename": "filename", - "source": { - "$$hexBytes": "112233" - }, - "chunkSizeBytes": 4 - }, - "expectResult": { - "$$type": "objectId" - }, - "saveResultAsEntity": "uploadedObjectId" - }, - { - "name": "find", - "object": "bucket0_files_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "length": 3, - "chunkSize": 4, - "uploadDate": { - "$$type": "date" - }, - "md5": { - "$$unsetOrMatches": "bafae3a174ab91fc70db7a6aa50f4f52" - }, - "filename": "filename" - } - ] - }, - { - "name": "find", - "object": "bucket0_chunks_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$type": "objectId" - }, - "files_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESIz", - "subType": "00" - } - } - } - ] - } - ] - }, - { - "description": "upload when length is 4", - "operations": [ - { - "name": "upload", - "object": "bucket0", - "arguments": { - "filename": "filename", - "source": { - "$$hexBytes": "11223344" - }, - "chunkSizeBytes": 4 - }, - "expectResult": { - "$$type": "objectId" - }, - "saveResultAsEntity": "uploadedObjectId" - }, - { - "name": "find", - "object": "bucket0_files_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "length": 4, - "chunkSize": 4, - "uploadDate": { - "$$type": "date" - }, - "md5": { - "$$unsetOrMatches": "7e7c77cff5705d1f7574a25ef6662117" - }, - "filename": "filename" - } - ] - }, - { - "name": "find", - "object": "bucket0_chunks_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$type": "objectId" - }, - "files_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESIzRA==", - "subType": "00" - } - } - } - ] - } - ] - }, - { - "description": "upload when length is 5", - "operations": [ - { - "name": "upload", - "object": "bucket0", - "arguments": { - "filename": "filename", - "source": { - "$$hexBytes": "1122334455" - }, - "chunkSizeBytes": 4 - }, - "expectResult": { - "$$type": "objectId" - }, - "saveResultAsEntity": "uploadedObjectId" - }, - { - "name": "find", - "object": "bucket0_files_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "length": 5, - "chunkSize": 4, - "uploadDate": { - "$$type": "date" - }, - "md5": { - "$$unsetOrMatches": "283d4fea5dded59cf837d3047328f5af" - }, - "filename": "filename" - } - ] - }, - { - "name": "find", - "object": "bucket0_chunks_collection", - "arguments": { - "filter": {}, - "sort": { - "n": 1 - } - }, - "expectResult": [ - { - "_id": { - "$$type": "objectId" - }, - "files_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESIzRA==", - "subType": "00" - } - } - }, - { - "_id": { - "$$type": "objectId" - }, - "files_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "n": 1, - "data": { - "$binary": { - "base64": "VQ==", - "subType": "00" - } - } - } - ] - } - ] - }, - { - "description": "upload when length is 8", - "operations": [ - { - "name": "upload", - "object": "bucket0", - "arguments": { - "filename": "filename", - "source": { - "$$hexBytes": "1122334455667788" - }, - "chunkSizeBytes": 4 - }, - "expectResult": { - "$$type": "objectId" - }, - "saveResultAsEntity": "uploadedObjectId" - }, - { - "name": "find", - "object": "bucket0_files_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "length": 8, - "chunkSize": 4, - "uploadDate": { - "$$type": "date" - }, - "md5": { - "$$unsetOrMatches": "dd254cdc958e53abaa67da9f797125f5" - }, - "filename": "filename" - } - ] - }, - { - "name": "find", - "object": "bucket0_chunks_collection", - "arguments": { - "filter": {}, - "sort": { - "n": 1 - } - }, - "expectResult": [ - { - "_id": { - "$$type": "objectId" - }, - "files_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESIzRA==", - "subType": "00" - } - } - }, - { - "_id": { - "$$type": "objectId" - }, - "files_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "n": 1, - "data": { - "$binary": { - "base64": "VWZ3iA==", - "subType": "00" - } - } - } - ] - } - ] - }, - { - "description": "upload when contentType is provided", - "operations": [ - { - "name": "upload", - "object": "bucket0", - "arguments": { - "filename": "filename", - "source": { - "$$hexBytes": "11" - }, - "chunkSizeBytes": 4, - "contentType": "image/jpeg" - }, - "expectResult": { - "$$type": "objectId" - }, - "saveResultAsEntity": "uploadedObjectId" - }, - { - "name": "find", - "object": "bucket0_files_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "length": 1, - "chunkSize": 4, - "uploadDate": { - "$$type": "date" - }, - "md5": { - "$$unsetOrMatches": "47ed733b8d10be225eceba344d533586" - }, - "filename": "filename", - "contentType": "image/jpeg" - } - ] - }, - { - "name": "find", - "object": "bucket0_chunks_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$type": "objectId" - }, - "files_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "n": 0, - "data": { - "$binary": { - "base64": "EQ==", - "subType": "00" - } - } - } - ] - } - ] - }, - { - "description": "upload when metadata is provided", - "operations": [ - { - "name": "upload", - "object": "bucket0", - "arguments": { - "filename": "filename", - "source": { - "$$hexBytes": "11" - }, - "chunkSizeBytes": 4, - "metadata": { - "x": 1 - } - }, - "expectResult": { - "$$type": "objectId" - }, - "saveResultAsEntity": "uploadedObjectId" - }, - { - "name": "find", - "object": "bucket0_files_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "length": 1, - "chunkSize": 4, - "uploadDate": { - "$$type": "date" - }, - "md5": { - "$$unsetOrMatches": "47ed733b8d10be225eceba344d533586" - }, - "filename": "filename", - "metadata": { - "x": 1 - } - } - ] - }, - { - "name": "find", - "object": "bucket0_chunks_collection", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": { - "$$type": "objectId" - }, - "files_id": { - "$$matchesEntity": "uploadedObjectId" - }, - "n": 0, - "data": { - "$binary": { - "base64": "EQ==", - "subType": "00" - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/index-management/createSearchIndex.json b/tests/UnifiedSpecTests/index-management/createSearchIndex.json deleted file mode 100644 index f4f2a6c66..000000000 --- a/tests/UnifiedSpecTests/index-management/createSearchIndex.json +++ /dev/null @@ -1,210 +0,0 @@ -{ - "description": "createSearchIndex", - "schemaVersion": "1.4", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - } - ], - "runOnRequirements": [ - { - "minServerVersion": "7.0.5", - "maxServerVersion": "7.0.99", - "topologies": [ - "replicaset", - "load-balanced", - "sharded" - ], - "serverless": "forbid" - }, - { - "minServerVersion": "7.2.0", - "topologies": [ - "replicaset", - "load-balanced", - "sharded" - ], - "serverless": "forbid" - } - ], - "tests": [ - { - "description": "no name provided for an index definition", - "operations": [ - { - "name": "createSearchIndex", - "object": "collection0", - "arguments": { - "model": { - "definition": { - "mappings": { - "dynamic": true - } - }, - "type": "search" - } - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "createSearchIndexes": "collection0", - "indexes": [ - { - "definition": { - "mappings": { - "dynamic": true - } - }, - "type": "search" - } - ], - "$db": "database0" - } - } - } - ] - } - ] - }, - { - "description": "name provided for an index definition", - "operations": [ - { - "name": "createSearchIndex", - "object": "collection0", - "arguments": { - "model": { - "definition": { - "mappings": { - "dynamic": true - } - }, - "name": "test index", - "type": "search" - } - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "createSearchIndexes": "collection0", - "indexes": [ - { - "definition": { - "mappings": { - "dynamic": true - } - }, - "name": "test index", - "type": "search" - } - ], - "$db": "database0" - } - } - } - ] - } - ] - }, - { - "description": "create a vector search index", - "operations": [ - { - "name": "createSearchIndex", - "object": "collection0", - "arguments": { - "model": { - "definition": { - "fields": [ - { - "type": "vector", - "path": "plot_embedding", - "numDimensions": 1536, - "similarity": "euclidean" - } - ] - }, - "name": "test index", - "type": "vectorSearch" - } - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "createSearchIndexes": "collection0", - "indexes": [ - { - "definition": { - "fields": [ - { - "type": "vector", - "path": "plot_embedding", - "numDimensions": 1536, - "similarity": "euclidean" - } - ] - }, - "name": "test index", - "type": "vectorSearch" - } - ], - "$db": "database0" - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/index-management/createSearchIndexes.json b/tests/UnifiedSpecTests/index-management/createSearchIndexes.json deleted file mode 100644 index 01300b1b7..000000000 --- a/tests/UnifiedSpecTests/index-management/createSearchIndexes.json +++ /dev/null @@ -1,248 +0,0 @@ -{ - "description": "createSearchIndexes", - "schemaVersion": "1.4", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - } - ], - "runOnRequirements": [ - { - "minServerVersion": "7.0.5", - "maxServerVersion": "7.0.99", - "topologies": [ - "replicaset", - "load-balanced", - "sharded" - ], - "serverless": "forbid" - }, - { - "minServerVersion": "7.2.0", - "topologies": [ - "replicaset", - "load-balanced", - "sharded" - ], - "serverless": "forbid" - } - ], - "tests": [ - { - "description": "empty index definition array", - "operations": [ - { - "name": "createSearchIndexes", - "object": "collection0", - "arguments": { - "models": [] - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "createSearchIndexes": "collection0", - "indexes": [], - "$db": "database0" - } - } - } - ] - } - ] - }, - { - "description": "no name provided for an index definition", - "operations": [ - { - "name": "createSearchIndexes", - "object": "collection0", - "arguments": { - "models": [ - { - "definition": { - "mappings": { - "dynamic": true - } - }, - "type": "search" - } - ] - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "createSearchIndexes": "collection0", - "indexes": [ - { - "definition": { - "mappings": { - "dynamic": true - } - }, - "type": "search" - } - ], - "$db": "database0" - } - } - } - ] - } - ] - }, - { - "description": "name provided for an index definition", - "operations": [ - { - "name": "createSearchIndexes", - "object": "collection0", - "arguments": { - "models": [ - { - "definition": { - "mappings": { - "dynamic": true - } - }, - "name": "test index", - "type": "search" - } - ] - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "createSearchIndexes": "collection0", - "indexes": [ - { - "definition": { - "mappings": { - "dynamic": true - } - }, - "name": "test index", - "type": "search" - } - ], - "$db": "database0" - } - } - } - ] - } - ] - }, - { - "description": "create a vector search index", - "operations": [ - { - "name": "createSearchIndexes", - "object": "collection0", - "arguments": { - "models": [ - { - "definition": { - "fields": [ - { - "type": "vector", - "path": "plot_embedding", - "numDimensions": 1536, - "similarity": "euclidean" - } - ] - }, - "name": "test index", - "type": "vectorSearch" - } - ] - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "createSearchIndexes": "collection0", - "indexes": [ - { - "definition": { - "fields": [ - { - "type": "vector", - "path": "plot_embedding", - "numDimensions": 1536, - "similarity": "euclidean" - } - ] - }, - "name": "test index", - "type": "vectorSearch" - } - ], - "$db": "database0" - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/index-management/dropSearchIndex.json b/tests/UnifiedSpecTests/index-management/dropSearchIndex.json deleted file mode 100644 index d8957a222..000000000 --- a/tests/UnifiedSpecTests/index-management/dropSearchIndex.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "description": "dropSearchIndex", - "schemaVersion": "1.4", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - } - ], - "runOnRequirements": [ - { - "minServerVersion": "7.0.0", - "topologies": [ - "replicaset", - "load-balanced", - "sharded" - ], - "serverless": "forbid" - } - ], - "tests": [ - { - "description": "sends the correct command", - "operations": [ - { - "name": "dropSearchIndex", - "object": "collection0", - "arguments": { - "name": "test index" - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "dropSearchIndex": "collection0", - "name": "test index", - "$db": "database0" - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/index-management/listSearchIndexes.json b/tests/UnifiedSpecTests/index-management/listSearchIndexes.json deleted file mode 100644 index a8cef42f7..000000000 --- a/tests/UnifiedSpecTests/index-management/listSearchIndexes.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "description": "listSearchIndexes", - "schemaVersion": "1.4", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - } - ], - "runOnRequirements": [ - { - "minServerVersion": "7.0.0", - "topologies": [ - "replicaset", - "load-balanced", - "sharded" - ], - "serverless": "forbid" - } - ], - "tests": [ - { - "description": "when no name is provided, it does not populate the filter", - "operations": [ - { - "name": "listSearchIndexes", - "object": "collection0", - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "pipeline": [ - { - "$listSearchIndexes": {} - } - ] - } - } - } - ] - } - ] - }, - { - "description": "when a name is provided, it is present in the filter", - "operations": [ - { - "name": "listSearchIndexes", - "object": "collection0", - "arguments": { - "name": "test index" - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "pipeline": [ - { - "$listSearchIndexes": { - "name": "test index" - } - } - ], - "$db": "database0" - } - } - } - ] - } - ] - }, - { - "description": "aggregation cursor options are supported", - "operations": [ - { - "name": "listSearchIndexes", - "object": "collection0", - "arguments": { - "name": "test index", - "aggregationOptions": { - "batchSize": 10 - } - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": { - "batchSize": 10 - }, - "pipeline": [ - { - "$listSearchIndexes": { - "name": "test index" - } - } - ], - "$db": "database0" - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/index-management/searchIndexIgnoresReadWriteConcern.json b/tests/UnifiedSpecTests/index-management/searchIndexIgnoresReadWriteConcern.json deleted file mode 100644 index 5b57cd22c..000000000 --- a/tests/UnifiedSpecTests/index-management/searchIndexIgnoresReadWriteConcern.json +++ /dev/null @@ -1,262 +0,0 @@ -{ - "description": "search index operations ignore read and write concern", - "schemaVersion": "1.4", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "uriOptions": { - "readConcernLevel": "local", - "w": 1 - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - } - ], - "runOnRequirements": [ - { - "minServerVersion": "7.0.5", - "maxServerVersion": "7.0.99", - "topologies": [ - "replicaset", - "load-balanced", - "sharded" - ], - "serverless": "forbid" - }, - { - "minServerVersion": "7.2.0", - "topologies": [ - "replicaset", - "load-balanced", - "sharded" - ], - "serverless": "forbid" - } - ], - "tests": [ - { - "description": "createSearchIndex ignores read and write concern", - "operations": [ - { - "name": "createSearchIndex", - "object": "collection0", - "arguments": { - "model": { - "definition": { - "mappings": { - "dynamic": true - } - } - } - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "createSearchIndexes": "collection0", - "indexes": [ - { - "definition": { - "mappings": { - "dynamic": true - } - } - } - ], - "$db": "database0", - "writeConcern": { - "$$exists": false - }, - "readConcern": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "createSearchIndexes ignores read and write concern", - "operations": [ - { - "name": "createSearchIndexes", - "object": "collection0", - "arguments": { - "models": [] - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "createSearchIndexes": "collection0", - "indexes": [], - "$db": "database0", - "writeConcern": { - "$$exists": false - }, - "readConcern": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "dropSearchIndex ignores read and write concern", - "operations": [ - { - "name": "dropSearchIndex", - "object": "collection0", - "arguments": { - "name": "test index" - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "dropSearchIndex": "collection0", - "name": "test index", - "$db": "database0", - "writeConcern": { - "$$exists": false - }, - "readConcern": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "listSearchIndexes ignores read and write concern", - "operations": [ - { - "name": "listSearchIndexes", - "object": "collection0", - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "pipeline": [ - { - "$listSearchIndexes": {} - } - ], - "writeConcern": { - "$$exists": false - }, - "readConcern": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "updateSearchIndex ignores the read and write concern", - "operations": [ - { - "name": "updateSearchIndex", - "object": "collection0", - "arguments": { - "name": "test index", - "definition": {} - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "updateSearchIndex": "collection0", - "name": "test index", - "definition": {}, - "$db": "database0", - "writeConcern": { - "$$exists": false - }, - "readConcern": { - "$$exists": false - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/index-management/updateSearchIndex.json b/tests/UnifiedSpecTests/index-management/updateSearchIndex.json deleted file mode 100644 index 76a596214..000000000 --- a/tests/UnifiedSpecTests/index-management/updateSearchIndex.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "description": "updateSearchIndex", - "schemaVersion": "1.4", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - } - ], - "runOnRequirements": [ - { - "minServerVersion": "7.0.0", - "topologies": [ - "replicaset", - "load-balanced", - "sharded" - ], - "serverless": "forbid" - } - ], - "tests": [ - { - "description": "sends the correct command", - "operations": [ - { - "name": "updateSearchIndex", - "object": "collection0", - "arguments": { - "name": "test index", - "definition": {} - }, - "expectError": { - "isError": true, - "errorContains": "Atlas" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "updateSearchIndex": "collection0", - "name": "test index", - "definition": {}, - "$db": "database0" - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/load-balancers/cursors.json b/tests/UnifiedSpecTests/load-balancers/cursors.json deleted file mode 100644 index b11bf2c6f..000000000 --- a/tests/UnifiedSpecTests/load-balancers/cursors.json +++ /dev/null @@ -1,1271 +0,0 @@ -{ - "description": "cursors are correctly pinned to connections for load-balanced clusters", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "topologies": [ - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent", - "connectionReadyEvent", - "connectionClosedEvent", - "connectionCheckedOutEvent", - "connectionCheckedInEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0Name" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - }, - { - "collection": { - "id": "collection1", - "database": "database0", - "collectionName": "coll1" - } - }, - { - "collection": { - "id": "collection2", - "database": "database0", - "collectionName": "coll2" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "database0Name", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - }, - { - "collectionName": "coll1", - "databaseName": "database0Name", - "documents": [] - }, - { - "collectionName": "coll2", - "databaseName": "database0Name", - "documents": [] - } - ], - "tests": [ - { - "description": "no connection is pinned if all documents are returned in the initial batch", - "operations": [ - { - "name": "createFindCursor", - "object": "collection0", - "arguments": { - "filter": {} - }, - "saveResultAsEntity": "cursor0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": {} - }, - "commandName": "find" - } - }, - { - "commandSucceededEvent": { - "reply": { - "cursor": { - "id": 0, - "firstBatch": { - "$$type": "array" - }, - "ns": { - "$$type": "string" - } - } - }, - "commandName": "find" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "pinned connections are returned when the cursor is drained", - "operations": [ - { - "name": "createFindCursor", - "object": "collection0", - "arguments": { - "filter": {}, - "batchSize": 2 - }, - "saveResultAsEntity": "cursor0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0", - "expectResult": { - "_id": 1 - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0", - "expectResult": { - "_id": 2 - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0", - "expectResult": { - "_id": 3 - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - }, - { - "name": "close", - "object": "cursor0" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": {}, - "batchSize": 2 - }, - "commandName": "find" - } - }, - { - "commandSucceededEvent": { - "reply": { - "cursor": { - "id": { - "$$type": [ - "int", - "long" - ] - }, - "firstBatch": { - "$$type": "array" - }, - "ns": { - "$$type": "string" - } - } - }, - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0" - }, - "commandName": "getMore" - } - }, - { - "commandSucceededEvent": { - "reply": { - "cursor": { - "id": 0, - "ns": { - "$$type": "string" - }, - "nextBatch": { - "$$type": "array" - } - } - }, - "commandName": "getMore" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "pinned connections are returned to the pool when the cursor is closed", - "operations": [ - { - "name": "createFindCursor", - "object": "collection0", - "arguments": { - "filter": {}, - "batchSize": 2 - }, - "saveResultAsEntity": "cursor0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "close", - "object": "cursor0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": {}, - "batchSize": 2 - }, - "commandName": "find" - } - }, - { - "commandSucceededEvent": { - "reply": { - "cursor": { - "id": { - "$$type": [ - "int", - "long" - ] - }, - "firstBatch": { - "$$type": "array" - }, - "ns": { - "$$type": "string" - } - } - }, - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "commandName": "killCursors" - } - }, - { - "commandSucceededEvent": { - "commandName": "killCursors" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "pinned connections are not returned after an network error during getMore", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "closeConnection": true - } - } - } - }, - { - "name": "createFindCursor", - "object": "collection0", - "arguments": { - "filter": {}, - "batchSize": 2 - }, - "saveResultAsEntity": "cursor0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0", - "expectResult": { - "_id": 1 - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0", - "expectResult": { - "_id": 2 - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0", - "expectError": { - "isClientError": true - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "close", - "object": "cursor0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": {}, - "batchSize": 2 - }, - "commandName": "find" - } - }, - { - "commandSucceededEvent": { - "reply": { - "cursor": { - "id": { - "$$type": [ - "int", - "long" - ] - }, - "firstBatch": { - "$$type": "array" - }, - "ns": { - "$$type": "string" - } - } - }, - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0" - }, - "commandName": "getMore" - } - }, - { - "commandFailedEvent": { - "commandName": "getMore" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionClosedEvent": { - "reason": "error" - } - } - ] - } - ] - }, - { - "description": "pinned connections are returned after a network error during a killCursors request", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "killCursors" - ], - "closeConnection": true - } - } - } - }, - { - "name": "createFindCursor", - "object": "collection0", - "arguments": { - "filter": {}, - "batchSize": 2 - }, - "saveResultAsEntity": "cursor0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "close", - "object": "cursor0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": {}, - "batchSize": 2 - }, - "commandName": "find" - } - }, - { - "commandSucceededEvent": { - "reply": { - "cursor": { - "id": { - "$$type": [ - "int", - "long" - ] - }, - "firstBatch": { - "$$type": "array" - }, - "ns": { - "$$type": "string" - } - } - }, - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "commandName": "killCursors" - } - }, - { - "commandFailedEvent": { - "commandName": "killCursors" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionClosedEvent": { - "reason": "error" - } - } - ] - } - ] - }, - { - "description": "pinned connections are not returned to the pool after a non-network error on getMore", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 7 - } - } - } - }, - { - "name": "createFindCursor", - "object": "collection0", - "arguments": { - "filter": {}, - "batchSize": 2 - }, - "saveResultAsEntity": "cursor0" - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0", - "expectResult": { - "_id": 1 - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0", - "expectResult": { - "_id": 2 - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0", - "expectError": { - "errorCode": 7 - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "close", - "object": "cursor0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": {}, - "batchSize": 2 - }, - "commandName": "find" - } - }, - { - "commandSucceededEvent": { - "reply": { - "cursor": { - "id": { - "$$type": [ - "int", - "long" - ] - }, - "firstBatch": { - "$$type": "array" - }, - "ns": { - "$$type": "string" - } - } - }, - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0" - }, - "commandName": "getMore" - } - }, - { - "commandFailedEvent": { - "commandName": "getMore" - } - }, - { - "commandStartedEvent": { - "commandName": "killCursors" - } - }, - { - "commandSucceededEvent": { - "commandName": "killCursors" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "aggregate pins the cursor to a connection", - "operations": [ - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [], - "batchSize": 2 - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "cursor": { - "batchSize": 2 - } - }, - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0" - }, - "commandName": "getMore" - } - }, - { - "commandSucceededEvent": { - "reply": { - "cursor": { - "id": 0, - "ns": { - "$$type": "string" - }, - "nextBatch": { - "$$type": "array" - } - } - }, - "commandName": "getMore" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "listCollections pins the cursor to a connection", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "listCollections", - "object": "database0", - "arguments": { - "filter": {}, - "batchSize": 2 - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1, - "cursor": { - "batchSize": 2 - } - }, - "commandName": "listCollections", - "databaseName": "database0Name" - } - }, - { - "commandSucceededEvent": { - "commandName": "listCollections" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": { - "$$type": "string" - } - }, - "commandName": "getMore" - } - }, - { - "commandSucceededEvent": { - "reply": { - "cursor": { - "id": 0, - "ns": { - "$$type": "string" - }, - "nextBatch": { - "$$type": "array" - } - } - }, - "commandName": "getMore" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "listIndexes pins the cursor to a connection", - "operations": [ - { - "name": "createIndex", - "object": "collection0", - "arguments": { - "keys": { - "x": 1 - }, - "name": "x_1" - } - }, - { - "name": "createIndex", - "object": "collection0", - "arguments": { - "keys": { - "y": 1 - }, - "name": "y_1" - } - }, - { - "name": "listIndexes", - "object": "collection0", - "arguments": { - "batchSize": 2 - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "createIndexes": "coll0", - "indexes": [ - { - "name": "x_1", - "key": { - "x": 1 - } - } - ] - }, - "commandName": "createIndexes" - } - }, - { - "commandSucceededEvent": { - "commandName": "createIndexes" - } - }, - { - "commandStartedEvent": { - "command": { - "createIndexes": "coll0", - "indexes": [ - { - "name": "y_1", - "key": { - "y": 1 - } - } - ] - }, - "commandName": "createIndexes" - } - }, - { - "commandSucceededEvent": { - "commandName": "createIndexes" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll0", - "cursor": { - "batchSize": 2 - } - }, - "commandName": "listIndexes", - "databaseName": "database0Name" - } - }, - { - "commandSucceededEvent": { - "commandName": "listIndexes" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0" - }, - "commandName": "getMore" - } - }, - { - "commandSucceededEvent": { - "reply": { - "cursor": { - "id": 0, - "ns": { - "$$type": "string" - }, - "nextBatch": { - "$$type": "array" - } - } - }, - "commandName": "getMore" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "change streams pin to a connection", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "close", - "object": "changeStream0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" - } - }, - { - "commandStartedEvent": { - "commandName": "killCursors" - } - }, - { - "commandSucceededEvent": { - "commandName": "killCursors" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/load-balancers/event-monitoring.json b/tests/UnifiedSpecTests/load-balancers/event-monitoring.json deleted file mode 100644 index 938c70bf3..000000000 --- a/tests/UnifiedSpecTests/load-balancers/event-monitoring.json +++ /dev/null @@ -1,184 +0,0 @@ -{ - "description": "monitoring events include correct fields", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "topologies": [ - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent", - "poolClearedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "databaseName": "database0", - "collectionName": "coll0", - "documents": [] - } - ], - "tests": [ - { - "description": "command started and succeeded events include serviceId", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert", - "hasServiceId": true - } - }, - { - "commandSucceededEvent": { - "commandName": "insert", - "hasServiceId": true - } - } - ] - } - ] - }, - { - "description": "command failed events include serviceId", - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "$or": true - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "find", - "hasServiceId": true - } - }, - { - "commandFailedEvent": { - "commandName": "find", - "hasServiceId": true - } - } - ] - } - ] - }, - { - "description": "poolClearedEvent events include serviceId", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": {} - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "find", - "hasServiceId": true - } - }, - { - "commandFailedEvent": { - "commandName": "find", - "hasServiceId": true - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "poolClearedEvent": { - "hasServiceId": true - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/load-balancers/lb-connection-establishment.json b/tests/UnifiedSpecTests/load-balancers/lb-connection-establishment.json deleted file mode 100644 index 0eaadf30c..000000000 --- a/tests/UnifiedSpecTests/load-balancers/lb-connection-establishment.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "description": "connection establishment for load-balanced clusters", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "topologies": [ - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "uriOptions": { - "loadBalanced": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - } - ], - "tests": [ - { - "description": "operations against load balancers fail if URI contains loadBalanced=false", - "skipReason": "servers have not implemented LB support yet so they will not fail the connection handshake in this case", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/load-balancers/non-lb-connection-establishment.json b/tests/UnifiedSpecTests/load-balancers/non-lb-connection-establishment.json deleted file mode 100644 index 6aaa7bdf9..000000000 --- a/tests/UnifiedSpecTests/load-balancers/non-lb-connection-establishment.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "description": "connection establishment if loadBalanced is specified for non-load balanced clusters", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "topologies": [ - "single", - "sharded" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "lbTrueClient", - "useMultipleMongoses": false, - "uriOptions": { - "loadBalanced": true - } - } - }, - { - "database": { - "id": "lbTrueDatabase", - "client": "lbTrueClient", - "databaseName": "lbTrueDb" - } - }, - { - "client": { - "id": "lbFalseClient", - "uriOptions": { - "loadBalanced": false - } - } - }, - { - "database": { - "id": "lbFalseDatabase", - "client": "lbFalseClient", - "databaseName": "lbFalseDb" - } - } - ], - "_yamlAnchors": { - "runCommandArguments": [ - { - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - } - } - ] - }, - "tests": [ - { - "description": "operations against non-load balanced clusters fail if URI contains loadBalanced=true", - "operations": [ - { - "name": "runCommand", - "object": "lbTrueDatabase", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "errorContains": "Driver attempted to initialize in load balancing mode, but the server does not support this mode" - } - } - ] - }, - { - "description": "operations against non-load balanced clusters succeed if URI contains loadBalanced=false", - "operations": [ - { - "name": "runCommand", - "object": "lbFalseDatabase", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/load-balancers/sdam-error-handling.json b/tests/UnifiedSpecTests/load-balancers/sdam-error-handling.json deleted file mode 100644 index 47323fae4..000000000 --- a/tests/UnifiedSpecTests/load-balancers/sdam-error-handling.json +++ /dev/null @@ -1,514 +0,0 @@ -{ - "description": "state change errors are correctly handled", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "topologies": [ - "load-balanced" - ] - } - ], - "_yamlAnchors": { - "observedEvents": [ - "connectionCreatedEvent", - "connectionReadyEvent", - "connectionCheckedOutEvent", - "connectionCheckOutFailedEvent", - "connectionCheckedInEvent", - "connectionClosedEvent", - "poolClearedEvent" - ] - }, - "createEntities": [ - { - "client": { - "id": "failPointClient", - "useMultipleMongoses": false - } - }, - { - "client": { - "id": "singleClient", - "useMultipleMongoses": false, - "uriOptions": { - "appname": "lbSDAMErrorTestClient", - "retryWrites": false - }, - "observeEvents": [ - "connectionCreatedEvent", - "connectionReadyEvent", - "connectionCheckedOutEvent", - "connectionCheckOutFailedEvent", - "connectionCheckedInEvent", - "connectionClosedEvent", - "poolClearedEvent" - ] - } - }, - { - "database": { - "id": "singleDB", - "client": "singleClient", - "databaseName": "singleDB" - } - }, - { - "collection": { - "id": "singleColl", - "database": "singleDB", - "collectionName": "singleColl" - } - }, - { - "client": { - "id": "multiClient", - "useMultipleMongoses": true, - "uriOptions": { - "retryWrites": false - }, - "observeEvents": [ - "connectionCreatedEvent", - "connectionReadyEvent", - "connectionCheckedOutEvent", - "connectionCheckOutFailedEvent", - "connectionCheckedInEvent", - "connectionClosedEvent", - "poolClearedEvent" - ] - } - }, - { - "database": { - "id": "multiDB", - "client": "multiClient", - "databaseName": "multiDB" - } - }, - { - "collection": { - "id": "multiColl", - "database": "multiDB", - "collectionName": "multiColl" - } - } - ], - "initialData": [ - { - "collectionName": "singleColl", - "databaseName": "singleDB", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - }, - { - "collectionName": "multiColl", - "databaseName": "multiDB", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ], - "tests": [ - { - "description": "only connections for a specific serviceId are closed when pools are cleared", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "createFindCursor", - "object": "multiColl", - "arguments": { - "filter": {}, - "batchSize": 2 - }, - "saveResultAsEntity": "cursor0" - }, - { - "name": "createFindCursor", - "object": "multiColl", - "arguments": { - "filter": {}, - "batchSize": 2 - }, - "saveResultAsEntity": "cursor1" - }, - { - "name": "close", - "object": "cursor0" - }, - { - "name": "close", - "object": "cursor1" - }, - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "multiClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11600 - } - } - } - }, - { - "name": "insertOne", - "object": "multiColl", - "arguments": { - "document": { - "x": 1 - } - }, - "expectError": { - "errorCode": 11600 - } - }, - { - "name": "insertOne", - "object": "multiColl", - "arguments": { - "document": { - "x": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "multiClient", - "eventType": "cmap", - "events": [ - { - "connectionCreatedEvent": {} - }, - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCreatedEvent": {} - }, - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "poolClearedEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionClosedEvent": { - "reason": "stale" - } - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "errors during the initial connection hello are ignored", - "runOnRequirements": [ - { - "minServerVersion": "4.4.7" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "isMaster", - "hello" - ], - "closeConnection": true, - "appName": "lbSDAMErrorTestClient" - } - } - } - }, - { - "name": "insertOne", - "object": "singleColl", - "arguments": { - "document": { - "x": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "singleClient", - "eventType": "cmap", - "events": [ - { - "connectionCreatedEvent": {} - }, - { - "connectionClosedEvent": { - "reason": "error" - } - }, - { - "connectionCheckOutFailedEvent": { - "reason": "connectionError" - } - } - ] - } - ] - }, - { - "description": "errors during authentication are processed", - "runOnRequirements": [ - { - "auth": true - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "saslContinue" - ], - "closeConnection": true, - "appName": "lbSDAMErrorTestClient" - } - } - } - }, - { - "name": "insertOne", - "object": "singleColl", - "arguments": { - "document": { - "x": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "singleClient", - "eventType": "cmap", - "events": [ - { - "connectionCreatedEvent": {} - }, - { - "poolClearedEvent": {} - }, - { - "connectionClosedEvent": { - "reason": "error" - } - }, - { - "connectionCheckOutFailedEvent": { - "reason": "connectionError" - } - } - ] - } - ] - }, - { - "description": "stale errors are ignored", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "failPointClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "getMore" - ], - "closeConnection": true - } - } - } - }, - { - "name": "createFindCursor", - "object": "singleColl", - "arguments": { - "filter": {}, - "batchSize": 2 - }, - "saveResultAsEntity": "cursor0" - }, - { - "name": "createFindCursor", - "object": "singleColl", - "arguments": { - "filter": {}, - "batchSize": 2 - }, - "saveResultAsEntity": "cursor1" - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0" - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0" - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0", - "expectError": { - "isClientError": true - } - }, - { - "name": "close", - "object": "cursor0" - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor1" - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor1" - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor1", - "expectError": { - "isClientError": true - } - }, - { - "name": "close", - "object": "cursor1" - } - ], - "expectEvents": [ - { - "client": "singleClient", - "eventType": "cmap", - "events": [ - { - "connectionCreatedEvent": {} - }, - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCreatedEvent": {} - }, - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "poolClearedEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionClosedEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionClosedEvent": {} - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/load-balancers/server-selection.json b/tests/UnifiedSpecTests/load-balancers/server-selection.json deleted file mode 100644 index 00c7e4c95..000000000 --- a/tests/UnifiedSpecTests/load-balancers/server-selection.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "description": "server selection for load-balanced clusters", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "topologies": [ - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0Name" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0", - "collectionOptions": { - "readPreference": { - "mode": "secondaryPreferred" - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "database0Name", - "documents": [] - } - ], - "tests": [ - { - "description": "$readPreference is sent for load-balanced clusters", - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": {}, - "$readPreference": { - "mode": "secondaryPreferred" - } - }, - "commandName": "find", - "databaseName": "database0Name" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/load-balancers/transactions.json b/tests/UnifiedSpecTests/load-balancers/transactions.json deleted file mode 100644 index 0dd04ee85..000000000 --- a/tests/UnifiedSpecTests/load-balancers/transactions.json +++ /dev/null @@ -1,1621 +0,0 @@ -{ - "description": "transactions are correctly pinned to connections for load-balanced clusters", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "topologies": [ - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent", - "connectionReadyEvent", - "connectionClosedEvent", - "connectionCheckedOutEvent", - "connectionCheckedInEvent" - ] - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0Name" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "database0Name", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ], - "_yamlAnchors": { - "documents": [ - { - "_id": 4 - } - ] - }, - "tests": [ - { - "description": "sessions are reused in LB mode", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "assertSameLsidOnLastTwoCommands", - "object": "testRunner", - "arguments": { - "client": "client0" - } - } - ] - }, - { - "description": "all operations go to the same mongos", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "commitTransaction" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - } - ] - } - ] - }, - { - "description": "transaction can be committed multiple times", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "commitTransaction" - } - }, - { - "commandStartedEvent": { - "commandName": "commitTransaction" - } - }, - { - "commandStartedEvent": { - "commandName": "commitTransaction" - } - }, - { - "commandStartedEvent": { - "commandName": "commitTransaction" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - } - ] - } - ] - }, - { - "description": "pinned connection is not released after a non-transient CRUD error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 51 - } - } - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - }, - "expectError": { - "errorCode": 51, - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - } - ] - } - ] - }, - { - "description": "pinned connection is not released after a non-transient commit error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 51 - } - } - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "commitTransaction", - "object": "session0", - "expectError": { - "errorCode": 51, - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "commitTransaction" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - } - ] - } - ] - }, - { - "description": "pinned connection is released after a non-transient abort error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 51 - } - } - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "abortTransaction" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "pinned connection is released after a transient non-network CRUD error", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 24 - } - } - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - }, - "expectError": { - "errorCode": 24, - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "abortTransaction" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "pinned connection is released after a transient network CRUD error", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - }, - "expectError": { - "isClientError": true, - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "abortTransaction" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionClosedEvent": { - "reason": "error" - } - }, - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "pinned connection is released after a transient non-network commit error", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 24 - } - } - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "commitTransaction", - "object": "session0", - "expectError": { - "errorCode": 24, - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "commitTransaction" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "pinned connection is released after a transient network commit error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "closeConnection": true - } - } - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "commitTransaction", - "object": "session0", - "ignoreResultAndError": true - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "commitTransaction" - } - }, - { - "commandStartedEvent": { - "commandName": "commitTransaction" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionClosedEvent": { - "reason": "error" - } - }, - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "pinned connection is released after a transient non-network abort error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 24 - } - } - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "abortTransaction" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "pinned connection is released after a transient network abort error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "closeConnection": true - } - } - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "abortTransaction" - } - }, - { - "commandStartedEvent": { - "commandName": "abortTransaction" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionClosedEvent": { - "reason": "error" - } - }, - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "pinned connection is released on successful abort", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "abortTransaction" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "pinned connection is returned when a new transaction is started", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "commitTransaction" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "commitTransaction" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - } - ] - } - ] - }, - { - "description": "pinned connection is returned when a non-transaction operation uses the session", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "commitTransaction" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - }, - { - "description": "a connection can be shared by a transaction and a cursor", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "createFindCursor", - "object": "collection0", - "arguments": { - "filter": {}, - "batchSize": 2, - "session": "session0" - }, - "saveResultAsEntity": "cursor0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "close", - "object": "cursor0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "commandName": "killCursors" - } - }, - { - "commandStartedEvent": { - "commandName": "abortTransaction" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/load-balancers/wait-queue-timeouts.json b/tests/UnifiedSpecTests/load-balancers/wait-queue-timeouts.json deleted file mode 100644 index 3dc6e46cf..000000000 --- a/tests/UnifiedSpecTests/load-balancers/wait-queue-timeouts.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "description": "wait queue timeout errors include details about checked out connections", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "topologies": [ - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "uriOptions": { - "maxPoolSize": 1, - "waitQueueTimeoutMS": 50 - }, - "observeEvents": [ - "connectionCheckedOutEvent", - "connectionCheckOutFailedEvent" - ] - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0Name" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "database0Name", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ], - "tests": [ - { - "description": "wait queue timeout errors include cursor statistics", - "operations": [ - { - "name": "createFindCursor", - "object": "collection0", - "arguments": { - "filter": {}, - "batchSize": 2 - }, - "saveResultAsEntity": "cursor0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - } - }, - "expectError": { - "isClientError": true, - "errorContains": "maxPoolSize: 1, connections in use by cursors: 1, connections in use by transactions: 0, connections in use by other operations: 0" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckOutFailedEvent": {} - } - ] - } - ] - }, - { - "description": "wait queue timeout errors include transaction statistics", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - } - }, - "expectError": { - "isClientError": true, - "errorContains": "maxPoolSize: 1, connections in use by cursors: 0, connections in use by transactions: 1, connections in use by other operations: 0" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckOutFailedEvent": {} - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/read-write-concern/default-write-concern-2.6.json b/tests/UnifiedSpecTests/read-write-concern/default-write-concern-2.6.json deleted file mode 100644 index 0d8f9c98a..000000000 --- a/tests/UnifiedSpecTests/read-write-concern/default-write-concern-2.6.json +++ /dev/null @@ -1,636 +0,0 @@ -{ - "description": "default-write-concern-2.6", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "2.6" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "default-write-concern-tests", - "databaseOptions": { - "writeConcern": {} - } - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll", - "collectionOptions": { - "writeConcern": {} - } - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "default-write-concern-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "DeleteOne omits default write concern", - "operations": [ - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "filter": {} - }, - "expectResult": { - "deletedCount": 1 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll", - "deletes": [ - { - "q": {}, - "limit": 1 - } - ], - "writeConcern": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "DeleteMany omits default write concern", - "operations": [ - { - "name": "deleteMany", - "object": "collection0", - "arguments": { - "filter": {} - }, - "expectResult": { - "deletedCount": 2 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll", - "deletes": [ - { - "q": {}, - "limit": 0 - } - ], - "writeConcern": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "BulkWrite with all models omits default write concern", - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "ordered": true, - "requests": [ - { - "deleteMany": { - "filter": {} - } - }, - { - "insertOne": { - "document": { - "_id": 1 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - }, - { - "insertOne": { - "document": { - "_id": 2 - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 2 - } - } - }, - { - "insertOne": { - "document": { - "_id": 3 - } - } - }, - { - "updateMany": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 3 - } - } - } - }, - { - "deleteOne": { - "filter": { - "_id": 3 - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll", - "deletes": [ - { - "q": {}, - "limit": 0 - } - ], - "writeConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 1 - } - ], - "writeConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "update": "coll", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$set": { - "x": 1 - } - }, - "upsert": { - "$$unsetOrMatches": false - }, - "multi": { - "$$unsetOrMatches": false - } - } - ], - "writeConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 2 - } - ], - "writeConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "update": "coll", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "x": 2 - }, - "upsert": { - "$$unsetOrMatches": false - }, - "multi": { - "$$unsetOrMatches": false - } - } - ], - "writeConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3 - } - ], - "writeConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "update": "coll", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$set": { - "x": 3 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "writeConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "delete": "coll", - "deletes": [ - { - "q": { - "_id": 3 - }, - "limit": 1 - } - ], - "writeConcern": { - "$$exists": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "default-write-concern-tests", - "documents": [ - { - "_id": 1, - "x": 3 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "InsertOne and InsertMany omit default write concern", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 3 - } - } - }, - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "documents": [ - { - "_id": 4 - }, - { - "_id": 5 - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3 - } - ], - "writeConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 4 - }, - { - "_id": 5 - } - ], - "writeConcern": { - "$$exists": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "default-write-concern-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3 - }, - { - "_id": 4 - }, - { - "_id": 5 - } - ] - } - ] - }, - { - "description": "UpdateOne, UpdateMany, and ReplaceOne omit default write concern", - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - }, - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "filter": { - "_id": 2 - }, - "update": { - "$set": { - "x": 2 - } - } - } - }, - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 2 - }, - "replacement": { - "x": 3 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$set": { - "x": 1 - } - }, - "upsert": { - "$$unsetOrMatches": false - }, - "multi": { - "$$unsetOrMatches": false - } - } - ], - "writeConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "update": "coll", - "updates": [ - { - "q": { - "_id": 2 - }, - "u": { - "$set": { - "x": 2 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "writeConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "update": "coll", - "updates": [ - { - "q": { - "_id": 2 - }, - "u": { - "x": 3 - }, - "upsert": { - "$$unsetOrMatches": false - }, - "multi": { - "$$unsetOrMatches": false - } - } - ], - "writeConcern": { - "$$exists": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "default-write-concern-tests", - "documents": [ - { - "_id": 1, - "x": 1 - }, - { - "_id": 2, - "x": 3 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/read-write-concern/default-write-concern-3.2.json b/tests/UnifiedSpecTests/read-write-concern/default-write-concern-3.2.json deleted file mode 100644 index 166a18491..000000000 --- a/tests/UnifiedSpecTests/read-write-concern/default-write-concern-3.2.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "description": "default-write-concern-3.2", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.2" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "default-write-concern-tests", - "databaseOptions": { - "writeConcern": {} - } - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll", - "collectionOptions": { - "writeConcern": {} - } - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "default-write-concern-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "findAndModify operations omit default write concern", - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - }, - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "filter": { - "_id": 2 - }, - "replacement": { - "x": 2 - } - } - }, - { - "name": "findOneAndDelete", - "object": "collection0", - "arguments": { - "filter": { - "_id": 2 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll", - "query": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - }, - "writeConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll", - "query": { - "_id": 2 - }, - "update": { - "x": 2 - }, - "writeConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll", - "query": { - "_id": 2 - }, - "remove": true, - "writeConcern": { - "$$exists": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "default-write-concern-tests", - "documents": [ - { - "_id": 1, - "x": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/read-write-concern/default-write-concern-3.4.json b/tests/UnifiedSpecTests/read-write-concern/default-write-concern-3.4.json deleted file mode 100644 index e18cdfc0c..000000000 --- a/tests/UnifiedSpecTests/read-write-concern/default-write-concern-3.4.json +++ /dev/null @@ -1,278 +0,0 @@ -{ - "description": "default-write-concern-3.4", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "default-write-concern-tests", - "databaseOptions": { - "writeConcern": {} - } - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll", - "collectionOptions": { - "writeConcern": {} - } - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "default-write-concern-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "Aggregate with $out omits default write concern", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_collection_name" - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "other_collection_name" - } - ], - "writeConcern": { - "$$exists": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "other_collection_name", - "databaseName": "default-write-concern-tests", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "RunCommand with a write command omits default write concern (runCommand should never inherit write concern)", - "operations": [ - { - "object": "database0", - "name": "runCommand", - "arguments": { - "command": { - "delete": "coll", - "deletes": [ - { - "q": {}, - "limit": 1 - } - ] - }, - "commandName": "delete" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll", - "deletes": [ - { - "q": {}, - "limit": 1 - } - ], - "writeConcern": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "CreateIndex and dropIndex omits default write concern", - "operations": [ - { - "object": "collection0", - "name": "createIndex", - "arguments": { - "keys": { - "x": 1 - } - } - }, - { - "object": "collection0", - "name": "dropIndex", - "arguments": { - "name": "x_1" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "createIndexes": "coll", - "indexes": [ - { - "name": "x_1", - "key": { - "x": 1 - } - } - ], - "writeConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "dropIndexes": "coll", - "index": "x_1", - "writeConcern": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "MapReduce omits default write concern", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "mapReduce", - "object": "collection0", - "arguments": { - "map": { - "$code": "function inc() { return emit(0, this.x + 1) }" - }, - "reduce": { - "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }" - }, - "out": { - "inline": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "mapReduce": "coll", - "map": { - "$code": "function inc() { return emit(0, this.x + 1) }" - }, - "reduce": { - "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }" - }, - "out": { - "inline": 1 - }, - "writeConcern": { - "$$exists": false - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/read-write-concern/default-write-concern-4.2.json b/tests/UnifiedSpecTests/read-write-concern/default-write-concern-4.2.json deleted file mode 100644 index e8bb78d91..000000000 --- a/tests/UnifiedSpecTests/read-write-concern/default-write-concern-4.2.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "description": "default-write-concern-4.2", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.2" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "default-write-concern-tests", - "databaseOptions": { - "writeConcern": {} - } - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll", - "collectionOptions": { - "writeConcern": {} - } - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "default-write-concern-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "Aggregate with $merge omits default write concern", - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_collection_name" - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$merge": { - "into": "other_collection_name" - } - } - ], - "writeConcern": { - "$$exists": false - } - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "other_collection_name", - "databaseName": "default-write-concern-tests", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/aggregate-merge.json b/tests/UnifiedSpecTests/retryable-reads/aggregate-merge.json deleted file mode 100644 index 96bbd0fc3..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/aggregate-merge.json +++ /dev/null @@ -1,143 +0,0 @@ -{ - "description": "aggregate-merge", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.1.11" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Aggregate with $merge does not retry", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - }, - { - "$merge": { - "into": "output-collection" - } - } - ] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - }, - { - "$merge": { - "into": "output-collection" - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/aggregate-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/aggregate-serverErrors.json deleted file mode 100644 index d39835a5d..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/aggregate-serverErrors.json +++ /dev/null @@ -1,1430 +0,0 @@ -{ - "description": "aggregate-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Aggregate succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection1", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/aggregate.json b/tests/UnifiedSpecTests/retryable-reads/aggregate.json deleted file mode 100644 index 2b504c8d4..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/aggregate.json +++ /dev/null @@ -1,527 +0,0 @@ -{ - "description": "aggregate", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Aggregate succeeds on first attempt", - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection1", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Aggregate with $out does not retry", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - }, - { - "$out": "output-collection" - } - ] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - }, - { - "$out": "output-collection" - } - ] - }, - "commandName": "aggregate", - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/changeStreams-client.watch-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/changeStreams-client.watch-serverErrors.json deleted file mode 100644 index 47375974d..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/changeStreams-client.watch-serverErrors.json +++ /dev/null @@ -1,959 +0,0 @@ -{ - "description": "changeStreams-client.watch-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "serverless": "forbid", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ] - } - } - ], - "tests": [ - { - "description": "client.watch succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "client0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "client.watch succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "client0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "client.watch succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "client0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "client.watch succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "client0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "client.watch succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "client0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "client.watch succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "client0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "client.watch succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "client0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "client.watch succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "client0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "client.watch succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "client0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "client.watch succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "client0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "client.watch succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "client0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "client.watch fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "client0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "client.watch fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ] - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "client1", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/changeStreams-client.watch.json b/tests/UnifiedSpecTests/retryable-reads/changeStreams-client.watch.json deleted file mode 100644 index 95ddaf921..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/changeStreams-client.watch.json +++ /dev/null @@ -1,294 +0,0 @@ -{ - "description": "changeStreams-client.watch", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "serverless": "forbid", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ] - } - } - ], - "tests": [ - { - "description": "client.watch succeeds on first attempt", - "operations": [ - { - "object": "client0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "client.watch succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "client0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "client.watch fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ] - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "client1", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "client.watch fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "client0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true - } - } - ] - }, - "databaseName": "admin" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/changeStreams-db.coll.watch-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/changeStreams-db.coll.watch-serverErrors.json deleted file mode 100644 index 589d0a3c3..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/changeStreams-db.coll.watch-serverErrors.json +++ /dev/null @@ -1,944 +0,0 @@ -{ - "description": "changeStreams-db.coll.watch-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "serverless": "forbid", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "db.coll.watch succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "collection0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.coll.watch succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "collection0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.coll.watch succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.coll.watch succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "collection0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.coll.watch succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "collection0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.coll.watch succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "collection0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.coll.watch succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "collection0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.coll.watch succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "collection0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.coll.watch succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "collection0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.coll.watch succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "collection0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.coll.watch succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "collection0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.coll.watch fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.coll.watch fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection1", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/changeStreams-db.coll.watch.json b/tests/UnifiedSpecTests/retryable-reads/changeStreams-db.coll.watch.json deleted file mode 100644 index bbea2ffe4..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/changeStreams-db.coll.watch.json +++ /dev/null @@ -1,314 +0,0 @@ -{ - "description": "changeStreams-db.coll.watch", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "serverless": "forbid", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "db.coll.watch succeeds on first attempt", - "operations": [ - { - "object": "collection0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.coll.watch succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.coll.watch fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection1", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.coll.watch fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/changeStreams-db.watch-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/changeStreams-db.watch-serverErrors.json deleted file mode 100644 index 6c12d7ddd..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/changeStreams-db.watch-serverErrors.json +++ /dev/null @@ -1,930 +0,0 @@ -{ - "description": "changeStreams-db.watch-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "serverless": "forbid", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "db.watch succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "database0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.watch succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "database0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.watch succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "database0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.watch succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "database0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.watch succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "database0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.watch succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "database0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.watch succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "database0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.watch succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "database0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.watch succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "database0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.watch succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "database0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.watch succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "database0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.watch fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "database0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.watch fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "database1", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/changeStreams-db.watch.json b/tests/UnifiedSpecTests/retryable-reads/changeStreams-db.watch.json deleted file mode 100644 index 1b6d911c7..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/changeStreams-db.watch.json +++ /dev/null @@ -1,303 +0,0 @@ -{ - "description": "changeStreams-db.watch", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "serverless": "forbid", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "db.watch succeeds on first attempt", - "operations": [ - { - "object": "database0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.watch succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "database0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.watch fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "killCursors" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "database1", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "db.watch fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "database0", - "name": "createChangeStream", - "arguments": { - "pipeline": [] - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/count-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/count-serverErrors.json deleted file mode 100644 index c52edfdb9..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/count-serverErrors.json +++ /dev/null @@ -1,808 +0,0 @@ -{ - "description": "count-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "Count succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Count succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Count succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Count succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Count succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Count succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Count succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Count succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Count succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Count succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Count succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Count fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Count fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection1", - "name": "count", - "arguments": { - "filter": {} - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/count.json b/tests/UnifiedSpecTests/retryable-reads/count.json deleted file mode 100644 index d5c9a343a..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/count.json +++ /dev/null @@ -1,286 +0,0 @@ -{ - "description": "count", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "Count succeeds on first attempt", - "operations": [ - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Count succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Count fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection1", - "name": "count", - "arguments": { - "filter": {} - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Count fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "count" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "count", - "arguments": { - "filter": {} - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/countDocuments-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/countDocuments-serverErrors.json deleted file mode 100644 index fd028b114..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/countDocuments-serverErrors.json +++ /dev/null @@ -1,1133 +0,0 @@ -{ - "description": "countDocuments-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "CountDocuments succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "CountDocuments succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "CountDocuments succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "CountDocuments succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "CountDocuments succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "CountDocuments succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "CountDocuments succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "CountDocuments succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "CountDocuments succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "CountDocuments succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "CountDocuments succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "CountDocuments fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "CountDocuments fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection1", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/countDocuments.json b/tests/UnifiedSpecTests/retryable-reads/countDocuments.json deleted file mode 100644 index e06e89c1a..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/countDocuments.json +++ /dev/null @@ -1,364 +0,0 @@ -{ - "description": "countDocuments", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "CountDocuments succeeds on first attempt", - "operations": [ - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "CountDocuments succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "CountDocuments fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection1", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "CountDocuments fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": {} - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/distinct-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/distinct-serverErrors.json deleted file mode 100644 index 79d2d5fc3..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/distinct-serverErrors.json +++ /dev/null @@ -1,1060 +0,0 @@ -{ - "description": "distinct-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Distinct succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": [ - 22, - 33 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Distinct succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": [ - 22, - 33 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Distinct succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": [ - 22, - 33 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Distinct succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": [ - 22, - 33 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Distinct succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": [ - 22, - 33 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Distinct succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": [ - 22, - 33 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Distinct succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": [ - 22, - 33 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Distinct succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": [ - 22, - 33 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Distinct succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": [ - 22, - 33 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Distinct succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": [ - 22, - 33 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Distinct succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": [ - 22, - 33 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Distinct fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Distinct fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection1", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/distinct.json b/tests/UnifiedSpecTests/retryable-reads/distinct.json deleted file mode 100644 index 81f1f66e9..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/distinct.json +++ /dev/null @@ -1,352 +0,0 @@ -{ - "description": "distinct", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Distinct succeeds on first attempt", - "operations": [ - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": [ - 22, - 33 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Distinct succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectResult": [ - 22, - 33 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Distinct fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection1", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Distinct fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "distinct" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "x", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "coll", - "key": "x", - "query": { - "_id": { - "$gt": 1 - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/estimatedDocumentCount-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/estimatedDocumentCount-serverErrors.json deleted file mode 100644 index ba983c6cd..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/estimatedDocumentCount-serverErrors.json +++ /dev/null @@ -1,768 +0,0 @@ -{ - "description": "estimatedDocumentCount-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "EstimatedDocumentCount succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "EstimatedDocumentCount succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "EstimatedDocumentCount succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "EstimatedDocumentCount succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "EstimatedDocumentCount succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "EstimatedDocumentCount succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "EstimatedDocumentCount succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "EstimatedDocumentCount succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "EstimatedDocumentCount succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "EstimatedDocumentCount succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "EstimatedDocumentCount succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "EstimatedDocumentCount fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "EstimatedDocumentCount fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection1", - "name": "estimatedDocumentCount", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/estimatedDocumentCount.json b/tests/UnifiedSpecTests/retryable-reads/estimatedDocumentCount.json deleted file mode 100644 index 75a676b9b..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/estimatedDocumentCount.json +++ /dev/null @@ -1,273 +0,0 @@ -{ - "description": "estimatedDocumentCount", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "EstimatedDocumentCount succeeds on first attempt", - "operations": [ - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "EstimatedDocumentCount succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "EstimatedDocumentCount fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "count" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection1", - "name": "estimatedDocumentCount", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "EstimatedDocumentCount fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "count" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "estimatedDocumentCount", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "count": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/exceededTimeLimit.json b/tests/UnifiedSpecTests/retryable-reads/exceededTimeLimit.json deleted file mode 100644 index 8d090bbe3..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/exceededTimeLimit.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "description": "ExceededTimeLimit is a retryable read", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "exceededtimelimit-test" - } - } - ], - "initialData": [ - { - "collectionName": "exceededtimelimit-test", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Find succeeds on second attempt after ExceededTimeLimit", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 262 - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "object": "collection0", - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "exceededtimelimit-test", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "commandName": "find", - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "exceededtimelimit-test", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "commandName": "find", - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/find-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/find-serverErrors.json deleted file mode 100644 index ab3dbe45f..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/find-serverErrors.json +++ /dev/null @@ -1,1184 +0,0 @@ -{ - "description": "find-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - } - ] - } - ], - "tests": [ - { - "description": "Find succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection1", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/find.json b/tests/UnifiedSpecTests/retryable-reads/find.json deleted file mode 100644 index 30c4c5e47..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/find.json +++ /dev/null @@ -1,498 +0,0 @@ -{ - "description": "find", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - } - ] - } - ], - "tests": [ - { - "description": "Find succeeds on first attempt", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find succeeds on second attempt with explicit clientOptions", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": true - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection1", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection1", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 4 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/findOne-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/findOne-serverErrors.json deleted file mode 100644 index 7adda1e32..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/findOne-serverErrors.json +++ /dev/null @@ -1,954 +0,0 @@ -{ - "description": "findOne-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - } - ] - } - ], - "tests": [ - { - "description": "FindOne succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "collection0", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "FindOne succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "collection0", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "FindOne succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "FindOne succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "collection0", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "FindOne succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "collection0", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "FindOne succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "collection0", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "FindOne succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "collection0", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "FindOne succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "collection0", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "FindOne succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "collection0", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "FindOne succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "collection0", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "FindOne succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "collection0", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "FindOne fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "FindOne fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection1", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/findOne.json b/tests/UnifiedSpecTests/retryable-reads/findOne.json deleted file mode 100644 index 4314a19e4..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/findOne.json +++ /dev/null @@ -1,330 +0,0 @@ -{ - "description": "findOne", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - } - ] - } - ], - "tests": [ - { - "description": "FindOne succeeds on first attempt", - "operations": [ - { - "object": "collection0", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "FindOne succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "FindOne fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection1", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "FindOne fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "findOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": { - "_id": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/gridfs-download-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/gridfs-download-serverErrors.json deleted file mode 100644 index 5bb7eee0b..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/gridfs-download-serverErrors.json +++ /dev/null @@ -1,1092 +0,0 @@ -{ - "description": "gridfs-download-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "bucket": { - "id": "bucket0", - "database": "database0" - } - } - ], - "initialData": [ - { - "collectionName": "fs.files", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "length": 1, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "filename": "abc", - "metadata": {} - } - ] - }, - { - "collectionName": "fs.chunks", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000002" - }, - "files_id": { - "$oid": "000000000000000000000001" - }, - "n": 0, - "data": { - "$binary": { - "base64": "EQ==", - "subType": "00" - } - } - } - ] - } - ], - "tests": [ - { - "description": "Download succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "bucket0", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Download succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "bucket0", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Download succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "bucket0", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Download succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "bucket0", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Download succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "bucket0", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Download succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "bucket0", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Download succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "bucket0", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Download succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "bucket0", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Download succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "bucket0", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Download succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "bucket0", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Download succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "bucket0", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Download fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "bucket0", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Download fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "bucket": { - "id": "bucket1", - "database": "database1" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "bucket1", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/gridfs-download.json b/tests/UnifiedSpecTests/retryable-reads/gridfs-download.json deleted file mode 100644 index 69fe8ff7c..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/gridfs-download.json +++ /dev/null @@ -1,367 +0,0 @@ -{ - "description": "gridfs-download", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "bucket": { - "id": "bucket0", - "database": "database0" - } - } - ], - "initialData": [ - { - "collectionName": "fs.files", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "length": 1, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "filename": "abc", - "metadata": {} - } - ] - }, - { - "collectionName": "fs.chunks", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000002" - }, - "files_id": { - "$oid": "000000000000000000000001" - }, - "n": 0, - "data": { - "$binary": { - "base64": "EQ==", - "subType": "00" - } - } - } - ] - } - ], - "tests": [ - { - "description": "Download succeeds on first attempt", - "operations": [ - { - "object": "bucket0", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Download succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "object": "bucket0", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Download fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "bucket": { - "id": "bucket1", - "database": "database1" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "object": "bucket1", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Download fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "object": "bucket0", - "name": "download", - "arguments": { - "id": { - "$oid": "000000000000000000000001" - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "_id": { - "$oid": "000000000000000000000001" - } - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/gridfs-downloadByName-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/gridfs-downloadByName-serverErrors.json deleted file mode 100644 index 35f7e1e56..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/gridfs-downloadByName-serverErrors.json +++ /dev/null @@ -1,1016 +0,0 @@ -{ - "description": "gridfs-downloadByName-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "bucket": { - "id": "bucket0", - "database": "database0" - } - } - ], - "initialData": [ - { - "collectionName": "fs.files", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "length": 1, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "filename": "abc", - "metadata": {} - } - ] - }, - { - "collectionName": "fs.chunks", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000002" - }, - "files_id": { - "$oid": "000000000000000000000001" - }, - "n": 0, - "data": { - "$binary": { - "base64": "EQ==", - "subType": "00" - } - } - } - ] - } - ], - "tests": [ - { - "description": "DownloadByName succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "bucket0", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "DownloadByName succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "bucket0", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "DownloadByName succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "bucket0", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "DownloadByName succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "bucket0", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "DownloadByName succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "bucket0", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "DownloadByName succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "bucket0", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "DownloadByName succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "bucket0", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "DownloadByName succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "bucket0", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "DownloadByName succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "bucket0", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "DownloadByName succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "bucket0", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "DownloadByName succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "bucket0", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "DownloadByName fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "bucket0", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "DownloadByName fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "bucket": { - "id": "bucket1", - "database": "database1" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "bucket1", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/gridfs-downloadByName.json b/tests/UnifiedSpecTests/retryable-reads/gridfs-downloadByName.json deleted file mode 100644 index c3fa87339..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/gridfs-downloadByName.json +++ /dev/null @@ -1,347 +0,0 @@ -{ - "description": "gridfs-downloadByName", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "bucket": { - "id": "bucket0", - "database": "database0" - } - } - ], - "initialData": [ - { - "collectionName": "fs.files", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000001" - }, - "length": 1, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "filename": "abc", - "metadata": {} - } - ] - }, - { - "collectionName": "fs.chunks", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000002" - }, - "files_id": { - "$oid": "000000000000000000000001" - }, - "n": 0, - "data": { - "$binary": { - "base64": "EQ==", - "subType": "00" - } - } - } - ] - } - ], - "tests": [ - { - "description": "DownloadByName succeeds on first attempt", - "operations": [ - { - "object": "bucket0", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "DownloadByName succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "object": "bucket0", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectResult": { - "$$matchesHexBytes": "11" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.chunks" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "DownloadByName fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "bucket": { - "id": "bucket1", - "database": "database1" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "object": "bucket1", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "DownloadByName fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "object": "bucket0", - "name": "downloadByName", - "arguments": { - "filename": "abc" - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "fs.files", - "filter": { - "filename": "abc" - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/handshakeError.json b/tests/UnifiedSpecTests/retryable-reads/handshakeError.json deleted file mode 100644 index 2921d8a95..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/handshakeError.json +++ /dev/null @@ -1,3079 +0,0 @@ -{ - "description": "retryable reads handshake failures", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ], - "auth": true - } - ], - "createEntities": [ - { - "client": { - "id": "client", - "useMultipleMongoses": false, - "observeEvents": [ - "connectionCheckOutStartedEvent", - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-handshake-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "client.listDatabases succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "listDatabases", - "object": "client", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandSucceededEvent": { - "commandName": "listDatabases" - } - } - ] - } - ] - }, - { - "description": "client.listDatabases succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "listDatabases", - "object": "client", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandSucceededEvent": { - "commandName": "listDatabases" - } - } - ] - } - ] - }, - { - "description": "client.listDatabaseNames succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "listDatabaseNames", - "object": "client" - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandSucceededEvent": { - "commandName": "listDatabases" - } - } - ] - } - ] - }, - { - "description": "client.listDatabaseNames succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "listDatabaseNames", - "object": "client" - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "listDatabases" - } - }, - { - "commandSucceededEvent": { - "commandName": "listDatabases" - } - } - ] - } - ] - }, - { - "description": "client.createChangeStream succeeds after retryable handshake network error", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "createChangeStream", - "object": "client", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream" - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" - } - } - ] - } - ] - }, - { - "description": "client.createChangeStream succeeds after retryable handshake server error (ShutdownInProgress)", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "createChangeStream", - "object": "client", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream" - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" - } - } - ] - } - ] - }, - { - "description": "database.aggregate succeeds after retryable handshake network error", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "aggregate", - "object": "database", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" - } - } - ] - } - ] - }, - { - "description": "database.aggregate succeeds after retryable handshake server error (ShutdownInProgress)", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "aggregate", - "object": "database", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" - } - } - ] - } - ] - }, - { - "description": "database.listCollections succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "listCollections", - "object": "database", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections" - } - }, - { - "commandSucceededEvent": { - "commandName": "listCollections" - } - } - ] - } - ] - }, - { - "description": "database.listCollections succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "listCollections", - "object": "database", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections" - } - }, - { - "commandSucceededEvent": { - "commandName": "listCollections" - } - } - ] - } - ] - }, - { - "description": "database.listCollectionNames succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "listCollectionNames", - "object": "database", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections" - } - }, - { - "commandSucceededEvent": { - "commandName": "listCollections" - } - } - ] - } - ] - }, - { - "description": "database.listCollectionNames succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "listCollectionNames", - "object": "database", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "listCollections" - } - }, - { - "commandSucceededEvent": { - "commandName": "listCollections" - } - } - ] - } - ] - }, - { - "description": "database.createChangeStream succeeds after retryable handshake network error", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "createChangeStream", - "object": "database", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream" - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" - } - } - ] - } - ] - }, - { - "description": "database.createChangeStream succeeds after retryable handshake server error (ShutdownInProgress)", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "createChangeStream", - "object": "database", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream" - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" - } - } - ] - } - ] - }, - { - "description": "collection.aggregate succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "aggregate", - "object": "collection", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" - } - } - ] - } - ] - }, - { - "description": "collection.aggregate succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "aggregate", - "object": "collection", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" - } - } - ] - } - ] - }, - { - "description": "collection.countDocuments succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" - } - } - ] - } - ] - }, - { - "description": "collection.countDocuments succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" - } - } - ] - } - ] - }, - { - "description": "collection.estimatedDocumentCount succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "estimatedDocumentCount", - "object": "collection" - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "count" - } - }, - { - "commandSucceededEvent": { - "commandName": "count" - } - } - ] - } - ] - }, - { - "description": "collection.estimatedDocumentCount succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "estimatedDocumentCount", - "object": "collection" - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "count" - } - }, - { - "commandSucceededEvent": { - "commandName": "count" - } - } - ] - } - ] - }, - { - "description": "collection.distinct succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "fieldName": "x", - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "distinct" - } - }, - { - "commandSucceededEvent": { - "commandName": "distinct" - } - } - ] - } - ] - }, - { - "description": "collection.distinct succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "distinct", - "object": "collection", - "arguments": { - "fieldName": "x", - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "distinct" - } - }, - { - "commandSucceededEvent": { - "commandName": "distinct" - } - } - ] - } - ] - }, - { - "description": "collection.find succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandSucceededEvent": { - "commandName": "find" - } - } - ] - } - ] - }, - { - "description": "collection.find succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "find", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandSucceededEvent": { - "commandName": "find" - } - } - ] - } - ] - }, - { - "description": "collection.findOne succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "findOne", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandSucceededEvent": { - "commandName": "find" - } - } - ] - } - ] - }, - { - "description": "collection.findOne succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "findOne", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "find" - } - }, - { - "commandSucceededEvent": { - "commandName": "find" - } - } - ] - } - ] - }, - { - "description": "collection.listIndexes succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "listIndexes", - "object": "collection" - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandSucceededEvent": { - "commandName": "listIndexes" - } - } - ] - } - ] - }, - { - "description": "collection.listIndexes succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "listIndexes", - "object": "collection" - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandSucceededEvent": { - "commandName": "listIndexes" - } - } - ] - } - ] - }, - { - "description": "collection.listIndexNames succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "listIndexNames", - "object": "collection" - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandSucceededEvent": { - "commandName": "listIndexes" - } - } - ] - } - ] - }, - { - "description": "collection.listIndexNames succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "listIndexNames", - "object": "collection" - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "listIndexes" - } - }, - { - "commandSucceededEvent": { - "commandName": "listIndexes" - } - } - ] - } - ] - }, - { - "description": "collection.createChangeStream succeeds after retryable handshake network error", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "createChangeStream", - "object": "collection", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream" - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" - } - } - ] - } - ] - }, - { - "description": "collection.createChangeStream succeeds after retryable handshake server error (ShutdownInProgress)", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "createChangeStream", - "object": "collection", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream" - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-reads-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "aggregate" - } - }, - { - "commandSucceededEvent": { - "commandName": "aggregate" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listCollectionNames-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/listCollectionNames-serverErrors.json deleted file mode 100644 index 162dd4cee..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listCollectionNames-serverErrors.json +++ /dev/null @@ -1,710 +0,0 @@ -{ - "description": "listCollectionNames-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListCollectionNames succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionNames succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionNames succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionNames succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionNames succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionNames succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionNames succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionNames succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionNames succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionNames succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionNames succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionNames fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionNames", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionNames fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "database1", - "name": "listCollectionNames", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listCollectionNames.json b/tests/UnifiedSpecTests/retryable-reads/listCollectionNames.json deleted file mode 100644 index 0fe575f7a..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listCollectionNames.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "description": "listCollectionNames", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListCollectionNames succeeds on first attempt", - "operations": [ - { - "object": "database0", - "name": "listCollectionNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionNames succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "closeConnection": true - } - } - } - }, - { - "object": "database0", - "name": "listCollectionNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionNames fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "closeConnection": true - } - } - } - }, - { - "object": "database1", - "name": "listCollectionNames", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionNames fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "closeConnection": true - } - } - } - }, - { - "object": "database0", - "name": "listCollectionNames", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listCollectionObjects-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/listCollectionObjects-serverErrors.json deleted file mode 100644 index 8b9d582c1..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listCollectionObjects-serverErrors.json +++ /dev/null @@ -1,710 +0,0 @@ -{ - "description": "listCollectionObjects-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListCollectionObjects succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionObjects succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionObjects succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionObjects succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionObjects succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionObjects succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionObjects succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionObjects succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionObjects succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionObjects succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionObjects succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionObjects fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "database0", - "name": "listCollectionObjects", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionObjects fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "database1", - "name": "listCollectionObjects", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listCollectionObjects.json b/tests/UnifiedSpecTests/retryable-reads/listCollectionObjects.json deleted file mode 100644 index 9cdbb6927..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listCollectionObjects.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "description": "listCollectionObjects", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListCollectionObjects succeeds on first attempt", - "operations": [ - { - "object": "database0", - "name": "listCollectionObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionObjects succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "closeConnection": true - } - } - } - }, - { - "object": "database0", - "name": "listCollectionObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionObjects fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "closeConnection": true - } - } - } - }, - { - "object": "database1", - "name": "listCollectionObjects", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollectionObjects fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "closeConnection": true - } - } - } - }, - { - "object": "database0", - "name": "listCollectionObjects", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listCollections-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/listCollections-serverErrors.json deleted file mode 100644 index 171fe7457..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listCollections-serverErrors.json +++ /dev/null @@ -1,710 +0,0 @@ -{ - "description": "listCollections-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListCollections succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "database0", - "name": "listCollections" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollections succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "database0", - "name": "listCollections" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollections succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "database0", - "name": "listCollections" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollections succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "database0", - "name": "listCollections" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollections succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "database0", - "name": "listCollections" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollections succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "database0", - "name": "listCollections" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollections succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "database0", - "name": "listCollections" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollections succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "database0", - "name": "listCollections" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollections succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "database0", - "name": "listCollections" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollections succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "database0", - "name": "listCollections" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollections succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "database0", - "name": "listCollections" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollections fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "database0", - "name": "listCollections", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollections fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "database1", - "name": "listCollections", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listCollections.json b/tests/UnifiedSpecTests/retryable-reads/listCollections.json deleted file mode 100644 index b6152f9ce..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listCollections.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "description": "listCollections", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListCollections succeeds on first attempt", - "operations": [ - { - "object": "database0", - "name": "listCollections" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollections succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "closeConnection": true - } - } - } - }, - { - "object": "database0", - "name": "listCollections" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollections fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "closeConnection": true - } - } - } - }, - { - "object": "database1", - "name": "listCollections", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListCollections fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listCollections" - ], - "closeConnection": true - } - } - } - }, - { - "object": "database0", - "name": "listCollections", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listCollections": 1 - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listDatabaseNames-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/listDatabaseNames-serverErrors.json deleted file mode 100644 index 489ff0ad5..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listDatabaseNames-serverErrors.json +++ /dev/null @@ -1,696 +0,0 @@ -{ - "description": "listDatabaseNames-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListDatabaseNames succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseNames succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseNames succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseNames succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseNames succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseNames succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseNames succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseNames succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseNames succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseNames succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseNames succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseNames fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseNames", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseNames fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "client1", - "name": "listDatabaseNames", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listDatabaseNames.json b/tests/UnifiedSpecTests/retryable-reads/listDatabaseNames.json deleted file mode 100644 index 5590f39a5..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listDatabaseNames.json +++ /dev/null @@ -1,229 +0,0 @@ -{ - "description": "listDatabaseNames", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListDatabaseNames succeeds on first attempt", - "operations": [ - { - "object": "client0", - "name": "listDatabaseNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseNames succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "closeConnection": true - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseNames fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "closeConnection": true - } - } - } - }, - { - "object": "client1", - "name": "listDatabaseNames", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseNames fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "closeConnection": true - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseNames", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listDatabaseObjects-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/listDatabaseObjects-serverErrors.json deleted file mode 100644 index 56f9f3623..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listDatabaseObjects-serverErrors.json +++ /dev/null @@ -1,696 +0,0 @@ -{ - "description": "listDatabaseObjects-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListDatabaseObjects succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseObjects succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseObjects succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseObjects succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseObjects succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseObjects succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseObjects succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseObjects succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseObjects succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseObjects succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseObjects succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseObjects fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseObjects", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseObjects fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "client1", - "name": "listDatabaseObjects", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listDatabaseObjects.json b/tests/UnifiedSpecTests/retryable-reads/listDatabaseObjects.json deleted file mode 100644 index 46b1511d4..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listDatabaseObjects.json +++ /dev/null @@ -1,229 +0,0 @@ -{ - "description": "listDatabaseObjects", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListDatabaseObjects succeeds on first attempt", - "operations": [ - { - "object": "client0", - "name": "listDatabaseObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseObjects succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "closeConnection": true - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseObjects" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseObjects fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "closeConnection": true - } - } - } - }, - { - "object": "client1", - "name": "listDatabaseObjects", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabaseObjects fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "closeConnection": true - } - } - } - }, - { - "object": "client0", - "name": "listDatabaseObjects", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listDatabases-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/listDatabases-serverErrors.json deleted file mode 100644 index 09b935a59..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listDatabases-serverErrors.json +++ /dev/null @@ -1,696 +0,0 @@ -{ - "description": "listDatabases-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListDatabases succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "client0", - "name": "listDatabases" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabases succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "client0", - "name": "listDatabases" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabases succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "client0", - "name": "listDatabases" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabases succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "client0", - "name": "listDatabases" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabases succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "client0", - "name": "listDatabases" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabases succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "client0", - "name": "listDatabases" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabases succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "client0", - "name": "listDatabases" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabases succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "client0", - "name": "listDatabases" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabases succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "client0", - "name": "listDatabases" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabases succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "client0", - "name": "listDatabases" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabases succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "client0", - "name": "listDatabases" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabases fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "client0", - "name": "listDatabases", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabases fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "client1", - "name": "listDatabases", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listDatabases.json b/tests/UnifiedSpecTests/retryable-reads/listDatabases.json deleted file mode 100644 index 4cf5eccc7..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listDatabases.json +++ /dev/null @@ -1,229 +0,0 @@ -{ - "description": "listDatabases", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListDatabases succeeds on first attempt", - "operations": [ - { - "object": "client0", - "name": "listDatabases" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabases succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "closeConnection": true - } - } - } - }, - { - "object": "client0", - "name": "listDatabases" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabases fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "closeConnection": true - } - } - } - }, - { - "object": "client1", - "name": "listDatabases", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - }, - { - "description": "ListDatabases fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "closeConnection": true - } - } - } - }, - { - "object": "client0", - "name": "listDatabases", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listIndexNames-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/listIndexNames-serverErrors.json deleted file mode 100644 index 7b9811148..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listIndexNames-serverErrors.json +++ /dev/null @@ -1,749 +0,0 @@ -{ - "description": "listIndexNames-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListIndexNames succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexNames succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexNames succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexNames succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexNames succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexNames succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexNames succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexNames succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexNames succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexNames succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexNames succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexNames fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexNames", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexNames fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection1", - "name": "listIndexNames", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listIndexNames.json b/tests/UnifiedSpecTests/retryable-reads/listIndexNames.json deleted file mode 100644 index c5fe967ff..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listIndexNames.json +++ /dev/null @@ -1,263 +0,0 @@ -{ - "description": "listIndexNames", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListIndexNames succeeds on first attempt", - "operations": [ - { - "object": "collection0", - "name": "listIndexNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexNames succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "listIndexNames" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexNames fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection1", - "name": "listIndexNames", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexNames fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "listIndexNames", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listIndexes-serverErrors.json b/tests/UnifiedSpecTests/retryable-reads/listIndexes-serverErrors.json deleted file mode 100644 index 0110a0acd..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listIndexes-serverErrors.json +++ /dev/null @@ -1,749 +0,0 @@ -{ - "description": "listIndexes-serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListIndexes succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 11600 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexes" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexes succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 11602 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexes" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexes succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexes" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexes succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 13435 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexes" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexes succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 13436 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexes" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexes succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 189 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexes" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexes succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 91 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexes" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexes succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 7 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexes" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexes succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 6 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexes" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexes succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 89 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexes" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexes succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 9001 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexes" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexes fails after two NotWritablePrimary errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection0", - "name": "listIndexes", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexes fails after NotWritablePrimary when retryReads is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "collection1", - "name": "listIndexes", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/listIndexes.json b/tests/UnifiedSpecTests/retryable-reads/listIndexes.json deleted file mode 100644 index 2560e4961..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/listIndexes.json +++ /dev/null @@ -1,263 +0,0 @@ -{ - "description": "listIndexes", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "ListIndexes succeeds on first attempt", - "operations": [ - { - "object": "collection0", - "name": "listIndexes" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexes succeeds on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "listIndexes" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexes fails on first attempt", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection1", - "name": "listIndexes", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListIndexes fails on second attempt", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "listIndexes" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "listIndexes", - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "listIndexes": "coll" - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/mapReduce.json b/tests/UnifiedSpecTests/retryable-reads/mapReduce.json deleted file mode 100644 index 745c0ef00..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/mapReduce.json +++ /dev/null @@ -1,284 +0,0 @@ -{ - "description": "mapReduce", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "serverless": "forbid", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 0 - }, - { - "_id": 2, - "x": 1 - }, - { - "_id": 3, - "x": 2 - } - ] - } - ], - "tests": [ - { - "description": "MapReduce succeeds with retry on", - "operations": [ - { - "object": "collection0", - "name": "mapReduce", - "arguments": { - "map": { - "$code": "function inc() { return emit(0, this.x + 1) }" - }, - "reduce": { - "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }" - }, - "out": { - "inline": 1 - } - }, - "expectResult": [ - { - "_id": 0, - "value": 6 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "mapReduce": "coll", - "map": { - "$code": "function inc() { return emit(0, this.x + 1) }" - }, - "reduce": { - "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }" - }, - "out": { - "inline": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "MapReduce fails with retry on", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "mapReduce" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "mapReduce", - "arguments": { - "map": { - "$code": "function inc() { return emit(0, this.x + 1) }" - }, - "reduce": { - "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }" - }, - "out": { - "inline": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "mapReduce": "coll", - "map": { - "$code": "function inc() { return emit(0, this.x + 1) }" - }, - "reduce": { - "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }" - }, - "out": { - "inline": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "MapReduce fails with retry off", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryReads": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "mapReduce" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection1", - "name": "mapReduce", - "arguments": { - "map": { - "$code": "function inc() { return emit(0, this.x + 1) }" - }, - "reduce": { - "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }" - }, - "out": { - "inline": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "mapReduce": "coll", - "map": { - "$code": "function inc() { return emit(0, this.x + 1) }" - }, - "reduce": { - "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }" - }, - "out": { - "inline": 1 - } - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-reads/readConcernMajorityNotAvailableYet.json b/tests/UnifiedSpecTests/retryable-reads/readConcernMajorityNotAvailableYet.json deleted file mode 100644 index 8aa6a6b5e..000000000 --- a/tests/UnifiedSpecTests/retryable-reads/readConcernMajorityNotAvailableYet.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "description": "ReadConcernMajorityNotAvailableYet is a retryable read", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "readconcernmajoritynotavailableyet_test" - } - } - ], - "initialData": [ - { - "collectionName": "readconcernmajoritynotavailableyet_test", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Find succeeds on second attempt after ReadConcernMajorityNotAvailableYet", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 134 - } - } - } - }, - { - "name": "find", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "object": "collection0", - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "readconcernmajoritynotavailableyet_test", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "commandName": "find", - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "readconcernmajoritynotavailableyet_test", - "filter": { - "_id": { - "$gt": 1 - } - } - }, - "commandName": "find", - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/bulkWrite-errorLabels.json b/tests/UnifiedSpecTests/retryable-writes/bulkWrite-errorLabels.json deleted file mode 100644 index 13ba9bae7..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/bulkWrite-errorLabels.json +++ /dev/null @@ -1,416 +0,0 @@ -{ - "description": "bulkWrite-errorLabels", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite succeeds with RetryableWriteError from server", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 112, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - }, - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 1, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "1": 3 - } - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "BulkWrite fails if server does not return RetryableWriteError", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 11600, - "errorLabels": [] - } - } - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - }, - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true, - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "BulkWrite succeeds after PrimarySteppedDown", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 189, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - }, - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 1, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "1": 3 - } - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "BulkWrite succeeds after WriteConcernError ShutdownInProgress", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - }, - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 1, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "1": 3 - } - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/bulkWrite-serverErrors.json b/tests/UnifiedSpecTests/retryable-writes/bulkWrite-serverErrors.json deleted file mode 100644 index 0a063ab4d..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/bulkWrite-serverErrors.json +++ /dev/null @@ -1,285 +0,0 @@ -{ - "description": "retryable-writes bulkWrite serverErrors", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "BulkWrite succeeds after retryable writeConcernError in first batch", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - }, - { - "deleteOne": { - "filter": { - "_id": 2 - } - } - } - ] - }, - "expectResult": { - "deletedCount": 1, - "insertedCount": 1, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": { - "0": 3 - } - }, - "upsertedIds": {} - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3, - "x": 33 - } - ] - }, - "commandName": "insert", - "databaseName": "retryable-writes-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3, - "x": 33 - } - ] - }, - "commandName": "insert", - "databaseName": "retryable-writes-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "delete": "coll", - "deletes": [ - { - "q": { - "_id": 2 - }, - "limit": 1 - } - ] - }, - "commandName": "delete", - "databaseName": "retryable-writes-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "BulkWrite fails with a RetryableWriteError label after two connection failures", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "update" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - }, - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true, - "errorLabelsContain": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/bulkWrite.json b/tests/UnifiedSpecTests/retryable-writes/bulkWrite.json deleted file mode 100644 index 691321746..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/bulkWrite.json +++ /dev/null @@ -1,931 +0,0 @@ -{ - "description": "bulkWrite", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "First command is retried", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - } - } - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 1, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 2 - } - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 23 - } - ] - } - ] - }, - { - "description": "All commands are retried", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 7 - } - } - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 4, - "x": 44 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "upsert": true - } - }, - { - "insertOne": { - "document": { - "_id": 5, - "x": 55 - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 3 - }, - "replacement": { - "_id": 3, - "x": 333 - } - } - }, - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 1, - "insertedCount": 3, - "insertedIds": { - "$$unsetOrMatches": { - "0": 2, - "2": 3, - "4": 5 - } - }, - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 1, - "upsertedIds": { - "3": 4 - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 23 - }, - { - "_id": 3, - "x": 333 - }, - { - "_id": 4, - "x": 45 - }, - { - "_id": 5, - "x": 55 - } - ] - } - ] - }, - { - "description": "Both commands are retried after their first statement fails", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 2 - } - } - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 2 - } - }, - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 23 - } - ] - } - ] - }, - { - "description": "Second command is retried after its second statement fails", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "skip": 2 - } - } - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 2 - } - }, - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 23 - } - ] - } - ] - }, - { - "description": "BulkWrite with unordered execution", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - } - } - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - }, - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - } - ], - "ordered": false - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 2, - "insertedIds": { - "$$unsetOrMatches": { - "0": 2, - "1": 3 - } - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "First insertOne is never committed", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 2 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true, - "expectResult": { - "deletedCount": 0, - "insertedCount": 0, - "insertedIds": { - "$$unsetOrMatches": {} - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "Second updateOne is never committed", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "skip": 1 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true, - "expectResult": { - "deletedCount": 0, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 2 - } - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "Third updateOne is never committed", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "skip": 2 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "ordered": true - }, - "expectError": { - "isError": true, - "expectResult": { - "deletedCount": 0, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "1": 2 - } - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "Single-document write following deleteMany is retried", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteMany": { - "filter": { - "x": 11 - } - } - }, - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 1, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "1": 2 - } - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "Single-document write following updateMany is retried", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "updateMany": { - "filter": { - "x": 11 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "1": 2 - } - }, - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0, - "upsertedIds": {} - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/deleteMany.json b/tests/UnifiedSpecTests/retryable-writes/deleteMany.json deleted file mode 100644 index 087576cc0..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/deleteMany.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "description": "deleteMany", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "DeleteMany ignores retryWrites", - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": {} - }, - "expectResult": { - "deletedCount": 2 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/deleteOne-errorLabels.json b/tests/UnifiedSpecTests/retryable-writes/deleteOne-errorLabels.json deleted file mode 100644 index 88920862e..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/deleteOne-errorLabels.json +++ /dev/null @@ -1,266 +0,0 @@ -{ - "description": "deleteOne-errorLabels", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "DeleteOne succeeds with RetryableWriteError from server", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 112, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "deletedCount": 1 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "DeleteOne fails if server does not return RetryableWriteError", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 11600, - "errorLabels": [] - } - } - } - }, - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectError": { - "isError": true, - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "DeleteOne succeeds after PrimarySteppedDown", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 189, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "deletedCount": 1 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "DeleteOne succeeds after WriteConcernError ShutdownInProgress", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "deletedCount": 1 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/deleteOne-serverErrors.json b/tests/UnifiedSpecTests/retryable-writes/deleteOne-serverErrors.json deleted file mode 100644 index 0808b7921..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/deleteOne-serverErrors.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "description": "deleteOne-serverErrors", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "DeleteOne fails with RetryableWriteError label after two connection failures", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "delete" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectError": { - "isError": true, - "errorLabelsContain": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/deleteOne.json b/tests/UnifiedSpecTests/retryable-writes/deleteOne.json deleted file mode 100644 index c3aaf8865..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/deleteOne.json +++ /dev/null @@ -1,188 +0,0 @@ -{ - "description": "deleteOne", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "DeleteOne is committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - } - } - } - }, - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "deletedCount": 1 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "DeleteOne is not committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": { - "deletedCount": 1 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "DeleteOne is never committed", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 2 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/findOneAndDelete-errorLabels.json b/tests/UnifiedSpecTests/retryable-writes/findOneAndDelete-errorLabels.json deleted file mode 100644 index 8639873fc..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/findOneAndDelete-errorLabels.json +++ /dev/null @@ -1,289 +0,0 @@ -{ - "description": "findOneAndDelete-errorLabels", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndDelete succeeds with RetryableWriteError from server", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 112, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "x": { - "$gte": 11 - } - }, - "sort": { - "x": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndDelete fails if server does not return RetryableWriteError", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 11600, - "errorLabels": [] - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "x": { - "$gte": 11 - } - }, - "sort": { - "x": 1 - } - }, - "expectError": { - "isError": true, - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndDelete succeeds after PrimarySteppedDown", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 189, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "x": { - "$gte": 11 - } - }, - "sort": { - "x": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndDelete succeeds after WriteConcernError ShutdownInProgress", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "x": { - "$gte": 11 - } - }, - "sort": { - "x": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/findOneAndDelete-serverErrors.json b/tests/UnifiedSpecTests/retryable-writes/findOneAndDelete-serverErrors.json deleted file mode 100644 index f6d8e9d69..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/findOneAndDelete-serverErrors.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "description": "findOneAndDelete-serverErrors", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndDelete fails with a RetryableWriteError label after two connection failures", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "x": { - "$gte": 11 - } - }, - "sort": { - "x": 1 - } - }, - "expectError": { - "isError": true, - "errorLabelsContain": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/findOneAndDelete.json b/tests/UnifiedSpecTests/retryable-writes/findOneAndDelete.json deleted file mode 100644 index 89dbb9d65..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/findOneAndDelete.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "description": "findOneAndDelete", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndDelete is committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "x": { - "$gte": 11 - } - }, - "sort": { - "x": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndDelete is not committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "x": { - "$gte": 11 - } - }, - "sort": { - "x": 1 - } - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndDelete is never committed", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 2 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "x": { - "$gte": 11 - } - }, - "sort": { - "x": 1 - } - }, - "expectError": { - "isError": true - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/findOneAndReplace-errorLabels.json b/tests/UnifiedSpecTests/retryable-writes/findOneAndReplace-errorLabels.json deleted file mode 100644 index 78db52e75..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/findOneAndReplace-errorLabels.json +++ /dev/null @@ -1,301 +0,0 @@ -{ - "description": "findOneAndReplace-errorLabels", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndReplace succeeds with RetryableWriteError from server", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 112, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 111 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace fails if server does not return RetryableWriteError", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 11600, - "errorLabels": [] - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - }, - "returnDocument": "Before" - }, - "expectError": { - "isError": true, - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace succeeds after PrimarySteppedDown", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 189, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 111 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace succeeds after WriteConcernError ShutdownInProgress", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 111 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/findOneAndReplace-serverErrors.json b/tests/UnifiedSpecTests/retryable-writes/findOneAndReplace-serverErrors.json deleted file mode 100644 index 1c355c3eb..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/findOneAndReplace-serverErrors.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "description": "findOneAndReplace-serverErrors", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndReplace fails with a RetryableWriteError label after two connection failures", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - }, - "returnDocument": "Before" - }, - "expectError": { - "isError": true, - "errorLabelsContain": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/findOneAndReplace.json b/tests/UnifiedSpecTests/retryable-writes/findOneAndReplace.json deleted file mode 100644 index 6d1cc1797..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/findOneAndReplace.json +++ /dev/null @@ -1,213 +0,0 @@ -{ - "description": "findOneAndReplace", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndReplace is committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 111 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace is not committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 111 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndReplace is never committed", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 2 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - }, - "returnDocument": "Before" - }, - "expectError": { - "isError": true - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/findOneAndUpdate-errorLabels.json b/tests/UnifiedSpecTests/retryable-writes/findOneAndUpdate-errorLabels.json deleted file mode 100644 index 38b3f7ba4..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/findOneAndUpdate-errorLabels.json +++ /dev/null @@ -1,305 +0,0 @@ -{ - "description": "findOneAndUpdate-errorLabels", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndUpdate succeeds with RetryableWriteError from server", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 112, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate fails if server does not return RetryableWriteError", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 11600, - "errorLabels": [] - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectError": { - "isError": true, - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate succeeds after PrimarySteppedDown", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 189, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate succeeds after WriteConcernError ShutdownInProgress", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/findOneAndUpdate-serverErrors.json b/tests/UnifiedSpecTests/retryable-writes/findOneAndUpdate-serverErrors.json deleted file mode 100644 index 150012ac7..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/findOneAndUpdate-serverErrors.json +++ /dev/null @@ -1,120 +0,0 @@ -{ - "description": "findOneAndUpdate-serverErrors", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndUpdate fails with a RetryableWriteError label after two connection failures", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectError": { - "isError": true, - "errorLabelsContain": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/findOneAndUpdate.json b/tests/UnifiedSpecTests/retryable-writes/findOneAndUpdate.json deleted file mode 100644 index eb88fbe9b..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/findOneAndUpdate.json +++ /dev/null @@ -1,215 +0,0 @@ -{ - "description": "findOneAndUpdate", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndUpdate is committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate is not committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate is never committed", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 2 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectError": { - "isError": true - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/handshakeError.json b/tests/UnifiedSpecTests/retryable-writes/handshakeError.json deleted file mode 100644 index df37bd723..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/handshakeError.json +++ /dev/null @@ -1,1797 +0,0 @@ -{ - "description": "retryable writes handshake failures", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ], - "auth": true - } - ], - "createEntities": [ - { - "client": { - "id": "client", - "useMultipleMongoses": false, - "observeEvents": [ - "connectionCheckOutStartedEvent", - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-handshake-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "collection.insertOne succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 2, - "x": 22 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandSucceededEvent": { - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "collection.insertOne succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 2, - "x": 22 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandSucceededEvent": { - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "collection.insertMany succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandSucceededEvent": { - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "collection.insertMany succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandSucceededEvent": { - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "collection.deleteOne succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "delete" - } - }, - { - "commandSucceededEvent": { - "commandName": "delete" - } - } - ] - } - ] - }, - { - "description": "collection.deleteOne succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "delete" - } - }, - { - "commandSucceededEvent": { - "commandName": "delete" - } - } - ] - } - ] - }, - { - "description": "collection.replaceOne succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "replaceOne", - "object": "collection", - "arguments": { - "filter": {}, - "replacement": { - "x": 22 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandSucceededEvent": { - "commandName": "update" - } - } - ] - } - ] - }, - { - "description": "collection.replaceOne succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "replaceOne", - "object": "collection", - "arguments": { - "filter": {}, - "replacement": { - "x": 22 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandSucceededEvent": { - "commandName": "update" - } - } - ] - } - ] - }, - { - "description": "collection.updateOne succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "updateOne", - "object": "collection", - "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 22 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandSucceededEvent": { - "commandName": "update" - } - } - ] - } - ] - }, - { - "description": "collection.updateOne succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "updateOne", - "object": "collection", - "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 22 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "update" - } - }, - { - "commandSucceededEvent": { - "commandName": "update" - } - } - ] - } - ] - }, - { - "description": "collection.findOneAndDelete succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "findOneAndDelete", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandSucceededEvent": { - "commandName": "findAndModify" - } - } - ] - } - ] - }, - { - "description": "collection.findOneAndDelete succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "findOneAndDelete", - "object": "collection", - "arguments": { - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandSucceededEvent": { - "commandName": "findAndModify" - } - } - ] - } - ] - }, - { - "description": "collection.findOneAndReplace succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "findOneAndReplace", - "object": "collection", - "arguments": { - "filter": {}, - "replacement": { - "x": 22 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandSucceededEvent": { - "commandName": "findAndModify" - } - } - ] - } - ] - }, - { - "description": "collection.findOneAndReplace succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "findOneAndReplace", - "object": "collection", - "arguments": { - "filter": {}, - "replacement": { - "x": 22 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandSucceededEvent": { - "commandName": "findAndModify" - } - } - ] - } - ] - }, - { - "description": "collection.findOneAndUpdate succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "findOneAndUpdate", - "object": "collection", - "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 22 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandSucceededEvent": { - "commandName": "findAndModify" - } - } - ] - } - ] - }, - { - "description": "collection.findOneAndUpdate succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "findOneAndUpdate", - "object": "collection", - "arguments": { - "filter": {}, - "update": { - "$set": { - "x": 22 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "findAndModify" - } - }, - { - "commandSucceededEvent": { - "commandName": "findAndModify" - } - } - ] - } - ] - }, - { - "description": "collection.bulkWrite succeeds after retryable handshake network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandSucceededEvent": { - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "collection.bulkWrite succeeds after retryable handshake server error (ShutdownInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "ping", - "saslContinue" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 2, - "x": 22 - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-writes-handshake-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "commandName": "insert" - } - }, - { - "commandSucceededEvent": { - "commandName": "insert" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/insertMany-errorLabels.json b/tests/UnifiedSpecTests/retryable-writes/insertMany-errorLabels.json deleted file mode 100644 index 5254ba7cb..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/insertMany-errorLabels.json +++ /dev/null @@ -1,335 +0,0 @@ -{ - "description": "insertMany-errorLabels", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "InsertMany succeeds with RetryableWriteError from server", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 112, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "ordered": true - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 2, - "1": 3 - } - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "InsertMany fails if server does not return RetryableWriteError", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11600, - "errorLabels": [] - } - } - } - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "ordered": true - }, - "expectError": { - "isError": true, - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertMany succeeds after PrimarySteppedDown", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 189, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "ordered": true - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 2, - "1": 3 - } - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "InsertMany succeeds after WriteConcernError ShutdownInProgress", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "ordered": true - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 2, - "1": 3 - } - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/insertMany-serverErrors.json b/tests/UnifiedSpecTests/retryable-writes/insertMany-serverErrors.json deleted file mode 100644 index f5f513603..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/insertMany-serverErrors.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "description": "insertMany-serverErrors", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "InsertMany fails with a RetryableWriteError label after two connection failures", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "ordered": true - }, - "expectError": { - "isError": true, - "errorLabelsContain": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/insertMany.json b/tests/UnifiedSpecTests/retryable-writes/insertMany.json deleted file mode 100644 index 47181d0a9..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/insertMany.json +++ /dev/null @@ -1,233 +0,0 @@ -{ - "description": "insertMany", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "InsertMany succeeds after one network error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - } - } - } - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "ordered": true - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 2, - "1": 3 - } - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "InsertMany with unordered execution", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - } - } - } - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "ordered": false - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 2, - "1": 3 - } - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "InsertMany fails after multiple network errors", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": "alwaysOn", - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ], - "ordered": true - }, - "expectError": { - "isError": true - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/insertOne-errorLabels.json b/tests/UnifiedSpecTests/retryable-writes/insertOne-errorLabels.json deleted file mode 100644 index 39f31a8aa..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/insertOne-errorLabels.json +++ /dev/null @@ -1,1127 +0,0 @@ -{ - "description": "insertOne-errorLabels", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "InsertOne succeeds with RetryableWriteError from server", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 112, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne fails if server does not return RetryableWriteError", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11600, - "errorLabels": [] - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectError": { - "isError": true, - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [] - } - ] - }, - { - "description": "InsertOne succeeds after NotWritablePrimary", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 10107, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 13436, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 13435, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11602, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after InterruptedAtShutdown", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11600, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after PrimarySteppedDown", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 189, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after ShutdownInProgress", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 91, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after HostNotFound", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 7, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after HostUnreachable", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 6, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after SocketException", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 9001, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after NetworkTimeout", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 89, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after ExceededTimeLimit", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 262, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after WriteConcernError InterruptedAtShutdown", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 11600, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after WriteConcernError InterruptedDueToReplStateChange", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 11602, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after WriteConcernError PrimarySteppedDown", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 189, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after WriteConcernError ShutdownInProgress", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "InsertOne fails after multiple retryable writeConcernErrors", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 1, - "x": 11 - } - }, - "expectError": { - "isError": true, - "errorLabelsContain": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/insertOne-noWritesPerformedError.json b/tests/UnifiedSpecTests/retryable-writes/insertOne-noWritesPerformedError.json deleted file mode 100644 index 3194e91c5..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/insertOne-noWritesPerformedError.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "description": "retryable-writes insertOne noWritesPerformedErrors", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "6.0", - "topologies": [ - "replicaset" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "no-writes-performed-collection" - } - } - ], - "tests": [ - { - "description": "InsertOne fails after NoWritesPerformed error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 64, - "errorLabels": [ - "NoWritesPerformed", - "RetryableWriteError" - ] - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - } - }, - "expectError": { - "errorCode": 64, - "errorLabelsContain": [ - "NoWritesPerformed", - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "no-writes-performed-collection", - "databaseName": "retryable-writes-tests", - "documents": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/insertOne-serverErrors.json b/tests/UnifiedSpecTests/retryable-writes/insertOne-serverErrors.json deleted file mode 100644 index f404adcaf..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/insertOne-serverErrors.json +++ /dev/null @@ -1,865 +0,0 @@ -{ - "description": "retryable-writes insertOne serverErrors", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "InsertOne succeeds after retryable writeConcernError", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3, - "x": 33 - } - ] - }, - "commandName": "insert", - "databaseName": "retryable-writes-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3, - "x": 33 - } - ] - }, - "commandName": "insert", - "databaseName": "retryable-writes-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "RetryableWriteError label is added based on top-level code in pre-4.4 server response", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99", - "topologies": [ - "replicaset", - "sharded" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 189 - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectError": { - "errorLabelsContain": [ - "RetryableWriteError" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3, - "x": 33 - } - ] - }, - "commandName": "insert", - "databaseName": "retryable-writes-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3, - "x": 33 - } - ] - }, - "commandName": "insert", - "databaseName": "retryable-writes-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "RetryableWriteError label is added based on writeConcernError in pre-4.4 mongod response", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99", - "topologies": [ - "replicaset" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "insert" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectError": { - "errorLabelsContain": [ - "RetryableWriteError" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3, - "x": 33 - } - ] - }, - "commandName": "insert", - "databaseName": "retryable-writes-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3, - "x": 33 - } - ] - }, - "commandName": "insert", - "databaseName": "retryable-writes-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "RetryableWriteError label is not added based on writeConcernError in pre-4.4 mongos response", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99", - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectError": { - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3, - "x": 33 - } - ] - }, - "commandName": "insert", - "databaseName": "retryable-writes-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "InsertOne succeeds after connection failure", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "InsertOne fails after connection failure when retryWrites option is false", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryWrites": false - } - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ] - } - }, - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectError": { - "isError": true, - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "InsertOne fails after Interrupted", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601, - "closeConnection": false - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectError": { - "isError": true, - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "InsertOne fails after WriteConcernError Interrupted", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "writeConcernError": { - "code": 11601, - "errmsg": "operation was interrupted" - } - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectError": { - "isError": true, - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "InsertOne fails after WriteConcernError WriteConcernFailed", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "writeConcernError": { - "code": 64, - "codeName": "WriteConcernFailed", - "errmsg": "waiting for replication timed out", - "errInfo": { - "wtimeout": true - } - } - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectError": { - "isError": true, - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "InsertOne fails with a RetryableWriteError label after two connection failures", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectError": { - "isError": true, - "errorLabelsContain": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/insertOne.json b/tests/UnifiedSpecTests/retryable-writes/insertOne.json deleted file mode 100644 index 61957415e..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/insertOne.json +++ /dev/null @@ -1,215 +0,0 @@ -{ - "description": "insertOne", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "InsertOne is committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "InsertOne is not committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "InsertOne is never committed", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 2 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectError": { - "isError": true - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/replaceOne-errorLabels.json b/tests/UnifiedSpecTests/retryable-writes/replaceOne-errorLabels.json deleted file mode 100644 index 22c4561ae..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/replaceOne-errorLabels.json +++ /dev/null @@ -1,300 +0,0 @@ -{ - "description": "replaceOne-errorLabels", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "ReplaceOne succeeds with RetryableWriteError from server", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 112, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 111 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "ReplaceOne fails if server does not return RetryableWriteError", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 11600, - "errorLabels": [] - } - } - } - }, - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - } - }, - "expectError": { - "isError": true, - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "ReplaceOne succeeds after PrimarySteppedDown", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 189, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 111 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "ReplaceOne succeeds after WriteConcernError ShutdownInProgress", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 111 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/replaceOne-serverErrors.json b/tests/UnifiedSpecTests/retryable-writes/replaceOne-serverErrors.json deleted file mode 100644 index c957db724..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/replaceOne-serverErrors.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "description": "replaceOne-serverErrors", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "ReplaceOne fails with a RetryableWriteError label after two connection failures", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "update" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - } - }, - "expectError": { - "isError": true, - "errorLabelsContain": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/replaceOne.json b/tests/UnifiedSpecTests/retryable-writes/replaceOne.json deleted file mode 100644 index e58625bb5..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/replaceOne.json +++ /dev/null @@ -1,212 +0,0 @@ -{ - "description": "replaceOne", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "ReplaceOne is committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - } - } - } - }, - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 111 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "ReplaceOne is not committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 111 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "ReplaceOne is never committed", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 2 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - } - }, - "expectError": { - "isError": true - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/updateMany.json b/tests/UnifiedSpecTests/retryable-writes/updateMany.json deleted file mode 100644 index 260b7ad1c..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/updateMany.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "description": "updateMany", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "UpdateMany ignores retryWrites", - "operations": [ - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "filter": {}, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectResult": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 23 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/updateOne-errorLabels.json b/tests/UnifiedSpecTests/retryable-writes/updateOne-errorLabels.json deleted file mode 100644 index e44cef45f..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/updateOne-errorLabels.json +++ /dev/null @@ -1,304 +0,0 @@ -{ - "description": "updateOne-errorLabels", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "UpdateOne succeeds with RetryableWriteError from server", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 112, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "UpdateOne fails if server does not return RetryableWriteError", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 11600, - "errorLabels": [] - } - } - } - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectError": { - "isError": true, - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "UpdateOne succeeds after PrimarySteppedDown", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 189, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "UpdateOne succeeds after WriteConcernError ShutdownInProgress", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/updateOne-serverErrors.json b/tests/UnifiedSpecTests/retryable-writes/updateOne-serverErrors.json deleted file mode 100644 index 648834ada..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/updateOne-serverErrors.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "description": "updateOne-serverErrors", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "UpdateOne fails with a RetryableWriteError label after two connection failures", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "update" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectError": { - "isError": true, - "errorLabelsContain": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/retryable-writes/updateOne.json b/tests/UnifiedSpecTests/retryable-writes/updateOne.json deleted file mode 100644 index 7947cef3c..000000000 --- a/tests/UnifiedSpecTests/retryable-writes/updateOne.json +++ /dev/null @@ -1,394 +0,0 @@ -{ - "description": "updateOne", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "UpdateOne is committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - } - } - } - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "UpdateOne is not committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "UpdateOne is never committed", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 2 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectError": { - "isError": true - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "UpdateOne with upsert is committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - } - } - } - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 3, - "x": 33 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "upsert": true - }, - "expectResult": { - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 1, - "upsertedId": 3 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 34 - } - ] - } - ] - }, - { - "description": "UpdateOne with upsert is not committed on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 3, - "x": 33 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "upsert": true - }, - "expectResult": { - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 1, - "upsertedId": 3 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 34 - } - ] - } - ] - }, - { - "description": "UpdateOne with upsert is never committed", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 2 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "filter": { - "_id": 3, - "x": 33 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "upsert": true - }, - "expectError": { - "isError": true - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/run-command/runCommand.json b/tests/UnifiedSpecTests/run-command/runCommand.json deleted file mode 100644 index fde9de92e..000000000 --- a/tests/UnifiedSpecTests/run-command/runCommand.json +++ /dev/null @@ -1,634 +0,0 @@ -{ - "description": "runCommand", - "schemaVersion": "1.3", - "createEntities": [ - { - "client": { - "id": "client", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "db", - "client": "client", - "databaseName": "db" - } - }, - { - "collection": { - "id": "collection", - "database": "db", - "collectionName": "collection" - } - }, - { - "database": { - "id": "dbWithRC", - "client": "client", - "databaseName": "dbWithRC", - "databaseOptions": { - "readConcern": { - "level": "local" - } - } - } - }, - { - "database": { - "id": "dbWithWC", - "client": "client", - "databaseName": "dbWithWC", - "databaseOptions": { - "writeConcern": { - "w": 0 - } - } - } - }, - { - "session": { - "id": "session", - "client": "client" - } - }, - { - "client": { - "id": "clientWithStableApi", - "observeEvents": [ - "commandStartedEvent" - ], - "serverApi": { - "version": "1", - "strict": true - } - } - }, - { - "database": { - "id": "dbWithStableApi", - "client": "clientWithStableApi", - "databaseName": "dbWithStableApi" - } - } - ], - "initialData": [ - { - "collectionName": "collection", - "databaseName": "db", - "documents": [] - } - ], - "tests": [ - { - "description": "always attaches $db and implicit lsid to given command and omits default readPreference", - "operations": [ - { - "name": "runCommand", - "object": "db", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectResult": { - "ok": 1 - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1, - "$db": "db", - "lsid": { - "$$exists": true - }, - "$readPreference": { - "$$exists": false - } - }, - "commandName": "ping" - } - } - ] - } - ] - }, - { - "description": "always gossips the $clusterTime on the sent command", - "runOnRequirements": [ - { - "topologies": [ - "replicaset", - "sharded" - ] - } - ], - "operations": [ - { - "name": "runCommand", - "object": "db", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectResult": { - "ok": 1 - } - }, - { - "name": "runCommand", - "object": "db", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectResult": { - "ok": 1 - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "commandName": "ping" - } - }, - { - "commandStartedEvent": { - "command": { - "ping": 1, - "$clusterTime": { - "$$exists": true - } - }, - "commandName": "ping" - } - } - ] - } - ] - }, - { - "description": "attaches the provided session lsid to given command", - "operations": [ - { - "name": "runCommand", - "object": "db", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - }, - "session": "session" - }, - "expectResult": { - "ok": 1 - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1, - "lsid": { - "$$sessionLsid": "session" - }, - "$db": "db" - }, - "commandName": "ping" - } - } - ] - } - ] - }, - { - "description": "attaches the provided $readPreference to given command", - "runOnRequirements": [ - { - "topologies": [ - "replicaset", - "load-balanced", - "sharded" - ] - } - ], - "operations": [ - { - "name": "runCommand", - "object": "db", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - }, - "readPreference": { - "mode": "nearest" - } - }, - "expectResult": { - "ok": 1 - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1, - "$readPreference": { - "mode": "nearest" - }, - "$db": "db" - }, - "commandName": "ping" - } - } - ] - } - ] - }, - { - "description": "does not attach $readPreference to given command on standalone", - "runOnRequirements": [ - { - "topologies": [ - "single" - ] - } - ], - "operations": [ - { - "name": "runCommand", - "object": "db", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - }, - "readPreference": { - "mode": "nearest" - } - }, - "expectResult": { - "ok": 1 - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1, - "$readPreference": { - "$$exists": false - }, - "$db": "db" - }, - "commandName": "ping" - } - } - ] - } - ] - }, - { - "description": "does not attach primary $readPreference to given command", - "operations": [ - { - "name": "runCommand", - "object": "db", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - }, - "readPreference": { - "mode": "primary" - } - }, - "expectResult": { - "ok": 1 - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1, - "$readPreference": { - "$$exists": false - }, - "$db": "db" - }, - "commandName": "ping" - } - } - ] - } - ] - }, - { - "description": "does not inherit readConcern specified at the db level", - "operations": [ - { - "name": "runCommand", - "object": "dbWithRC", - "arguments": { - "commandName": "aggregate", - "command": { - "aggregate": "collection", - "pipeline": [], - "cursor": {} - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection", - "readConcern": { - "$$exists": false - }, - "$db": "dbWithRC" - }, - "commandName": "aggregate" - } - } - ] - } - ] - }, - { - "description": "does not inherit writeConcern specified at the db level", - "operations": [ - { - "name": "runCommand", - "object": "dbWithWC", - "arguments": { - "commandName": "insert", - "command": { - "insert": "collection", - "documents": [ - { - "foo": "bar" - } - ], - "ordered": true - } - }, - "expectResult": { - "ok": 1 - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "collection", - "writeConcern": { - "$$exists": false - }, - "$db": "dbWithWC" - }, - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "does not retry retryable errors on given command", - "runOnRequirements": [ - { - "minServerVersion": "4.2" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "ping" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "db", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ] - }, - { - "description": "attaches transaction fields to given command", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.2", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "operations": [ - { - "name": "withTransaction", - "object": "session", - "arguments": { - "callback": [ - { - "name": "runCommand", - "object": "db", - "arguments": { - "session": "session", - "commandName": "insert", - "command": { - "insert": "collection", - "documents": [ - { - "foo": "transaction" - } - ], - "ordered": true - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "collection", - "documents": [ - { - "foo": "transaction" - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session" - }, - "txnNumber": 1, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "db" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session" - }, - "txnNumber": 1, - "autocommit": false, - "writeConcern": { - "$$exists": false - }, - "readConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "attaches apiVersion fields to given command when stableApi is configured on the client", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "runCommand", - "object": "dbWithStableApi", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectResult": { - "ok": 1 - } - } - ], - "expectEvents": [ - { - "client": "clientWithStableApi", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1, - "$db": "dbWithStableApi", - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - }, - "commandName": "ping" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/sessions/driver-sessions-dirty-session-errors.json b/tests/UnifiedSpecTests/sessions/driver-sessions-dirty-session-errors.json deleted file mode 100644 index 6aa1da1df..000000000 --- a/tests/UnifiedSpecTests/sessions/driver-sessions-dirty-session-errors.json +++ /dev/null @@ -1,968 +0,0 @@ -{ - "description": "driver-sessions-dirty-session-errors", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "session-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "session-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ], - "tests": [ - { - "description": "Dirty explicit session is discarded (insert)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "assertSessionNotDirty", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "name": "assertSessionDirty", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "assertSessionDirty", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "endSession", - "object": "session0" - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": -1 - } - }, - "expectResult": [] - }, - { - "name": "assertDifferentLsidOnLastTwoCommands", - "object": "testRunner", - "arguments": { - "client": "client0" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1 - }, - "commandName": "insert", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1 - }, - "commandName": "insert", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 2 - }, - "commandName": "insert", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": -1 - }, - "lsid": { - "$$type": "object" - } - }, - "commandName": "find", - "databaseName": "session-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "session-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ] - }, - { - "description": "Dirty explicit session is discarded (findAndModify)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "closeConnection": true - } - } - } - }, - { - "name": "assertSessionNotDirty", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 1 - } - }, - { - "name": "assertSessionDirty", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "endSession", - "object": "session0" - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": -1 - } - }, - "expectResult": [] - }, - { - "name": "assertDifferentLsidOnLastTwoCommands", - "object": "testRunner", - "arguments": { - "client": "client0" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": false, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": false, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": -1 - }, - "lsid": { - "$$type": "object" - } - }, - "commandName": "find", - "databaseName": "session-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "session-tests", - "documents": [ - { - "_id": 1, - "x": 1 - } - ] - } - ] - }, - { - "description": "Dirty implicit session is discarded (insert)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": -1 - } - }, - "expectResult": [] - }, - { - "name": "assertDifferentLsidOnLastTwoCommands", - "object": "testRunner", - "arguments": { - "client": "client0" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$type": "object" - }, - "txnNumber": 1 - }, - "commandName": "insert", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$type": "object" - }, - "txnNumber": 1 - }, - "commandName": "insert", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": -1 - }, - "lsid": { - "$$type": "object" - } - }, - "commandName": "find", - "databaseName": "session-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "session-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "Dirty implicit session is discarded (findAndModify)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "closeConnection": true - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 1 - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": -1 - } - }, - "expectResult": [] - }, - { - "name": "assertDifferentLsidOnLastTwoCommands", - "object": "testRunner", - "arguments": { - "client": "client0" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": false, - "lsid": { - "$$type": "object" - }, - "txnNumber": 1, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": false, - "lsid": { - "$$type": "object" - }, - "txnNumber": 1, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": -1 - }, - "lsid": { - "$$type": "object" - } - }, - "commandName": "find", - "databaseName": "session-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "session-tests", - "documents": [ - { - "_id": 1, - "x": 1 - } - ] - } - ] - }, - { - "description": "Dirty implicit session is discarded (read returning cursor)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 1 - } - ] - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": -1 - } - }, - "expectResult": [] - }, - { - "name": "assertDifferentLsidOnLastTwoCommands", - "object": "testRunner", - "arguments": { - "client": "client0" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "lsid": { - "$$type": "object" - } - }, - "commandName": "aggregate", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "lsid": { - "$$type": "object" - } - }, - "commandName": "aggregate", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": -1 - }, - "lsid": { - "$$type": "object" - } - }, - "commandName": "find", - "databaseName": "session-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "session-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "Dirty implicit session is discarded (read not returning cursor)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "name": "countDocuments", - "object": "collection0", - "arguments": { - "filter": {} - }, - "expectResult": 1 - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": -1 - } - }, - "expectResult": [] - }, - { - "name": "assertDifferentLsidOnLastTwoCommands", - "object": "testRunner", - "arguments": { - "client": "client0" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ], - "lsid": { - "$$type": "object" - } - }, - "commandName": "aggregate", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$match": {} - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ], - "lsid": { - "$$type": "object" - } - }, - "commandName": "aggregate", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": -1 - }, - "lsid": { - "$$type": "object" - } - }, - "commandName": "find", - "databaseName": "session-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "session-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/sessions/driver-sessions-server-support.json b/tests/UnifiedSpecTests/sessions/driver-sessions-server-support.json deleted file mode 100644 index 55312b32e..000000000 --- a/tests/UnifiedSpecTests/sessions/driver-sessions-server-support.json +++ /dev/null @@ -1,256 +0,0 @@ -{ - "description": "driver-sessions-server-support", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.6" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "session-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "session-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ], - "tests": [ - { - "description": "Server supports explicit sessions", - "operations": [ - { - "name": "assertSessionNotDirty", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "name": "assertSessionNotDirty", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "endSession", - "object": "session0" - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": -1 - } - }, - "expectResult": [] - }, - { - "name": "assertSameLsidOnLastTwoCommands", - "object": "testRunner", - "arguments": { - "client": "client0" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - } - }, - "commandName": "insert", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": -1 - }, - "lsid": { - "$$sessionLsid": "session0" - } - }, - "commandName": "find", - "databaseName": "session-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "session-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "Server supports implicit sessions", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": -1 - } - }, - "expectResult": [] - }, - { - "name": "assertSameLsidOnLastTwoCommands", - "object": "testRunner", - "arguments": { - "client": "client0" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$type": "object" - } - }, - "commandName": "insert", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": -1 - }, - "lsid": { - "$$type": "object" - } - }, - "commandName": "find", - "databaseName": "session-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "session-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/sessions/implicit-sessions-default-causal-consistency.json b/tests/UnifiedSpecTests/sessions/implicit-sessions-default-causal-consistency.json deleted file mode 100644 index 517c8ebc6..000000000 --- a/tests/UnifiedSpecTests/sessions/implicit-sessions-default-causal-consistency.json +++ /dev/null @@ -1,318 +0,0 @@ -{ - "description": "implicit sessions default causal consistency", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "implicit-cc-tests" - } - }, - { - "collection": { - "id": "collectionDefault", - "database": "database0", - "collectionName": "coll-default" - } - }, - { - "collection": { - "id": "collectionSnapshot", - "database": "database0", - "collectionName": "coll-snapshot", - "collectionOptions": { - "readConcern": { - "level": "snapshot" - } - } - } - }, - { - "collection": { - "id": "collectionlinearizable", - "database": "database0", - "collectionName": "coll-linearizable", - "collectionOptions": { - "readConcern": { - "level": "linearizable" - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll-default", - "databaseName": "implicit-cc-tests", - "documents": [ - { - "_id": 1, - "x": "default" - } - ] - }, - { - "collectionName": "coll-snapshot", - "databaseName": "implicit-cc-tests", - "documents": [ - { - "_id": 1, - "x": "snapshot" - } - ] - }, - { - "collectionName": "coll-linearizable", - "databaseName": "implicit-cc-tests", - "documents": [ - { - "_id": 1, - "x": "linearizable" - } - ] - } - ], - "tests": [ - { - "description": "readConcern is not sent on retried read in implicit session when readConcern level is not specified", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 11600 - } - } - } - }, - { - "name": "find", - "object": "collectionDefault", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": 1, - "x": "default" - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll-default", - "filter": {}, - "readConcern": { - "$$exists": false - } - }, - "databaseName": "implicit-cc-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll-default", - "filter": {}, - "readConcern": { - "$$exists": false - } - }, - "databaseName": "implicit-cc-tests" - } - } - ] - } - ] - }, - { - "description": "afterClusterTime is not sent on retried read in implicit session when readConcern level is snapshot", - "runOnRequirements": [ - { - "minServerVersion": "5.0" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 11600 - } - } - } - }, - { - "name": "find", - "object": "collectionSnapshot", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": 1, - "x": "snapshot" - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll-snapshot", - "filter": {}, - "readConcern": { - "level": "snapshot", - "afterClusterTime": { - "$$exists": false - } - } - }, - "databaseName": "implicit-cc-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll-snapshot", - "filter": {}, - "readConcern": { - "level": "snapshot", - "afterClusterTime": { - "$$exists": false - } - } - }, - "databaseName": "implicit-cc-tests" - } - } - ] - } - ] - }, - { - "description": "afterClusterTime is not sent on retried read in implicit session when readConcern level is linearizable", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 11600 - } - } - } - }, - { - "name": "find", - "object": "collectionlinearizable", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": 1, - "x": "linearizable" - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll-linearizable", - "filter": {}, - "readConcern": { - "level": "linearizable", - "afterClusterTime": { - "$$exists": false - } - } - }, - "databaseName": "implicit-cc-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll-linearizable", - "filter": {}, - "readConcern": { - "level": "linearizable", - "afterClusterTime": { - "$$exists": false - } - } - }, - "databaseName": "implicit-cc-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/sessions/snapshot-sessions-not-supported-client-error.json b/tests/UnifiedSpecTests/sessions/snapshot-sessions-not-supported-client-error.json deleted file mode 100644 index 208e4cfe6..000000000 --- a/tests/UnifiedSpecTests/sessions/snapshot-sessions-not-supported-client-error.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "description": "snapshot-sessions-not-supported-client-error", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "maxServerVersion": "4.4.99" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - }, - { - "session": { - "id": "session0", - "client": "client0", - "sessionOptions": { - "snapshot": true - } - } - } - ], - "initialData": [ - { - "collectionName": "collection0", - "databaseName": "database0", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "Client error on find with snapshot", - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": {} - }, - "expectError": { - "isClientError": true, - "errorContains": "Snapshot reads require MongoDB 5.0 or later" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Client error on aggregate with snapshot", - "operations": [ - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "session": "session0", - "pipeline": [] - }, - "expectError": { - "isClientError": true, - "errorContains": "Snapshot reads require MongoDB 5.0 or later" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Client error on distinct with snapshot", - "operations": [ - { - "name": "distinct", - "object": "collection0", - "arguments": { - "fieldName": "x", - "filter": {}, - "session": "session0" - }, - "expectError": { - "isClientError": true, - "errorContains": "Snapshot reads require MongoDB 5.0 or later" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/sessions/snapshot-sessions-not-supported-server-error.json b/tests/UnifiedSpecTests/sessions/snapshot-sessions-not-supported-server-error.json deleted file mode 100644 index 79213f314..000000000 --- a/tests/UnifiedSpecTests/sessions/snapshot-sessions-not-supported-server-error.json +++ /dev/null @@ -1,187 +0,0 @@ -{ - "description": "snapshot-sessions-not-supported-server-error", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "5.0", - "topologies": [ - "single" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - }, - { - "session": { - "id": "session0", - "client": "client0", - "sessionOptions": { - "snapshot": true - } - } - } - ], - "initialData": [ - { - "collectionName": "collection0", - "databaseName": "database0", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "Server returns an error on find with snapshot", - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": {} - }, - "expectError": { - "isError": true, - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandFailedEvent": { - "commandName": "find" - } - } - ] - } - ] - }, - { - "description": "Server returns an error on aggregate with snapshot", - "operations": [ - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "session": "session0", - "pipeline": [] - }, - "expectError": { - "isError": true, - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandFailedEvent": { - "commandName": "aggregate" - } - } - ] - } - ] - }, - { - "description": "Server returns an error on distinct with snapshot", - "operations": [ - { - "name": "distinct", - "object": "collection0", - "arguments": { - "fieldName": "x", - "filter": {}, - "session": "session0" - }, - "expectError": { - "isError": true, - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandFailedEvent": { - "commandName": "distinct" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/sessions/snapshot-sessions-unsupported-ops.json b/tests/UnifiedSpecTests/sessions/snapshot-sessions-unsupported-ops.json deleted file mode 100644 index c41f74d33..000000000 --- a/tests/UnifiedSpecTests/sessions/snapshot-sessions-unsupported-ops.json +++ /dev/null @@ -1,493 +0,0 @@ -{ - "description": "snapshot-sessions-unsupported-ops", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "5.0", - "topologies": [ - "replicaset", - "sharded" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0" - } - }, - { - "session": { - "id": "session0", - "client": "client0", - "sessionOptions": { - "snapshot": true - } - } - } - ], - "initialData": [ - { - "collectionName": "collection0", - "databaseName": "database0", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "Server returns an error on insertOne with snapshot", - "runOnRequirements": [ - { - "topologies": [ - "replicaset" - ] - } - ], - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 22, - "x": 22 - } - }, - "expectError": { - "isError": true, - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandFailedEvent": { - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "Server returns an error on insertMany with snapshot", - "runOnRequirements": [ - { - "topologies": [ - "replicaset" - ] - } - ], - "operations": [ - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "session": "session0", - "documents": [ - { - "_id": 22, - "x": 22 - }, - { - "_id": 33, - "x": 33 - } - ] - }, - "expectError": { - "isError": true, - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandFailedEvent": { - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "Server returns an error on deleteOne with snapshot", - "runOnRequirements": [ - { - "topologies": [ - "replicaset" - ] - } - ], - "operations": [ - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": {} - }, - "expectError": { - "isError": true, - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandFailedEvent": { - "commandName": "delete" - } - } - ] - } - ] - }, - { - "description": "Server returns an error on updateOne with snapshot", - "runOnRequirements": [ - { - "topologies": [ - "replicaset" - ] - } - ], - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectError": { - "isError": true, - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandFailedEvent": { - "commandName": "update" - } - } - ] - } - ] - }, - { - "description": "Server returns an error on findOneAndUpdate with snapshot", - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectError": { - "isError": true, - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandFailedEvent": { - "commandName": "findAndModify" - } - } - ] - } - ] - }, - { - "description": "Server returns an error on listDatabases with snapshot", - "operations": [ - { - "name": "listDatabases", - "object": "client0", - "arguments": { - "session": "session0" - }, - "expectError": { - "isError": true, - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1, - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandFailedEvent": { - "commandName": "listDatabases" - } - } - ] - } - ] - }, - { - "description": "Server returns an error on listCollections with snapshot", - "operations": [ - { - "name": "listCollections", - "object": "database0", - "arguments": { - "session": "session0" - }, - "expectError": { - "isError": true, - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1, - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandFailedEvent": { - "commandName": "listCollections" - } - } - ] - } - ] - }, - { - "description": "Server returns an error on listIndexes with snapshot", - "operations": [ - { - "name": "listIndexes", - "object": "collection0", - "arguments": { - "session": "session0" - }, - "expectError": { - "isError": true, - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listIndexes": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandFailedEvent": { - "commandName": "listIndexes" - } - } - ] - } - ] - }, - { - "description": "Server returns an error on runCommand with snapshot", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "session": "session0", - "commandName": "listCollections", - "command": { - "listCollections": 1 - } - }, - "expectError": { - "isError": true, - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listCollections": 1, - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandFailedEvent": { - "commandName": "listCollections" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/sessions/snapshot-sessions.json b/tests/UnifiedSpecTests/sessions/snapshot-sessions.json deleted file mode 100644 index 260f8b6f4..000000000 --- a/tests/UnifiedSpecTests/sessions/snapshot-sessions.json +++ /dev/null @@ -1,993 +0,0 @@ -{ - "description": "snapshot-sessions", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "5.0", - "topologies": [ - "replicaset", - "sharded" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "findAndModify", - "insert", - "update" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "collection0", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "session": { - "id": "session0", - "client": "client0", - "sessionOptions": { - "snapshot": true - } - } - }, - { - "session": { - "id": "session1", - "client": "client0", - "sessionOptions": { - "snapshot": true - } - } - } - ], - "initialData": [ - { - "collectionName": "collection0", - "databaseName": "database0", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "Find operation with snapshot", - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - } - ] - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "After" - }, - "expectResult": { - "_id": 1, - "x": 12 - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "session": "session1", - "filter": { - "_id": 1 - } - }, - "expectResult": [ - { - "_id": 1, - "x": 12 - } - ] - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "After" - }, - "expectResult": { - "_id": 1, - "x": 13 - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": [ - { - "_id": 1, - "x": 13 - } - ] - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - } - ] - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "session": "session1", - "filter": { - "_id": 1 - } - }, - "expectResult": [ - { - "_id": 1, - "x": 12 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "find": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "find": "collection0", - "readConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "find": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": true - } - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "find": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": true - } - } - } - } - } - ] - } - ] - }, - { - "description": "Distinct operation with snapshot", - "operations": [ - { - "name": "distinct", - "object": "collection0", - "arguments": { - "fieldName": "x", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 11 - ] - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "After" - }, - "expectResult": { - "_id": 2, - "x": 12 - } - }, - { - "name": "distinct", - "object": "collection0", - "arguments": { - "fieldName": "x", - "filter": {}, - "session": "session1" - }, - "expectResult": [ - 11, - 12 - ] - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "After" - }, - "expectResult": { - "_id": 2, - "x": 13 - } - }, - { - "name": "distinct", - "object": "collection0", - "arguments": { - "fieldName": "x", - "filter": {} - }, - "expectResult": [ - 11, - 13 - ] - }, - { - "name": "distinct", - "object": "collection0", - "arguments": { - "fieldName": "x", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 11 - ] - }, - { - "name": "distinct", - "object": "collection0", - "arguments": { - "fieldName": "x", - "filter": {}, - "session": "session1" - }, - "expectResult": [ - 11, - 12 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "collection0", - "readConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": true - } - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": true - } - } - } - } - } - ] - } - ] - }, - { - "description": "Aggregate operation with snapshot", - "operations": [ - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": 1 - } - } - ], - "session": "session0" - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - } - ] - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "After" - }, - "expectResult": { - "_id": 1, - "x": 12 - } - }, - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": 1 - } - } - ], - "session": "session1" - }, - "expectResult": [ - { - "_id": 1, - "x": 12 - } - ] - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "After" - }, - "expectResult": { - "_id": 1, - "x": 13 - } - }, - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 1, - "x": 13 - } - ] - }, - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": 1 - } - } - ], - "session": "session0" - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - } - ] - }, - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": 1 - } - } - ], - "session": "session1" - }, - "expectResult": [ - { - "_id": 1, - "x": 12 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "readConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": true - } - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": true - } - } - } - } - } - ] - } - ] - }, - { - "description": "countDocuments operation with snapshot", - "operations": [ - { - "name": "countDocuments", - "object": "collection0", - "arguments": { - "filter": {}, - "session": "session0" - }, - "expectResult": 2 - }, - { - "name": "countDocuments", - "object": "collection0", - "arguments": { - "filter": {}, - "session": "session0" - }, - "expectResult": 2 - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": true - } - } - } - } - } - ] - } - ] - }, - { - "description": "Mixed operation with snapshot", - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - } - ] - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "After" - }, - "expectResult": { - "_id": 1, - "x": 12 - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": [ - { - "_id": 1, - "x": 12 - } - ] - }, - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": 1 - } - } - ], - "session": "session0" - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - } - ] - }, - { - "name": "distinct", - "object": "collection0", - "arguments": { - "fieldName": "x", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 11 - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "find": "collection0", - "readConcern": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": true - } - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": true - } - } - } - } - } - ] - } - ] - }, - { - "description": "Write commands with snapshot session do not affect snapshot reads", - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": {}, - "session": "session0" - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 22, - "x": 33 - } - } - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "find": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": true - } - } - } - } - } - ] - } - ] - }, - { - "description": "First snapshot read does not send atClusterTime", - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": {}, - "session": "session0" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "collection0", - "readConcern": { - "level": "snapshot", - "atClusterTime": { - "$$exists": false - } - } - }, - "commandName": "find", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "StartTransaction fails in snapshot session", - "operations": [ - { - "name": "startTransaction", - "object": "session0", - "expectError": { - "isError": true, - "isClientError": true, - "errorContains": "Transactions are not supported in snapshot sessions" - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions-convenient-api/callback-aborts.json b/tests/UnifiedSpecTests/transactions-convenient-api/callback-aborts.json deleted file mode 100644 index 206428715..000000000 --- a/tests/UnifiedSpecTests/transactions-convenient-api/callback-aborts.json +++ /dev/null @@ -1,344 +0,0 @@ -{ - "description": "callback-aborts", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "withTransaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "withTransaction succeeds if callback aborts", - "operations": [ - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [] - } - ] - }, - { - "description": "withTransaction succeeds if callback aborts with no ops", - "operations": [ - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "abortTransaction", - "object": "session0" - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [] - } - ] - }, - { - "description": "withTransaction still succeeds if callback aborts and runs extra op", - "operations": [ - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "autocommit": { - "$$exists": false - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions-convenient-api/callback-commits.json b/tests/UnifiedSpecTests/transactions-convenient-api/callback-commits.json deleted file mode 100644 index 06f791e9a..000000000 --- a/tests/UnifiedSpecTests/transactions-convenient-api/callback-commits.json +++ /dev/null @@ -1,423 +0,0 @@ -{ - "description": "callback-commits", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "withTransaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "withTransaction succeeds if callback commits", - "operations": [ - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "withTransaction still succeeds if callback commits and runs extra op", - "operations": [ - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "autocommit": { - "$$exists": false - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions-convenient-api/callback-retry.json b/tests/UnifiedSpecTests/transactions-convenient-api/callback-retry.json deleted file mode 100644 index 277dfa18e..000000000 --- a/tests/UnifiedSpecTests/transactions-convenient-api/callback-retry.json +++ /dev/null @@ -1,472 +0,0 @@ -{ - "description": "callback-retry", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "withTransaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - }, - { - "client": { - "id": "client1", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "withTransaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "callback succeeds after multiple connection errors", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "ignoreResultAndError": true - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "3" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "callback is not retried after non-transient error (DuplicateKeyError)", - "operations": [ - { - "name": "withTransaction", - "object": "session1", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection1", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "name": "insertOne", - "object": "collection1", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - } - ] - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ], - "errorContains": "E11000" - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions-convenient-api/commit-retry-errorLabels.json b/tests/UnifiedSpecTests/transactions-convenient-api/commit-retry-errorLabels.json deleted file mode 100644 index c6a4e44d6..000000000 --- a/tests/UnifiedSpecTests/transactions-convenient-api/commit-retry-errorLabels.json +++ /dev/null @@ -1,231 +0,0 @@ -{ - "description": "commit-retry-errorLabels", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "withTransaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "commit is retried after commitTransaction UnknownTransactionCommitResult (NotWritablePrimary)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 10107, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions-convenient-api/commit-retry.json b/tests/UnifiedSpecTests/transactions-convenient-api/commit-retry.json deleted file mode 100644 index 928f0167e..000000000 --- a/tests/UnifiedSpecTests/transactions-convenient-api/commit-retry.json +++ /dev/null @@ -1,552 +0,0 @@ -{ - "description": "commit-retry", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "withTransaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "commitTransaction succeeds after multiple connection errors", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "closeConnection": true - } - } - } - }, - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction retry only overwrites write concern w option", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "closeConnection": true - } - } - } - }, - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "writeConcern": { - "w": 2, - "journal": true, - "wtimeoutMS": 5000 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": 2, - "j": true, - "wtimeout": 5000 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "j": true, - "wtimeout": 5000 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "j": true, - "wtimeout": 5000 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commit is not retried after MaxTimeMSExpired error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 50 - } - } - } - }, - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "maxCommitTimeMS": 60000 - }, - "expectError": { - "errorCodeName": "MaxTimeMSExpired", - "errorLabelsContain": [ - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "maxTimeMS": 60000, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions-convenient-api/commit-transienttransactionerror-4.2.json b/tests/UnifiedSpecTests/transactions-convenient-api/commit-transienttransactionerror-4.2.json deleted file mode 100644 index 0f5a78245..000000000 --- a/tests/UnifiedSpecTests/transactions-convenient-api/commit-transienttransactionerror-4.2.json +++ /dev/null @@ -1,294 +0,0 @@ -{ - "description": "commit-transienttransactionerror-4.2", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.1.6", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ], - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "withTransaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "transaction is retried after commitTransaction TransientTransactionError (PreparedTransactionInProgress)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 267, - "closeConnection": false - } - } - } - }, - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "3" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions-convenient-api/commit-transienttransactionerror.json b/tests/UnifiedSpecTests/transactions-convenient-api/commit-transienttransactionerror.json deleted file mode 100644 index dd5158d81..000000000 --- a/tests/UnifiedSpecTests/transactions-convenient-api/commit-transienttransactionerror.json +++ /dev/null @@ -1,996 +0,0 @@ -{ - "description": "commit-transienttransactionerror", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ], - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "withTransaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "transaction is retried after commitTransaction TransientTransactionError (LockTimeout)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 24, - "closeConnection": false - } - } - } - }, - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "3" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "transaction is retried after commitTransaction TransientTransactionError (WriteConflict)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 112, - "closeConnection": false - } - } - } - }, - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "3" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "transaction is retried after commitTransaction TransientTransactionError (SnapshotUnavailable)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 246, - "closeConnection": false - } - } - } - }, - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "3" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "transaction is retried after commitTransaction TransientTransactionError (NoSuchTransaction)", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 251, - "closeConnection": false - } - } - } - }, - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "3" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions-convenient-api/commit-writeconcernerror.json b/tests/UnifiedSpecTests/transactions-convenient-api/commit-writeconcernerror.json deleted file mode 100644 index a6f6e6bd7..000000000 --- a/tests/UnifiedSpecTests/transactions-convenient-api/commit-writeconcernerror.json +++ /dev/null @@ -1,814 +0,0 @@ -{ - "description": "commit-writeconcernerror", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "withTransaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "commitTransaction is retried after WriteConcernFailed timeout error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 64, - "codeName": "WriteConcernFailed", - "errmsg": "waiting for replication timed out", - "errInfo": { - "wtimeout": true - } - } - } - } - } - }, - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction is retried after WriteConcernFailed non-timeout error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 64, - "codeName": "WriteConcernFailed", - "errmsg": "multiple errors reported" - } - } - } - } - }, - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction is not retried after UnknownReplWriteConcern error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 79, - "codeName": "UnknownReplWriteConcern", - "errmsg": "No write concern mode named 'foo' found in replica set configuration" - } - } - } - } - }, - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - }, - "expectError": { - "errorCodeName": "UnknownReplWriteConcern", - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction is not retried after UnsatisfiableWriteConcern error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 100, - "codeName": "UnsatisfiableWriteConcern", - "errmsg": "Not enough data-bearing nodes" - } - } - } - } - }, - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - }, - "expectError": { - "errorCodeName": "UnsatisfiableWriteConcern", - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction is not retried after MaxTimeMSExpired error", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 50, - "codeName": "MaxTimeMSExpired", - "errmsg": "operation exceeded time limit" - } - } - } - } - }, - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - }, - "expectError": { - "errorCodeName": "MaxTimeMSExpired", - "errorLabelsContain": [ - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions-convenient-api/commit.json b/tests/UnifiedSpecTests/transactions-convenient-api/commit.json deleted file mode 100644 index 5684d5ee8..000000000 --- a/tests/UnifiedSpecTests/transactions-convenient-api/commit.json +++ /dev/null @@ -1,398 +0,0 @@ -{ - "description": "commit", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "withTransaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "withTransaction commits after callback returns", - "operations": [ - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "withTransaction commits after callback returns (second transaction)", - "operations": [ - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions-convenient-api/transaction-options.json b/tests/UnifiedSpecTests/transactions-convenient-api/transaction-options.json deleted file mode 100644 index b1a74c5fd..000000000 --- a/tests/UnifiedSpecTests/transactions-convenient-api/transaction-options.json +++ /dev/null @@ -1,819 +0,0 @@ -{ - "description": "transaction-options", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "withTransaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "withTransaction and no transaction options set", - "operations": [ - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "withTransaction inherits transaction options from client", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": true, - "uriOptions": { - "readConcernLevel": "local", - "w": 1 - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "withTransaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1" - } - } - ] - } - }, - { - "name": "withTransaction", - "object": "session1", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection1", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "local" - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": 1 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "withTransaction inherits transaction options from defaultTransactionOptions", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "session": { - "id": "session1", - "client": "client0", - "sessionOptions": { - "defaultTransactionOptions": { - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "w": 1 - } - } - } - } - } - ] - } - }, - { - "name": "withTransaction", - "object": "session1", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": 1 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "withTransaction explicit transaction options", - "operations": [ - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "w": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": 1 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "withTransaction explicit transaction options override defaultTransactionOptions", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "session": { - "id": "session1", - "client": "client0", - "sessionOptions": { - "defaultTransactionOptions": { - "readConcern": { - "level": "snapshot" - }, - "writeConcern": { - "w": "majority" - } - } - } - } - } - ] - } - }, - { - "name": "withTransaction", - "object": "session1", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "w": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": 1 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "withTransaction explicit transaction options override client options", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": true, - "uriOptions": { - "readConcernLevel": "local", - "w": "majority" - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "withTransaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1" - } - } - ] - } - }, - { - "name": "withTransaction", - "object": "session1", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection1", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "w": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "withTransaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "w": 1 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "withTransaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/abort.json b/tests/UnifiedSpecTests/transactions/abort.json deleted file mode 100644 index c151a7d0c..000000000 --- a/tests/UnifiedSpecTests/transactions/abort.json +++ /dev/null @@ -1,828 +0,0 @@ -{ - "description": "abort", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "abort", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "implicit abort", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "endSession" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "two aborts", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - }, - { - "object": "session0", - "name": "abortTransaction", - "expectError": { - "errorContains": "cannot call abortTransaction twice" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abort without start", - "operations": [ - { - "object": "session0", - "name": "abortTransaction", - "expectError": { - "errorContains": "no transaction started" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abort directly after no-op commit", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "abortTransaction", - "expectError": { - "errorContains": "Cannot call abortTransaction after calling commitTransaction" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abort directly after commit", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "abortTransaction", - "expectError": { - "errorContains": "Cannot call abortTransaction after calling commitTransaction" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "abort ignores TransactionAborted", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ], - "errorContains": "E11000" - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectError": { - "errorCodeName": "NoSuchTransaction", - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abort does not apply writeConcern", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": 10 - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/bulk.json b/tests/UnifiedSpecTests/transactions/bulk.json deleted file mode 100644 index ece162518..000000000 --- a/tests/UnifiedSpecTests/transactions/bulk.json +++ /dev/null @@ -1,652 +0,0 @@ -{ - "description": "bulk", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "bulk", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectResult": { - "deletedCount": 1 - } - }, - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "session": "session0", - "requests": [ - { - "insertOne": { - "document": { - "_id": 1 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$set": { - "x": 2 - } - }, - "upsert": true - } - }, - { - "insertOne": { - "document": { - "_id": 3 - } - } - }, - { - "insertOne": { - "document": { - "_id": 4 - } - } - }, - { - "insertOne": { - "document": { - "_id": 5 - } - } - }, - { - "insertOne": { - "document": { - "_id": 6 - } - } - }, - { - "insertOne": { - "document": { - "_id": 7 - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 2 - }, - "replacement": { - "y": 2 - } - } - }, - { - "deleteOne": { - "filter": { - "_id": 3 - } - } - }, - { - "deleteOne": { - "filter": { - "_id": 4 - } - } - }, - { - "updateMany": { - "filter": { - "_id": { - "$gte": 2 - } - }, - "update": { - "$set": { - "z": 1 - } - } - } - }, - { - "deleteMany": { - "filter": { - "_id": { - "$gte": 6 - } - } - } - } - ] - }, - "expectResult": { - "deletedCount": 4, - "insertedCount": 6, - "insertedIds": { - "$$unsetOrMatches": { - "0": 1, - "3": 3, - "4": 4, - "5": 5, - "6": 6, - "7": 7 - } - }, - "matchedCount": 7, - "modifiedCount": 7, - "upsertedCount": 1, - "upsertedIds": { - "2": 2 - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 1 - }, - "limit": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "delete", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$set": { - "x": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": 2 - }, - "u": { - "$set": { - "x": 2 - } - }, - "upsert": true, - "multi": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "update", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - }, - { - "_id": 4 - }, - { - "_id": 5 - }, - { - "_id": 6 - }, - { - "_id": 7 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "y": 1 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - }, - { - "q": { - "_id": 2 - }, - "u": { - "y": 2 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "update", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 3 - }, - "limit": 1 - }, - { - "q": { - "_id": 4 - }, - "limit": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "delete", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": { - "$gte": 2 - } - }, - "u": { - "$set": { - "z": 1 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "update", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": { - "$gte": 6 - } - }, - "limit": 0 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "delete", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1, - "y": 1 - }, - { - "_id": 2, - "y": 2, - "z": 1 - }, - { - "_id": 5, - "z": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/causal-consistency.json b/tests/UnifiedSpecTests/transactions/causal-consistency.json deleted file mode 100644 index 52a6cb818..000000000 --- a/tests/UnifiedSpecTests/transactions/causal-consistency.json +++ /dev/null @@ -1,426 +0,0 @@ -{ - "description": "causal-consistency", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "uriOptions": { - "retryWrites": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - }, - { - "session": { - "id": "session_no_cc", - "client": "client0", - "sessionOptions": { - "causalConsistency": false - } - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1, - "count": 0 - } - ] - } - ], - "tests": [ - { - "description": "causal consistency", - "operations": [ - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "count": 1 - } - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "count": 1 - } - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$inc": { - "count": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "update", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$inc": { - "count": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "update", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1, - "count": 2 - } - ] - } - ] - }, - { - "description": "causal consistency disabled", - "operations": [ - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session_no_cc", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "object": "session_no_cc", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "session": "session_no_cc", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "count": 1 - } - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "object": "session_no_cc", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session_no_cc" - }, - "txnNumber": { - "$$exists": false - }, - "autocommit": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$inc": { - "count": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session_no_cc" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "update", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session_no_cc" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1, - "count": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/commit.json b/tests/UnifiedSpecTests/transactions/commit.json deleted file mode 100644 index ab778d8df..000000000 --- a/tests/UnifiedSpecTests/transactions/commit.json +++ /dev/null @@ -1,1234 +0,0 @@ -{ - "description": "commit", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - }, - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryWrites": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "commit", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "rerun commit after empty transaction", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "multiple commits in a row", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "write concern error on commit", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": 10 - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commit without start", - "operations": [ - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorContains": "no transaction started" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "commit after no-op abort", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "session0", - "name": "abortTransaction" - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorContains": "Cannot call commitTransaction after calling abortTransaction" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "commit after abort", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorContains": "Cannot call commitTransaction after calling abortTransaction" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "multiple commits after empty transaction", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "reset session state commit", - "operations": [ - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session1", - "name": "commitTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "object": "session1", - "name": "commitTransaction", - "expectError": { - "errorContains": "no transaction started" - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "reset session state abort", - "operations": [ - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session1", - "name": "abortTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "object": "session1", - "name": "abortTransaction", - "expectError": { - "errorContains": "no transaction started" - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/count.json b/tests/UnifiedSpecTests/transactions/count.json deleted file mode 100644 index 404b06beb..000000000 --- a/tests/UnifiedSpecTests/transactions/count.json +++ /dev/null @@ -1,177 +0,0 @@ -{ - "description": "count", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0.2", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ], - "tests": [ - { - "description": "count", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "count", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorCodeName": "OperationNotSupportedInTransaction", - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "test", - "query": { - "_id": 1 - }, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "count", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/create-collection.json b/tests/UnifiedSpecTests/transactions/create-collection.json deleted file mode 100644 index e190088b3..000000000 --- a/tests/UnifiedSpecTests/transactions/create-collection.json +++ /dev/null @@ -1,282 +0,0 @@ -{ - "description": "create-collection", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.3.4", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "explicitly create collection using create command", - "operations": [ - { - "object": "database0", - "name": "dropCollection", - "arguments": { - "collection": "test" - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "database0", - "name": "createCollection", - "arguments": { - "session": "session0", - "collection": "test" - } - }, - { - "object": "testRunner", - "name": "assertCollectionNotExists", - "arguments": { - "databaseName": "transaction-tests", - "collectionName": "test" - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "testRunner", - "name": "assertCollectionExists", - "arguments": { - "databaseName": "transaction-tests", - "collectionName": "test" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "drop": "test", - "writeConcern": { - "$$exists": false - } - }, - "commandName": "drop", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "create": "test", - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "create", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "implicitly create collection using insert", - "operations": [ - { - "object": "database0", - "name": "dropCollection", - "arguments": { - "collection": "test" - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "testRunner", - "name": "assertCollectionNotExists", - "arguments": { - "databaseName": "transaction-tests", - "collectionName": "test" - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "testRunner", - "name": "assertCollectionExists", - "arguments": { - "databaseName": "transaction-tests", - "collectionName": "test" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "drop": "test", - "writeConcern": { - "$$exists": false - } - }, - "commandName": "drop", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/create-index.json b/tests/UnifiedSpecTests/transactions/create-index.json deleted file mode 100644 index 98d6e1154..000000000 --- a/tests/UnifiedSpecTests/transactions/create-index.json +++ /dev/null @@ -1,313 +0,0 @@ -{ - "description": "create-index", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.3.4", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "create index on a non-existing collection", - "operations": [ - { - "object": "database0", - "name": "dropCollection", - "arguments": { - "collection": "test" - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "createIndex", - "arguments": { - "session": "session0", - "name": "t_1", - "keys": { - "x": 1 - } - } - }, - { - "object": "testRunner", - "name": "assertIndexNotExists", - "arguments": { - "databaseName": "transaction-tests", - "collectionName": "test", - "indexName": "t_1" - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "testRunner", - "name": "assertIndexExists", - "arguments": { - "databaseName": "transaction-tests", - "collectionName": "test", - "indexName": "t_1" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "drop": "test", - "writeConcern": { - "$$exists": false - } - }, - "commandName": "drop", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "createIndexes": "test", - "indexes": [ - { - "name": "t_1", - "key": { - "x": 1 - } - } - ], - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "createIndexes", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "create index on a collection created within the same transaction", - "operations": [ - { - "object": "database0", - "name": "dropCollection", - "arguments": { - "collection": "test" - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "database0", - "name": "createCollection", - "arguments": { - "session": "session0", - "collection": "test" - } - }, - { - "object": "collection0", - "name": "createIndex", - "arguments": { - "session": "session0", - "name": "t_1", - "keys": { - "x": 1 - } - } - }, - { - "object": "testRunner", - "name": "assertIndexNotExists", - "arguments": { - "databaseName": "transaction-tests", - "collectionName": "test", - "indexName": "t_1" - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "testRunner", - "name": "assertIndexExists", - "arguments": { - "databaseName": "transaction-tests", - "collectionName": "test", - "indexName": "t_1" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "drop": "test", - "writeConcern": { - "$$exists": false - } - }, - "commandName": "drop", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "create": "test", - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "create", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "createIndexes": "test", - "indexes": [ - { - "name": "t_1", - "key": { - "x": 1 - } - } - ], - "lsid": { - "$$sessionLsid": "session0" - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "createIndexes", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/delete.json b/tests/UnifiedSpecTests/transactions/delete.json deleted file mode 100644 index 4c1cae0a4..000000000 --- a/tests/UnifiedSpecTests/transactions/delete.json +++ /dev/null @@ -1,425 +0,0 @@ -{ - "description": "delete", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - }, - { - "_id": 5 - } - ] - } - ], - "tests": [ - { - "description": "delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectResult": { - "deletedCount": 1 - } - }, - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$lte": 3 - } - } - }, - "expectResult": { - "deletedCount": 2 - } - }, - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "session": "session0", - "filter": { - "_id": 4 - } - }, - "expectResult": { - "deletedCount": 1 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 1 - }, - "limit": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "delete", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": { - "$lte": 3 - } - }, - "limit": 0 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "delete", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 4 - }, - "limit": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "delete", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 5 - } - ] - } - ] - }, - { - "description": "collection writeConcern ignored for delete", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "collection": { - "id": "collection_wc_majority", - "database": "database0", - "collectionName": "test", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection_wc_majority", - "name": "deleteOne", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectResult": { - "deletedCount": 1 - } - }, - { - "object": "collection_wc_majority", - "name": "deleteMany", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$lte": 3 - } - } - }, - "expectResult": { - "deletedCount": 2 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 1 - }, - "limit": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "delete", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": { - "$lte": 3 - } - }, - "limit": 0 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "delete", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/do-not-retry-read-in-transaction.json b/tests/UnifiedSpecTests/transactions/do-not-retry-read-in-transaction.json deleted file mode 100644 index 6d9dc704b..000000000 --- a/tests/UnifiedSpecTests/transactions/do-not-retry-read-in-transaction.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "description": "do not retry read in a transaction", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.0.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.2.0", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ], - "uriOptions": { - "retryReads": true - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-read-in-transaction-test" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "tests": [ - { - "description": "find does not retry in a transaction", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": {}, - "session": "session0" - }, - "expectError": { - "isError": true, - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "startTransaction": true - }, - "commandName": "find", - "databaseName": "retryable-read-in-transaction-test" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/error-labels-blockConnection.json b/tests/UnifiedSpecTests/transactions/error-labels-blockConnection.json deleted file mode 100644 index 8da04d100..000000000 --- a/tests/UnifiedSpecTests/transactions/error-labels-blockConnection.json +++ /dev/null @@ -1,235 +0,0 @@ -{ - "description": "error-labels-blockConnection", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "uriOptions": { - "socketTimeoutMS": 100 - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "add RetryableWriteError and UnknownTransactionCommitResult labels to connection errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "blockConnection": true, - "blockTimeMS": 150 - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorLabelsContain": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/error-labels-errorLabels.json b/tests/UnifiedSpecTests/transactions/error-labels-errorLabels.json deleted file mode 100644 index 1f95ad341..000000000 --- a/tests/UnifiedSpecTests/transactions/error-labels-errorLabels.json +++ /dev/null @@ -1,423 +0,0 @@ -{ - "description": "error-labels-errorLabels", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "serverless": "forbid", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "add RetryableWriteError and UnknownTransactionCommitResult labels to retryable commit errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 11602, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorLabelsContain": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "add RetryableWriteError and UnknownTransactionCommitResult labels to writeConcernError ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorLabelsContain": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/error-labels.json b/tests/UnifiedSpecTests/transactions/error-labels.json deleted file mode 100644 index be8df10ed..000000000 --- a/tests/UnifiedSpecTests/transactions/error-labels.json +++ /dev/null @@ -1,2264 +0,0 @@ -{ - "description": "error-labels", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "serverless": "forbid", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "DuplicateKey errors do not contain transient label", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "session": "session0", - "documents": [ - { - "_id": 1 - }, - { - "_id": 1 - } - ] - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ], - "errorContains": "E11000" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - }, - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "NotWritablePrimary errors contain transient label", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 10107 - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "WriteConflict errors contain transient label", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 112 - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "NoSuchTransaction errors contain transient label", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 251 - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "NoSuchTransaction errors on commit contain transient label", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 251 - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "add TransientTransactionError label to connection errors, but do not add RetryableWriteError label", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 4 - }, - "data": { - "failCommands": [ - "insert", - "find", - "aggregate", - "distinct" - ], - "closeConnection": true - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "session": "session0" - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "session": "session0" - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "_id", - "filter": {}, - "session": "session0" - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "find", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": {}, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "aggregate", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "test", - "key": "_id", - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "distinct", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "add RetryableWriteError and UnknownTransactionCommitResult labels to connection errors", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "closeConnection": true - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorLabelsContain": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "do not add RetryableWriteError label to writeConcernError ShutdownInProgress that occurs within transaction", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 64, - "errmsg": "multiple errors reported" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorLabelsContain": [ - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError" - ] - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "add UnknownTransactionCommitResult label to writeConcernError WriteConcernFailed with wtimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 64, - "codeName": "WriteConcernFailed", - "errmsg": "waiting for replication timed out", - "errInfo": { - "wtimeout": true - } - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorLabelsContain": [ - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError" - ] - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "omit UnknownTransactionCommitResult label from writeConcernError UnsatisfiableWriteConcern", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 100, - "errmsg": "Not enough data-bearing nodes" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "omit UnknownTransactionCommitResult label from writeConcernError UnknownReplWriteConcern", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 79, - "errmsg": "No write concern mode named 'blah' found in replica set configuration" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorLabelsOmit": [ - "RetryableWriteConcern", - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "do not add UnknownTransactionCommitResult label to MaxTimeMSExpired inside transactions", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 50 - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "maxTimeMS": 60000, - "session": "session0" - }, - "expectError": { - "errorLabelsOmit": [ - "RetryableWriteError", - "UnknownTransactionCommitResult", - "TransientTransactionError" - ] - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": {}, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "maxTimeMS": 60000 - }, - "commandName": "aggregate", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "add UnknownTransactionCommitResult label to MaxTimeMSExpired", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 50 - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - }, - "maxCommitTimeMS": 60000 - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorLabelsContain": [ - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError" - ] - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - }, - "maxTimeMS": 60000 - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "maxTimeMS": 60000 - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "add UnknownTransactionCommitResult label to writeConcernError MaxTimeMSExpired", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 50, - "errmsg": "operation exceeded time limit" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - }, - "maxCommitTimeMS": 60000 - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorLabelsContain": [ - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError" - ] - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - }, - "maxTimeMS": 60000 - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "maxTimeMS": 60000 - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/errors-client.json b/tests/UnifiedSpecTests/transactions/errors-client.json deleted file mode 100644 index 00f1497c2..000000000 --- a/tests/UnifiedSpecTests/transactions/errors-client.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "description": "errors-client", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "Client side error in command starting transaction", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "x": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "object": "testRunner", - "name": "assertSessionTransactionState", - "arguments": { - "session": "session0", - "state": "starting" - } - } - ] - }, - { - "description": "Client side error when transaction is in progress", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "x": 1 - } - }, - "expectError": { - "isError": true - } - }, - { - "object": "testRunner", - "name": "assertSessionTransactionState", - "arguments": { - "session": "session0", - "state": "in_progress" - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/errors.json b/tests/UnifiedSpecTests/transactions/errors.json deleted file mode 100644 index 94a9cac20..000000000 --- a/tests/UnifiedSpecTests/transactions/errors.json +++ /dev/null @@ -1,285 +0,0 @@ -{ - "description": "errors", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - }, - { - "session": { - "id": "session1", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "start insert start", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "expectError": { - "isClientError": true, - "errorContains": "transaction already in progress" - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ] - }, - { - "description": "start twice", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "session0", - "name": "startTransaction", - "expectError": { - "isClientError": true, - "errorContains": "transaction already in progress" - } - } - ] - }, - { - "description": "commit and start twice", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "session0", - "name": "startTransaction", - "expectError": { - "isClientError": true, - "errorContains": "transaction already in progress" - } - } - ] - }, - { - "description": "write conflict commit", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectError": { - "errorCodeName": "WriteConflict", - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session1", - "name": "commitTransaction", - "expectError": { - "errorCodeName": "NoSuchTransaction", - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - } - ] - }, - { - "description": "write conflict abort", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectError": { - "errorCodeName": "WriteConflict", - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session1", - "name": "abortTransaction" - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/findOneAndDelete.json b/tests/UnifiedSpecTests/transactions/findOneAndDelete.json deleted file mode 100644 index 7db9c872a..000000000 --- a/tests/UnifiedSpecTests/transactions/findOneAndDelete.json +++ /dev/null @@ -1,317 +0,0 @@ -{ - "description": "findOneAndDelete", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ], - "tests": [ - { - "description": "findOneAndDelete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - } - }, - "expectResult": { - "_id": 3 - } - }, - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "session": "session0", - "filter": { - "_id": 4 - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "remove": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 4 - }, - "remove": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "collection writeConcern ignored for findOneAndDelete", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "collection": { - "id": "collection_wc_majority", - "database": "database0", - "collectionName": "test", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection_wc_majority", - "name": "findOneAndDelete", - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - } - }, - "expectResult": { - "_id": 3 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "remove": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/findOneAndReplace.json b/tests/UnifiedSpecTests/transactions/findOneAndReplace.json deleted file mode 100644 index d9248244b..000000000 --- a/tests/UnifiedSpecTests/transactions/findOneAndReplace.json +++ /dev/null @@ -1,352 +0,0 @@ -{ - "description": "findOneAndReplace", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ], - "tests": [ - { - "description": "findOneAndReplace", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - }, - "replacement": { - "x": 1 - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 3 - } - }, - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "session": "session0", - "filter": { - "_id": 4 - }, - "replacement": { - "x": 1 - }, - "upsert": true, - "returnDocument": "After" - }, - "expectResult": { - "_id": 4, - "x": 1 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "update": { - "x": 1 - }, - "new": false, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 4 - }, - "update": { - "x": 1 - }, - "new": true, - "upsert": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3, - "x": 1 - }, - { - "_id": 4, - "x": 1 - } - ] - } - ] - }, - { - "description": "collection writeConcern ignored for findOneAndReplace", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "collection": { - "id": "collection_wc_majority", - "database": "database0", - "collectionName": "test", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection_wc_majority", - "name": "findOneAndReplace", - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - }, - "replacement": { - "x": 1 - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 3 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "update": { - "x": 1 - }, - "new": false, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/findOneAndUpdate.json b/tests/UnifiedSpecTests/transactions/findOneAndUpdate.json deleted file mode 100644 index 34a40bb57..000000000 --- a/tests/UnifiedSpecTests/transactions/findOneAndUpdate.json +++ /dev/null @@ -1,538 +0,0 @@ -{ - "description": "findOneAndUpdate", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ], - "tests": [ - { - "description": "findOneAndUpdate", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 3 - } - }, - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "session": "session0", - "filter": { - "_id": 4 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "upsert": true, - "returnDocument": "After" - }, - "expectResult": { - "_id": 4, - "x": 1 - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 3, - "x": 1 - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 3, - "x": 2 - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": false, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 4 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": true, - "upsert": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": false, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": false, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3, - "x": 2 - }, - { - "_id": 4, - "x": 1 - } - ] - } - ] - }, - { - "description": "collection writeConcern ignored for findOneAndUpdate", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "collection": { - "id": "collection_wc_majority", - "database": "database0", - "collectionName": "test", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection_wc_majority", - "name": "findOneAndUpdate", - "arguments": { - "session": "session0", - "filter": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 3 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 3 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": false, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/insert.json b/tests/UnifiedSpecTests/transactions/insert.json deleted file mode 100644 index 9a80d8bf4..000000000 --- a/tests/UnifiedSpecTests/transactions/insert.json +++ /dev/null @@ -1,895 +0,0 @@ -{ - "description": "insert", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - }, - { - "session": { - "id": "session1", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 2 - }, - { - "_id": 3 - } - ], - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 2, - "1": 3 - } - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 4 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 5 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 5 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - }, - { - "_id": 3 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 5 - } - ], - "ordered": true, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - }, - { - "_id": 5 - } - ] - } - ] - }, - { - "description": "insert with session1", - "operations": [ - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 2 - }, - { - "_id": 3 - } - ], - "session": "session1" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 2, - "1": 3 - } - } - } - } - }, - { - "object": "session1", - "name": "commitTransaction" - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 4 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 4 - } - } - } - }, - { - "object": "session1", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - }, - { - "_id": 3 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ] - }, - { - "description": "collection writeConcern without transaction", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryWrites": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection_wc_majority", - "database": "database1", - "collectionName": "test", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - } - } - }, - { - "session": { - "id": "session2", - "client": "client1" - } - } - ] - } - }, - { - "object": "collection_wc_majority", - "name": "insertOne", - "arguments": { - "session": "session2", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session2" - }, - "txnNumber": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": { - "$$exists": false - }, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "collection writeConcern ignored for insert", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "collection": { - "id": "collection_wc_majority", - "database": "database0", - "collectionName": "test", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection_wc_majority", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "collection_wc_majority", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 2 - }, - { - "_id": 3 - } - ], - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 2, - "1": 3 - } - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - }, - { - "_id": 3 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/isolation.json b/tests/UnifiedSpecTests/transactions/isolation.json deleted file mode 100644 index 5d0a0139f..000000000 --- a/tests/UnifiedSpecTests/transactions/isolation.json +++ /dev/null @@ -1,281 +0,0 @@ -{ - "description": "isolation", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - }, - { - "session": { - "id": "session1", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "one transaction", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectResult": [ - { - "_id": 1 - } - ] - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "session": "session1", - "filter": { - "_id": 1 - } - }, - "expectResult": [] - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": [] - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "session": "session1", - "filter": { - "_id": 1 - } - }, - "expectResult": [ - { - "_id": 1 - } - ] - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": [ - { - "_id": 1 - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "two transactions", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectResult": [ - { - "_id": 1 - } - ] - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "session": "session1", - "filter": { - "_id": 1 - } - }, - "expectResult": [] - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": [] - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "session": "session1", - "filter": { - "_id": 1 - } - }, - "expectResult": [] - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "_id": 1 - } - }, - "expectResult": [ - { - "_id": 1 - } - ] - }, - { - "object": "session1", - "name": "commitTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/mongos-pin-auto.json b/tests/UnifiedSpecTests/transactions/mongos-pin-auto.json deleted file mode 100644 index 93eac8bb7..000000000 --- a/tests/UnifiedSpecTests/transactions/mongos-pin-auto.json +++ /dev/null @@ -1,5180 +0,0 @@ -{ - "description": "mongos-pin-auto", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded" - ], - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "remain pinned after non-transient Interrupted error on insertOne", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "object": "testRunner", - "name": "targetedFailPoint", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ], - "errorCodeName": "Interrupted" - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - }, - "recoveryToken": { - "$$exists": true - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ] - }, - { - "description": "unpin after transient error within a transaction", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "object": "testRunner", - "name": "targetedFailPoint", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - }, - "recoveryToken": { - "$$exists": true - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on insertOne insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on insertMany insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "session": "session0", - "documents": [ - { - "_id": 4 - }, - { - "_id": 5 - } - ] - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on updateOne update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on replaceOne update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on updateMany update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - }, - "update": { - "$set": { - "z": 1 - } - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on deleteOne delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on deleteMany delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "deleteMany", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on findOneAndDelete findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "findOneAndDelete", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on findOneAndUpdate findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on findOneAndReplace findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - }, - "returnDocument": "Before" - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on bulkWrite insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "insertOne": { - "document": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on bulkWrite update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - } - ] - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on bulkWrite delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on find find", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on countDocuments aggregate", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "countDocuments", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": {} - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on aggregate aggregate", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "session": "session0", - "pipeline": [] - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on distinct distinct", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "distinct", - "object": "collection0", - "arguments": { - "session": "session0", - "fieldName": "_id", - "filter": {} - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient Interrupted error on runCommand insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "runCommand", - "object": "database0", - "arguments": { - "session": "session0", - "commandName": "insert", - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ] - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on insertOne insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on insertOne insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on insertMany insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "session": "session0", - "documents": [ - { - "_id": 4 - }, - { - "_id": 5 - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on insertMany insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "session": "session0", - "documents": [ - { - "_id": 4 - }, - { - "_id": 5 - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on updateOne update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "closeConnection": true - } - } - } - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on updateOne update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on replaceOne update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "closeConnection": true - } - } - } - }, - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on replaceOne update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on updateMany update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "closeConnection": true - } - } - } - }, - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - }, - "update": { - "$set": { - "z": 1 - } - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on updateMany update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - }, - "update": { - "$set": { - "z": 1 - } - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on deleteOne delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "closeConnection": true - } - } - } - }, - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on deleteOne delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on deleteMany delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "closeConnection": true - } - } - } - }, - { - "name": "deleteMany", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on deleteMany delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "deleteMany", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 1 - } - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on findOneAndDelete findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "closeConnection": true - } - } - } - }, - { - "name": "findOneAndDelete", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on findOneAndDelete findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "findOneAndDelete", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on findOneAndUpdate findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "closeConnection": true - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on findOneAndUpdate findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on findOneAndReplace findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "closeConnection": true - } - } - } - }, - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - }, - "returnDocument": "Before" - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on findOneAndReplace findAndModify", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "findAndModify" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "replacement": { - "y": 1 - }, - "returnDocument": "Before" - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on bulkWrite insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "insertOne": { - "document": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on bulkWrite insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "insertOne": { - "document": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on bulkWrite update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "closeConnection": true - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on bulkWrite update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "update" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "updateOne": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 1 - } - } - } - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on bulkWrite delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "closeConnection": true - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on bulkWrite delete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "delete" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "session": "session0", - "requests": [ - { - "deleteOne": { - "filter": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on find find", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on find find", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on countDocuments aggregate", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "name": "countDocuments", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": {} - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on countDocuments aggregate", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "countDocuments", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": {} - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on aggregate aggregate", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "closeConnection": true - } - } - } - }, - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "session": "session0", - "pipeline": [] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on aggregate aggregate", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "session": "session0", - "pipeline": [] - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on distinct distinct", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "closeConnection": true - } - } - } - }, - { - "name": "distinct", - "object": "collection0", - "arguments": { - "session": "session0", - "fieldName": "_id", - "filter": {} - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on distinct distinct", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "distinct" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "distinct", - "object": "collection0", - "arguments": { - "session": "session0", - "fieldName": "_id", - "filter": {} - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient connection error on runCommand insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database0", - "arguments": { - "session": "session0", - "commandName": "insert", - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ] - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient ShutdownInProgress error on runCommand insert", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "runCommand", - "object": "database0", - "arguments": { - "session": "session0", - "commandName": "insert", - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ] - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "testRunner", - "name": "assertSessionUnpinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/mongos-recovery-token-errorLabels.json b/tests/UnifiedSpecTests/transactions/mongos-recovery-token-errorLabels.json deleted file mode 100644 index 13345c6a2..000000000 --- a/tests/UnifiedSpecTests/transactions/mongos-recovery-token-errorLabels.json +++ /dev/null @@ -1,211 +0,0 @@ -{ - "description": "mongos-recovery-token-errorLabels", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "serverless": "forbid", - "topologies": [ - "sharded" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "commitTransaction retry succeeds on new mongos", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "testRunner", - "name": "targetedFailPoint", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - }, - "recoveryToken": { - "$$exists": true - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "recoveryToken": { - "$$exists": true - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/mongos-recovery-token.json b/tests/UnifiedSpecTests/transactions/mongos-recovery-token.json deleted file mode 100644 index 00909c421..000000000 --- a/tests/UnifiedSpecTests/transactions/mongos-recovery-token.json +++ /dev/null @@ -1,566 +0,0 @@ -{ - "description": "mongos-recovery-token", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.1.8", - "serverless": "forbid", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "commitTransaction explicit retries include recoveryToken", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - }, - "recoveryToken": { - "$$exists": true - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "recoveryToken": { - "$$exists": true - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "recoveryToken": { - "$$exists": true - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction retry fails on new mongos", - "runOnRequirements": [ - { - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": true, - "uriOptions": { - "heartbeatFrequencyMS": 30000 - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1" - } - } - ] - } - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "testRunner", - "name": "targetedFailPoint", - "arguments": { - "session": "session1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 7 - }, - "data": { - "failCommands": [ - "commitTransaction", - "isMaster", - "hello" - ], - "closeConnection": true - } - } - } - }, - { - "object": "session1", - "name": "commitTransaction", - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ], - "errorCodeName": "NoSuchTransaction" - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - }, - "recoveryToken": { - "$$exists": true - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - }, - "recoveryToken": { - "$$exists": true - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction sends recoveryToken", - "runOnRequirements": [ - { - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "testRunner", - "name": "targetedFailPoint", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "closeConnection": true - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - }, - "recoveryToken": { - "$$exists": true - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - }, - "recoveryToken": { - "$$exists": true - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/mongos-unpin.json b/tests/UnifiedSpecTests/transactions/mongos-unpin.json deleted file mode 100644 index 4d1ebc87b..000000000 --- a/tests/UnifiedSpecTests/transactions/mongos-unpin.json +++ /dev/null @@ -1,450 +0,0 @@ -{ - "description": "mongos-unpin", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "topologies": [ - "sharded" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "mongos-unpin-db" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "mongos-unpin-db", - "documents": [] - } - ], - "_yamlAnchors": { - "anchors": 24 - }, - "tests": [ - { - "description": "unpin after TransientTransactionError error on commit", - "runOnRequirements": [ - { - "serverless": "forbid", - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 24 - } - } - } - }, - { - "name": "commitTransaction", - "object": "session0", - "expectError": { - "errorCode": 24, - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ] - }, - { - "description": "unpin on successful abort", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - } - ] - }, - { - "description": "unpin after non-transient error on abort", - "runOnRequirements": [ - { - "serverless": "forbid", - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 24 - } - } - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ] - }, - { - "description": "unpin after TransientTransactionError error on abort", - "runOnRequirements": [ - { - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 91 - } - } - } - }, - { - "name": "abortTransaction", - "object": "session0" - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ] - }, - { - "description": "unpin when a new transaction is started", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - } - ] - }, - { - "description": "unpin when a non-transaction write operation uses a session", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - } - ] - }, - { - "description": "unpin when a non-transaction read operation uses a session", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "x": 1 - }, - "session": "session0" - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/pin-mongos.json b/tests/UnifiedSpecTests/transactions/pin-mongos.json deleted file mode 100644 index 5f2ecca5c..000000000 --- a/tests/UnifiedSpecTests/transactions/pin-mongos.json +++ /dev/null @@ -1,1464 +0,0 @@ -{ - "description": "pin-mongos", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.1.8", - "serverless": "forbid", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "countDocuments", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": 1 - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": 1 - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": 1 - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": 1 - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": 1 - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": 1 - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": 1 - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": 1 - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "distinct", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "_id", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 1, - 2 - ] - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "_id", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 1, - 2 - ] - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "_id", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 1, - 2 - ] - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "_id", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 1, - 2 - ] - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "_id", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 1, - 2 - ] - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "_id", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 1, - 2 - ] - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "_id", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 1, - 2 - ] - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "_id", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 1, - 2 - ] - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "find", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": [ - { - "_id": 2 - } - ] - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": [ - { - "_id": 2 - } - ] - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": [ - { - "_id": 2 - } - ] - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": [ - { - "_id": 2 - } - ] - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": [ - { - "_id": 2 - } - ] - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": [ - { - "_id": 2 - } - ] - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": [ - { - "_id": 2 - } - ] - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": { - "_id": 2 - }, - "session": "session0" - }, - "expectResult": [ - { - "_id": 2 - } - ] - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "insertOne", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 3 - }, - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 4 - }, - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 4 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 5 - }, - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 5 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 6 - }, - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 6 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 7 - }, - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 7 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 8 - }, - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 8 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 9 - }, - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 9 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 10 - }, - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 10 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - }, - { - "_id": 5 - }, - { - "_id": 6 - }, - { - "_id": 7 - }, - { - "_id": 8 - }, - { - "_id": 9 - }, - { - "_id": 10 - } - ] - } - ] - }, - { - "description": "mixed read write operations", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 3 - }, - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": 3 - }, - "session": "session0" - }, - "expectResult": 1 - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": 3 - }, - "session": "session0" - }, - "expectResult": 1 - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": 3 - }, - "session": "session0" - }, - "expectResult": 1 - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": 3 - }, - "session": "session0" - }, - "expectResult": 1 - }, - { - "object": "collection0", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": 3 - }, - "session": "session0" - }, - "expectResult": 1 - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 4 - }, - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 4 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 5 - }, - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 5 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 6 - }, - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 6 - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "document": { - "_id": 7 - }, - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 7 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - }, - { - "_id": 5 - }, - { - "_id": 6 - }, - { - "_id": 7 - } - ] - } - ] - }, - { - "description": "multiple commits", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 3, - "1": 4 - } - } - } - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "remain pinned after non-transient error on commit", - "runOnRequirements": [ - { - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 3, - "1": 4 - } - } - } - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "testRunner", - "name": "targetedFailPoint", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 51 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError" - ], - "errorCode": 51 - } - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "testRunner", - "name": "assertSessionPinned", - "arguments": { - "session": "session0" - } - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "unpin after transient error within a transaction", - "runOnRequirements": [ - { - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "object": "testRunner", - "name": "targetedFailPoint", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - }, - "recoveryToken": { - "$$exists": true - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unpin after transient error within a transaction and commit", - "runOnRequirements": [ - { - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": true, - "uriOptions": { - "heartbeatFrequencyMS": 30000 - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1" - } - } - ] - } - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "object": "testRunner", - "name": "targetedFailPoint", - "arguments": { - "session": "session1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 7 - }, - "data": { - "failCommands": [ - "insert", - "isMaster", - "hello" - ], - "closeConnection": true - } - } - } - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 4 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - }, - { - "object": "session1", - "name": "commitTransaction", - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ], - "errorCodeName": "NoSuchTransaction" - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - }, - "recoveryToken": { - "$$exists": true - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/read-concern.json b/tests/UnifiedSpecTests/transactions/read-concern.json deleted file mode 100644 index b3bd967c0..000000000 --- a/tests/UnifiedSpecTests/transactions/read-concern.json +++ /dev/null @@ -1,1924 +0,0 @@ -{ - "description": "read-concern", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "database": { - "id": "database_rc_majority", - "client": "client0", - "databaseName": "transaction-tests", - "databaseOptions": { - "readConcern": { - "level": "majority" - } - } - } - }, - { - "collection": { - "id": "collection_rc_majority", - "database": "database0", - "collectionName": "test", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - } - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ], - "tests": [ - { - "description": "only first countDocuments includes readConcern", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "readConcern": { - "level": "majority" - } - } - }, - { - "object": "collection_rc_majority", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": { - "$gte": 2 - } - }, - "session": "session0" - }, - "expectResult": 3 - }, - { - "object": "collection_rc_majority", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": { - "$gte": 2 - } - }, - "session": "session0" - }, - "expectResult": 3 - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$match": { - "_id": { - "$gte": 2 - } - } - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ], - "cursor": {}, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "level": "majority" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "commandName": "aggregate", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$match": { - "_id": { - "$gte": 2 - } - } - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ], - "cursor": {}, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "aggregate", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "only first find includes readConcern", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "readConcern": { - "level": "majority" - } - } - }, - { - "object": "collection_rc_majority", - "name": "find", - "arguments": { - "batchSize": 3, - "filter": {}, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "collection_rc_majority", - "name": "find", - "arguments": { - "batchSize": 3, - "filter": {}, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "level": "majority" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "commandName": "find", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "getMore", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "find", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "getMore", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "only first aggregate includes readConcern", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "readConcern": { - "level": "majority" - } - } - }, - { - "object": "collection_rc_majority", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "collection_rc_majority", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": { - "batchSize": 3 - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "level": "majority" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "commandName": "aggregate", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "getMore", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": { - "batchSize": 3 - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "aggregate", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "getMore", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "only first distinct includes readConcern", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "readConcern": { - "level": "majority" - } - } - }, - { - "object": "collection_rc_majority", - "name": "distinct", - "arguments": { - "fieldName": "_id", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 1, - 2, - 3, - 4 - ] - }, - { - "object": "collection_rc_majority", - "name": "distinct", - "arguments": { - "fieldName": "_id", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 1, - 2, - 3, - 4 - ] - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "test", - "key": "_id", - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "level": "majority" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "distinct", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "test", - "key": "_id", - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "distinct", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "only first runCommand includes readConcern", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "readConcern": { - "level": "majority" - } - } - }, - { - "object": "database0", - "name": "runCommand", - "arguments": { - "session": "session0", - "command": { - "find": "test" - }, - "commandName": "find" - } - }, - { - "object": "database0", - "name": "runCommand", - "arguments": { - "session": "session0", - "command": { - "find": "test" - }, - "commandName": "find" - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "level": "majority" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "find", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "find", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "countDocuments ignores collection readConcern", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection_rc_majority", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": { - "$gte": 2 - } - }, - "session": "session0" - }, - "expectResult": 3 - }, - { - "object": "collection_rc_majority", - "name": "countDocuments", - "arguments": { - "filter": { - "_id": { - "$gte": 2 - } - }, - "session": "session0" - }, - "expectResult": 3 - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$match": { - "_id": { - "$gte": 2 - } - } - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ], - "cursor": {}, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "commandName": "aggregate", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$match": { - "_id": { - "$gte": 2 - } - } - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ], - "cursor": {}, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "aggregate", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "find ignores collection readConcern", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection_rc_majority", - "name": "find", - "arguments": { - "batchSize": 3, - "filter": {}, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "collection_rc_majority", - "name": "find", - "arguments": { - "batchSize": 3, - "filter": {}, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "commandName": "find", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "getMore", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "find", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "getMore", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "aggregate ignores collection readConcern", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection_rc_majority", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "collection_rc_majority", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": { - "batchSize": 3 - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "commandName": "aggregate", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "getMore", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": { - "batchSize": 3 - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "aggregate", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "getMore", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "distinct ignores collection readConcern", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection_rc_majority", - "name": "distinct", - "arguments": { - "fieldName": "_id", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 1, - 2, - 3, - 4 - ] - }, - { - "object": "collection_rc_majority", - "name": "distinct", - "arguments": { - "fieldName": "_id", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 1, - 2, - 3, - 4 - ] - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "test", - "key": "_id", - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "distinct", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "distinct": "test", - "key": "_id", - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "distinct", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "runCommand ignores database readConcern", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "database_rc_majority", - "name": "runCommand", - "arguments": { - "session": "session0", - "command": { - "find": "test" - }, - "commandName": "find" - } - }, - { - "object": "database0", - "name": "runCommand", - "arguments": { - "session": "session0", - "command": { - "find": "test" - }, - "commandName": "find" - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "find", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "find", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/read-pref.json b/tests/UnifiedSpecTests/transactions/read-pref.json deleted file mode 100644 index eda00bd10..000000000 --- a/tests/UnifiedSpecTests/transactions/read-pref.json +++ /dev/null @@ -1,728 +0,0 @@ -{ - "description": "read-pref", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "collection": { - "id": "collection_rp_primary", - "database": "database0", - "collectionName": "test" - } - }, - { - "collection": { - "id": "collection_rp_secondary", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "default readPreference", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 1, - "1": 2, - "2": 3, - "3": 4 - } - } - } - } - }, - { - "object": "collection_rp_secondary", - "name": "aggregate", - "arguments": { - "session": "session0", - "pipeline": [ - { - "$match": { - "_id": 1 - } - }, - { - "$count": "count" - } - ] - }, - "expectResult": [ - { - "count": 1 - } - ] - }, - { - "object": "collection_rp_secondary", - "name": "find", - "arguments": { - "batchSize": 3, - "filter": {}, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "collection_rp_secondary", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "primary readPreference", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "readPreference": { - "mode": "primary" - } - } - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 1, - "1": 2, - "2": 3, - "3": 4 - } - } - } - } - }, - { - "object": "collection_rp_secondary", - "name": "aggregate", - "arguments": { - "session": "session0", - "pipeline": [ - { - "$match": { - "_id": 1 - } - }, - { - "$count": "count" - } - ] - }, - "expectResult": [ - { - "count": 1 - } - ] - }, - { - "object": "collection_rp_secondary", - "name": "find", - "arguments": { - "batchSize": 3, - "filter": {}, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "collection_rp_secondary", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "secondary readPreference", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "readPreference": { - "mode": "secondary" - } - } - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 1, - "1": 2, - "2": 3, - "3": 4 - } - } - } - } - }, - { - "object": "collection_rp_primary", - "name": "aggregate", - "arguments": { - "session": "session0", - "pipeline": [ - { - "$match": { - "_id": 1 - } - }, - { - "$count": "count" - } - ] - }, - "expectError": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "object": "collection_rp_primary", - "name": "find", - "arguments": { - "batchSize": 3, - "filter": {}, - "session": "session0" - }, - "expectError": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "object": "collection_rp_primary", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "expectError": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "primaryPreferred readPreference", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "readPreference": { - "mode": "primaryPreferred" - } - } - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 1, - "1": 2, - "2": 3, - "3": 4 - } - } - } - } - }, - { - "object": "collection_rp_primary", - "name": "aggregate", - "arguments": { - "session": "session0", - "pipeline": [ - { - "$match": { - "_id": 1 - } - }, - { - "$count": "count" - } - ] - }, - "expectError": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "object": "collection_rp_primary", - "name": "find", - "arguments": { - "batchSize": 3, - "filter": {}, - "session": "session0" - }, - "expectError": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "object": "collection_rp_primary", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "expectError": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "nearest readPreference", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "readPreference": { - "mode": "nearest" - } - } - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ], - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 1, - "1": 2, - "2": 3, - "3": 4 - } - } - } - } - }, - { - "object": "collection_rp_primary", - "name": "aggregate", - "arguments": { - "session": "session0", - "pipeline": [ - { - "$match": { - "_id": 1 - } - }, - { - "$count": "count" - } - ] - }, - "expectError": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "object": "collection_rp_primary", - "name": "find", - "arguments": { - "batchSize": 3, - "filter": {}, - "session": "session0" - }, - "expectError": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "object": "collection_rp_primary", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "expectError": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "secondary write only", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "readPreference": { - "mode": "secondary" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/reads.json b/tests/UnifiedSpecTests/transactions/reads.json deleted file mode 100644 index 52e845763..000000000 --- a/tests/UnifiedSpecTests/transactions/reads.json +++ /dev/null @@ -1,706 +0,0 @@ -{ - "description": "reads", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ], - "tests": [ - { - "description": "collection readConcern without transaction", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "collection": { - "id": "collection1", - "database": "database0", - "collectionName": "test", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - } - } - } - ] - } - }, - { - "object": "collection1", - "name": "find", - "arguments": { - "filter": {}, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "readConcern": { - "level": "majority" - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": { - "$$exists": false - } - }, - "commandName": "find", - "databaseName": "transaction-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "find", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "batchSize": 3, - "filter": {}, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "collection0", - "name": "find", - "arguments": { - "batchSize": 3, - "filter": {}, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "batchSize": 3, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "commandName": "find", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "getMore", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "find", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "getMore", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "aggregate", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "batchSize": 3, - "session": "session0" - }, - "expectResult": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": { - "batchSize": 3 - }, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false - }, - "commandName": "aggregate", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "getMore", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$project": { - "_id": 1 - } - } - ], - "cursor": { - "batchSize": 3 - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "aggregate", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "test", - "batchSize": 3, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false - }, - "commandName": "getMore", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - }, - { - "description": "distinct", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "distinct", - "arguments": { - "fieldName": "_id", - "filter": {}, - "session": "session0" - }, - "expectResult": [ - 1, - 2, - 3, - 4 - ] - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "test", - "key": "_id", - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "distinct", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "readConcern": { - "$$exists": false - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/retryable-abort-errorLabels.json b/tests/UnifiedSpecTests/transactions/retryable-abort-errorLabels.json deleted file mode 100644 index 77a1b03eb..000000000 --- a/tests/UnifiedSpecTests/transactions/retryable-abort-errorLabels.json +++ /dev/null @@ -1,2436 +0,0 @@ -{ - "description": "retryable-abort-errorLabels", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "abortTransaction only retries once with RetryableWriteError from server", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 112, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction does not retry without RetryableWriteError label", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 11600, - "errorLabels": [] - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 10107, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 13436, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 13435, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 11602, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 11600, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 189, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 91, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 7, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 6, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 9001, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 89, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after WriteConcernError InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 11600, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after WriteConcernError InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 11602, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after WriteConcernError PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 189, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after WriteConcernError ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/retryable-abort-handshake.json b/tests/UnifiedSpecTests/transactions/retryable-abort-handshake.json deleted file mode 100644 index 4ad56e2f2..000000000 --- a/tests/UnifiedSpecTests/transactions/retryable-abort-handshake.json +++ /dev/null @@ -1,204 +0,0 @@ -{ - "description": "retryable abortTransaction on handshake errors", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ], - "serverless": "forbid", - "auth": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent", - "connectionCheckOutStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-handshake-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - }, - { - "session": { - "id": "session1", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-handshake-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "AbortTransaction succeeds after handshake network error", - "skipReason": "DRIVERS-2032: Pinned servers need to be checked if they are still selectable", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 2, - "x": 22 - } - } - }, - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "session": "session1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "saslContinue", - "ping" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - }, - "session": "session1" - }, - "expectError": { - "isError": true - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectEvents": [ - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "startTransaction": true - }, - "commandName": "insert", - "databaseName": "retryable-handshake-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-handshake-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-handshake-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/retryable-abort.json b/tests/UnifiedSpecTests/transactions/retryable-abort.json deleted file mode 100644 index 381cfa91f..000000000 --- a/tests/UnifiedSpecTests/transactions/retryable-abort.json +++ /dev/null @@ -1,600 +0,0 @@ -{ - "description": "retryable-abort", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - }, - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryWrites": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "abortTransaction only performs a single retry", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "closeConnection": true - } - } - } - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session1", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction does not retry after Interrupted", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "errorCode": 11601, - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction does not retry after WriteConcernError Interrupted", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "writeConcernError": { - "code": 11601, - "errmsg": "operation was interrupted" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "abortTransaction succeeds after connection error", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "abortTransaction" - ], - "closeConnection": true - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/retryable-commit-errorLabels.json b/tests/UnifiedSpecTests/transactions/retryable-commit-errorLabels.json deleted file mode 100644 index d3ce8b148..000000000 --- a/tests/UnifiedSpecTests/transactions/retryable-commit-errorLabels.json +++ /dev/null @@ -1,2564 +0,0 @@ -{ - "description": "retryable-commit-errorLabels", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - }, - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryWrites": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "commitTransaction does not retry error without RetryableWriteError label", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 11600, - "errorLabels": [] - } - } - } - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session1", - "name": "commitTransaction", - "expectError": { - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError" - ] - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "commitTransaction retries once with RetryableWriteError from server", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 112, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session1", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after NotWritablePrimary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 10107, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after NotPrimaryOrSecondary", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 13436, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after NotPrimaryNoSecondaryOk", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 13435, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 11602, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 189, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after HostNotFound", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 7, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after HostUnreachable", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 6, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after SocketException", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 9001, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after NetworkTimeout", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 89, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after WriteConcernError InterruptedAtShutdown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 11600, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after WriteConcernError InterruptedDueToReplStateChange", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 11602, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after WriteConcernError PrimarySteppedDown", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 189, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after WriteConcernError ShutdownInProgress", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after InterruptedAtShutdown", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 11600, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after ShutdownInProgress", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 91, - "errorLabels": [ - "RetryableWriteError" - ], - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/retryable-commit-handshake.json b/tests/UnifiedSpecTests/transactions/retryable-commit-handshake.json deleted file mode 100644 index d9315a8fc..000000000 --- a/tests/UnifiedSpecTests/transactions/retryable-commit-handshake.json +++ /dev/null @@ -1,211 +0,0 @@ -{ - "description": "retryable commitTransaction on handshake errors", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ], - "serverless": "forbid", - "auth": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent", - "connectionCheckOutStartedEvent" - ], - "uriOptions": { - "retryWrites": false - } - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-handshake-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - }, - { - "session": { - "id": "session1", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-handshake-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "CommitTransaction succeeds after handshake network error", - "skipReason": "DRIVERS-2032: Pinned servers need to be checked if they are still selectable", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 2, - "x": 22 - } - } - }, - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "session": "session1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "saslContinue", - "ping" - ], - "closeConnection": true - } - } - } - }, - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - }, - "session": "session1" - }, - "expectError": { - "isError": true - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectEvents": [ - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - }, - { - "connectionCheckOutStartedEvent": {} - } - ] - }, - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "startTransaction": true - }, - "commandName": "insert", - "databaseName": "retryable-handshake-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "ping": 1 - }, - "databaseName": "retryable-handshake-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-handshake-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/retryable-commit.json b/tests/UnifiedSpecTests/transactions/retryable-commit.json deleted file mode 100644 index b794c1c55..000000000 --- a/tests/UnifiedSpecTests/transactions/retryable-commit.json +++ /dev/null @@ -1,868 +0,0 @@ -{ - "description": "retryable-commit", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - }, - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "retryWrites": false - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "commitTransaction fails after Interrupted", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "errorCode": 11601, - "closeConnection": false - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorCodeName": "Interrupted", - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "commitTransaction is not retried after UnsatisfiableWriteConcern error", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "writeConcernError": { - "code": 100, - "errmsg": "Not enough data-bearing nodes" - } - } - } - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction", - "expectError": { - "errorLabelsOmit": [ - "RetryableWriteError", - "TransientTransactionError", - "UnknownTransactionCommitResult" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction fails after two errors", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "closeConnection": true - } - } - } - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session1", - "name": "commitTransaction", - "expectError": { - "errorLabelsContain": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "session1", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction applies majority write concern on retries", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "closeConnection": true - } - } - } - }, - { - "object": "session1", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": 2, - "journal": true, - "wtimeoutMS": 5000 - } - } - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session1", - "name": "commitTransaction", - "expectError": { - "errorLabelsContain": [ - "RetryableWriteError", - "UnknownTransactionCommitResult" - ], - "errorLabelsOmit": [ - "TransientTransactionError" - ] - } - }, - { - "object": "session1", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": 2, - "j": true, - "wtimeout": 5000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "j": true, - "wtimeout": 5000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "j": true, - "wtimeout": 5000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commitTransaction succeeds after connection error", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "commitTransaction" - ], - "closeConnection": true - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority", - "wtimeout": 10000 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/retryable-writes.json b/tests/UnifiedSpecTests/transactions/retryable-writes.json deleted file mode 100644 index c196e6862..000000000 --- a/tests/UnifiedSpecTests/transactions/retryable-writes.json +++ /dev/null @@ -1,468 +0,0 @@ -{ - "description": "retryable-writes", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "increment txnNumber", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - }, - { - "object": "collection0", - "name": "insertMany", - "arguments": { - "documents": [ - { - "_id": 4 - }, - { - "_id": 5 - } - ], - "session": "session0" - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 4, - "1": 5 - } - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "3" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - }, - { - "_id": 5 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "4" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 4 - }, - { - "_id": 5 - } - ] - } - ] - }, - { - "description": "writes are not retried", - "operations": [ - { - "object": "testRunner", - "name": "failPoint", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ] - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/run-command.json b/tests/UnifiedSpecTests/transactions/run-command.json deleted file mode 100644 index 7bd420ef7..000000000 --- a/tests/UnifiedSpecTests/transactions/run-command.json +++ /dev/null @@ -1,421 +0,0 @@ -{ - "description": "run-command", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "run command with default read preference", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "database0", - "name": "runCommand", - "arguments": { - "session": "session0", - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ] - }, - "commandName": "insert" - }, - "expectResult": { - "n": 1 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "run command with secondary read preference in client option and primary read preference in transaction options", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "readPreference": "secondary" - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "session": { - "id": "session1", - "client": "client1" - } - } - ] - } - }, - { - "object": "session1", - "name": "startTransaction", - "arguments": { - "readPreference": { - "mode": "primary" - } - } - }, - { - "object": "database1", - "name": "runCommand", - "arguments": { - "session": "session1", - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ] - }, - "commandName": "insert" - }, - "expectResult": { - "n": 1 - } - }, - { - "object": "session1", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "run command with explicit primary read preference", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "database0", - "name": "runCommand", - "arguments": { - "session": "session0", - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ] - }, - "readPreference": { - "mode": "primary" - }, - "commandName": "insert" - }, - "expectResult": { - "n": 1 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "run command fails with explicit secondary read preference", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "database0", - "name": "runCommand", - "arguments": { - "session": "session0", - "command": { - "find": "test" - }, - "readPreference": { - "mode": "secondary" - }, - "commandName": "find" - }, - "expectError": { - "errorContains": "read preference in a transaction must be primary" - } - } - ] - }, - { - "description": "run command fails with secondary read preference from transaction options", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "readPreference": { - "mode": "secondary" - } - } - }, - { - "object": "database0", - "name": "runCommand", - "arguments": { - "session": "session0", - "command": { - "find": "test" - }, - "commandName": "find" - }, - "expectError": { - "errorContains": "read preference in a transaction must be primary" - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/transaction-options-repl.json b/tests/UnifiedSpecTests/transactions/transaction-options-repl.json deleted file mode 100644 index dc2cb7758..000000000 --- a/tests/UnifiedSpecTests/transactions/transaction-options-repl.json +++ /dev/null @@ -1,267 +0,0 @@ -{ - "description": "transaction-options-repl", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "readConcern snapshot in startTransaction options", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "session": { - "id": "session1", - "client": "client0", - "sessionOptions": { - "defaultTransactionOptions": { - "readConcern": { - "level": "majority" - } - } - } - } - } - ] - } - }, - { - "object": "session1", - "name": "startTransaction", - "arguments": { - "readConcern": { - "level": "snapshot" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session1", - "name": "commitTransaction" - }, - { - "object": "session1", - "name": "startTransaction", - "arguments": { - "readConcern": { - "level": "snapshot" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "object": "session1", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "snapshot" - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "snapshot", - "afterClusterTime": { - "$$exists": true - } - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/transaction-options.json b/tests/UnifiedSpecTests/transactions/transaction-options.json deleted file mode 100644 index 78e4c8207..000000000 --- a/tests/UnifiedSpecTests/transactions/transaction-options.json +++ /dev/null @@ -1,2081 +0,0 @@ -{ - "description": "transaction-options", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "no transaction options set", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - }, - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - }, - "maxTimeMS": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - }, - "maxTimeMS": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "afterClusterTime": { - "$$exists": true - } - }, - "writeConcern": { - "$$exists": false - }, - "maxTimeMS": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - }, - "maxTimeMS": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "transaction options inherited from client", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "readConcernLevel": "local", - "w": 1 - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1" - } - } - ] - } - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session1", - "name": "commitTransaction" - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "object": "session1", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "local" - }, - "writeConcern": { - "$$exists": false - }, - "maxTimeMS": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "w": 1 - }, - "maxTimeMS": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "local", - "afterClusterTime": { - "$$exists": true - } - }, - "writeConcern": { - "$$exists": false - }, - "maxTimeMS": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "w": 1 - }, - "maxTimeMS": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "transaction options inherited from defaultTransactionOptions", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "session": { - "id": "session1", - "client": "client0", - "sessionOptions": { - "defaultTransactionOptions": { - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "w": 1 - }, - "maxCommitTimeMS": 60000 - } - } - } - } - ] - } - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session1", - "name": "commitTransaction" - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "object": "session1", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "w": 1 - }, - "maxTimeMS": 60000 - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority", - "afterClusterTime": { - "$$exists": true - } - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "w": 1 - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "startTransaction options override defaults", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "readConcernLevel": "local", - "w": 1 - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1", - "sessionOptions": { - "defaultTransactionOptions": { - "readConcern": { - "level": "snapshot" - }, - "writeConcern": { - "w": 1 - }, - "maxCommitTimeMS": 30000 - } - } - } - } - ] - } - }, - { - "object": "session1", - "name": "startTransaction", - "arguments": { - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "w": "majority" - }, - "maxCommitTimeMS": 60000 - } - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session1", - "name": "commitTransaction" - }, - { - "object": "session1", - "name": "startTransaction", - "arguments": { - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "object": "session1", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "$$exists": false - }, - "maxTimeMS": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "w": "majority" - }, - "maxTimeMS": 60000 - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority", - "afterClusterTime": { - "$$exists": true - } - }, - "writeConcern": { - "$$exists": false - }, - "maxTimeMS": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "w": "majority" - }, - "maxTimeMS": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "defaultTransactionOptions override client options", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "readConcernLevel": "local", - "w": 1 - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1", - "sessionOptions": { - "defaultTransactionOptions": { - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "w": "majority" - }, - "maxCommitTimeMS": 60000 - } - } - } - } - ] - } - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session1", - "name": "commitTransaction" - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "object": "session1", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "$$exists": false - }, - "maxTimeMS": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "w": "majority" - }, - "maxTimeMS": 60000 - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority", - "afterClusterTime": { - "$$exists": true - } - }, - "writeConcern": { - "$$exists": false - }, - "maxTimeMS": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "w": "majority" - }, - "maxTimeMS": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "readConcern local in defaultTransactionOptions", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "w": 1 - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1", - "sessionOptions": { - "defaultTransactionOptions": { - "readConcern": { - "level": "local" - } - } - } - } - } - ] - } - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session1", - "name": "commitTransaction" - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "object": "session1", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "local" - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "w": 1 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "local", - "afterClusterTime": { - "$$exists": true - } - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "2" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "w": 1 - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "client writeConcern ignored for bulk", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "w": "majority" - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1" - } - } - ] - } - }, - { - "object": "session1", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": 1 - } - } - }, - { - "object": "collection1", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 1 - } - } - } - ], - "session": "session1" - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 - } - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - }, - { - "object": "session1", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": 1 - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "readPreference inherited from client", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "readPreference": "secondary" - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1" - } - } - ] - } - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "collection1", - "name": "find", - "arguments": { - "session": "session1", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "object": "session1", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "readPreference inherited from defaultTransactionOptions", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "readPreference": "primary" - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1", - "sessionOptions": { - "defaultTransactionOptions": { - "readPreference": { - "mode": "secondary" - } - } - } - } - } - ] - } - }, - { - "object": "session1", - "name": "startTransaction" - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "collection1", - "name": "find", - "arguments": { - "session": "session1", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "object": "session1", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "startTransaction overrides readPreference", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "readPreference": "primary" - }, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session1", - "client": "client1", - "sessionOptions": { - "defaultTransactionOptions": { - "readPreference": { - "mode": "primary" - } - } - } - } - } - ] - } - }, - { - "object": "session1", - "name": "startTransaction", - "arguments": { - "readPreference": { - "mode": "secondary" - } - } - }, - { - "object": "collection1", - "name": "insertOne", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "collection1", - "name": "find", - "arguments": { - "session": "session1", - "filter": { - "_id": 1 - } - }, - "expectError": { - "errorContains": "read preference in a transaction must be primary" - } - }, - { - "object": "session1", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/update.json b/tests/UnifiedSpecTests/transactions/update.json deleted file mode 100644 index 8090fc908..000000000 --- a/tests/UnifiedSpecTests/transactions/update.json +++ /dev/null @@ -1,565 +0,0 @@ -{ - "description": "update", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ], - "tests": [ - { - "description": "update", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "updateOne", - "arguments": { - "session": "session0", - "filter": { - "_id": 4 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "upsert": true - }, - "expectResult": { - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 1, - "upsertedId": 4 - } - }, - { - "object": "collection0", - "name": "replaceOne", - "arguments": { - "session": "session0", - "filter": { - "x": 1 - }, - "replacement": { - "y": 1 - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "object": "collection0", - "name": "updateMany", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 3 - } - }, - "update": { - "$set": { - "z": 1 - } - } - }, - "expectResult": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 4 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "upsert": true, - "multi": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "update", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "x": 1 - }, - "u": { - "y": 1 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "update", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": { - "$gte": 3 - } - }, - "u": { - "$set": { - "z": 1 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "update", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3, - "z": 1 - }, - { - "_id": 4, - "y": 1, - "z": 1 - } - ] - } - ] - }, - { - "description": "collections writeConcern ignored for update", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "collection": { - "id": "collection1", - "database": "database0", - "collectionName": "test", - "collectionOptions": { - "writeConcern": { - "w": "majority" - } - } - } - } - ] - } - }, - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection1", - "name": "updateOne", - "arguments": { - "session": "session0", - "filter": { - "_id": 4 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "upsert": true - }, - "expectResult": { - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 1, - "upsertedId": 4 - } - }, - { - "object": "collection1", - "name": "replaceOne", - "arguments": { - "session": "session0", - "filter": { - "x": 1 - }, - "replacement": { - "y": 1 - } - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "object": "collection1", - "name": "updateMany", - "arguments": { - "session": "session0", - "filter": { - "_id": { - "$gte": 3 - } - }, - "update": { - "$set": { - "z": 1 - } - } - }, - "expectResult": { - "matchedCount": 2, - "modifiedCount": 2, - "upsertedCount": 0 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 4 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "upsert": true, - "multi": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "update", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "x": 1 - }, - "u": { - "y": 1 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "update", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": { - "$gte": 3 - } - }, - "u": { - "$set": { - "z": 1 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "update", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/transactions/write-concern.json b/tests/UnifiedSpecTests/transactions/write-concern.json deleted file mode 100644 index 7acdd5406..000000000 --- a/tests/UnifiedSpecTests/transactions/write-concern.json +++ /dev/null @@ -1,1584 +0,0 @@ -{ - "description": "write-concern", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "collection": { - "id": "collection_w0", - "database": "database0", - "collectionName": "test", - "collectionOptions": { - "writeConcern": { - "w": 0 - } - } - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 0 - } - ] - } - ], - "tests": [ - { - "description": "commit with majority", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 0 - }, - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "commit with default", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 0 - }, - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "abort with majority", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": "majority" - } - } - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "w": "majority" - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 0 - } - ] - } - ] - }, - { - "description": "abort with default", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "abortTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 0 - } - ] - } - ] - }, - { - "description": "start with unacknowledged write concern", - "operations": [ - { - "object": "session0", - "name": "startTransaction", - "arguments": { - "writeConcern": { - "w": 0 - } - }, - "expectError": { - "isClientError": true, - "errorContains": "transactions do not support unacknowledged write concern" - } - } - ] - }, - { - "description": "start with implicit unacknowledged write concern", - "operations": [ - { - "object": "testRunner", - "name": "createEntities", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "useMultipleMongoses": false, - "uriOptions": { - "w": 0 - } - } - }, - { - "session": { - "id": "session1", - "client": "client1" - } - } - ] - } - }, - { - "object": "session1", - "name": "startTransaction", - "expectError": { - "isClientError": true, - "errorContains": "transactions do not support unacknowledged write concern" - } - } - ] - }, - { - "description": "unacknowledged write concern coll insertOne", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection_w0", - "name": "insertOne", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 0 - }, - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "unacknowledged write concern coll insertMany", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection_w0", - "name": "insertMany", - "arguments": { - "session": "session0", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 1, - "1": 2 - } - } - } - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 0 - }, - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "unacknowledged write concern coll bulkWrite", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection_w0", - "name": "bulkWrite", - "arguments": { - "session": "session0", - "requests": [ - { - "insertOne": { - "document": { - "_id": 1 - } - } - } - ] - }, - "expectResult": { - "deletedCount": 0, - "insertedCount": 1, - "insertedIds": { - "$$unsetOrMatches": { - "0": 1 - } - }, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 0 - }, - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "unacknowledged write concern coll deleteOne", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection_w0", - "name": "deleteOne", - "arguments": { - "session": "session0", - "filter": { - "_id": 0 - } - }, - "expectResult": { - "deletedCount": 1 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 0 - }, - "limit": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "delete", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "unacknowledged write concern coll deleteMany", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection_w0", - "name": "deleteMany", - "arguments": { - "session": "session0", - "filter": { - "_id": 0 - } - }, - "expectResult": { - "deletedCount": 1 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 0 - }, - "limit": 0 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "delete", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "unacknowledged write concern coll updateOne", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection_w0", - "name": "updateOne", - "arguments": { - "session": "session0", - "filter": { - "_id": 0 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "upsert": true - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 0 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "upsert": true, - "multi": { - "$$unsetOrMatches": false - } - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "update", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 0, - "x": 1 - } - ] - } - ] - }, - { - "description": "unacknowledged write concern coll updateMany", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection_w0", - "name": "updateMany", - "arguments": { - "session": "session0", - "filter": { - "_id": 0 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "upsert": true - }, - "expectResult": { - "matchedCount": 1, - "modifiedCount": 1, - "upsertedCount": 0 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 0 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "upsert": true - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "update", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 0, - "x": 1 - } - ] - } - ] - }, - { - "description": "unacknowledged write concern coll findOneAndDelete", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection_w0", - "name": "findOneAndDelete", - "arguments": { - "session": "session0", - "filter": { - "_id": 0 - } - }, - "expectResult": { - "_id": 0 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 0 - }, - "remove": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ] - }, - { - "description": "unacknowledged write concern coll findOneAndReplace", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection_w0", - "name": "findOneAndReplace", - "arguments": { - "session": "session0", - "filter": { - "_id": 0 - }, - "replacement": { - "x": 1 - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 0 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 0 - }, - "update": { - "x": 1 - }, - "new": false, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 0, - "x": 1 - } - ] - } - ] - }, - { - "description": "unacknowledged write concern coll findOneAndUpdate", - "operations": [ - { - "object": "session0", - "name": "startTransaction" - }, - { - "object": "collection_w0", - "name": "findOneAndUpdate", - "arguments": { - "session": "session0", - "filter": { - "_id": 0 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 0 - } - }, - { - "object": "session0", - "name": "commitTransaction" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 0 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "new": false, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "findAndModify", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": { - "$numberLong": "1" - }, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 0, - "x": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/assertNumberConnectionsCheckedOut.json b/tests/UnifiedSpecTests/valid-fail/assertNumberConnectionsCheckedOut.json deleted file mode 100644 index 9799bb2f6..000000000 --- a/tests/UnifiedSpecTests/valid-fail/assertNumberConnectionsCheckedOut.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "description": "assertNumberConnectionsCheckedOut", - "schemaVersion": "1.3", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true - } - } - ], - "tests": [ - { - "description": "operation fails if client field is not specified", - "operations": [ - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "connections": 1 - } - } - ] - }, - { - "description": "operation fails if connections field is not specified", - "operations": [ - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0" - } - } - ] - }, - { - "description": "operation fails if client entity does not exist", - "operations": [ - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client1" - } - } - ] - }, - { - "description": "operation fails if number of connections is incorrect", - "operations": [ - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 1 - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/entity-bucket-database-undefined.json b/tests/UnifiedSpecTests/valid-fail/entity-bucket-database-undefined.json deleted file mode 100644 index 7f7f1978c..000000000 --- a/tests/UnifiedSpecTests/valid-fail/entity-bucket-database-undefined.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "entity-bucket-database-undefined", - "schemaVersion": "1.0", - "createEntities": [ - { - "bucket": { - "id": "bucket0", - "database": "foo" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/entity-client-apiVersion-unsupported.json b/tests/UnifiedSpecTests/valid-fail/entity-client-apiVersion-unsupported.json deleted file mode 100644 index d92d23dca..000000000 --- a/tests/UnifiedSpecTests/valid-fail/entity-client-apiVersion-unsupported.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "description": "entity-client-apiVersion-unsupported", - "schemaVersion": "1.1", - "createEntities": [ - { - "client": { - "id": "client0", - "serverApi": { - "version": "server_will_never_support_this_api_version" - } - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.json b/tests/UnifiedSpecTests/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.json deleted file mode 100644 index 8c0c4d204..000000000 --- a/tests/UnifiedSpecTests/valid-fail/entity-client-storeEventsAsEntities-conflict_with_client_id.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "description": "entity-client-storeEventsAsEntities-conflict_with_client_id", - "schemaVersion": "1.2", - "createEntities": [ - { - "client": { - "id": "client0", - "storeEventsAsEntities": [ - { - "id": "client0", - "events": [ - "PoolCreatedEvent", - "PoolReadyEvent", - "PoolClearedEvent", - "PoolClosedEvent" - ] - } - ] - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.json b/tests/UnifiedSpecTests/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.json deleted file mode 100644 index 77bc4abf2..000000000 --- a/tests/UnifiedSpecTests/valid-fail/entity-client-storeEventsAsEntities-conflict_within_different_array.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "description": "entity-client-storeEventsAsEntities-conflict_within_different_array", - "schemaVersion": "1.2", - "createEntities": [ - { - "client": { - "id": "client0", - "storeEventsAsEntities": [ - { - "id": "events", - "events": [ - "PoolCreatedEvent", - "PoolReadyEvent", - "PoolClearedEvent", - "PoolClosedEvent" - ] - } - ] - } - }, - { - "client": { - "id": "client1", - "storeEventsAsEntities": [ - { - "id": "events", - "events": [ - "CommandStartedEvent", - "CommandSucceededEvent", - "CommandFailedEvent" - ] - } - ] - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.json b/tests/UnifiedSpecTests/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.json deleted file mode 100644 index e1a949988..000000000 --- a/tests/UnifiedSpecTests/valid-fail/entity-client-storeEventsAsEntities-conflict_within_same_array.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "description": "entity-client-storeEventsAsEntities-conflict_within_same_array", - "schemaVersion": "1.2", - "createEntities": [ - { - "client": { - "id": "client0", - "storeEventsAsEntities": [ - { - "id": "events", - "events": [ - "PoolCreatedEvent", - "PoolReadyEvent", - "PoolClearedEvent", - "PoolClosedEvent" - ] - }, - { - "id": "events", - "events": [ - "CommandStartedEvent", - "CommandSucceededEvent", - "CommandFailedEvent" - ] - } - ] - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/entity-collection-database-undefined.json b/tests/UnifiedSpecTests/valid-fail/entity-collection-database-undefined.json deleted file mode 100644 index 20b0733e3..000000000 --- a/tests/UnifiedSpecTests/valid-fail/entity-collection-database-undefined.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "entity-collection-database-undefined", - "schemaVersion": "1.0", - "createEntities": [ - { - "collection": { - "id": "collection0", - "database": "foo", - "collectionName": "foo" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/entity-database-client-undefined.json b/tests/UnifiedSpecTests/valid-fail/entity-database-client-undefined.json deleted file mode 100644 index 0f8110e6d..000000000 --- a/tests/UnifiedSpecTests/valid-fail/entity-database-client-undefined.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "entity-database-client-undefined", - "schemaVersion": "1.0", - "createEntities": [ - { - "database": { - "id": "database0", - "client": "foo", - "databaseName": "foo" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/entity-findCursor-malformed.json b/tests/UnifiedSpecTests/valid-fail/entity-findCursor-malformed.json deleted file mode 100644 index 0956efa4c..000000000 --- a/tests/UnifiedSpecTests/valid-fail/entity-findCursor-malformed.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "description": "entity-findCursor-malformed", - "schemaVersion": "1.3", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0Name" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "databaseName": "database0Name", - "collectionName": "coll0", - "documents": [] - } - ], - "tests": [ - { - "description": "createFindCursor fails if filter is not specified", - "operations": [ - { - "name": "createFindCursor", - "object": "collection0", - "saveResultAsEntity": "cursor0" - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/entity-findCursor.json b/tests/UnifiedSpecTests/valid-fail/entity-findCursor.json deleted file mode 100644 index 389e448c0..000000000 --- a/tests/UnifiedSpecTests/valid-fail/entity-findCursor.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "description": "entity-findCursor", - "schemaVersion": "1.3", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0Name" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "databaseName": "database0Name", - "collectionName": "coll0", - "documents": [] - } - ], - "tests": [ - { - "description": "iterateUntilDocumentOrError fails if it references a nonexistent entity", - "operations": [ - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0" - } - ] - }, - { - "description": "close fails if it references a nonexistent entity", - "operations": [ - { - "name": "close", - "object": "cursor0" - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/entity-session-client-undefined.json b/tests/UnifiedSpecTests/valid-fail/entity-session-client-undefined.json deleted file mode 100644 index 260356436..000000000 --- a/tests/UnifiedSpecTests/valid-fail/entity-session-client-undefined.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "entity-session-client-undefined", - "schemaVersion": "1.0", - "createEntities": [ - { - "session": { - "id": "session0", - "client": "foo" - } - } - ], - "tests": [ - { - "description": "foo", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/ignoreResultAndError-malformed.json b/tests/UnifiedSpecTests/valid-fail/ignoreResultAndError-malformed.json deleted file mode 100644 index b64779c72..000000000 --- a/tests/UnifiedSpecTests/valid-fail/ignoreResultAndError-malformed.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "description": "ignoreResultAndError-malformed", - "schemaVersion": "1.3", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0Name" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "database0Name", - "documents": [] - } - ], - "tests": [ - { - "description": "malformed operation fails if ignoreResultAndError is true", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "foo": "bar" - }, - "ignoreResultAndError": true - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/ignoreResultAndError.json b/tests/UnifiedSpecTests/valid-fail/ignoreResultAndError.json deleted file mode 100644 index 01b2421a9..000000000 --- a/tests/UnifiedSpecTests/valid-fail/ignoreResultAndError.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "description": "ignoreResultAndError", - "schemaVersion": "1.3", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0Name" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "database0Name", - "documents": [] - } - ], - "tests": [ - { - "description": "operation errors are not ignored if ignoreResultAndError is false", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1 - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1 - } - }, - "ignoreResultAndError": false - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/kmsProviders-missing_aws_kms_credentials.json b/tests/UnifiedSpecTests/valid-fail/kmsProviders-missing_aws_kms_credentials.json deleted file mode 100644 index e62de8003..000000000 --- a/tests/UnifiedSpecTests/valid-fail/kmsProviders-missing_aws_kms_credentials.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "description": "kmsProviders-missing_aws_kms_credentials", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "aws": { - "accessKeyId": "accessKeyId" - } - } - } - } - } - ], - "tests": [ - { - "description": "", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/kmsProviders-missing_azure_kms_credentials.json b/tests/UnifiedSpecTests/valid-fail/kmsProviders-missing_azure_kms_credentials.json deleted file mode 100644 index 8ef805d0f..000000000 --- a/tests/UnifiedSpecTests/valid-fail/kmsProviders-missing_azure_kms_credentials.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "description": "kmsProviders-missing_azure_kms_credentials", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "azure": { - "tenantId": "tenantId" - } - } - } - } - } - ], - "tests": [ - { - "description": "", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/kmsProviders-missing_gcp_kms_credentials.json b/tests/UnifiedSpecTests/valid-fail/kmsProviders-missing_gcp_kms_credentials.json deleted file mode 100644 index c6da1ce58..000000000 --- a/tests/UnifiedSpecTests/valid-fail/kmsProviders-missing_gcp_kms_credentials.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "description": "kmsProviders-missing_gcp_kms_credentials", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "gcp": { - "email": "email" - } - } - } - } - } - ], - "tests": [ - { - "description": "", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/kmsProviders-no_kms.json b/tests/UnifiedSpecTests/valid-fail/kmsProviders-no_kms.json deleted file mode 100644 index 57499b4ea..000000000 --- a/tests/UnifiedSpecTests/valid-fail/kmsProviders-no_kms.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "description": "clientEncryptionOpts-no_kms", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": {} - } - } - } - ], - "tests": [ - { - "description": "", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/operation-failure.json b/tests/UnifiedSpecTests/valid-fail/operation-failure.json deleted file mode 100644 index 8f6cae152..000000000 --- a/tests/UnifiedSpecTests/valid-fail/operation-failure.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "description": "operation-failure", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "operation-failure" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "tests": [ - { - "description": "Unsupported command", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "unsupportedCommand", - "command": { - "unsupportedCommand": 1 - } - } - } - ] - }, - { - "description": "Unsupported query operator", - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "$unsupportedQueryOperator": 1 - } - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/operation-unsupported.json b/tests/UnifiedSpecTests/valid-fail/operation-unsupported.json deleted file mode 100644 index d8ef5ab1c..000000000 --- a/tests/UnifiedSpecTests/valid-fail/operation-unsupported.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "description": "operation-unsupported", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - } - ], - "tests": [ - { - "description": "Unsupported operation", - "operations": [ - { - "name": "unsupportedOperation", - "object": "client0" - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/returnDocument-enum-invalid.json b/tests/UnifiedSpecTests/valid-fail/returnDocument-enum-invalid.json deleted file mode 100644 index ea425fb56..000000000 --- a/tests/UnifiedSpecTests/valid-fail/returnDocument-enum-invalid.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "description": "returnDocument-enum-invalid", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "test" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - } - ], - "tests": [ - { - "description": "FindOneAndReplace returnDocument invalid enum value", - "operations": [ - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": 111 - }, - "returnDocument": "invalid" - } - } - ] - }, - { - "description": "FindOneAndUpdate returnDocument invalid enum value", - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "invalid" - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-fail/schemaVersion-unsupported.json b/tests/UnifiedSpecTests/valid-fail/schemaVersion-unsupported.json deleted file mode 100644 index ceb553291..000000000 --- a/tests/UnifiedSpecTests/valid-fail/schemaVersion-unsupported.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "description": "schemaVersion-unsupported", - "schemaVersion": "0.1", - "tests": [ - { - "description": "foo", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/assertNumberConnectionsCheckedOut.json b/tests/UnifiedSpecTests/valid-pass/assertNumberConnectionsCheckedOut.json deleted file mode 100644 index a9fc063f3..000000000 --- a/tests/UnifiedSpecTests/valid-pass/assertNumberConnectionsCheckedOut.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "assertNumberConnectionsCheckedOut", - "schemaVersion": "1.3", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true - } - } - ], - "tests": [ - { - "description": "basic assertion succeeds", - "operations": [ - { - "name": "assertNumberConnectionsCheckedOut", - "object": "testRunner", - "arguments": { - "client": "client0", - "connections": 0 - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/collectionData-createOptions.json b/tests/UnifiedSpecTests/valid-pass/collectionData-createOptions.json deleted file mode 100644 index 19edc2247..000000000 --- a/tests/UnifiedSpecTests/valid-pass/collectionData-createOptions.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "description": "collectionData-createOptions", - "schemaVersion": "1.9", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "database0", - "createOptions": { - "capped": true, - "size": 4096 - }, - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "collection is created with the correct options", - "operations": [ - { - "object": "collection0", - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$collStats": { - "storageStats": {} - } - }, - { - "$project": { - "capped": "$storageStats.capped", - "maxSize": "$storageStats.maxSize" - } - } - ] - }, - "expectResult": [ - { - "capped": true, - "maxSize": 4096 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/createEntities-operation.json b/tests/UnifiedSpecTests/valid-pass/createEntities-operation.json deleted file mode 100644 index 3fde42919..000000000 --- a/tests/UnifiedSpecTests/valid-pass/createEntities-operation.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "description": "createEntities-operation", - "schemaVersion": "1.9", - "tests": [ - { - "description": "createEntities operation", - "operations": [ - { - "name": "createEntities", - "object": "testRunner", - "arguments": { - "entities": [ - { - "client": { - "id": "client1", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "database1" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll1" - } - } - ] - } - }, - { - "name": "deleteOne", - "object": "collection1", - "arguments": { - "filter": { - "_id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll1", - "deletes": [ - { - "q": { - "_id": 1 - }, - "limit": 1 - } - ] - }, - "commandName": "delete", - "databaseName": "database1" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/entity-client-cmap-events.json b/tests/UnifiedSpecTests/valid-pass/entity-client-cmap-events.json deleted file mode 100644 index 3209033de..000000000 --- a/tests/UnifiedSpecTests/valid-pass/entity-client-cmap-events.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "description": "entity-client-cmap-events", - "schemaVersion": "1.3", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "connectionReadyEvent", - "connectionCheckedOutEvent", - "connectionCheckedInEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0Name" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "database0Name", - "documents": [] - } - ], - "tests": [ - { - "description": "events are captured during an operation", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "x": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - }, - { - "connectionCheckedOutEvent": {} - }, - { - "connectionCheckedInEvent": {} - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/entity-client-storeEventsAsEntities.json b/tests/UnifiedSpecTests/valid-pass/entity-client-storeEventsAsEntities.json deleted file mode 100644 index e37e5a1ac..000000000 --- a/tests/UnifiedSpecTests/valid-pass/entity-client-storeEventsAsEntities.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "description": "entity-client-storeEventsAsEntities", - "schemaVersion": "1.2", - "createEntities": [ - { - "client": { - "id": "client0", - "storeEventsAsEntities": [ - { - "id": "client0_events", - "events": [ - "CommandStartedEvent", - "CommandSucceededEvent", - "CommandFailedEvent" - ] - } - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "test" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "test", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ], - "tests": [ - { - "description": "storeEventsAsEntities captures events", - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": {} - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/entity-commandCursor.json b/tests/UnifiedSpecTests/valid-pass/entity-commandCursor.json deleted file mode 100644 index 72b74b4a9..000000000 --- a/tests/UnifiedSpecTests/valid-pass/entity-commandCursor.json +++ /dev/null @@ -1,278 +0,0 @@ -{ - "description": "entity-commandCursor", - "schemaVersion": "1.3", - "createEntities": [ - { - "client": { - "id": "client", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "db", - "client": "client", - "databaseName": "db" - } - }, - { - "collection": { - "id": "collection", - "database": "db", - "collectionName": "collection" - } - } - ], - "initialData": [ - { - "collectionName": "collection", - "databaseName": "db", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - } - ] - } - ], - "tests": [ - { - "description": "runCursorCommand creates and exhausts cursor by running getMores", - "operations": [ - { - "name": "runCursorCommand", - "object": "db", - "arguments": { - "commandName": "find", - "batchSize": 2, - "command": { - "find": "collection", - "filter": {}, - "batchSize": 2 - } - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - } - ] - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "collection", - "filter": {}, - "batchSize": 2, - "$db": "db", - "lsid": { - "$$exists": true - } - }, - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "collection", - "$db": "db", - "lsid": { - "$$exists": true - } - }, - "commandName": "getMore" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "collection", - "$db": "db", - "lsid": { - "$$exists": true - } - }, - "commandName": "getMore" - } - } - ] - } - ] - }, - { - "description": "createCommandCursor creates a cursor and stores it as an entity that can be iterated one document at a time", - "operations": [ - { - "name": "createCommandCursor", - "object": "db", - "arguments": { - "commandName": "find", - "batchSize": 2, - "command": { - "find": "collection", - "filter": {}, - "batchSize": 2 - } - }, - "saveResultAsEntity": "myRunCommandCursor" - }, - { - "name": "iterateUntilDocumentOrError", - "object": "myRunCommandCursor", - "expectResult": { - "_id": 1, - "x": 11 - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "myRunCommandCursor", - "expectResult": { - "_id": 2, - "x": 22 - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "myRunCommandCursor", - "expectResult": { - "_id": 3, - "x": 33 - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "myRunCommandCursor", - "expectResult": { - "_id": 4, - "x": 44 - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "myRunCommandCursor", - "expectResult": { - "_id": 5, - "x": 55 - } - } - ] - }, - { - "description": "createCommandCursor's cursor can be closed and will perform a killCursors operation", - "operations": [ - { - "name": "createCommandCursor", - "object": "db", - "arguments": { - "commandName": "find", - "batchSize": 2, - "command": { - "find": "collection", - "filter": {}, - "batchSize": 2 - } - }, - "saveResultAsEntity": "myRunCommandCursor" - }, - { - "name": "iterateUntilDocumentOrError", - "object": "myRunCommandCursor", - "expectResult": { - "_id": 1, - "x": 11 - } - }, - { - "name": "close", - "object": "myRunCommandCursor" - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "collection", - "filter": {}, - "batchSize": 2, - "$db": "db", - "lsid": { - "$$exists": true - } - }, - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "command": { - "killCursors": "collection", - "cursors": { - "$$type": "array" - } - }, - "commandName": "killCursors" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/entity-cursor-iterateOnce.json b/tests/UnifiedSpecTests/valid-pass/entity-cursor-iterateOnce.json deleted file mode 100644 index b17ae78b9..000000000 --- a/tests/UnifiedSpecTests/valid-pass/entity-cursor-iterateOnce.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "description": "entity-cursor-iterateOnce", - "schemaVersion": "1.9", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "databaseName": "database0", - "collectionName": "coll0", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ], - "tests": [ - { - "description": "iterateOnce", - "operations": [ - { - "name": "createFindCursor", - "object": "collection0", - "arguments": { - "filter": {}, - "batchSize": 2 - }, - "saveResultAsEntity": "cursor0" - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0", - "expectResult": { - "_id": 1 - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0", - "expectResult": { - "_id": 2 - } - }, - { - "name": "iterateOnce", - "object": "cursor0" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": {}, - "batchSize": 2 - }, - "commandName": "find", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0" - }, - "commandName": "getMore" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/entity-find-cursor.json b/tests/UnifiedSpecTests/valid-pass/entity-find-cursor.json deleted file mode 100644 index 6f955d81f..000000000 --- a/tests/UnifiedSpecTests/valid-pass/entity-find-cursor.json +++ /dev/null @@ -1,191 +0,0 @@ -{ - "description": "entity-find-cursor", - "schemaVersion": "1.3", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0Name" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "databaseName": "database0Name", - "collectionName": "coll0", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - }, - { - "_id": 4 - }, - { - "_id": 5 - } - ] - } - ], - "tests": [ - { - "description": "cursors can be created, iterated, and closed", - "operations": [ - { - "name": "createFindCursor", - "object": "collection0", - "arguments": { - "filter": {}, - "batchSize": 2 - }, - "saveResultAsEntity": "cursor0" - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0", - "expectResult": { - "_id": 1 - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0", - "expectResult": { - "_id": 2 - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "cursor0", - "expectResult": { - "_id": 3 - } - }, - { - "name": "close", - "object": "cursor0" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": {}, - "batchSize": 2 - }, - "commandName": "find", - "databaseName": "database0Name" - } - }, - { - "commandSucceededEvent": { - "reply": { - "cursor": { - "id": { - "$$type": [ - "int", - "long" - ] - }, - "ns": { - "$$type": "string" - }, - "firstBatch": { - "$$type": "array" - } - } - }, - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0" - }, - "commandName": "getMore" - } - }, - { - "commandSucceededEvent": { - "reply": { - "cursor": { - "id": { - "$$type": [ - "int", - "long" - ] - }, - "ns": { - "$$type": "string" - }, - "nextBatch": { - "$$type": "array" - } - } - }, - "commandName": "getMore" - } - }, - { - "commandStartedEvent": { - "command": { - "killCursors": "coll0", - "cursors": { - "$$type": "array" - } - }, - "commandName": "killCursors" - } - }, - { - "commandSucceededEvent": { - "reply": { - "cursorsKilled": { - "$$unsetOrMatches": { - "$$type": "array" - } - } - }, - "commandName": "killCursors" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/expectedError-errorResponse.json b/tests/UnifiedSpecTests/valid-pass/expectedError-errorResponse.json deleted file mode 100644 index 177b1baf5..000000000 --- a/tests/UnifiedSpecTests/valid-pass/expectedError-errorResponse.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "description": "expectedError-errorResponse", - "schemaVersion": "1.12", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "test" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "tests": [ - { - "description": "Unsupported command", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "unsupportedCommand", - "command": { - "unsupportedCommand": 1 - } - }, - "expectError": { - "errorResponse": { - "errmsg": { - "$$type": "string" - } - } - } - } - ] - }, - { - "description": "Unsupported query operator", - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "$unsupportedQueryOperator": 1 - } - }, - "expectError": { - "errorResponse": { - "errmsg": { - "$$type": "string" - } - } - } - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/expectedEventsForClient-eventType.json b/tests/UnifiedSpecTests/valid-pass/expectedEventsForClient-eventType.json deleted file mode 100644 index fe308df96..000000000 --- a/tests/UnifiedSpecTests/valid-pass/expectedEventsForClient-eventType.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "description": "expectedEventsForClient-eventType", - "schemaVersion": "1.3", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent", - "connectionReadyEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0Name" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "database0Name", - "documents": [] - } - ], - "tests": [ - { - "description": "eventType can be set to command and cmap", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "eventType": "command", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1 - } - ] - }, - "commandName": "insert" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - } - ] - } - ] - }, - { - "description": "eventType defaults to command if unset", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1 - } - ] - }, - "commandName": "insert" - } - } - ] - }, - { - "client": "client0", - "eventType": "cmap", - "events": [ - { - "connectionReadyEvent": {} - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/expectedEventsForClient-ignoreExtraEvents.json b/tests/UnifiedSpecTests/valid-pass/expectedEventsForClient-ignoreExtraEvents.json deleted file mode 100644 index 178b756c2..000000000 --- a/tests/UnifiedSpecTests/valid-pass/expectedEventsForClient-ignoreExtraEvents.json +++ /dev/null @@ -1,151 +0,0 @@ -{ - "description": "expectedEventsForClient-ignoreExtraEvents", - "schemaVersion": "1.7", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0Name" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "database0Name", - "documents": [] - } - ], - "tests": [ - { - "description": "ignoreExtraEvents can be set to false", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": false, - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 1 - } - ] - }, - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "ignoreExtraEvents can be set to true", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 2 - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 3 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 2 - } - ] - }, - "commandName": "insert" - } - } - ] - } - ] - }, - { - "description": "ignoreExtraEvents defaults to false if unset", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 4 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 4 - } - ] - }, - "commandName": "insert" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/ignoreResultAndError.json b/tests/UnifiedSpecTests/valid-pass/ignoreResultAndError.json deleted file mode 100644 index 2e9b1c58a..000000000 --- a/tests/UnifiedSpecTests/valid-pass/ignoreResultAndError.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "description": "ignoreResultAndError", - "schemaVersion": "1.3", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0Name" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "database0Name", - "documents": [] - } - ], - "tests": [ - { - "description": "operation errors are ignored if ignoreResultAndError is true", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1 - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1 - } - }, - "ignoreResultAndError": true - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/kmsProviders-explicit_kms_credentials.json b/tests/UnifiedSpecTests/valid-pass/kmsProviders-explicit_kms_credentials.json deleted file mode 100644 index 7cc74939e..000000000 --- a/tests/UnifiedSpecTests/valid-pass/kmsProviders-explicit_kms_credentials.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "description": "kmsProviders-explicit_kms_credentials", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "aws": { - "accessKeyId": "accessKeyId", - "secretAccessKey": "secretAccessKey" - }, - "azure": { - "tenantId": "tenantId", - "clientId": "clientId", - "clientSecret": "clientSecret" - }, - "gcp": { - "email": "email", - "privateKey": "cHJpdmF0ZUtleQo=" - }, - "kmip": { - "endpoint": "endpoint" - }, - "local": { - "key": "a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5a2V5" - } - } - } - } - } - ], - "tests": [ - { - "description": "", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/kmsProviders-mixed_kms_credential_fields.json b/tests/UnifiedSpecTests/valid-pass/kmsProviders-mixed_kms_credential_fields.json deleted file mode 100644 index 363f2a457..000000000 --- a/tests/UnifiedSpecTests/valid-pass/kmsProviders-mixed_kms_credential_fields.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "description": "kmsProviders-mixed_kms_credential_fields", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "aws": { - "accessKeyId": "accessKeyId", - "secretAccessKey": { - "$$placeholder": 1 - } - }, - "azure": { - "tenantId": "tenantId", - "clientId": { - "$$placeholder": 1 - }, - "clientSecret": { - "$$placeholder": 1 - } - }, - "gcp": { - "email": "email", - "privateKey": { - "$$placeholder": 1 - } - } - } - } - } - } - ], - "tests": [ - { - "description": "", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/kmsProviders-placeholder_kms_credentials.json b/tests/UnifiedSpecTests/valid-pass/kmsProviders-placeholder_kms_credentials.json deleted file mode 100644 index 3f7721f01..000000000 --- a/tests/UnifiedSpecTests/valid-pass/kmsProviders-placeholder_kms_credentials.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "description": "kmsProviders-placeholder_kms_credentials", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "aws": { - "accessKeyId": { - "$$placeholder": 1 - }, - "secretAccessKey": { - "$$placeholder": 1 - } - }, - "azure": { - "tenantId": { - "$$placeholder": 1 - }, - "clientId": { - "$$placeholder": 1 - }, - "clientSecret": { - "$$placeholder": 1 - } - }, - "gcp": { - "email": { - "$$placeholder": 1 - }, - "privateKey": { - "$$placeholder": 1 - } - }, - "kmip": { - "endpoint": { - "$$placeholder": 1 - } - }, - "local": { - "key": { - "$$placeholder": 1 - } - } - } - } - } - } - ], - "tests": [ - { - "description": "", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/kmsProviders-unconfigured_kms.json b/tests/UnifiedSpecTests/valid-pass/kmsProviders-unconfigured_kms.json deleted file mode 100644 index 12ca58094..000000000 --- a/tests/UnifiedSpecTests/valid-pass/kmsProviders-unconfigured_kms.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "description": "kmsProviders-unconfigured_kms", - "schemaVersion": "1.8", - "runOnRequirements": [ - { - "csfle": true - } - ], - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "clientEncryption": { - "id": "clientEncryption0", - "clientEncryptionOpts": { - "keyVaultClient": "client0", - "keyVaultNamespace": "keyvault.datakeys", - "kmsProviders": { - "aws": {}, - "azure": {}, - "gcp": {}, - "kmip": {}, - "local": {} - } - } - } - } - ], - "tests": [ - { - "description": "", - "skipReason": "DRIVERS-2280: waiting on driver support for on-demand credentials", - "operations": [] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/matches-lte-operator.json b/tests/UnifiedSpecTests/valid-pass/matches-lte-operator.json deleted file mode 100644 index 4de65c583..000000000 --- a/tests/UnifiedSpecTests/valid-pass/matches-lte-operator.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "description": "matches-lte-operator", - "schemaVersion": "1.9", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "database0Name" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "database0Name", - "documents": [] - } - ], - "tests": [ - { - "description": "special lte matching operator", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "y": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": { - "$$lte": 1 - }, - "y": { - "$$lte": 2 - } - } - ] - }, - "commandName": "insert", - "databaseName": "database0Name" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/observeSensitiveCommands.json b/tests/UnifiedSpecTests/valid-pass/observeSensitiveCommands.json deleted file mode 100644 index d3ae5665b..000000000 --- a/tests/UnifiedSpecTests/valid-pass/observeSensitiveCommands.json +++ /dev/null @@ -1,706 +0,0 @@ -{ - "description": "observeSensitiveCommands", - "schemaVersion": "1.5", - "runOnRequirements": [ - { - "auth": false - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent" - ], - "observeSensitiveCommands": true - } - }, - { - "client": { - "id": "client1", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent" - ], - "observeSensitiveCommands": false - } - }, - { - "client": { - "id": "client2", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "observeSensitiveCommands" - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "observeSensitiveCommands" - } - }, - { - "database": { - "id": "database2", - "client": "client2", - "databaseName": "observeSensitiveCommands" - } - } - ], - "tests": [ - { - "description": "getnonce is observed with observeSensitiveCommands=true", - "runOnRequirements": [ - { - "maxServerVersion": "6.1.99" - } - ], - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "getnonce", - "command": { - "getnonce": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "getnonce", - "command": { - "getnonce": { - "$$exists": false - } - } - } - }, - { - "commandSucceededEvent": { - "commandName": "getnonce", - "reply": { - "ok": { - "$$exists": false - }, - "nonce": { - "$$exists": false - } - } - } - } - ] - } - ] - }, - { - "description": "getnonce is not observed with observeSensitiveCommands=false", - "runOnRequirements": [ - { - "maxServerVersion": "6.1.99" - } - ], - "operations": [ - { - "name": "runCommand", - "object": "database1", - "arguments": { - "commandName": "getnonce", - "command": { - "getnonce": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [] - } - ] - }, - { - "description": "getnonce is not observed by default", - "runOnRequirements": [ - { - "maxServerVersion": "6.1.99" - } - ], - "operations": [ - { - "name": "runCommand", - "object": "database2", - "arguments": { - "commandName": "getnonce", - "command": { - "getnonce": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client2", - "events": [] - } - ] - }, - { - "description": "hello with speculativeAuthenticate", - "runOnRequirements": [ - { - "minServerVersion": "4.9" - } - ], - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "hello", - "command": { - "hello": 1, - "speculativeAuthenticate": { - "saslStart": 1 - } - } - } - }, - { - "name": "runCommand", - "object": "database1", - "arguments": { - "commandName": "hello", - "command": { - "hello": 1, - "speculativeAuthenticate": { - "saslStart": 1 - } - } - } - }, - { - "name": "runCommand", - "object": "database2", - "arguments": { - "commandName": "hello", - "command": { - "hello": 1, - "speculativeAuthenticate": { - "saslStart": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "hello", - "command": { - "hello": { - "$$exists": false - }, - "speculativeAuthenticate": { - "$$exists": false - } - } - } - }, - { - "commandSucceededEvent": { - "commandName": "hello", - "reply": { - "isWritablePrimary": { - "$$exists": false - }, - "speculativeAuthenticate": { - "$$exists": false - } - } - } - } - ] - }, - { - "client": "client1", - "events": [] - }, - { - "client": "client2", - "events": [] - } - ] - }, - { - "description": "hello without speculativeAuthenticate is always observed", - "runOnRequirements": [ - { - "minServerVersion": "4.9" - } - ], - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "hello", - "command": { - "hello": 1 - } - } - }, - { - "name": "runCommand", - "object": "database1", - "arguments": { - "commandName": "hello", - "command": { - "hello": 1 - } - } - }, - { - "name": "runCommand", - "object": "database2", - "arguments": { - "commandName": "hello", - "command": { - "hello": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "hello", - "command": { - "hello": 1 - } - } - }, - { - "commandSucceededEvent": { - "commandName": "hello", - "reply": { - "isWritablePrimary": { - "$$exists": true - } - } - } - } - ] - }, - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "commandName": "hello", - "command": { - "hello": 1 - } - } - }, - { - "commandSucceededEvent": { - "commandName": "hello", - "reply": { - "isWritablePrimary": { - "$$exists": true - } - } - } - } - ] - }, - { - "client": "client2", - "events": [ - { - "commandStartedEvent": { - "commandName": "hello", - "command": { - "hello": 1 - } - } - }, - { - "commandSucceededEvent": { - "commandName": "hello", - "reply": { - "isWritablePrimary": { - "$$exists": true - } - } - } - } - ] - } - ] - }, - { - "description": "legacy hello with speculativeAuthenticate", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "ismaster", - "command": { - "ismaster": 1, - "speculativeAuthenticate": { - "saslStart": 1 - } - } - } - }, - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "isMaster", - "command": { - "isMaster": 1, - "speculativeAuthenticate": { - "saslStart": 1 - } - } - } - }, - { - "name": "runCommand", - "object": "database1", - "arguments": { - "commandName": "ismaster", - "command": { - "ismaster": 1, - "speculativeAuthenticate": { - "saslStart": 1 - } - } - } - }, - { - "name": "runCommand", - "object": "database1", - "arguments": { - "commandName": "isMaster", - "command": { - "isMaster": 1, - "speculativeAuthenticate": { - "saslStart": 1 - } - } - } - }, - { - "name": "runCommand", - "object": "database2", - "arguments": { - "commandName": "ismaster", - "command": { - "ismaster": 1, - "speculativeAuthenticate": { - "saslStart": 1 - } - } - } - }, - { - "name": "runCommand", - "object": "database2", - "arguments": { - "commandName": "isMaster", - "command": { - "isMaster": 1, - "speculativeAuthenticate": { - "saslStart": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "ismaster", - "command": { - "ismaster": { - "$$exists": false - }, - "speculativeAuthenticate": { - "$$exists": false - } - } - } - }, - { - "commandSucceededEvent": { - "commandName": "ismaster", - "reply": { - "ismaster": { - "$$exists": false - }, - "speculativeAuthenticate": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "commandName": "isMaster", - "command": { - "isMaster": { - "$$exists": false - }, - "speculativeAuthenticate": { - "$$exists": false - } - } - } - }, - { - "commandSucceededEvent": { - "commandName": "isMaster", - "reply": { - "ismaster": { - "$$exists": false - }, - "speculativeAuthenticate": { - "$$exists": false - } - } - } - } - ] - }, - { - "client": "client1", - "events": [] - }, - { - "client": "client2", - "events": [] - } - ] - }, - { - "description": "legacy hello without speculativeAuthenticate is always observed", - "operations": [ - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "ismaster", - "command": { - "ismaster": 1 - } - } - }, - { - "name": "runCommand", - "object": "database0", - "arguments": { - "commandName": "isMaster", - "command": { - "isMaster": 1 - } - } - }, - { - "name": "runCommand", - "object": "database1", - "arguments": { - "commandName": "ismaster", - "command": { - "ismaster": 1 - } - } - }, - { - "name": "runCommand", - "object": "database1", - "arguments": { - "commandName": "isMaster", - "command": { - "isMaster": 1 - } - } - }, - { - "name": "runCommand", - "object": "database2", - "arguments": { - "commandName": "ismaster", - "command": { - "ismaster": 1 - } - } - }, - { - "name": "runCommand", - "object": "database2", - "arguments": { - "commandName": "isMaster", - "command": { - "isMaster": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "commandName": "ismaster", - "command": { - "ismaster": 1 - } - } - }, - { - "commandSucceededEvent": { - "commandName": "ismaster", - "reply": { - "ismaster": { - "$$exists": true - } - } - } - }, - { - "commandStartedEvent": { - "commandName": "isMaster", - "command": { - "isMaster": 1 - } - } - }, - { - "commandSucceededEvent": { - "commandName": "isMaster", - "reply": { - "ismaster": { - "$$exists": true - } - } - } - } - ] - }, - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "commandName": "ismaster", - "command": { - "ismaster": 1 - } - } - }, - { - "commandSucceededEvent": { - "commandName": "ismaster", - "reply": { - "ismaster": { - "$$exists": true - } - } - } - }, - { - "commandStartedEvent": { - "commandName": "isMaster", - "command": { - "isMaster": 1 - } - } - }, - { - "commandSucceededEvent": { - "commandName": "isMaster", - "reply": { - "ismaster": { - "$$exists": true - } - } - } - } - ] - }, - { - "client": "client2", - "events": [ - { - "commandStartedEvent": { - "commandName": "ismaster", - "command": { - "ismaster": 1 - } - } - }, - { - "commandSucceededEvent": { - "commandName": "ismaster", - "reply": { - "ismaster": { - "$$exists": true - } - } - } - }, - { - "commandStartedEvent": { - "commandName": "isMaster", - "command": { - "isMaster": 1 - } - } - }, - { - "commandSucceededEvent": { - "commandName": "isMaster", - "reply": { - "ismaster": { - "$$exists": true - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/poc-change-streams.json b/tests/UnifiedSpecTests/valid-pass/poc-change-streams.json deleted file mode 100644 index 50f0d06f0..000000000 --- a/tests/UnifiedSpecTests/valid-pass/poc-change-streams.json +++ /dev/null @@ -1,455 +0,0 @@ -{ - "description": "poc-change-streams", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ], - "ignoreCommandMonitoringEvents": [ - "getMore", - "killCursors" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "change-stream-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "client": { - "id": "client1", - "useMultipleMongoses": false - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "change-stream-tests" - } - }, - { - "database": { - "id": "database2", - "client": "client1", - "databaseName": "change-stream-tests-2" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "collection": { - "id": "collection2", - "database": "database1", - "collectionName": "test2" - } - }, - { - "collection": { - "id": "collection3", - "database": "database2", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "change-stream-tests", - "documents": [] - }, - { - "collectionName": "test2", - "databaseName": "change-stream-tests", - "documents": [] - }, - { - "collectionName": "test", - "databaseName": "change-stream-tests-2", - "documents": [] - } - ], - "tests": [ - { - "description": "saveResultAsEntity is optional for createChangeStream", - "runOnRequirements": [ - { - "minServerVersion": "3.8.0", - "topologies": [ - "replicaset" - ] - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "client0", - "arguments": { - "pipeline": [] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1 - }, - "commandName": "aggregate", - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "Executing a watch helper on a MongoClient results in notifications for changes to all collections in all databases in the cluster.", - "runOnRequirements": [ - { - "minServerVersion": "3.8.0", - "topologies": [ - "replicaset" - ] - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "client0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "collection2", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "insertOne", - "object": "collection3", - "arguments": { - "document": { - "y": 1 - } - } - }, - { - "name": "insertOne", - "object": "collection1", - "arguments": { - "document": { - "z": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "change-stream-tests", - "coll": "test2" - }, - "fullDocument": { - "_id": { - "$$type": "objectId" - }, - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "change-stream-tests-2", - "coll": "test" - }, - "fullDocument": { - "_id": { - "$$type": "objectId" - }, - "y": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "change-stream-tests", - "coll": "test" - }, - "fullDocument": { - "_id": { - "$$type": "objectId" - }, - "z": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "allChangesForCluster": true, - "fullDocument": { - "$$unsetOrMatches": "default" - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "Test consecutive resume", - "runOnRequirements": [ - { - "minServerVersion": "4.1.7", - "topologies": [ - "replicaset" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "getMore" - ], - "closeConnection": true - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "batchSize": 1, - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "collection1", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "insertOne", - "object": "collection1", - "arguments": { - "document": { - "x": 2 - } - } - }, - { - "name": "insertOne", - "object": "collection1", - "arguments": { - "document": { - "x": 3 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "change-stream-tests", - "coll": "test" - }, - "fullDocument": { - "_id": { - "$$type": "objectId" - }, - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "change-stream-tests", - "coll": "test" - }, - "fullDocument": { - "_id": { - "$$type": "objectId" - }, - "x": 2 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "operationType": "insert", - "ns": { - "db": "change-stream-tests", - "coll": "test" - }, - "fullDocument": { - "_id": { - "$$type": "objectId" - }, - "x": 3 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "cursor": { - "batchSize": 1 - }, - "pipeline": [ - { - "$changeStream": { - "fullDocument": { - "$$unsetOrMatches": "default" - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "change-stream-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "cursor": { - "batchSize": 1 - }, - "pipeline": [ - { - "$changeStream": { - "fullDocument": { - "$$unsetOrMatches": "default" - }, - "resumeAfter": { - "$$exists": true - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "change-stream-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "cursor": { - "batchSize": 1 - }, - "pipeline": [ - { - "$changeStream": { - "fullDocument": { - "$$unsetOrMatches": "default" - }, - "resumeAfter": { - "$$exists": true - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "change-stream-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/poc-command-monitoring.json b/tests/UnifiedSpecTests/valid-pass/poc-command-monitoring.json deleted file mode 100644 index fe0a5ae99..000000000 --- a/tests/UnifiedSpecTests/valid-pass/poc-command-monitoring.json +++ /dev/null @@ -1,223 +0,0 @@ -{ - "description": "poc-command-monitoring", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent", - "commandSucceededEvent", - "commandFailedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "command-monitoring-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "command-monitoring-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - } - ] - } - ], - "tests": [ - { - "description": "A successful find event with a getmore and the server kills the cursor (<= 4.4)", - "runOnRequirements": [ - { - "minServerVersion": "3.1", - "maxServerVersion": "4.4.99", - "topologies": [ - "single", - "replicaset" - ] - } - ], - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": { - "$gte": 1 - } - }, - "sort": { - "_id": 1 - }, - "batchSize": 3, - "limit": 4 - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": { - "$gte": 1 - } - }, - "sort": { - "_id": 1 - }, - "batchSize": 3, - "limit": 4 - }, - "commandName": "find", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "cursor": { - "id": { - "$$type": [ - "int", - "long" - ] - }, - "ns": "command-monitoring-tests.test", - "firstBatch": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - }, - "commandName": "find" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "test", - "batchSize": 1 - }, - "commandName": "getMore", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandSucceededEvent": { - "reply": { - "ok": 1, - "cursor": { - "id": 0, - "ns": "command-monitoring-tests.test", - "nextBatch": [ - { - "_id": 4, - "x": 44 - } - ] - } - }, - "commandName": "getMore" - } - } - ] - } - ] - }, - { - "description": "A failed find event", - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "$or": true - } - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "$or": true - } - }, - "commandName": "find", - "databaseName": "command-monitoring-tests" - } - }, - { - "commandFailedEvent": { - "commandName": "find" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/poc-crud.json b/tests/UnifiedSpecTests/valid-pass/poc-crud.json deleted file mode 100644 index 94e4ec568..000000000 --- a/tests/UnifiedSpecTests/valid-pass/poc-crud.json +++ /dev/null @@ -1,450 +0,0 @@ -{ - "description": "poc-crud", - "schemaVersion": "1.4", - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-tests" - } - }, - { - "database": { - "id": "database1", - "client": "client0", - "databaseName": "admin" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll0" - } - }, - { - "collection": { - "id": "collection1", - "database": "database0", - "collectionName": "coll1" - } - }, - { - "collection": { - "id": "collection2", - "database": "database0", - "collectionName": "coll2", - "collectionOptions": { - "readConcern": { - "level": "majority" - } - } - } - } - ], - "initialData": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - }, - { - "collectionName": "coll1", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - }, - { - "collectionName": "coll2", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - }, - { - "collectionName": "aggregate_out", - "databaseName": "crud-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "BulkWrite with mixed ordered operations", - "operations": [ - { - "name": "bulkWrite", - "object": "collection0", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 3, - "x": 33 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "updateMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "insertOne": { - "document": { - "_id": 4, - "x": 44 - } - } - }, - { - "deleteMany": { - "filter": { - "x": { - "$nin": [ - 24, - 34 - ] - } - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 4 - }, - "replacement": { - "_id": 4, - "x": 44 - }, - "upsert": true - } - } - ], - "ordered": true - }, - "expectResult": { - "deletedCount": 2, - "insertedCount": 2, - "insertedIds": { - "$$unsetOrMatches": { - "0": 3, - "3": 4 - } - }, - "matchedCount": 3, - "modifiedCount": 3, - "upsertedCount": 1, - "upsertedIds": { - "5": 4 - } - } - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 2, - "x": 24 - }, - { - "_id": 3, - "x": 34 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "InsertMany continue-on-error behavior with unordered (duplicate key in requests)", - "operations": [ - { - "name": "insertMany", - "object": "collection1", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ], - "ordered": false - }, - "expectError": { - "expectResult": { - "$$unsetOrMatches": { - "deletedCount": 0, - "insertedCount": 2, - "matchedCount": 0, - "modifiedCount": 0, - "upsertedCount": 0, - "upsertedIds": {} - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll1", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "ReplaceOne prohibits atomic modifiers", - "operations": [ - { - "name": "replaceOne", - "object": "collection1", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "$set": { - "x": 22 - } - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ], - "outcome": [ - { - "collectionName": "coll1", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] - }, - { - "description": "readConcern majority with out stage", - "runOnRequirements": [ - { - "minServerVersion": "4.1.0", - "topologies": [ - "replicaset", - "sharded" - ], - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "aggregate", - "object": "collection2", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "aggregate_out" - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll2", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$out": "aggregate_out" - } - ], - "readConcern": { - "level": "majority" - } - }, - "commandName": "aggregate", - "databaseName": "crud-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "aggregate_out", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "Aggregate with $listLocalSessions", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "aggregate", - "object": "database1", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - }, - { - "$addFields": { - "dummy": "dummy field" - } - }, - { - "$project": { - "_id": 0, - "dummy": 1 - } - } - ] - }, - "expectResult": [ - { - "dummy": "dummy field" - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/poc-gridfs.json b/tests/UnifiedSpecTests/valid-pass/poc-gridfs.json deleted file mode 100644 index 1f07a19bf..000000000 --- a/tests/UnifiedSpecTests/valid-pass/poc-gridfs.json +++ /dev/null @@ -1,301 +0,0 @@ -{ - "description": "poc-gridfs", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0" - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "gridfs-tests" - } - }, - { - "bucket": { - "id": "bucket0", - "database": "database0" - } - }, - { - "collection": { - "id": "bucket0_files_collection", - "database": "database0", - "collectionName": "fs.files" - } - }, - { - "collection": { - "id": "bucket0_chunks_collection", - "database": "database0", - "collectionName": "fs.chunks" - } - } - ], - "initialData": [ - { - "collectionName": "fs.files", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000005" - }, - "length": 10, - "chunkSize": 4, - "uploadDate": { - "$date": "1970-01-01T00:00:00.000Z" - }, - "md5": "57d83cd477bfb1ccd975ab33d827a92b", - "filename": "length-10", - "contentType": "application/octet-stream", - "aliases": [], - "metadata": {} - } - ] - }, - { - "collectionName": "fs.chunks", - "databaseName": "gridfs-tests", - "documents": [ - { - "_id": { - "$oid": "000000000000000000000005" - }, - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESIzRA==", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000006" - }, - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 1, - "data": { - "$binary": { - "base64": "VWZ3iA==", - "subType": "00" - } - } - }, - { - "_id": { - "$oid": "000000000000000000000007" - }, - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 2, - "data": { - "$binary": { - "base64": "mao=", - "subType": "00" - } - } - } - ] - } - ], - "tests": [ - { - "description": "Delete when length is 10", - "operations": [ - { - "name": "delete", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000005" - } - } - } - ], - "outcome": [ - { - "collectionName": "fs.files", - "databaseName": "gridfs-tests", - "documents": [] - }, - { - "collectionName": "fs.chunks", - "databaseName": "gridfs-tests", - "documents": [] - } - ] - }, - { - "description": "Download when there are three chunks", - "operations": [ - { - "name": "download", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000005" - } - }, - "expectResult": { - "$$matchesHexBytes": "112233445566778899aa" - } - } - ] - }, - { - "description": "Download when files entry does not exist", - "operations": [ - { - "name": "download", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000000" - } - }, - "expectError": { - "isError": true - } - } - ] - }, - { - "description": "Download when an intermediate chunk is missing", - "operations": [ - { - "name": "deleteOne", - "object": "bucket0_chunks_collection", - "arguments": { - "filter": { - "files_id": { - "$oid": "000000000000000000000005" - }, - "n": 1 - } - }, - "expectResult": { - "deletedCount": 1 - } - }, - { - "name": "download", - "object": "bucket0", - "arguments": { - "id": { - "$oid": "000000000000000000000005" - } - }, - "expectError": { - "isError": true - } - } - ] - }, - { - "description": "Upload when length is 5", - "operations": [ - { - "name": "upload", - "object": "bucket0", - "arguments": { - "filename": "filename", - "source": { - "$$hexBytes": "1122334455" - }, - "chunkSizeBytes": 4 - }, - "expectResult": { - "$$type": "objectId" - }, - "saveResultAsEntity": "oid0" - }, - { - "name": "find", - "object": "bucket0_files_collection", - "arguments": { - "filter": {}, - "sort": { - "uploadDate": -1 - }, - "limit": 1 - }, - "expectResult": [ - { - "_id": { - "$$matchesEntity": "oid0" - }, - "length": 5, - "chunkSize": 4, - "uploadDate": { - "$$type": "date" - }, - "md5": { - "$$unsetOrMatches": "283d4fea5dded59cf837d3047328f5af" - }, - "filename": "filename" - } - ] - }, - { - "name": "find", - "object": "bucket0_chunks_collection", - "arguments": { - "filter": { - "_id": { - "$gt": { - "$oid": "000000000000000000000007" - } - } - }, - "sort": { - "n": 1 - } - }, - "expectResult": [ - { - "_id": { - "$$type": "objectId" - }, - "files_id": { - "$$matchesEntity": "oid0" - }, - "n": 0, - "data": { - "$binary": { - "base64": "ESIzRA==", - "subType": "00" - } - } - }, - { - "_id": { - "$$type": "objectId" - }, - "files_id": { - "$$matchesEntity": "oid0" - }, - "n": 1, - "data": { - "$binary": { - "base64": "VQ==", - "subType": "00" - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/poc-retryable-reads.json b/tests/UnifiedSpecTests/valid-pass/poc-retryable-reads.json deleted file mode 100644 index 2b65d501a..000000000 --- a/tests/UnifiedSpecTests/valid-pass/poc-retryable-reads.json +++ /dev/null @@ -1,433 +0,0 @@ -{ - "description": "poc-retryable-reads", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "single", - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "client": { - "id": "client1", - "uriOptions": { - "retryReads": false - }, - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-reads-tests" - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-reads-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-reads-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "tests": [ - { - "description": "Aggregate succeeds after InterruptedAtShutdown", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "aggregate" - ], - "errorCode": 11600 - } - } - } - }, - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "coll", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - }, - { - "$sort": { - "x": 1 - } - } - ] - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find succeeds on second attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 2 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 2 - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {}, - "sort": { - "_id": 1 - }, - "limit": 2 - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find fails on first attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "name": "find", - "object": "collection1", - "arguments": { - "filter": {} - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {} - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "Find fails on second attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "find" - ], - "closeConnection": true - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": {} - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {} - }, - "databaseName": "retryable-reads-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "coll", - "filter": {} - }, - "databaseName": "retryable-reads-tests" - } - } - ] - } - ] - }, - { - "description": "ListDatabases succeeds on second attempt", - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "listDatabases" - ], - "closeConnection": true - } - } - } - }, - { - "name": "listDatabases", - "object": "client0" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - }, - { - "commandStartedEvent": { - "command": { - "listDatabases": 1 - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/poc-retryable-writes.json b/tests/UnifiedSpecTests/valid-pass/poc-retryable-writes.json deleted file mode 100644 index f19aa3f9d..000000000 --- a/tests/UnifiedSpecTests/valid-pass/poc-retryable-writes.json +++ /dev/null @@ -1,491 +0,0 @@ -{ - "description": "poc-retryable-writes", - "schemaVersion": "1.0", - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "client": { - "id": "client1", - "uriOptions": { - "retryWrites": false - }, - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "retryable-writes-tests" - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "retryable-writes-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "coll" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "coll" - } - } - ], - "initialData": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ], - "tests": [ - { - "description": "FindOneAndUpdate is committed on first attempt", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate is not committed on first attempt", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 1 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectResult": { - "_id": 1, - "x": 11 - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 12 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "FindOneAndUpdate is never committed", - "runOnRequirements": [ - { - "minServerVersion": "3.6", - "topologies": [ - "replicaset" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "onPrimaryTransactionalWrite", - "mode": { - "times": 2 - }, - "data": { - "failBeforeCommitExceptionCode": 1 - } - } - } - }, - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "returnDocument": "Before" - }, - "expectError": { - "isError": true - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "InsertMany succeeds after PrimarySteppedDown", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset", - "sharded" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 189, - "errorLabels": [ - "RetryableWriteError" - ] - } - } - } - }, - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "documents": [ - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ], - "ordered": true - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedIds": { - "$$unsetOrMatches": { - "0": 3, - "1": 4 - } - } - } - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] - }, - { - "description": "InsertOne fails after connection failure when retryWrites option is false", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.7", - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client1", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "insertOne", - "object": "collection1", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectError": { - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "InsertOne fails after multiple retryable writeConcernErrors", - "runOnRequirements": [ - { - "minServerVersion": "4.3.1", - "topologies": [ - "replicaset", - "sharded" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorLabels": [ - "RetryableWriteError" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectError": { - "errorLabelsContain": [ - "RetryableWriteError" - ] - } - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/poc-sessions.json b/tests/UnifiedSpecTests/valid-pass/poc-sessions.json deleted file mode 100644 index 117c9e7d0..000000000 --- a/tests/UnifiedSpecTests/valid-pass/poc-sessions.json +++ /dev/null @@ -1,466 +0,0 @@ -{ - "description": "poc-sessions", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": false, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "session-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "session-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ], - "tests": [ - { - "description": "Server supports explicit sessions", - "operations": [ - { - "name": "assertSessionNotDirty", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "name": "assertSessionNotDirty", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "endSession", - "object": "session0" - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": -1 - } - }, - "expectResult": [] - }, - { - "name": "assertSameLsidOnLastTwoCommands", - "object": "testRunner", - "arguments": { - "client": "client0" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - } - }, - "commandName": "insert", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": -1 - }, - "lsid": { - "$$sessionLsid": "session0" - } - }, - "commandName": "find", - "databaseName": "session-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "session-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "Server supports implicit sessions", - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": -1 - } - }, - "expectResult": [] - }, - { - "name": "assertSameLsidOnLastTwoCommands", - "object": "testRunner", - "arguments": { - "client": "client0" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$type": "object" - } - }, - "commandName": "insert", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": -1 - }, - "lsid": { - "$$type": "object" - } - }, - "commandName": "find", - "databaseName": "session-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "session-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - }, - { - "description": "Dirty explicit session is discarded", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "assertSessionNotDirty", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 2 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 2 - } - } - } - }, - { - "name": "assertSessionDirty", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "assertSessionDirty", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "endSession", - "object": "session0" - }, - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": -1 - } - }, - "expectResult": [] - }, - { - "name": "assertDifferentLsidOnLastTwoCommands", - "object": "testRunner", - "arguments": { - "client": "client0" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1 - }, - "commandName": "insert", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 2 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1 - }, - "commandName": "insert", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 2 - }, - "commandName": "insert", - "databaseName": "session-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "find": "test", - "filter": { - "_id": -1 - }, - "lsid": { - "$$type": "object" - } - }, - "commandName": "find", - "databaseName": "session-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "session-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/poc-transactions-convenient-api.json b/tests/UnifiedSpecTests/valid-pass/poc-transactions-convenient-api.json deleted file mode 100644 index 9ab44a9c5..000000000 --- a/tests/UnifiedSpecTests/valid-pass/poc-transactions-convenient-api.json +++ /dev/null @@ -1,505 +0,0 @@ -{ - "description": "poc-transactions-convenient-api", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "client": { - "id": "client1", - "uriOptions": { - "readConcernLevel": "local", - "w": 1 - }, - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "database": { - "id": "database1", - "client": "client1", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "collection": { - "id": "collection1", - "database": "database1", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - }, - { - "session": { - "id": "session1", - "client": "client1" - } - }, - { - "session": { - "id": "session2", - "client": "client0", - "sessionOptions": { - "defaultTransactionOptions": { - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "w": 1 - } - } - } - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "withTransaction and no transaction options set", - "operations": [ - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "autocommit": false, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "withTransaction inherits transaction options from client", - "operations": [ - { - "name": "withTransaction", - "object": "session1", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection1", - "arguments": { - "session": "session1", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client1", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": 1, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "local" - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session1" - }, - "txnNumber": 1, - "autocommit": false, - "writeConcern": { - "w": 1 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "withTransaction inherits transaction options from defaultTransactionOptions", - "operations": [ - { - "name": "withTransaction", - "object": "session2", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session2", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session2" - }, - "txnNumber": 1, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session2" - }, - "txnNumber": 1, - "autocommit": false, - "writeConcern": { - "w": 1 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - }, - { - "description": "withTransaction explicit transaction options", - "operations": [ - { - "name": "withTransaction", - "object": "session0", - "arguments": { - "callback": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 1 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 1 - } - } - } - } - ], - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "w": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 1 - } - ], - "ordered": true, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "startTransaction": true, - "autocommit": false, - "readConcern": { - "level": "majority" - }, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "autocommit": false, - "writeConcern": { - "w": 1 - }, - "readConcern": { - "$$exists": false - }, - "startTransaction": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/poc-transactions-mongos-pin-auto.json b/tests/UnifiedSpecTests/valid-pass/poc-transactions-mongos-pin-auto.json deleted file mode 100644 index de08edec4..000000000 --- a/tests/UnifiedSpecTests/valid-pass/poc-transactions-mongos-pin-auto.json +++ /dev/null @@ -1,409 +0,0 @@ -{ - "description": "poc-transactions-mongos-pin-auto", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "useMultipleMongoses": true, - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ], - "tests": [ - { - "description": "remain pinned after non-transient Interrupted error on insertOne", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 11601 - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "expectError": { - "errorLabelsOmit": [ - "TransientTransactionError", - "UnknownTransactionCommitResult" - ], - "errorCodeName": "Interrupted" - } - }, - { - "name": "assertSessionPinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "commitTransaction", - "object": "session0" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - }, - "recoveryToken": { - "$$type": "object" - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - }, - { - "_id": 3 - } - ] - } - ] - }, - { - "description": "unpin after transient error within a transaction", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 3 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 3 - } - } - } - }, - { - "name": "targetedFailPoint", - "object": "testRunner", - "arguments": { - "session": "session0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "closeConnection": true - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "session": "session0", - "document": { - "_id": 4 - } - }, - "expectError": { - "errorLabelsContain": [ - "TransientTransactionError" - ], - "errorLabelsOmit": [ - "UnknownTransactionCommitResult" - ] - } - }, - { - "name": "assertSessionUnpinned", - "object": "testRunner", - "arguments": { - "session": "session0" - } - }, - { - "name": "abortTransaction", - "object": "session0" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 3 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 4 - } - ], - "ordered": true, - "readConcern": { - "$$exists": false - }, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "insert", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - }, - "recoveryToken": { - "$$type": "object" - } - }, - "commandName": "abortTransaction", - "databaseName": "admin" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/valid-pass/poc-transactions.json b/tests/UnifiedSpecTests/valid-pass/poc-transactions.json deleted file mode 100644 index 2055a3b70..000000000 --- a/tests/UnifiedSpecTests/valid-pass/poc-transactions.json +++ /dev/null @@ -1,323 +0,0 @@ -{ - "description": "poc-transactions", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "4.0", - "topologies": [ - "replicaset" - ] - }, - { - "minServerVersion": "4.1.8", - "topologies": [ - "sharded" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "transaction-tests" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test" - } - }, - { - "session": { - "id": "session0", - "client": "client0" - } - } - ], - "initialData": [ - { - "collectionName": "test", - "databaseName": "transaction-tests", - "documents": [] - } - ], - "tests": [ - { - "description": "Client side error in command starting transaction", - "operations": [ - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "session": "session0", - "filter": { - "_id": 1 - }, - "update": { - "x": 1 - } - }, - "expectError": { - "isClientError": true - } - }, - { - "name": "assertSessionTransactionState", - "object": "testRunner", - "arguments": { - "session": "session0", - "state": "starting" - } - } - ] - }, - { - "description": "explicitly create collection using create command", - "runOnRequirements": [ - { - "minServerVersion": "4.3.4", - "topologies": [ - "replicaset", - "sharded" - ] - } - ], - "operations": [ - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "test" - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "createCollection", - "object": "database0", - "arguments": { - "session": "session0", - "collection": "test" - } - }, - { - "name": "assertCollectionNotExists", - "object": "testRunner", - "arguments": { - "databaseName": "transaction-tests", - "collectionName": "test" - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertCollectionExists", - "object": "testRunner", - "arguments": { - "databaseName": "transaction-tests", - "collectionName": "test" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "drop": "test", - "writeConcern": { - "$$exists": false - } - }, - "commandName": "drop", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "create": "test", - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "create", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ] - }, - { - "description": "create index on a non-existing collection", - "runOnRequirements": [ - { - "minServerVersion": "4.3.4", - "topologies": [ - "replicaset", - "sharded" - ] - } - ], - "operations": [ - { - "name": "dropCollection", - "object": "database0", - "arguments": { - "collection": "test" - } - }, - { - "name": "startTransaction", - "object": "session0" - }, - { - "name": "createIndex", - "object": "collection0", - "arguments": { - "session": "session0", - "name": "x_1", - "keys": { - "x": 1 - } - } - }, - { - "name": "assertIndexNotExists", - "object": "testRunner", - "arguments": { - "databaseName": "transaction-tests", - "collectionName": "test", - "indexName": "x_1" - } - }, - { - "name": "commitTransaction", - "object": "session0" - }, - { - "name": "assertIndexExists", - "object": "testRunner", - "arguments": { - "databaseName": "transaction-tests", - "collectionName": "test", - "indexName": "x_1" - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "drop": "test", - "writeConcern": { - "$$exists": false - } - }, - "commandName": "drop", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "createIndexes": "test", - "indexes": [ - { - "name": "x_1", - "key": { - "x": 1 - } - } - ], - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "startTransaction": true, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "createIndexes", - "databaseName": "transaction-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session0" - }, - "txnNumber": 1, - "startTransaction": { - "$$exists": false - }, - "autocommit": false, - "writeConcern": { - "$$exists": false - } - }, - "commandName": "commitTransaction", - "databaseName": "admin" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/versioned-api/crud-api-version-1-strict.json b/tests/UnifiedSpecTests/versioned-api/crud-api-version-1-strict.json deleted file mode 100644 index c1c8ecce0..000000000 --- a/tests/UnifiedSpecTests/versioned-api/crud-api-version-1-strict.json +++ /dev/null @@ -1,1109 +0,0 @@ -{ - "description": "CRUD Api Version 1 (strict)", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.9" - } - ], - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent" - ], - "serverApi": { - "version": "1", - "strict": true - } - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "versioned-api-tests" - } - }, - { - "database": { - "id": "adminDatabase", - "client": "client", - "databaseName": "admin" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "test" - } - } - ], - "_yamlAnchors": { - "versions": [ - { - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - ] - }, - "initialData": [ - { - "collectionName": "test", - "databaseName": "versioned-api-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - } - ] - } - ], - "tests": [ - { - "description": "aggregate on collection appends declared API version", - "operations": [ - { - "name": "aggregate", - "object": "collection", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "aggregate on database appends declared API version", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "aggregate", - "object": "adminDatabase", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - } - ] - }, - "expectError": { - "errorCodeName": "APIStrictError" - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "bulkWrite appends declared API version", - "operations": [ - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 6, - "x": 66 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "deleteMany": { - "filter": { - "x": { - "$nin": [ - 24, - 34 - ] - } - } - } - }, - { - "updateMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "deleteOne": { - "filter": { - "_id": 7 - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 4 - }, - "replacement": { - "_id": 4, - "x": 44 - }, - "upsert": true - } - } - ], - "ordered": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 6, - "x": 66 - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 2 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "x": { - "$nin": [ - 24, - 34 - ] - } - }, - "limit": 0 - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 7 - }, - "limit": 1 - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 4 - }, - "u": { - "_id": 4, - "x": 44 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": true - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "countDocuments appends declared API version", - "operations": [ - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": { - "x": { - "$gt": 11 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$match": { - "x": { - "$gt": 11 - } - } - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "deleteMany appends declared API version", - "operations": [ - { - "name": "deleteMany", - "object": "collection", - "arguments": { - "filter": { - "x": { - "$nin": [ - 24, - 34 - ] - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "x": { - "$nin": [ - 24, - 34 - ] - } - }, - "limit": 0 - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "deleteOne appends declared API version", - "operations": [ - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "filter": { - "_id": 7 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 7 - }, - "limit": 1 - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "distinct appends declared API version", - "operations": [ - { - "name": "distinct", - "object": "collection", - "arguments": { - "fieldName": "x", - "filter": {} - }, - "expectError": { - "isError": true, - "errorContains": "command distinct is not in API Version 1", - "errorCodeName": "APIStrictError" - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "test", - "key": "x", - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "estimatedDocumentCount appends declared API version", - "runOnRequirements": [ - { - "minServerVersion": "5.0.9", - "maxServerVersion": "5.0.99" - }, - { - "minServerVersion": "5.3.2" - } - ], - "operations": [ - { - "name": "estimatedDocumentCount", - "object": "collection", - "arguments": {} - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "test", - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "find and getMore append API version", - "operations": [ - { - "name": "find", - "object": "collection", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "batchSize": 3 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - } - ] - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "findOneAndDelete appends declared API version", - "operations": [ - { - "name": "findOneAndDelete", - "object": "collection", - "arguments": { - "filter": { - "_id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 1 - }, - "remove": true, - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "findOneAndReplace appends declared API version", - "operations": [ - { - "name": "findOneAndReplace", - "object": "collection", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 1 - }, - "update": { - "x": 33 - }, - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "findOneAndUpdate appends declared API version", - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "insertMany appends declared API version", - "operations": [ - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 6, - "x": 66 - }, - { - "_id": 7, - "x": 77 - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 6, - "x": 66 - }, - { - "_id": 7, - "x": 77 - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "insertOne appends declared API version", - "operations": [ - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 6, - "x": 66 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 6, - "x": 66 - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "replaceOne appends declared API version", - "operations": [ - { - "name": "replaceOne", - "object": "collection", - "arguments": { - "filter": { - "_id": 4 - }, - "replacement": { - "_id": 4, - "x": 44 - }, - "upsert": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 4 - }, - "u": { - "_id": 4, - "x": 44 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": true - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "updateMany appends declared API version", - "operations": [ - { - "name": "updateMany", - "object": "collection", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "updateOne appends declared API version", - "operations": [ - { - "name": "updateOne", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 2 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/versioned-api/crud-api-version-1.json b/tests/UnifiedSpecTests/versioned-api/crud-api-version-1.json deleted file mode 100644 index a387d0587..000000000 --- a/tests/UnifiedSpecTests/versioned-api/crud-api-version-1.json +++ /dev/null @@ -1,1101 +0,0 @@ -{ - "description": "CRUD Api Version 1", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.9" - } - ], - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent" - ], - "serverApi": { - "version": "1", - "deprecationErrors": true - } - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "versioned-api-tests" - } - }, - { - "database": { - "id": "adminDatabase", - "client": "client", - "databaseName": "admin" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "test" - } - } - ], - "_yamlAnchors": { - "versions": [ - { - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - ] - }, - "initialData": [ - { - "collectionName": "test", - "databaseName": "versioned-api-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - } - ] - } - ], - "tests": [ - { - "description": "aggregate on collection appends declared API version", - "operations": [ - { - "name": "aggregate", - "object": "collection", - "arguments": { - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$sort": { - "x": 1 - } - }, - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "aggregate on database appends declared API version", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "aggregate", - "object": "adminDatabase", - "arguments": { - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": 1, - "pipeline": [ - { - "$listLocalSessions": {} - }, - { - "$limit": 1 - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "bulkWrite appends declared API version", - "operations": [ - { - "name": "bulkWrite", - "object": "collection", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 6, - "x": 66 - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "deleteMany": { - "filter": { - "x": { - "$nin": [ - 24, - 34 - ] - } - } - } - }, - { - "updateMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - } - } - }, - { - "deleteOne": { - "filter": { - "_id": 7 - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 4 - }, - "replacement": { - "_id": 4, - "x": 44 - }, - "upsert": true - } - } - ], - "ordered": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 6, - "x": 66 - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 2 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - }, - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "x": { - "$nin": [ - 24, - 34 - ] - } - }, - "limit": 0 - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - }, - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 7 - }, - "limit": 1 - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - }, - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 4 - }, - "u": { - "_id": 4, - "x": 44 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": true - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "countDocuments appends declared API version", - "operations": [ - { - "name": "countDocuments", - "object": "collection", - "arguments": { - "filter": { - "x": { - "$gt": 11 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "test", - "pipeline": [ - { - "$match": { - "x": { - "$gt": 11 - } - } - }, - { - "$group": { - "_id": 1, - "n": { - "$sum": 1 - } - } - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "deleteMany appends declared API version", - "operations": [ - { - "name": "deleteMany", - "object": "collection", - "arguments": { - "filter": { - "x": { - "$nin": [ - 24, - 34 - ] - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "x": { - "$nin": [ - 24, - 34 - ] - } - }, - "limit": 0 - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "deleteOne appends declared API version", - "operations": [ - { - "name": "deleteOne", - "object": "collection", - "arguments": { - "filter": { - "_id": 7 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "test", - "deletes": [ - { - "q": { - "_id": 7 - }, - "limit": 1 - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "distinct appends declared API version", - "operations": [ - { - "name": "distinct", - "object": "collection", - "arguments": { - "fieldName": "x", - "filter": {} - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "test", - "key": "x", - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "estimatedDocumentCount appends declared API version", - "runOnRequirements": [ - { - "minServerVersion": "5.0.9", - "maxServerVersion": "5.0.99" - }, - { - "minServerVersion": "5.3.2" - } - ], - "operations": [ - { - "name": "estimatedDocumentCount", - "object": "collection", - "arguments": {} - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "test", - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "find and getMore append API version", - "operations": [ - { - "name": "find", - "object": "collection", - "arguments": { - "filter": {}, - "sort": { - "_id": 1 - }, - "batchSize": 3 - }, - "expectResult": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - } - ] - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test", - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "findOneAndDelete appends declared API version", - "operations": [ - { - "name": "findOneAndDelete", - "object": "collection", - "arguments": { - "filter": { - "_id": 1 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 1 - }, - "remove": true, - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "findOneAndReplace appends declared API version", - "operations": [ - { - "name": "findOneAndReplace", - "object": "collection", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 33 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 1 - }, - "update": { - "x": 33 - }, - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "findOneAndUpdate appends declared API version", - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "test", - "query": { - "_id": 1 - }, - "update": { - "$inc": { - "x": 1 - } - }, - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "insertMany appends declared API version", - "operations": [ - { - "name": "insertMany", - "object": "collection", - "arguments": { - "documents": [ - { - "_id": 6, - "x": 66 - }, - { - "_id": 7, - "x": 77 - } - ] - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 6, - "x": 66 - }, - { - "_id": 7, - "x": 77 - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "insertOne appends declared API version", - "operations": [ - { - "name": "insertOne", - "object": "collection", - "arguments": { - "document": { - "_id": 6, - "x": 66 - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 6, - "x": 66 - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "replaceOne appends declared API version", - "operations": [ - { - "name": "replaceOne", - "object": "collection", - "arguments": { - "filter": { - "_id": 4 - }, - "replacement": { - "_id": 4, - "x": 44 - }, - "upsert": true - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 4 - }, - "u": { - "_id": 4, - "x": 44 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": true - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "updateMany appends declared API version", - "operations": [ - { - "name": "updateMany", - "object": "collection", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - }, - { - "description": "updateOne appends declared API version", - "operations": [ - { - "name": "updateOne", - "object": "collection", - "arguments": { - "filter": { - "_id": 2 - }, - "update": { - "$inc": { - "x": 1 - } - } - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "test", - "updates": [ - { - "q": { - "_id": 2 - }, - "u": { - "$inc": { - "x": 1 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/versioned-api/runcommand-helper-no-api-version-declared.json b/tests/UnifiedSpecTests/versioned-api/runcommand-helper-no-api-version-declared.json deleted file mode 100644 index 17e0126d1..000000000 --- a/tests/UnifiedSpecTests/versioned-api/runcommand-helper-no-api-version-declared.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "description": "RunCommand helper: No API version declared", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.9", - "serverParameters": { - "requireApiVersion": false - } - } - ], - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "versioned-api-tests" - } - } - ], - "tests": [ - { - "description": "runCommand does not inspect or change the command document", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1, - "apiVersion": "server_will_never_support_this_api_version" - } - }, - "expectError": { - "isError": true, - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1, - "apiVersion": "server_will_never_support_this_api_version", - "apiStrict": { - "$$exists": false - }, - "apiDeprecationErrors": { - "$$exists": false - } - }, - "commandName": "ping", - "databaseName": "versioned-api-tests" - } - } - ] - } - ] - }, - { - "description": "runCommand does not prevent sending invalid API version declarations", - "runOnRequirements": [ - { - "serverless": "forbid" - } - ], - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1, - "apiStrict": true - } - }, - "expectError": { - "isError": true, - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "ping": 1, - "apiVersion": { - "$$exists": false - }, - "apiStrict": true, - "apiDeprecationErrors": { - "$$exists": false - } - }, - "commandName": "ping", - "databaseName": "versioned-api-tests" - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/versioned-api/test-commands-deprecation-errors.json b/tests/UnifiedSpecTests/versioned-api/test-commands-deprecation-errors.json deleted file mode 100644 index 0668df830..000000000 --- a/tests/UnifiedSpecTests/versioned-api/test-commands-deprecation-errors.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "description": "Test commands: deprecation errors", - "schemaVersion": "1.1", - "runOnRequirements": [ - { - "minServerVersion": "4.9", - "serverParameters": { - "enableTestCommands": true, - "acceptApiVersion2": true, - "requireApiVersion": false - } - } - ], - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "versioned-api-tests" - } - } - ], - "tests": [ - { - "description": "Running a command that is deprecated raises a deprecation error", - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "testDeprecationInVersion2", - "command": { - "testDeprecationInVersion2": 1, - "apiVersion": "2", - "apiDeprecationErrors": true - } - }, - "expectError": { - "isError": true, - "errorContains": "command testDeprecationInVersion2 is deprecated in API Version 2", - "errorCodeName": "APIDeprecationError" - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "testDeprecationInVersion2": 1, - "apiVersion": "2", - "apiStrict": { - "$$exists": false - }, - "apiDeprecationErrors": true - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/versioned-api/test-commands-strict-mode.json b/tests/UnifiedSpecTests/versioned-api/test-commands-strict-mode.json deleted file mode 100644 index 9c4ebea78..000000000 --- a/tests/UnifiedSpecTests/versioned-api/test-commands-strict-mode.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "description": "Test commands: strict mode", - "schemaVersion": "1.4", - "runOnRequirements": [ - { - "minServerVersion": "4.9", - "serverParameters": { - "enableTestCommands": true - }, - "serverless": "forbid" - } - ], - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent" - ], - "serverApi": { - "version": "1", - "strict": true - } - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "versioned-api-tests" - } - } - ], - "tests": [ - { - "description": "Running a command that is not part of the versioned API results in an error", - "operations": [ - { - "name": "runCommand", - "object": "database", - "arguments": { - "commandName": "testVersion2", - "command": { - "testVersion2": 1 - } - }, - "expectError": { - "isError": true, - "errorContains": "command testVersion2 is not in API Version 1", - "errorCodeName": "APIStrictError" - } - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "testVersion2": 1, - "apiVersion": "1", - "apiStrict": true, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/UnifiedSpecTests/versioned-api/transaction-handling.json b/tests/UnifiedSpecTests/versioned-api/transaction-handling.json deleted file mode 100644 index 32031296a..000000000 --- a/tests/UnifiedSpecTests/versioned-api/transaction-handling.json +++ /dev/null @@ -1,348 +0,0 @@ -{ - "description": "Transaction handling", - "schemaVersion": "1.3", - "runOnRequirements": [ - { - "minServerVersion": "4.9", - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "createEntities": [ - { - "client": { - "id": "client", - "observeEvents": [ - "commandStartedEvent" - ], - "serverApi": { - "version": "1" - } - } - }, - { - "database": { - "id": "database", - "client": "client", - "databaseName": "versioned-api-tests" - } - }, - { - "collection": { - "id": "collection", - "database": "database", - "collectionName": "test" - } - }, - { - "session": { - "id": "session", - "client": "client" - } - } - ], - "_yamlAnchors": { - "versions": [ - { - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - ] - }, - "initialData": [ - { - "collectionName": "test", - "databaseName": "versioned-api-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - } - ] - } - ], - "tests": [ - { - "description": "All commands in a transaction declare an API version", - "runOnRequirements": [ - { - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "operations": [ - { - "name": "startTransaction", - "object": "session" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session", - "document": { - "_id": 6, - "x": 66 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 6 - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session", - "document": { - "_id": 7, - "x": 77 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 7 - } - } - } - }, - { - "name": "commitTransaction", - "object": "session" - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 6, - "x": 66 - } - ], - "lsid": { - "$$sessionLsid": "session" - }, - "startTransaction": true, - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 7, - "x": 77 - } - ], - "lsid": { - "$$sessionLsid": "session" - }, - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "commitTransaction": 1, - "lsid": { - "$$sessionLsid": "session" - }, - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - }, - { - "description": "abortTransaction includes an API version", - "runOnRequirements": [ - { - "topologies": [ - "replicaset", - "sharded", - "load-balanced" - ] - } - ], - "operations": [ - { - "name": "startTransaction", - "object": "session" - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session", - "document": { - "_id": 6, - "x": 66 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 6 - } - } - } - }, - { - "name": "insertOne", - "object": "collection", - "arguments": { - "session": "session", - "document": { - "_id": 7, - "x": 77 - } - }, - "expectResult": { - "$$unsetOrMatches": { - "insertedId": { - "$$unsetOrMatches": 7 - } - } - } - }, - { - "name": "abortTransaction", - "object": "session" - } - ], - "expectEvents": [ - { - "client": "client", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 6, - "x": 66 - } - ], - "lsid": { - "$$sessionLsid": "session" - }, - "startTransaction": true, - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "test", - "documents": [ - { - "_id": 7, - "x": 77 - } - ], - "lsid": { - "$$sessionLsid": "session" - }, - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "abortTransaction": 1, - "lsid": { - "$$sessionLsid": "session" - }, - "apiVersion": "1", - "apiStrict": { - "$$unsetOrMatches": false - }, - "apiDeprecationErrors": { - "$$unsetOrMatches": false - } - } - } - } - ] - } - ] - } - ] -} diff --git a/tests/drivers-evergreen-tools b/tests/drivers-evergreen-tools new file mode 160000 index 000000000..f8ab2a54f --- /dev/null +++ b/tests/drivers-evergreen-tools @@ -0,0 +1 @@ +Subproject commit f8ab2a54f774cab1e92bcf222949181baf8b2f1c diff --git a/tests/specifications b/tests/specifications new file mode 160000 index 000000000..d41d48b90 --- /dev/null +++ b/tests/specifications @@ -0,0 +1 @@ +Subproject commit d41d48b90ef22aedae934dd22f3a21c65b5a13bc diff --git a/tools/connect.php b/tools/connect.php index 136ac106e..1b7dfa567 100644 --- a/tools/connect.php +++ b/tools/connect.php @@ -2,14 +2,14 @@ function getHosts(string $uri): array { - if (strpos($uri, '://') === false) { + if (! str_contains($uri, '://')) { return [$uri]; } $parsed = parse_url($uri); if (isset($parsed['scheme']) && $parsed['scheme'] !== 'mongodb') { - // TODO: Resolve SRV records (https://github.com/mongodb/specifications/blob/master/source/initial-dns-seedlist-discovery/initial-dns-seedlist-discovery.rst) + // TODO: Resolve SRV records (https://github.com/mongodb/specifications/blob/master/source/initial-dns-seedlist-discovery/initial-dns-seedlist-discovery.md) throw new RuntimeException('Unsupported scheme: ' . $parsed['scheme']); } diff --git a/tools/detect-extension.php b/tools/detect-extension.php index 13eabb5c0..1741a4328 100644 --- a/tools/detect-extension.php +++ b/tools/detect-extension.php @@ -5,11 +5,11 @@ function grepIniFile(string $filename, string $extension): int $lines = []; foreach (new SplFileObject($filename) as $i => $line) { - if (strpos($line, 'extension') === false) { + if (! str_contains($line, 'extension')) { continue; } - if (strpos($line, $extension) === false) { + if (! str_contains($line, $extension)) { continue; }