HarvardEconCS/turkserver-meteor — pull request #13 by meonkeys (2014-10-23 19:01:00+00:00)
Title: Be forwards-compatible with MongoDB 2.6.5

This is probably not a pressing need, but I noticed that the code breaks against MongoDB 2.6.5. Eventually Meteor will upgrade, so it probably wouldn't hurt to be forwards-compatible if it isn't too much effort. MongoDB 2.6.5 is more strict that 2.4.x, so it offers a bit more safety. For example, see the bug I found/fixed in 32492039e693026f11c553825d557faaf6ee2fd2 thanks to stricter checking in MongoDB 2.6.5.

Here's an example error one will encounter running `meteor test-packages ./` when `MONGO_URL` points to a local MongoDB 2.6.5 instance:

W20141023-10:28:53.231(-7)? (STDERR)
W20141023-10:28:53.232(-7)? (STDERR) /home/user/.meteor/packages/meteor-tool/.1.0.34.oxpz2l++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:206
W20141023-10:28:53.232(-7)? (STDERR)	throw(ex);
W20141023-10:28:53.232(-7)? (STDERR)	^
W20141023-10:28:53.287(-7)? (STDERR) MongoError: '$set' is empty. You must specify a field like so: {$mod: {: ...}}
W20141023-10:28:53.287(-7)? (STDERR) at Object.Future.wait (/home/user/.meteor/packages/meteor-tool/.1.0.34.oxpz2l++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:326:15)
W20141023-10:28:53.287(-7)? (STDERR) at null. (packages/meteor/helpers.js:118)
W20141023-10:28:53.287(-7)? (STDERR) at MongoConnection.(anonymous function) [as update] (packages/mongo/mongo_driver.js:607)
W20141023-10:28:53.288(-7)? (STDERR) at Object.fields (packages/matb33:collection-hooks/update.js:71)
W20141023-10:28:53.288(-7)? (STDERR) at Object.collection.(anonymous function) [as update] (packages/matb33:collection-hooks/collection-hooks.js:104)
W20141023-10:28:53.288(-7)? (STDERR) at Mongo.Collection.(anonymous function) [as update] (packages/mongo/collection.js:572)
W20141023-10:28:53.288(-7)? (STDERR) at Mongo.Collection.upsert (packages/mongo/collection.js:606)
W20141023-10:28:53.288(-7)? (STDERR) at __coffeescriptShare (packages/local-test:mizzao:turkserver/tests/lobby_tests.coffee:4:10)
W20141023-10:28:53.288(-7)? (STDERR) at /tmp/meteor-test-run1k3mm8q/.meteor/local/build/programs/server/packages/local-test_mizzao_turkserver.js:305:4
W20141023-10:28:53.289(-7)? (STDERR) at /tmp/meteor-test-run1k3mm8q/.meteor/local/build/programs/server/packages/local-test_mizzao_turkserver.js:2931:3
W20141023-10:28:53.289(-7)? (STDERR) - - - - -
W20141023-10:28:53.289(-7)? (STDERR) at Object.toError (/home/user/.meteor/packages/mongo/.1.0.7.vij4hh++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/utils.js:110:11)
W20141023-10:28:53.289(-7)? (STDERR) at /home/user/.meteor/packages/mongo/.1.0.7.vij4hh++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/collection/core.js:542:27
W20141023-10:28:53.289(-7)? (STDERR) at /home/user/.meteor/packages/mongo/.1.0.7.vij4hh++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/db.js:1129:7
W20141023-10:28:53.289(-7)? (STDERR) at /home/user/.meteor/packages/mongo/.1.0.7.vij4hh++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/db.js:1843:9
W20141023-10:28:53.289(-7)? (STDERR) at Server.Base._callHandler (/home/user/.meteor/packages/mongo/.1.0.7.vij4hh++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/base.js:445:41)
W20141023-10:28:53.289(-7)? (STDERR) at /home/user/.meteor/packages/mongo/.1.0.7.vij4hh++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/server.js:468:18
W20141023-10:28:53.289(-7)? (STDERR) at MongoReply.parseBody (/home/user/.meteor/packages/mongo/.1.0.7.vij4hh++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
W20141023-10:28:53.289(-7)? (STDERR) at null. (/home/user/.meteor/packages/mongo/.1.0.7.vij4hh++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/server.js:426:20)
W20141023-10:28:53.289(-7)? (STDERR) at emit (events.js:95:17)
W20141023-10:28:53.290(-7)? (STDERR) at null. (/home/user/.meteor/packages/mongo/.1.0.7.vij4hh++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:201:13)