@@ -15,15 +15,16 @@ Scala queries
15
15
16
16
17
17
18
- ### MongoDB Compass
18
+ ### MongoDB Compass Queries
19
19
20
20
<details >
21
21
<summary >
22
- MongoDB Compass Queries
22
+ Compass Queries
23
23
</summary >
24
24
25
25
[ MongoDB Compass] ( https://www.mongodb.com/products/compass ) is the primary interface of mongoDB where users can interact with their data.
26
26
27
+ #### Filters
27
28
<details >
28
29
<summary >
29
30
Documents: filters
@@ -33,41 +34,50 @@ Documents: filters
33
34
34
35
Provide the filters on the first section in order to use them. Make sure you are in the correct collection.
35
36
36
- Sort a collection based on insertion time:
37
+ ##### Sort a collection based on insertion time:
37
38
``` bash
38
39
filter:
39
40
{ _id: -1}
40
41
` ` `
41
-
42
- Find objects with-in a bounding box:
42
+
43
+ # #### Regex: [link](https://docs.mongodb.com/manual/reference/operator/query/regex/)
44
+ ` ` ` bash
45
+ { ' name' : /George/ }
46
+ ` ` `
47
+
48
+ # #### Find objects within a bounding box:
43
49
` ` ` bash
44
50
{geometry: { $geoWithin : { $box : [ [ 33.0, 33.0 ], [ 35.0, 35.0 ] ] } }}
45
51
` ` `
46
52
47
- Find fingerprints with-in a time-span:
53
+ # #### Find fingerprints within a time-span:
48
54
` ` `
49
55
{ timestamp : { $gt : " 0000000000000" , $lt : " 1532759230143" }}
50
56
` ` `
51
57
52
- Find objects with-in a bounding box on a time-span:
58
+ # #### Find objects within a bounding box on a time-span:
53
59
` ` `
54
60
{geometry: { $geoWithin : { $box : [ [ 33.0, 33.0 ], [ 35.0, 35.0 ] ] } }, timestamp : { $gt : " 0000000000000" , $lt : " 1617117985695" }, buid: " building_8d9753f0-9dae-4772-81a6-942940ade718_1616948897991" }
55
61
` ` `
56
62
57
- Find objects where floor are not -1, 0, 1, 2.
63
+ # #### Find objects where floor are not -1, 0, 1, 2.
58
64
(Used in fingerprints collection)
59
65
` ` `
60
66
{$and :[ {buid: " username_1373876832005" }, {floor: {$ne : " 1" }}, {floor: {$ne : " 2" }}, {floor: {$ne : " 0" }},{floor: {$ne : " -1" }} ]}
61
67
` ` `
62
68
63
69
< /details>
64
70
71
+ # ### Validation
65
72
< details>
66
73
< summary>
67
- Validation
74
+ Documents: Validation
68
75
< /summary>
69
76
70
- Prevent collection fingerprints to add JSON objects without the field geometry.
77
+ # #### Prevent object addition to `fingerprints` collection
78
+ The object must have geometry with valid coordinates:
79
+ - ranges: -90 to 90, and -180 to 180
80
+
71
81
` ` `
72
82
{
73
83
$jsonSchema : {
0 commit comments