Skip to content

Commit 8dbc428

Browse files
committed
fix code example
1 parent 14aa2b7 commit 8dbc428

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

Diff for: source/includes/builders.php

+17-12
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@
1818
// start-find
1919
// Creates a query filter by using builders and
2020
// retrieves matching documents
21-
$docs = $collection->find(Query::query(
22-
feature_type: Query::eq('Wrecks - Visible'),
23-
coordinates: Query::near(
24-
Query::geometry(
25-
type: 'Point',
26-
coordinates: [-79.9, 9.3],
27-
),
28-
maxDistance: 10000,
21+
$docs = $collection->find(
22+
Query::query(
23+
feature_type: Query::eq('Wrecks - Visible'),
24+
coordinates: Query::near(
25+
Query::geometry(
26+
type: 'Point',
27+
coordinates: [-79.9, 9.3],
28+
),
29+
maxDistance: 10000,
30+
)
2931
)
30-
));
32+
);
3133

3234
// Prints matching documents
3335
foreach ($docs as $doc) {
@@ -38,9 +40,12 @@
3840
// start-deleteone
3941
// Creates a query filter by using builders
4042
// and deletes the first matching document
41-
$result = $collection->deleteOne(Query::query(
42-
feature_type: Query::regex('nondangerous$', '')
43-
));
43+
$result = $collection->deleteOne(
44+
Query::or(
45+
Query::query(feature_type: Query::regex('nondangerous$', '')),
46+
Query::query(depth: Query::gt(10.0)),
47+
)
48+
);
4449

4550
// Prints number of deleted documents
4651
echo 'Deleted documents: ', $result->getDeletedCount(), PHP_EOL;

0 commit comments

Comments
 (0)