yxorP Documentation

ClientSideEncryptionSpecTest extends FunctionalTestCase
in package

Client-side encryption spec tests.

Tags
see
https://github.com/mongodb/specifications/tree/master/source/client-side-encryption

Table of Contents

LOCAL_MASTERKEY  = 'Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk'
SERVERLESS_ALLOW  = 'allow'
SERVERLESS_FORBID  = 'forbid'
SERVERLESS_REQUIRE  = 'require'
TOPOLOGY_LOAD_BALANCED  = 'load-balanced'
TOPOLOGY_REPLICASET  = 'replicaset'
TOPOLOGY_SHARDED  = 'sharded'
TOPOLOGY_SINGLE  = 'single'
$manager  : Manager
$configuredFailPoints  : array<string|int, mixed>
$context  : Context|null
$incompleteTests  : array<string|int, mixed>
assertCommandMatches()  : void
Assert that the expected and actual command documents match.
assertCommandReplyMatches()  : void
Assert that the expected and actual command reply documents match.
assertMatchesDocument()  : void
Asserts that a document has expected values for some fields.
assertSameDocument()  : void
Asserts that a document has expected values for all fields.
assertSameDocuments()  : void
configureFailPoint()  : void
Configure a fail point for the test.
createTestClient()  : Client
createTestManager()  : Manager
customEndpointProvider()  : mixed
dataDescription()  : string
Compatibility method as PHPUnit 9 no longer includes this method.
dataKeyProvider()  : mixed
getUri()  : string
Return the connection URI.
provideBSONSizeLimitsAndBatchSplittingTests()  : mixed
provideInvalidArrayValues()  : mixed
provideInvalidDocumentValues()  : mixed
provideKmsTlsOptionsTests()  : mixed
provideTests()  : mixed
setUp()  : void
tearDown()  : void
testBSONSizeLimitsAndBatchSplitting()  : void
Prose test: BSON size limits and batch splitting
testBypassSpawningMongocryptdViaBypassAutoEncryption()  : void
Bypass spawning mongocryptd (via bypassAutoEncryption)
testBypassSpawningMongocryptdViaBypassSpawn()  : void
Prose test: Bypass spawning mongocryptd (via mongocryptdBypassSpawn)
testClientSideEncryption()  : void
Execute an individual test case from the specification.
testCorpus()  : void
Prose test: BSON Corpus
testCustomEndpoint()  : void
Prose test: Custom Endpoint
testDataKeyAndDoubleEncryption()  : void
Prose test: Data key and double encryption
testExternalKeyVault()  : void
Prose test: External Key Vault
testInvalidHostnameInKmsCertificate()  : void
Prose test: Invalid Hostname in KMS Certificate
testInvalidKmsCertificate()  : void
Prose test: Invalid KMS Certificate
testKmsTlsOptions()  : void
Prose test: KMS TLS Options
testViewsAreProhibited()  : void
Prose test: Views are prohibited
assertCollectionCount()  : void
assertCollectionDoesNotExist()  : void
Asserts that a collection with the given name does not exist on the server.
assertCollectionExists()  : void
Asserts that a collection with the given name exists on the server.
assertCommandSucceeded()  : void
assertDeprecated()  : void
assertDocumentsMatch()  : void
Asserts that two given documents match.
assertOutcomeCollectionData()  : void
Assert data within the outcome collection.
assertSameObjectId()  : void
checkServerRequirements()  : void
Checks server version and topology requirements.
createCollection()  : void
Creates the test collection with the specified options.
decodeJson()  : array<string|int, mixed>|object
Decode a JSON spec test.
dropCollection()  : void
Drops the test collection with the specified options.
dropTestAndOutcomeCollections()  : void
Drop the test and outcome collections by dropping them.
getCollectionName()  : string
Return the test collection name.
getContext()  : Context
Return the test context.
getDatabaseName()  : string
Return the test database name.
getFeatureCompatibilityVersion()  : mixed
getInvalidArrayValues()  : array<string|int, mixed>
Return a list of invalid array values.
getInvalidBooleanValues()  : array<string|int, mixed>
Return a list of invalid boolean values.
getInvalidDocumentValues()  : array<string|int, mixed>
Return a list of invalid document values.
getInvalidIntegerValues()  : array<string|int, mixed>
Return a list of invalid integer values.
getInvalidReadConcernValues()  : array<string|int, mixed>
Return a list of invalid ReadPreference values.
getInvalidReadPreferenceValues()  : array<string|int, mixed>
Return a list of invalid ReadPreference values.
getInvalidSessionValues()  : array<string|int, mixed>
Return a list of invalid Session values.
getInvalidStringValues()  : array<string|int, mixed>
Return a list of invalid string values.
getInvalidWriteConcernValues()  : array<string|int, mixed>
Return a list of invalid WriteConcern values.
getNamespace()  : string
Return the test namespace.
getPrimaryServer()  : mixed
getServerStorageEngine()  : mixed
getServerVersion()  : mixed
insertDataFixtures()  : void
Insert data fixtures into the test collection.
isLoadBalanced()  : mixed
isMongos()  : mixed
isReplicaSet()  : mixed
isServerless()  : bool
Return whether serverless (i.e. proxy as mongos) is being utilized.
isShardedCluster()  : mixed
isShardedClusterUsingReplicasets()  : mixed
setContext()  : void
Set the test context.
skipIfCausalConsistencyIsNotSupported()  : void
skipIfChangeStreamIsNotSupported()  : void
skipIfClientSideEncryptionIsNotSupported()  : void
skipIfGeoHaystackIndexIsNotSupported()  : void
skipIfTransactionsAreNotSupported()  : void
wrapValuesForDataProvider()  : array<string|int, mixed>
Wrap a list of values for use as a single-argument data provider.
appendAuthenticationOptions()  : array<string|int, mixed>
appendServerApiOption()  : array<string|int, mixed>
craftInt64()  : Int64|mixed
Casts the value for a BSON corpus structure to int64 if necessary.
createTestCollection()  : void
disableFailPoints()  : void
Disables any fail points that were configured earlier in the test.
encryptCorpusValue()  : mixed
getEnv()  : string
getModuleInfo()  : string|null
getOutcomeCollection()  : mixed
getTopology()  : string
Return the corresponding topology constants for the current topology.
insertKeyVaultData()  : void
isFailCommandEnabled()  : bool
Checks if the failCommand command is enabled by checking the enableTestCommands parameter
isFailCommandSupported()  : bool
Checks if the failCommand command is supported on this server version
isServerlessRequirementSatisfied()  : bool
isServerRequirementSatisifed()  : bool
Checks if server version and topology requirements are satifised.
normalizeBSON()  : BSONDocument|BSONArray
Normalizes a BSON document or array for use with assertEquals().
prepareCorpusData()  : mixed

Constants

LOCAL_MASTERKEY

public mixed LOCAL_MASTERKEY = 'Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk'

Properties

$configuredFailPoints

private array<string|int, mixed> $configuredFailPoints = []

$incompleteTests

private static array<string|int, mixed> $incompleteTests = ['awsTemporary: Insert a document with auto encryption using the AWS provider with temporary credentials' => 'Not yet implemented (PHPC-1751)', 'awsTemporary: Insert with invalid temporary credentials' => 'Not yet implemented (PHPC-1751)', 'azureKMS: Insert a document with auto encryption using Azure KMS provider' => 'RHEL platform is missing Azure root certificate (PHPLIB-619)']

Methods

assertCommandMatches()

Assert that the expected and actual command documents match.

public static assertCommandMatches(stdClass $expected, stdClass $actual) : void
Parameters
$expected : stdClass

Expected command document

$actual : stdClass

Actual command document

Return values
void

assertCommandReplyMatches()

Assert that the expected and actual command reply documents match.

public static assertCommandReplyMatches(stdClass $expected, stdClass $actual) : void

Note: Spec tests that do not assert command started events may throw an exception in lieu of implementing this method.

Parameters
$expected : stdClass

Expected command reply document

$actual : stdClass

Actual command reply document

Return values
void

assertMatchesDocument()

Asserts that a document has expected values for some fields.

public assertMatchesDocument(array<string|int, mixed>|object $expectedDocument, array<string|int, mixed>|object $actualDocument) : void

Only fields in the expected document will be checked. The actual document may contain additional fields.

Parameters
$expectedDocument : array<string|int, mixed>|object
$actualDocument : array<string|int, mixed>|object
Return values
void

assertSameDocument()

Asserts that a document has expected values for all fields.

public assertSameDocument(array<string|int, mixed>|object $expectedDocument, array<string|int, mixed>|object $actualDocument) : void

The actual document will be compared directly with the expected document and may not contain extra fields.

Parameters
$expectedDocument : array<string|int, mixed>|object
$actualDocument : array<string|int, mixed>|object
Return values
void

assertSameDocuments()

public assertSameDocuments(array<string|int, mixed> $expectedDocuments, mixed $actualDocuments) : void
Parameters
$expectedDocuments : array<string|int, mixed>
$actualDocuments : mixed
Return values
void

configureFailPoint()

Configure a fail point for the test.

public configureFailPoint(array<string|int, mixed>|stdClass $command[, Server|null $server = null ]) : void

The fail point will automatically be disabled during tearDown() to avoid affecting a subsequent test.

Parameters
$command : array<string|int, mixed>|stdClass

configureFailPoint command document

$server : Server|null = null
Tags
throws
InvalidArgumentException

if $command is not a configureFailPoint command

Return values
void

createTestClient()

public static createTestClient([string|null $uri = null ][, array<string|int, mixed> $options = [] ][, array<string|int, mixed> $driverOptions = [] ]) : Client
Parameters
$uri : string|null = null
$options : array<string|int, mixed> = []
$driverOptions : array<string|int, mixed> = []
Return values
Client

createTestManager()

public static createTestManager([string|null $uri = null ][, array<string|int, mixed> $options = [] ][, array<string|int, mixed> $driverOptions = [] ]) : Manager
Parameters
$uri : string|null = null
$options : array<string|int, mixed> = []
$driverOptions : array<string|int, mixed> = []
Return values
Manager

dataDescription()

Compatibility method as PHPUnit 9 no longer includes this method.

public dataDescription() : string
Return values
string

getUri()

Return the connection URI.

public static getUri() : string
Return values
string

provideBSONSizeLimitsAndBatchSplittingTests()

public static provideBSONSizeLimitsAndBatchSplittingTests() : mixed
Return values
mixed

provideInvalidArrayValues()

public provideInvalidArrayValues() : mixed
Return values
mixed

provideInvalidDocumentValues()

public provideInvalidDocumentValues() : mixed
Return values
mixed

testBSONSizeLimitsAndBatchSplitting()

Prose test: BSON size limits and batch splitting

public testBSONSizeLimitsAndBatchSplitting(Closure $test) : void
Parameters
$test : Closure
Tags
dataProvider

provideBSONSizeLimitsAndBatchSplittingTests

Return values
void

testBypassSpawningMongocryptdViaBypassAutoEncryption()

Bypass spawning mongocryptd (via bypassAutoEncryption)

public testBypassSpawningMongocryptdViaBypassAutoEncryption() : void
Return values
void

testBypassSpawningMongocryptdViaBypassSpawn()

Prose test: Bypass spawning mongocryptd (via mongocryptdBypassSpawn)

public testBypassSpawningMongocryptdViaBypassSpawn() : void
Return values
void

testClientSideEncryption()

Execute an individual test case from the specification.

public testClientSideEncryption(stdClass $test, array<string|int, mixed> $runOn, array<string|int, mixed> $data[, array<string|int, mixed>|null $keyVaultData = null ][, object|null $jsonSchema = null ][, string $databaseName = null ][, string $collectionName = null ]) : void
Parameters
$test : stdClass

Individual "tests[]" document

$runOn : array<string|int, mixed>

Top-level "runOn" array with server requirements

$data : array<string|int, mixed>

Top-level "data" array to initialize collection

$keyVaultData : array<string|int, mixed>|null = null

Top-level "key_vault_data" array to initialize keyvault.datakeys collection

$jsonSchema : object|null = null

Top-level "json_schema" array to initialize collection

$databaseName : string = null

Name of database under test

$collectionName : string = null

Name of collection under test

Tags
dataProvider

provideTests

Return values
void

testCorpus()

Prose test: BSON Corpus

public testCorpus([mixed $schemaMap = true ]) : void
Parameters
$schemaMap : mixed = true
Tags
testWith

[true] [false]

Return values
void

testCustomEndpoint()

Prose test: Custom Endpoint

public testCustomEndpoint(Closure $test) : void
Parameters
$test : Closure
Tags
dataProvider

customEndpointProvider

Return values
void

testDataKeyAndDoubleEncryption()

Prose test: Data key and double encryption

public testDataKeyAndDoubleEncryption(string $providerName, mixed $masterKey) : void
Parameters
$providerName : string
$masterKey : mixed
Tags
dataProvider

dataKeyProvider

Return values
void

testExternalKeyVault()

Prose test: External Key Vault

public testExternalKeyVault(mixed $withExternalKeyVault) : void
Parameters
$withExternalKeyVault : mixed
Tags
testWith

[false] [true]

Return values
void

testViewsAreProhibited()

Prose test: Views are prohibited

public testViewsAreProhibited() : void
Return values
void

assertCollectionCount()

protected assertCollectionCount(mixed $namespace, mixed $count) : void
Parameters
$namespace : mixed
$count : mixed
Return values
void

assertCollectionDoesNotExist()

Asserts that a collection with the given name does not exist on the server.

protected assertCollectionDoesNotExist(string $collectionName[, string|null $databaseName = null ]) : void

$databaseName defaults to TestCase::getDatabaseName() if unspecified.

Parameters
$collectionName : string
$databaseName : string|null = null
Return values
void

assertCollectionExists()

Asserts that a collection with the given name exists on the server.

protected assertCollectionExists(string $collectionName[, string|null $databaseName = null ][, callable|null $callback = null ]) : void

$databaseName defaults to TestCase::getDatabaseName() if unspecified. An optional $callback may be provided, which should take a CollectionInfo argument as its first and only parameter. If a CollectionInfo matching the given name is found, it will be passed to the callback, which may perform additional assertions.

Parameters
$collectionName : string
$databaseName : string|null = null
$callback : callable|null = null
Return values
void

assertCommandSucceeded()

protected assertCommandSucceeded(mixed $document) : void
Parameters
$document : mixed
Return values
void

assertDeprecated()

protected assertDeprecated(callable $execution) : void
Parameters
$execution : callable
Return values
void

assertDocumentsMatch()

Asserts that two given documents match.

protected static assertDocumentsMatch(array<string|int, mixed>|object $expectedDocument, array<string|int, mixed>|object $actualDocument[, string $message = '' ]) : void

Extra keys in the actual value's document(s) will be ignored.

Parameters
$expectedDocument : array<string|int, mixed>|object
$actualDocument : array<string|int, mixed>|object
$message : string = ''
Return values
void

assertOutcomeCollectionData()

Assert data within the outcome collection.

protected assertOutcomeCollectionData(array<string|int, mixed> $expectedDocuments[, int $resultExpectation = ResultExpectation::ASSERT_SAME_DOCUMENT ]) : void
Parameters
$expectedDocuments : array<string|int, mixed>
$resultExpectation : int = ResultExpectation::ASSERT_SAME_DOCUMENT
Return values
void

assertSameObjectId()

protected assertSameObjectId(mixed $expectedObjectId, mixed $actualObjectId) : void
Parameters
$expectedObjectId : mixed
$actualObjectId : mixed
Return values
void

checkServerRequirements()

Checks server version and topology requirements.

protected checkServerRequirements(array<string|int, mixed> $runOn) : void
Parameters
$runOn : array<string|int, mixed>
Tags
throws
SkippedTest

if the server requirements are not met

Return values
void

createCollection()

Creates the test collection with the specified options.

protected createCollection([array<string|int, mixed> $options = [] ]) : void

If the "writeConcern" option is not specified but is supported by the server, a majority write concern will be used. This is helpful for tests using transactions or secondary reads.

Parameters
$options : array<string|int, mixed> = []
Return values
void

decodeJson()

Decode a JSON spec test.

protected decodeJson(string $json) : array<string|int, mixed>|object

This decodes the file through the driver's extended JSON parser to ensure proper handling of special types.

Parameters
$json : string
Return values
array<string|int, mixed>|object

dropCollection()

Drops the test collection with the specified options.

protected dropCollection([array<string|int, mixed> $options = [] ]) : void

If the "writeConcern" option is not specified but is supported by the server, a majority write concern will be used. This is helpful for tests using transactions or secondary reads.

Parameters
$options : array<string|int, mixed> = []
Return values
void

dropTestAndOutcomeCollections()

Drop the test and outcome collections by dropping them.

protected dropTestAndOutcomeCollections() : void
Return values
void

getCollectionName()

Return the test collection name.

protected getCollectionName() : string
Return values
string

getContext()

Return the test context.

protected getContext() : Context
Tags
throws
LogicException

if the context has not been set

Return values
Context

getDatabaseName()

Return the test database name.

protected getDatabaseName() : string
Return values
string

getFeatureCompatibilityVersion()

protected getFeatureCompatibilityVersion([ReadPreference|null $readPreference = null ]) : mixed
Parameters
$readPreference : ReadPreference|null = null
Return values
mixed

getInvalidArrayValues()

Return a list of invalid array values.

protected getInvalidArrayValues([bool $includeNull = false ]) : array<string|int, mixed>
Parameters
$includeNull : bool = false
Return values
array<string|int, mixed>

getInvalidBooleanValues()

Return a list of invalid boolean values.

protected getInvalidBooleanValues([bool $includeNull = false ]) : array<string|int, mixed>
Parameters
$includeNull : bool = false
Return values
array<string|int, mixed>

getInvalidDocumentValues()

Return a list of invalid document values.

protected getInvalidDocumentValues([bool $includeNull = false ]) : array<string|int, mixed>
Parameters
$includeNull : bool = false
Return values
array<string|int, mixed>

getInvalidIntegerValues()

Return a list of invalid integer values.

protected getInvalidIntegerValues([bool $includeNull = false ]) : array<string|int, mixed>
Parameters
$includeNull : bool = false
Return values
array<string|int, mixed>

getInvalidReadConcernValues()

Return a list of invalid ReadPreference values.

protected getInvalidReadConcernValues([bool $includeNull = false ]) : array<string|int, mixed>
Parameters
$includeNull : bool = false
Return values
array<string|int, mixed>

getInvalidReadPreferenceValues()

Return a list of invalid ReadPreference values.

protected getInvalidReadPreferenceValues([bool $includeNull = false ]) : array<string|int, mixed>
Parameters
$includeNull : bool = false
Return values
array<string|int, mixed>

getInvalidSessionValues()

Return a list of invalid Session values.

protected getInvalidSessionValues([bool $includeNull = false ]) : array<string|int, mixed>
Parameters
$includeNull : bool = false
Return values
array<string|int, mixed>

getInvalidStringValues()

Return a list of invalid string values.

protected getInvalidStringValues([bool $includeNull = false ]) : array<string|int, mixed>
Parameters
$includeNull : bool = false
Return values
array<string|int, mixed>

getInvalidWriteConcernValues()

Return a list of invalid WriteConcern values.

protected getInvalidWriteConcernValues([bool $includeNull = false ]) : array<string|int, mixed>
Parameters
$includeNull : bool = false
Return values
array<string|int, mixed>

getNamespace()

Return the test namespace.

protected getNamespace() : string
Return values
string

getPrimaryServer()

protected getPrimaryServer() : mixed
Return values
mixed

getServerStorageEngine()

protected getServerStorageEngine([ReadPreference|null $readPreference = null ]) : mixed
Parameters
$readPreference : ReadPreference|null = null
Return values
mixed

getServerVersion()

protected getServerVersion([ReadPreference|null $readPreference = null ]) : mixed
Parameters
$readPreference : ReadPreference|null = null
Return values
mixed

insertDataFixtures()

Insert data fixtures into the test collection.

protected insertDataFixtures(array<string|int, mixed> $documents[, string|null $collectionName = null ]) : void
Parameters
$documents : array<string|int, mixed>
$collectionName : string|null = null
Return values
void

isServerless()

Return whether serverless (i.e. proxy as mongos) is being utilized.

protected static isServerless() : bool
Return values
bool

isShardedCluster()

protected isShardedCluster() : mixed
Return values
mixed

isShardedClusterUsingReplicasets()

protected isShardedClusterUsingReplicasets() : mixed
Return values
mixed

skipIfCausalConsistencyIsNotSupported()

protected skipIfCausalConsistencyIsNotSupported() : void
Return values
void

skipIfChangeStreamIsNotSupported()

protected skipIfChangeStreamIsNotSupported() : void
Return values
void

skipIfClientSideEncryptionIsNotSupported()

protected skipIfClientSideEncryptionIsNotSupported() : void
Return values
void

skipIfGeoHaystackIndexIsNotSupported()

protected skipIfGeoHaystackIndexIsNotSupported() : void
Return values
void

skipIfTransactionsAreNotSupported()

protected skipIfTransactionsAreNotSupported() : void
Return values
void

wrapValuesForDataProvider()

Wrap a list of values for use as a single-argument data provider.

protected wrapValuesForDataProvider(array<string|int, mixed> $values) : array<string|int, mixed>
Parameters
$values : array<string|int, mixed>

List of values

Return values
array<string|int, mixed>

appendAuthenticationOptions()

private static appendAuthenticationOptions(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
$options : array<string|int, mixed>
Return values
array<string|int, mixed>

appendServerApiOption()

private static appendServerApiOption(array<string|int, mixed> $driverOptions) : array<string|int, mixed>
Parameters
$driverOptions : array<string|int, mixed>
Return values
array<string|int, mixed>

craftInt64()

Casts the value for a BSON corpus structure to int64 if necessary.

private craftInt64(object $data) : Int64|mixed

This is a workaround for an issue in mongocryptd which refuses to encrypt int32 values if the schemaMap defines a "long" bsonType for an object.

Parameters
$data : object
Return values
Int64|mixed

createTestCollection()

private createTestCollection(mixed $jsonSchema) : void
Parameters
$jsonSchema : mixed
Return values
void

disableFailPoints()

Disables any fail points that were configured earlier in the test.

private disableFailPoints() : void

This tracks fail points set via configureFailPoint() and should be called during tearDown().

Return values
void

encryptCorpusValue()

private encryptCorpusValue(string $fieldName, stdClass $data, ClientEncryption $clientEncryption) : mixed
Parameters
$fieldName : string
$data : stdClass
$clientEncryption : ClientEncryption
Return values
mixed

getModuleInfo()

private getModuleInfo(string $row) : string|null
Parameters
$row : string
Return values
string|null

getOutcomeCollection()

private getOutcomeCollection([array<string|int, mixed> $collectionOptions = [] ]) : mixed
Parameters
$collectionOptions : array<string|int, mixed> = []
Return values
mixed

getTopology()

Return the corresponding topology constants for the current topology.

private getTopology() : string
Tags
throws
UnexpectedValueException

if topology is neither single nor RS nor sharded

Return values
string

insertKeyVaultData()

private insertKeyVaultData([array<string|int, mixed>|null $keyVaultData = null ]) : void
Parameters
$keyVaultData : array<string|int, mixed>|null = null
Return values
void

isFailCommandEnabled()

Checks if the failCommand command is enabled by checking the enableTestCommands parameter

private isFailCommandEnabled() : bool
Return values
bool

isFailCommandSupported()

Checks if the failCommand command is supported on this server version

private isFailCommandSupported() : bool
Return values
bool

isServerlessRequirementSatisfied()

private isServerlessRequirementSatisfied(string|null $serverlessMode) : bool
Parameters
$serverlessMode : string|null
Return values
bool

isServerRequirementSatisifed()

Checks if server version and topology requirements are satifised.

private isServerRequirementSatisifed(string|null $minServerVersion, string|null $maxServerVersion[, array<string|int, mixed>|null $topologies = null ][, string|null $serverlessMode = null ]) : bool
Parameters
$minServerVersion : string|null
$maxServerVersion : string|null
$topologies : array<string|int, mixed>|null = null
$serverlessMode : string|null = null
Return values
bool

normalizeBSON()

Normalizes a BSON document or array for use with assertEquals().

private normalizeBSON(array<string|int, mixed>|object $bson) : BSONDocument|BSONArray

The argument will be converted to a BSONArray or BSONDocument based on its type and keys. Document fields will be sorted alphabetically. Each value within the array or document will then be normalized recursively.

Parameters
$bson : array<string|int, mixed>|object
Tags
throws
InvalidArgumentException

if $bson is not an array or object

Return values
BSONDocument|BSONArray

prepareCorpusData()

private prepareCorpusData(string $fieldName, stdClass $data, ClientEncryption $clientEncryption) : mixed
Parameters
$fieldName : string
$data : stdClass
$clientEncryption : ClientEncryption
Return values
mixed

Search results