benoitc / couchbeam

Apache CouchDB client in Erlang
Other
242 stars 113 forks source link

Support _find query #186

Open SachsKaylee opened 4 years ago

SachsKaylee commented 4 years ago

Closes #185 Adds support for _find using mango queries https://docs.couchdb.org/en/2.3.1/api/database/find.html

Usage:

couchbeam:find_docs(Db, {[
    {<<"$or">>, [
      {[{<<"salutation">>, {[{<<"$regex">>, <<"Test">>}]}}]},
      {[{<<"forename">>, {[{<<"$regex">>, <<"Test">>}]}}]},
      {[{<<"surname">>, {[{<<"$regex">>, <<"Test">>}]}}]}
    ]},
    {<<"company">>, {[{<<"$eq">>, <<"08f878d42296b9f9115848ce01012847">>}]}},
    {<<"type">>, {[{<<"$eq">>, <<"contact">>}]}}
  ]}, [{limit, 10}, {skip, 5}]).