support for findAndModify #17

wants to merge 134 commits into from

6 participants


Hi Jacob,

Here are my commits for the findAndModify command. I guess I included both Jeremy Hood's commits for insert_sync and the whitespace work that I did on my fork. Oh well, the rest of the commits are the meat of the pull request.

Comments welcome, especially on the options handling for specific features (fam_options/2 vs. create_query/2 and /4)


Jacob Vorreuter and others added some commits Oct 12, 2009
Jacob Vorreuter merging 8c58aed
Jacob Vorreuter fixing oid encode/decode function 8819c4c
Jacob Vorreuter adding a test for bson encode/decode f3d9f41
Jacob Vorreuter replacing list of pids in pool with queue 34f268a
Jacob Vorreuter finishing converting pids in pool to queue from list f7cfb77
Jacob Vorreuter temporarily adding back in ability to pass query record into find fun…
Jacob Vorreuter adding socket into receive loop to verify source of packet 5d10f7f
Jacob Vorreuter Merge branch 'master' of 1a4708b
Jacob Vorreuter updating readme da3b374
Jacob Vorreuter adding options to emongo:find and adding api docs to readme d50efe5
Jacob Vorreuter updating api docs 9abbcce
Jacob Vorreuter updating api docs 093649e
Jacob Vorreuter updating api docs 76fc1ce
Jacob Vorreuter updating api docs b752a81
Jacob Vorreuter adding initial ensure_index code ef9ee92
Jacob Vorreuter removing bad byte cf75e03
Jacob Vorreuter adding distinction between int and long in emongo_bson 3243be1
Jacob Vorreuter adding new test and refactoring the create_query function a little e8689a6
Jacob Vorreuter adding conditional operators, a test file and documentation 0cd4374
Jacob Vorreuter bolding some stuff in the documentation 3bc9f4d
Jacob Vorreuter adding examples of alternative ne syntax 3fa3394
Jacob Vorreuter added nested query tests and documentation c22e46b
Jacob Vorreuter fixing documentation f3a65ec
Jacob Vorreuter adding some insert, update and delete documentation 847a8e8
@japerk japerk app & build refactor 837cab2
@japerk japerk replace emongo_conn with emongo_server gen_server eb91b35
@japerk japerk emongo_server:send does gen_server:cast 5e16b83
@japerk japerk empty appup 0bb6f7e
@japerk japerk emongo 0.0.3 with supervised pools and connections dabba66
@japerk japerk appup fixes cddf563
@japerk japerk emongo 0.0.4 with emongo_collection foreach & fold bac7077
@RumataEstor RumataEstor binary string must be already in utf8 7313b6f
@RumataEstor RumataEstor Use transform_selector on Selector in delete/3 so that the selector w… be228bc
@RumataEstor RumataEstor Do not register pools. 7942ecf
@RumataEstor RumataEstor Remove configuration from app. e0d91bf
@RumataEstor RumataEstor Create pool workers specifications statically. 5aab3e8
@RumataEstor RumataEstor Revert changeset 53. Create missing workers on demand. 4165640
@japerk japerk Add call to do_open_connections even if pool exists to gracefully han…
…dle mongo server restarts (adapted from mclaughlin77)
@japerk japerk emongo can somewhat gracefully handle tcp_closed and reconnect later,…
… vsn 0.0.5
@RumataEstor RumataEstor use queue for connections in pool
rename emongo_server_sup to emongo_pool
@RumataEstor RumataEstor makefile bugfix 425deb6
@RumataEstor RumataEstor internal round-robin balancer d3c3dbd
@RumataEstor RumataEstor convert database field to utf8 beforehand f9afe4e
@RumataEstor RumataEstor syncronous update 2be0892
@RumataEstor RumataEstor packet for server status 3bbc375
@RumataEstor RumataEstor gen_server:cast always returns ok 7252d5a
@RumataEstor RumataEstor router start/stop dd06e70
@RumataEstor RumataEstor ping server (with getlasterror) to detect connection problems
don't use pool state in emongo module
@RumataEstor RumataEstor router as a pool for transparent pool switch if one is down 969a948
@RumataEstor RumataEstor do not hang if connection cannot be established 6167c8f
@RumataEstor RumataEstor Added tag emongo_0.0.4-6 for changeset 0916ed87ec42 8f356b0
@RumataEstor RumataEstor find_all uses the same pool as first find call
pool deactivation logging
@RumataEstor RumataEstor lost file for previous commit df768af
@RumataEstor RumataEstor fetch pools only once per pid request 6259525
@RumataEstor RumataEstor remove useless balancer 2b3c5c9
@RumataEstor RumataEstor more logging 49c2104
@japerk japerk distinct key command e1ff452
@japerk japerk count command with selector 4889d7b
@japerk japerk distinct command with Selector d539f25
@japerk japerk emongo_collection distinct set & list, count & distinct command cleanup 283e330
@RumataEstor RumataEstor remove useless balancer 2370b68
@RumataEstor RumataEstor connect router to existing pools (in case of restart)
router polling time not equal pool's
@RumataEstor RumataEstor remove find and kill_cursors, use find_all and fold_all
less checks in function heads
@RumataEstor RumataEstor non-blocking send_recv_nowait and recv for receiving c766a79
@RumataEstor RumataEstor polling doesn't block pool 5f10207
@RumataEstor RumataEstor remove emongo_balancer from app d95b7de
@RumataEstor RumataEstor process many responses in one tcp packet a4751d3
@RumataEstor RumataEstor count and distinct commands 526a2b8
@RumataEstor RumataEstor New sequenced interface for combining updates and reads. New worker q…
…ueue with priorities.
@RumataEstor RumataEstor test: different interface d5b99d5
@RumataEstor RumataEstor 7716403
@RumataEstor RumataEstor bugfix: find_all result was reversed 34b5905
@RumataEstor RumataEstor issue/7/check-for-abort-message-in-emongo_server a40bed3
@RumataEstor RumataEstor bugfix: find_all result was reversed ddaa6fb
@RumataEstor RumataEstor Pool is active after creation. b41b2ba
@RumataEstor RumataEstor Sequenced operations do not return ReqId aed4281
@RumataEstor RumataEstor better testing deployment 820b941
@RumataEstor RumataEstor human-readable error handling d8d4139
@RumataEstor RumataEstor heavy operations may block requests while everything's fine 42b36e5
@RumataEstor RumataEstor synchronous insert helper 47ecc0f
@RumataEstor RumataEstor make orderby work on mongodb 1.4.4 5007a0e
@RumataEstor RumataEstor decode bson type 17 "timestamp" 01402c7
@RumataEstor RumataEstor ensure_index usage example a888b4c
@RumataEstor RumataEstor better exception atom d8098ef
@RumataEstor RumataEstor syncronous results are documents, not raw response 8178cd4
@RumataEstor RumataEstor issue 17: Limit not working
with limit we receive all the documents in first response and must close cursor
Jeremy Hood Added insert_sync 7d63a64
Jeremy Hood Added DUPLICATE_KEY_ERROR c45caf4
@RumataEstor RumataEstor explain option bf9d9f1
@boorad boorad add support for findAndModify command 2ae4e61
@boorad boorad extra guard on Update param e63fe58
@boorad boorad whitespace b725cfd
@boorad boorad ack, forgot to export insert_sync/3 953a4d5
@boorad boorad oops, we should ignore update in options, because it is a distinct ar…
…g to find_and_modify/5
@boorad boorad work-around for bug in mongos 5388bbe
@boorad boorad rebar-friendly .app file, and whitespace ff74563
@boorad boorad Merge branch 'master' of /Users/brad/dev/tv/emongo-git-bb into bitbuc…

@boorad boorad whitespace cleanup and a few more fixes for merge of bitbucket repo cf1d051
@boorad boorad patch up find_and_modify to work after bitbucket merge 27ff5f3
@boorad boorad fix old module call 6be87e3
@frail frail 'make install' Makefile fix (ubuntu) e10ab04
@francois2metz francois2metz added drop database command f6d17c3
@francois2metz francois2metz using /usr/bin/env escript instead of /usr/local/bin/escript 812a252
@francois2metz francois2metz fixed 003-find.t b58aca0
@francois2metz francois2metz reindent and untabify t/* 600353b
@francois2metz francois2metz fixed tests t/003-find.t t/004-cond-exprs.t, by replacing find/2 with…
… find_all
@francois2metz francois2metz updated README with latest api change and instructions about running …
@francois2metz francois2metz added doc on drop database fad8870
@francois2metz francois2metz delete-trailing-whitespace on README 9547a6e
@francois2metz francois2metz added tests on drop database 0a4f185
@francois2metz francois2metz added drop database command af8c49b
@francois2metz francois2metz using /usr/bin/env escript instead of /usr/local/bin/escript 173d48b
@francois2metz francois2metz fixed 003-find.t dbf92d6
@francois2metz francois2metz reindent and untabify t/* a339729
@francois2metz francois2metz fixed tests t/003-find.t t/004-cond-exprs.t, by replacing find/2 with…
… find_all
@francois2metz francois2metz updated README with latest api change and instructions about running …
@francois2metz francois2metz added doc on drop database b2c7c56
@francois2metz francois2metz delete-trailing-whitespace on README a961312
@francois2metz francois2metz added tests on drop database 8807b0b
@boorad boorad Merge branch 'make_install' 37b79aa
@master master documentation fix 6821d78
@master master MultiUpdate support 6380e03
@master master MultiUpdate unit test 7f50bb5
@master master MultiUpdate for update_sync 49ecb97
@master master documentation bumb 9dbc74c
@master master clean 0f94010
@master master allow sup's Pid as PoolId 8352e67
@boorad boorad more idiomatic erlang on update/5 calling update/6, whitespace & wrap da921b9
@boorad boorad ibid 4e1d0c5

What if whole pool will be restarted? Then old saved pid will be useless...

We need this mainly for applications monitoring workers on their own. E.g. ejabberd. We use one worker per pool so restart causes no problems. But I agree, this should be explicitly mentioned in the documentation.

francois2metz and others added some commits Oct 6, 2011
@francois2metz francois2metz Fix the path to escript in 006-multiup.t.
Signed-off-by: François de Metz <>
@francois2metz francois2metz Fix the 001-load test by filtering pools.
Signed-off-by: François de Metz <>
@francois2metz francois2metz Update to the latest version of etap.
Also providing better instructions.

Signed-off-by: François de Metz <>
@francois2metz francois2metz Add bson encoding of null values.
undefined value have been already implemented, but doesn't follow the specifications.

Signed-off-by: François de Metz <>
@boorad boorad Merge pull request #3 from AF83/bson_null
Bson value null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment