TypeError: Cannot call method 'dropDatabase' of null

39 views
Skip to first unread message

Kyle Banker

unread,
May 17, 2010, 5:02:20 PM5/17/10
to node-mongodb-native
I know I'm missing something really simple here, but I'm getting this
error any time I run one of the example scripts. It seems that the db
is always null.

Here's an example:

node examples/queries.js

Connecting to localhost:27017
events:11
throw arguments[1];
^
TypeError: Cannot call method 'dropDatabase' of null
at /Users/kyle/z/node-mongodb-native/examples/queries.js:15:6
at [object Object].<anonymous> (/Users/kyle/z/node-mongodb-native/
lib/mongodb/db.js:51:11)
at [object Object].emit (events:32:26)
at [object Object].<anonymous> (/Users/kyle/z/node-mongodb-native/
lib/mongodb/db.js:73:37)
at [object Object].emit (events:25:26)
at Stream.<anonymous> (/Users/kyle/z/node-mongodb-native/lib/
mongodb/connection.js:82:16)
at Stream.emit (events:25:26)
at IOWatcher.callback (net:386:16)
at node.js:204:9

Kyle Banker

unread,
May 17, 2010, 6:17:04 PM5/17/10
to node-mongodb-native
Tracking down the issue further, I'm running MongoDB 1.5.1, and by the
default, the ismaster command return a 'msg' key with the value 'not
paired.' The driver seems to be interpreting this as an error even
though the 'ok' value is 1.0. Still learning the code base, but
having a tough time finding the code that interprets 'msg' as an error
message.

christkv

unread,
May 18, 2010, 6:54:43 AM5/18/10
to node-mongodb-native
You can run against 1.5.1 with release V0.7.4 BUT eval and map-reduce
will not work. It's either a bug introduced in 1.5.X or a deliberate
change. I'm trying to ask Eliot at 10gen about it.

Kyle Banker

unread,
May 18, 2010, 10:11:10 AM5/18/10
to node-mongodb-native
It's actually a recent change, but I think that the issue is with the
driver. As long as the ismaster command returns 'ok' with a value of
1.0, no error should be propogated. What I believe the driver is doing
is interpreting the 'msg' key as an error; however, it's not.

Christian Kvalheim

unread,
May 18, 2010, 10:15:46 AM5/18/10
to node-mong...@googlegroups.com
V0.7.4 works now, I was using the responseTo code to handle errors but there is no guarantee for that. That's no longer the case. However some other things like eval are broken or have changed on the mongodb side in 1.5.1 that is not documented anywhere and thus break.

I only recommend 1.4.X for now and probably will not fix the eval/map-reduce problems until a stable release is out for 1.5.X or 1.6.X

Cheers
Reply all
Reply to author
Forward
0 new messages