Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use $maxDistance with Array #388

Closed
santiago opened this issue Jun 21, 2011 · 1 comment
Closed

Can't use $maxDistance with Array #388

santiago opened this issue Jun 21, 2011 · 1 comment

Comments

@santiago
Copy link

Was having this issue with 1.3.7; just updated to 1.4.0, still the same:

Doing the following

var center= [4,4];
RoomModel.find({ center: { "$near": center, "$maxDistance": 1.5 } } ... );

I get error:

{ stack: [Getter/Setter],
  arguments: undefined,
  type: undefined,
  message: 'Can\'t use $maxDistance with Array.' }

Tried the same in Mongo's CLI and it works ok:

> db.rooms.find({ center : { "$near" : [4,4], $maxDistance: 1.5 } })
  { "center" : [ 4, 4 ], "updated_at" : "Mon Jun 20 2011 22:48:58 GMT-0500 (COT)", "_id" :      ObjectId("4e0014aa9bf6296204000002"), "radius" : 1 }

It works if $maxDistance not included in query

@rogchap
Copy link

rogchap commented Jun 24, 2011

I added:

          return new MongooseNumber(val, this.path).valueOf();
       }

at line 133 in mogoose/schema/array.js to get this to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants