|
18 | 18 | // start-find |
19 | 19 | // Creates a query filter by using builders and |
20 | 20 | // 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 | + ) |
29 | 31 | ) |
30 | | -)); |
| 32 | +); |
31 | 33 |
|
32 | 34 | // Prints matching documents |
33 | 35 | foreach ($docs as $doc) { |
|
38 | 40 | // start-deleteone |
39 | 41 | // Creates a query filter by using builders |
40 | 42 | // 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 | +); |
44 | 49 |
|
45 | 50 | // Prints number of deleted documents |
46 | 51 | echo 'Deleted documents: ', $result->getDeletedCount(), PHP_EOL; |
|
0 commit comments