-
Notifications
You must be signed in to change notification settings - Fork 0
/
q8.js
47 lines (47 loc) · 914 Bytes
/
q8.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
db.hotelSearch.aggregate([
{
$search: {
"geoWithin": {
"circle": {
"center": {
"type": "Point",
"coordinates": [
12.496366,
41.902782
]
},
"radius": 10000
},
"path": "geoCode"
}
}
},
{
$limit: 100
},
{
$group: {
_id: {
"physicalHotel": "$dupeId",
"distance": "$dist.calculated",
"name": "$hotelName",
"amenities": "$amenityCodes"
},
offersCount: {
$sum: 1
},
hotels: {
$push: {
provider: {
$concat: [
"$chainCode",
"-",
"$iataCode"
]
},
property: "$propertyId"
}
}
}
}
])