LearnBoost/mongoose — Issue #720:  Maximum call stack size exceeded on geospatial
Author: Tizianol8
Created: 2012-02-07 18:09:51+00:00
State: open

I have this configuration:

// SCHEMA
sSchema: new Schema({
name: {type: String, required: true},
loc:
{
lng: {type: Number, default: 0},
lat: {type: Number, default: 0}
},
insertdate: {type: Date, default: Date.now}
})

// QUERY in NODE CODE
...
scollections.find({ loc: {$near: { lat: 46.250833, lng: 11.170278 }, $maxDistance: 0.8 } }).run(function(err, docs)
...

// QUERY PRINTED FROM DEBUGGER (mongoose.set('debug', true); )
...
scollections.find({ loc: { '$near': { lat: 46.250833, lng: 11.170278 }, '$maxDistance': 0.8 } })
...

// ERROR
[RangeError: Maximum call stack size exceeded]

The same query directly in mongodb shell give me the correct docs..

mongoose version: mongoose@2.5.5
mongodb version: v2.0.1
nodejs version: v0.6.8