Skip to content

Commit 65308e2

Browse files
committed
Add range query
1 parent 6225e23 commit 65308e2

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
// start-enable-range
4+
$encryptedFieldsMap = [
5+
'encryptedFields' => [
6+
'fields' => [
7+
[
8+
'path' => 'patientRecord.ssn',
9+
'bsonType' => 'string',
10+
'queries' => ['queryType' => 'equality'],
11+
'keyId' => null,
12+
],
13+
[
14+
'path' => 'patientRecord.billing',
15+
'bsonType' => 'object',
16+
'keyId' => null,
17+
],
18+
[
19+
'path' => 'patientRecord.billAmount',
20+
'bsonType' => 'int',
21+
'queries' => [
22+
'queryType' => 'range',
23+
'sparsity' => 1,
24+
'trimFactor' => 4,
25+
'min' => 100,
26+
'max' => 2000,
27+
],
28+
'keyId' => null,
29+
],
30+
],
31+
],
32+
];
33+
// end-enable-range
34+
35+
// start-query-range
36+
$findResult = $encryptedCollection->findOne([
37+
'patientRecord.billAmount' => ['$gt' => 1000, '$lt' => 2000],
38+
]);
39+
print_r($findResult);
40+
// end-query-range

0 commit comments

Comments
 (0)