Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added $near operator #18

Merged
merged 1 commit into from

2 participants

@goya

Added the $near operator to transform_selector

@jkvor jkvor merged commit ded0c8c into jkvor:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 19, 2011
  1. Added near operator

    RUDD, Brett authored
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/emongo.erl
View
4 src/emongo.erl
@@ -555,7 +555,7 @@ transform_selector([{Key, [{_,_}|_]=Vals}|Tail], Acc) ->
{<<"$in">>, {array, Val}};
nin when is_list(Val) ->
{<<"$nin">>, {array, Val}};
- mod when is_list(Val), length(Val) == 2 ->
+ mod when is_list(Val), length(Val) == 2 ->
{<<"$mod">>, {array, Val}};
all when is_list(Val) ->
{<<"$all">>, {array, Val}};
@@ -563,6 +563,8 @@ transform_selector([{Key, [{_,_}|_]=Vals}|Tail], Acc) ->
{<<"$size">>, Val};
exists when is_boolean(Val) ->
{<<"$exists">>, Val};
+ near when is_list(Val) ->
+ {<<"$near">>, {array, Val}};
_ ->
{Operator, Val}
end || {Operator, Val} <- Vals],
Something went wrong with that request. Please try again.