sql >> Base de Datos >  >> NoSQL >> MongoDB

Ubicación en mangosta, mongoDB

Lo arreglé yo mismo.

Hice esto en mi modelo:

loc :  { type: {type:String}, coordinates: [Number]},

Debajo hice un índice de 2dsphere.

eventSchema.index({loc: '2dsphere'});

Y para agregarle datos:

loc: { type: "Point", coordinates: [ longitude, latitude ] },