This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StoreSchema.statics.findByCoordinates = function(coordinates, maxDistance) { | |
return this.aggregate([ | |
{ | |
$geoNear: { | |
near: { | |
type: "Point", | |
coordinates: coordinates | |
}, | |
maxDistance: maxDistance, | |
distanceField: "dist.calculated", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoose = require("mongoose"); | |
const Schema = mongoose.Schema; | |
// On définit le schéma du Store | |
const StoreSchema = new Schema({ | |
name: { | |
type: String, | |
required: true | |
}, | |
address: { |
NewerOlder