Skip to content

Commit

Permalink
fix(query): add $geoWithin query casting for single embedded
Browse files Browse the repository at this point in the history
Fix #4044
  • Loading branch information
vkarpov15 committed Apr 9, 2016
1 parent 5222424 commit c1245af
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/schema/embedded.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ function Embedded(schema, path, options) {

Embedded.prototype = Object.create(SchemaType.prototype);

/**
* Special case for when users use a common location schema to represent
* locations for use with $geoWithin.
* https://docs.mongodb.org/manual/reference/operator/query/geoWithin/
*
* @param {Object} val
* @api private
*/

Embedded.prototype.$conditionalHandlers.$geoWithin = function(val) {
return { $geometry: this.castForQuery(val.$geometry) };
};

/**
* Casts contents
*
Expand Down

0 comments on commit c1245af

Please sign in to comment.