Skip to content

A thin wrapper that fuses mongodb-erlang with poolboy (mostly for my own sake)

License

Notifications You must be signed in to change notification settings

peffis/poolmongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

poolmongo

A thin wrapper that fuses mongodb-erlang with poolboy (mostly for my own sake)

usage

  • Add poolmongo as a dependency to your erlang.mk project
DEPS = ... poolmongo ...
dep_poolmongo = git https://github.com/peffis/poolmongo master
  • Add a pool configuration to your sys.config (any config really, but keep the name "pmongo" as the name for the pool)
[
...
{poolmongo, [ 
               {pools, [
                        {pmongo, [
                                  {size, 10},
                                  {max_overflow, 20}
                                 ], [
                                     {host, "localhost"},
                                     {port, 27017},
                                     {database, <<"your mongodb database">>},
                                     {w_mode, safe},
                                     {r_mode, slave_ok}
                                    ]}
                       ]}
             ]}, 
...
].
  • If you make use of .app.src you need to add poolmongo to the list of applications
{application, your_app,
 [
  {description, ""},
  {vsn, "0.9"},
  {registered, []},
  {applications, [
                  ...
		  poolmongo,
		  ...
                 ]},
  {mod, { your_app, []}},
  {included_applications, []},
  {modules, []},
  {env, []}
 ]}.
  • Build your system
make
  • Use the API in the pmongo module which is the same API as mongodb-erlang's mc_worker_api except that the first argument, the Connection, is removed (as the connection is handled by poolboy)

About

A thin wrapper that fuses mongodb-erlang with poolboy (mostly for my own sake)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published