Permalink
Browse files

bugfix for findOpt(Col,[],...)

  • Loading branch information...
1 parent 516b646 commit 5bec60832873e2d852c4c189cd7e3e4f65284813 @SergejJurecko committed Aug 6, 2010
Showing with 6 additions and 1 deletion.
  1. +6 −1 mongoapi.erl
View
7 mongoapi.erl
@@ -223,7 +223,12 @@ find(Query, Selector, From, Limit) ->
% SortBy: {key, Val} or a list of keyval tuples -> {i,1} (1 = ascending, -1 = descending)
% Hint: [{Key,Val}] -> [{#mydoc.i,1}]
findOpt(Col, Query, Selector, Opts, From, Limit) when is_list(Query) ->
- {_,Q} = translateopts(false,undefined, Opts,[{<<"query">>, Query}]),
+ case Query of
+ [] ->
+ {_,Q} = translateopts(false,undefined, Opts,[{<<"query">>, {bson,<<>>}}]);
+ _ ->
+ {_,Q} = translateopts(false,undefined, Opts,[{<<"query">>, Query}])
+ end,
find(Col, Q, Selector, From, Limit);
% SortBy examples: {#mydoc.name, 1}, [{#mydoc.i, 1},{#mydoc.name,-1}]
% Hint example: #mydoc.name

0 comments on commit 5bec608

Please sign in to comment.