emongo 是另外一个 MongoDB 的 Erlang 开发包,已经多年没更新。
示例代码:
%% find documents where field1 is greater than 5 and less than 10 emongo:find(test, "collection", [{"field1", [{gt, 5}, {lt, 10}]}]). %% find documents where field1 is greater than or equal to 5 and less than or equal to 10 emongo:find(test, "collection", [{"field1", [{gte, 5}, {lte, 10}]}]). %% find documents where field1 is greater than 5 and less than 10 emongo:find(test, "collection", [{"field1", [{'>', 5}, {'<', 10}]}]). %% find documents where field1 is greater than or equal to 5 and less than or equal to 10 emongo:find(test, "collection", [{"field1", [{'>=', 5}, {'=<', 10}]}]).