File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
graphql/resolvers/Freight Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -131,17 +131,18 @@ export default {
131131 if ( vehicles ) conditions . vehicles = { vehicles : { $in : vehicles } } ;
132132 if ( bodies ) conditions . bodies = { bodies : { $in : bodies } } ;
133133 const res = await Freight . aggregate ( [
134- ...freightquery ,
135- { $match : conditions } ,
136- /*{
134+ {
137135 $geoNear : {
138136 near : { type : "Point" , coordinates } ,
139137 distanceField : "dist.calculated" ,
140138 spherical : true ,
141139 key : "origin.location" ,
142- maxDistance: range
140+ includeLocs : "location" ,
141+ maxDistance : range ,
142+ query : conditions
143143 }
144- },*/
144+ } ,
145+ ...freightquery ,
145146 { $skip : ( page - 1 ) * perpage } ,
146147 { $limit : perpage }
147148 ] ) . exec ( ) ;
Original file line number Diff line number Diff line change @@ -41,6 +41,6 @@ const LocSchema = new Schema({
4141 }
4242} ) ;
4343
44- LocSchema . index ( { coordinates : "2dsphere" } ) ;
44+ LocSchema . index ( { location : "2dsphere" } ) ;
4545
4646export default mongoose . model ( "Location" , LocSchema ) ;
You can’t perform that action at this time.
0 commit comments