My Schema is as follows:
mongoose = require 'mongoose'
ObjectId = mongoose.Schema.ObjectId
CheckinSchema = new mongoose.Schema
text:
type: String, required: true
location_latLong:
lat:
type: Number
lon:
type: Number
location_country:
type: String
addedOn:
type: Date
default: Date.now
CheckinSchema.index
location_latLong: '2d'
exports.CheckinSchema = CheckinSchema
The Model is generated separately. I get an error however when running a query. The error is:
count fails:{ errmsg: "exception: can't find special index: 2d for: { location_latLong: { $wi...", code: 13038, ok: 0.0 }
My query is:
{ location_latLong: { '$within': { '$box': [[ '-100', '-100' ],[ '100', '100' ]] } } }
So my question is.... what gives? How can I properly do Geospatial indexing in Mongoose (using Node.js)