--TEST-- MongoDB\Driver\ClientEncryption::encryptExpression() encrypts $and operator --SKIPIF-- createClientEncryption([ 'keyVaultNamespace' => CSFLE_KEY_VAULT_NS, 'kmsProviders' => ['local' => ['key' => new MongoDB\BSON\Binary(CSFLE_LOCAL_KEY, 0)]], ]); $keyId = $clientEncryption->createDataKey('local'); $encryptOpts = [ 'keyId' => $keyId, 'algorithm' => MongoDB\Driver\ClientEncryption::ALGORITHM_RANGE_PREVIEW, 'queryType' => MongoDB\Driver\ClientEncryption::QUERY_TYPE_RANGE_PREVIEW, 'contentionFactor' => 0, 'rangeOpts' => ['min' => 0, 'max' => 200, 'sparsity' => 1], ]; $expr = [ '$and' => [ ['encryptedInt' => ['$gte' => 6]], ['encryptedInt' => ['$lte' => 200]], ], ]; $encryptedExpr = $clientEncryption->encryptExpression($expr, $encryptOpts); var_dump($encryptedExpr->{'$and'}[0]->encryptedInt->{'$gte'} instanceof MongoDB\BSON\Binary); var_dump($encryptedExpr->{'$and'}[0]->encryptedInt->{'$gte'}->getType() === MongoDB\BSON\Binary::TYPE_ENCRYPTED); var_dump($encryptedExpr->{'$and'}[1]->encryptedInt->{'$lte'} instanceof MongoDB\BSON\Binary); var_dump($encryptedExpr->{'$and'}[1]->encryptedInt->{'$lte'}->getType() === MongoDB\BSON\Binary::TYPE_ENCRYPTED); ?> ===DONE=== --EXPECT-- bool(true) bool(true) bool(true) bool(true) ===DONE===