{"_id":"mongodb-bridge","_rev":"136-df788ea21d9ea319a02e2733d2bba6ef","name":"mongodb-bridge","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.1":{"name":"mongodb-bridge","version":"0.0.1","keywords":["mongodb","mongodb.js"],"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","_id":"mongodb-bridge@0.0.1","maintainers":[{"name":"imlucas","email":"lucas@ex.fm"}],"homepage":"http://github.com/imlucas/mongodb-bridge","bugs":{"url":"https://github.com/imlucas/mongodb-bridge/issues"},"bin":{"mongobridge":"./bin/mongobridge.js"},"dist":{"shasum":"781c9a0994f3fe08814c32277f8c1592580dd688","tarball":"https://registry.npmjs.org/mongodb-bridge/-/mongodb-bridge-0.0.1.tgz","integrity":"sha512-9PqT2KFEYGWuG+aqPK/vSohnMHJgCW9DEKmTlHBtm5IjqxvCrVA8rXWap3MfFhk9zzlluETh3ZSomn5HdvCH3A==","signatures":[{"sig":"MEYCIQDichGIFf4kIP5ZWmXFxgv5wE1OG13iU/UScq2oYauB6wIhAPAgib7hXKIjLv6qhWD70SamUbd/fv4DljqdTokpRyxz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","scripts":{"test":"mocha"},"_npmUser":{"name":"imlucas","email":"lucas@ex.fm"},"repository":{"url":"http://github.com/imlucas/mongodb-bridge.git","type":"git"},"_npmVersion":"1.4.3","description":"a tiny tcp proxy for network simulation (same as mongobridge.cpp)","directories":{},"dependencies":{"debug":"^0.7.4"},"devDependencies":{"mocha":"^1.17.1"}},"0.0.2":{"name":"mongodb-bridge","version":"0.0.2","keywords":["mongodb","mongodb.js"],"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","_id":"mongodb-bridge@0.0.2","maintainers":[{"name":"imlucas","email":"lucas@ex.fm"}],"homepage":"http://github.com/imlucas/mongodb-bridge","bugs":{"url":"https://github.com/imlucas/mongodb-bridge/issues"},"bin":{"mongodb-bridge":"bin/mongodb-bridge.js"},"dist":{"shasum":"49d16c495ff4645c04c9f07a87375fa69c7647d1","tarball":"https://registry.npmjs.org/mongodb-bridge/-/mongodb-bridge-0.0.2.tgz","integrity":"sha512-dGg98J2WCfYTdcqk+0t/VTaRW0CPFhNNTsSnysqoNgtyt9gLiz4rIFapb3O9dU0EWyUUB4iAqVOzGK4L6PKl9w==","signatures":[{"sig":"MEUCIQDNzKkutPGn1v0bq46UBKPJA6s+wRAVFLzx7LKWHmui0wIgF7dhbsiqpyg7j45FWXEZIg6+Tdsx79ia4HAFF299L/E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","scripts":{"dist":"lone --release"},"_npmUser":{"name":"imlucas","email":"lucas@ex.fm"},"repository":{"url":"http://github.com/imlucas/mongodb-bridge.git","type":"git"},"_npmVersion":"1.4.3","description":"a tiny tcp proxy for network simulation (same as mongobridge.cpp)","directories":{},"devDependencies":{"lone":"^0.2.0"}},"0.0.3":{"name":"mongodb-bridge","version":"0.0.3","keywords":["mongodb","mongodb.js"],"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","_id":"mongodb-bridge@0.0.3","maintainers":[{"name":"imlucas","email":"lucas@ex.fm"}],"homepage":"http://github.com/imlucas/mongodb-bridge","bugs":{"url":"https://github.com/imlucas/mongodb-bridge/issues"},"bin":{"mongodb-bridge":"bin/mongodb-bridge.js"},"dist":{"shasum":"06fa66120aa08d6a7e5b5cfb47701515bc61d394","tarball":"https://registry.npmjs.org/mongodb-bridge/-/mongodb-bridge-0.0.3.tgz","integrity":"sha512-tcXq7QzgMDGbxnZ+5sGTnARJ/JJLTUzlhrnLmTh9QzdtUquRBlERLLkXJOt+/7yB4Y2DZdOd+HqV6ruN7Y3a8g==","signatures":[{"sig":"MEQCIC0tWLAg417zXY5HhOYga2vi1N84veJBxF306gBSsWemAiBnJ2sTTtI66Lg8/TCKW75jBcBh+9eOcBNh85NtmZMBFw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","scripts":{"dist":"lone --release"},"_npmUser":{"name":"imlucas","email":"lucas@ex.fm"},"repository":{"url":"http://github.com/imlucas/mongodb-bridge.git","type":"git"},"_npmVersion":"1.4.3","description":"a tiny tcp proxy for network simulation (same as mongobridge.cpp)","directories":{},"devDependencies":{"lone":"^0.2.0"}},"0.0.4":{"name":"mongodb-bridge","version":"0.0.4","keywords":["mongodb","mongodb.js"],"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","_id":"mongodb-bridge@0.0.4","maintainers":[{"name":"imlucas","email":"lucas@ex.fm"}],"homepage":"http://github.com/imlucas/mongodb-bridge","bugs":{"url":"https://github.com/imlucas/mongodb-bridge/issues"},"bin":{"mongodb-bridge":"bin/mongodb-bridge.js"},"dist":{"shasum":"5332e2f9580d9a3d424e3d021367f0e9bdc5771d","tarball":"https://registry.npmjs.org/mongodb-bridge/-/mongodb-bridge-0.0.4.tgz","integrity":"sha512-9Ed8E7fPQgAfVBWK8wHTJMLaNk0OdG9DOBFU3+4Oyd/ThGLamq2SmIvAb4GqWNtr5tlbOWUYCy3xaoV6ADgZjQ==","signatures":[{"sig":"MEUCIApWP7jNL49jyh8MxYzWmE3s8D939g+UarrHrz69jaXIAiEArvN1FVZ3Ee9LEp2SlCCIUTdFbux7y+8Y4oiNhswOzek=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","scripts":{"dist":"lone --release"},"_npmUser":{"name":"imlucas","email":"lucas@ex.fm"},"repository":{"url":"http://github.com/imlucas/mongodb-bridge.git","type":"git"},"_npmVersion":"1.4.3","description":"a tiny tcp proxy for network simulation (same as mongobridge.cpp)","directories":{},"devDependencies":{"lone":"^0.2.0"}},"0.0.5":{"name":"mongodb-bridge","version":"0.0.5","keywords":["mongodb","mongodb.js"],"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","_id":"mongodb-bridge@0.0.5","maintainers":[{"name":"imlucas","email":"lucas@ex.fm"}],"homepage":"http://github.com/imlucas/mongodb-bridge","bugs":{"url":"https://github.com/imlucas/mongodb-bridge/issues"},"bin":{"mongodb-bridge":"bin/mongodb-bridge.js"},"dist":{"shasum":"d554d5fc78ef6042e6245cf7828dd7c8c4c8640c","tarball":"https://registry.npmjs.org/mongodb-bridge/-/mongodb-bridge-0.0.5.tgz","integrity":"sha512-kVhwgDQySHSkTisbfbBJUsBdjWE+lZRLVWMp24DOaffuJ2AebBXTL24bl/FZTnXIXHogHkHRZch6gWjDiK9evA==","signatures":[{"sig":"MEUCIQD6Q6C2YEw0eaO4+2dKkUUGoi0k/ma59DvL2f+XzJRiqAIgK7O6aZRFE1E5vGWQPPo04OPFJNBhOGRrngkvGUnEw3s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","scripts":{"dist":"lone --release"},"_npmUser":{"name":"imlucas","email":"lucas@ex.fm"},"repository":{"url":"http://github.com/imlucas/mongodb-bridge.git","type":"git"},"_npmVersion":"1.4.3","description":"a tiny tcp proxy for network simulation (same as mongobridge.cpp)","directories":{},"dependencies":{"debug":"^0.8.1"},"devDependencies":{"lone":"^0.2.0"}},"0.1.0":{"name":"mongodb-bridge","version":"0.1.0","keywords":["mongodb","mongodb.js"],"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","_id":"mongodb-bridge@0.1.0","maintainers":[{"name":"imlucas","email":"lucas@ex.fm"}],"homepage":"http://github.com/imlucas/mongodb-bridge","bugs":{"url":"https://github.com/imlucas/mongodb-bridge/issues"},"bin":{"mongodb-bridge":"bin/mongodb-bridge.js"},"dist":{"shasum":"a306d0a2bf407b41722348c653edc442cd6b9157","tarball":"https://registry.npmjs.org/mongodb-bridge/-/mongodb-bridge-0.1.0.tgz","integrity":"sha512-8X3W2vOaG6mKsimuG+0469O7TmdyMBZgBc8a0wiBwtmMJ1uGeU7Hys4Me3sv1q27dBnqycVoFj/9lKhkTh9bdQ==","signatures":[{"sig":"MEUCIQCFeHy/94z8p8pYx/sOAfUBWpg9ksk8WHrfZRUHzh3a/QIgUbPqYWN0FEcZldWxH49+lDckjlkmVNzh1jLXNCi0O/4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_shasum":"a306d0a2bf407b41722348c653edc442cd6b9157","scripts":{"dist":"lone --release","start":"bin/mongodb-bridge.js"},"_npmUser":{"name":"imlucas","email":"lucas@ex.fm"},"repository":{"url":"http://github.com/imlucas/mongodb-bridge.git","type":"git"},"_npmVersion":"1.4.9","description":"a tiny tcp proxy for network simulation (same as mongobridge.cpp)","directories":{},"dependencies":{"debug":"^0.8.1","yargs":"^1.2.5"},"devDependencies":{"lone":"^0.2.0"}}},"time":{"created":"2014-05-21T00:35:55.060Z","modified":"2026-07-15T15:35:08.326Z","0.0.1":"2014-05-21T00:35:55.060Z","0.0.2":"2014-05-21T01:27:16.108Z","0.0.3":"2014-05-21T01:54:47.357Z","0.0.4":"2014-05-22T23:05:18.377Z","0.0.5":"2014-06-02T20:33:38.194Z","0.1.0":"2014-08-20T02:58:29.770Z"},"bugs":{"url":"https://github.com/imlucas/mongodb-bridge/issues"},"author":{"url":"http://imlucas.com","name":"Lucas Hrabovsky","email":"hrabovsky.lucas@gmail.com"},"license":"MIT","homepage":"http://github.com/imlucas/mongodb-bridge","keywords":["mongodb","mongodb.js"],"repository":{"url":"http://github.com/imlucas/mongodb-bridge.git","type":"git"},"description":"a tiny tcp proxy for network simulation (same as mongobridge.cpp)","maintainers":[{"email":"satya@mongodb.com","name":"satyasinha"},{"email":"kristina.stefanova@mongodb.com","name":"kristina.stefano"},{"email":"nathan.smyth@10gen.com","name":"jarjee"},{"email":"iteng@mongodb.com","name":"devtoolsbot"},{"email":"james.wang@mongodb.com","name":"mongo-j"},{"email":"neal.beeken@mongodb.com","name":"nbbeeken"},{"email":"dbx-node@mongodb.com","name":"dbx-node"},{"email":"devtools-npm-user@mongodb.com","name":"devtools-npm-user"},{"email":"hrabovsky.lucas@gmail.com","name":"imlucas"},{"email":"dana.groff+mongodb-js@mongodb.com","name":"mongodb-js-user"}],"readme":"# mongodb-bridge\n\n[![build status](https://secure.travis-ci.org/imlucas/mongodb-bridge.png)](http://travis-ci.org/imlucas/mongodb-bridge)\n\nMake weird network stuff reproducable, particularly handy when testing\nand distributed system that needs to handle these kinds of things.\n\n## Example\n\n```\n# Start a mongod in terminal 1\nmongod --port 27018;\n\n# Start a bridge in terminal 2\nmongodb-bridge --from localhost:27017 --to localhost:27018\n\n# Open mongo shell in terminal 3\nmongo localhost:27017\n\n# When you run `show dbs` everything looks fine.\n# Let's simulate the some delay though.\n# Open terminal 4.\n# What if you're connecting to another ec2 instance in the same availability zone? ~1ms\ncurl http://localhost:27019/delay/1\n\n# Not a realy noticable difference.\n# How about from ec2 east -> west? ~40ms\ncurl http://localhost:27019/delay/40\n\n# How about ec2 east (virginia) -> EU (dublin)? ~100ms\ncurl http://localhost:27019/delay/100\n\n# Now we're starting to notice.\n# How about from ec2 west (oregon) -> EU (dublin)? ~180ms\ncurl http://localhost:27019/delay/180\n\n# Ok starting to hurt.\n# How about ec2 west -> tokyo? ~1100ms\ncurl http://localhost:27019/delay/1100\n\n# Zoinks.  How about some weirdness.\n# mongodb running on a satellite ~2200ms\ncurl http://localhost:27019/delay/2200\n\n# Even at that, not so bad.  Lots of people can do that.\n# What about mars, tough guy? ~9 minutes and 30 seconds\ncurl http://localhost:27019/delay/570000\n\n# Let's go back to no delay.\ncurl http://localhost:27019/delay/0\n\n# How about another common scenario: someone screwed up the iptables config.\n# Hmm I can send but I never get anything back from mongo...\ncurl http://localhost:27019/drop/outgoing\n\n# Whew!  Ok that's fixed.\ncurl http://localhost:27019/drop/none;\n\n# Now let's update the app servers...\ncurl http://localhost:27019/drop/incoming;\n\n# Nards!  Let me see that thing.  I remember how to ip all the tables...\ncurl http://localhost:27019/drop/all;\n\n# Oi... we forgot to run chef-client.\ncurl http://localhost:27019/drop/none;\n```\n\n## Scenarios\n\nSay you are trying to test a system over time.  You can use a pretty\nsimple grammar to have bridge replay a scenario.\n\n```bash\ncat > one_minute_slowdown.txt << EOF\nset the delay to 0\nand after 100ms, set the delay to 100\nand after 1 minute, set the delay to 0\nEOF\n\ncat one_minute_slowdown.txt | mongodb-bridge run-scenario\n```\n\n```bash\ncat > drop_outgoing_then_lose_some_incoming.txt << EOF\nset the delay to 0\nand after 10 seconds, drop outgoing\nand after 30 seconds, drop none\nand set the delay to 0\nand after 1 minute, drop all\nand then wait 1 minute\nand then stop\nEOF\n\ncat drop_outgoing_then_lose_some_incoming.txt | mongodb-bridge run-scenario\n```\n\n## Real World\n\nThis is the workflow I imagine would help folks to the most: put some\nscenarios in your integration tests directory so you can test and observe:\n\n```bash\ncat > prepare_slight_slow_down.txt << EOF\nwait 100ms\nand then set the delay to 100\nEOF\n\ncat prepare_slight_slow_down.txt | mongodb-bridge run-scenario\n\n# you go observe the system...\n# hmm everything looks ok...\n\ncat > shit_hits_the_fan.txt << EOF\nset the delay to 500\nand then wait 1 minute\nand set the delay to 1000\nand then wait 1 minute\nand then drop all\nEOF\n\ncat shit_hits_the_fan.txt | mongodb-bridge run-scenario\n\n# you go and check your system handled it correctly...\ncat > restore_order.txt << EOF\nset the delay to 0\nand after 100ms, drop none\nEOF\n\ncat restore_order.txt | mongodb-bridge run-scenario\n\n# you check everything is ok while self-fiving your way to the kitchen.\n```\n\n## REST Client\n\n```javascript\nvar bridge = require('bridge').client('localhost:27019');\nbridge.delay(1);\n\nbridge.delay(100);\n\nbridge.delay(0);\n\nbridge.drop('incoming');\n\nbridge.drop('outgoing');\n\nbridge.drop('all');\n\nbridge.drop('none');\n\nbridge.stop();\n```\n\n## license\n\nMIT\n","readmeFilename":"README.md"}