-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: 2.0.2, 2.0.5
-
Component/s: None
-
Environment:Reading out of my node process...
{
"version": "v0.10.29",
"versions": {
"http_parser": "1.0",
"node": "0.10.29",
"v8": "3.14.5.8",
"ares": "1.10.0",
"uv": "0.10.27",
"zlib": "1.2.8",
"modules": "11",
"openssl": "1.0.1i-dev"
},
"domain": null,
"arch": "x64",
"execPath": "/usr/bin/nodejs",
"hrtime": [
37672,
326515759
],
"groups": [
4,
33,
60,
113,
131,
1000,
1001
],
"config": {
"target_defaults": {
"cflags": [],
"default_configuration": "Release",
"defines": [],
"include_dirs": [],
"libraries": [
"-lz",
"-lcares",
"-lv8",
"-lssl",
"-lcrypto"
]
},
"variables": {
"clang": 0,
"gcc_version": 49,
"host_arch": "x64",
"node_install_npm": false,
"node_prefix": "/usr",
"node_shared_cares": true,
"node_shared_http_parser": false,
"node_shared_libuv": false,
"node_shared_openssl": true,
"node_shared_v8": true,
"node_shared_zlib": true,
"node_tag": "",
"node_unsafe_optimizations": 0,
"node_use_dtrace": false,
"node_use_etw": false,
"node_use_openssl": true,
"node_use_perfctr": false,
"node_use_systemtap": false,
"python": "/usr/bin/python",
"target_arch": "x64",
"v8_enable_gdbjit": 0,
"v8_no_strict_aliasing": 1,
"v8_use_snapshot": false
}
},
"features": {
"debug": false,
"uv": true,
"ipv6": true,
"tls_npn": true,
"tls_sni": true,
"tls": true
},
"pid": 29376,
"title": "node",
"modules": [
"Binding evals",
"Binding natives",
"NativeModule events",
"NativeModule buffer",
"Binding buffer",
"NativeModule assert",
"NativeModule util",
"NativeModule path",
"NativeModule module",
"NativeModule fs",
"Binding fs",
"Binding constants",
"NativeModule stream",
"NativeModule _stream_readable",
"NativeModule _stream_writable",
"NativeModule _stream_duplex",
"NativeModule _stream_transform",
"NativeModule _stream_passthrough",
"NativeModule http",
"NativeModule net",
"NativeModule timers",
"Binding timer_wrap",
"NativeModule _linklist",
"Binding cares_wrap",
"NativeModule url",
"NativeModule punycode",
"NativeModule querystring",
"NativeModule freelist",
"Binding http_parser",
"NativeModule https",
"NativeModule tls",
"NativeModule crypto",
"Binding crypto",
"NativeModule string_decoder",
"NativeModule constants",
"NativeModule os",
"Binding os",
"NativeModule tty",
"Binding tty_wrap",
"Binding pipe_wrap",
"NativeModule child_process",
"NativeModule dgram",
"Binding udp_wrap",
"Binding process_wrap",
"NativeModule console",
"Binding tcp_wrap",
"NativeModule dns",
"NativeModule zlib",
"Binding zlib",
"NativeModule cluster"
]
}Reading out of my node process... { "version": "v0.10.29", "versions": { "http_parser": "1.0", "node": "0.10.29", "v8": "3.14.5.8", "ares": "1.10.0", "uv": "0.10.27", "zlib": "1.2.8", "modules": "11", "openssl": "1.0.1i-dev" }, "domain": null, "arch": "x64", "execPath": "/usr/bin/nodejs", "hrtime": [ 37672, 326515759 ], "groups": [ 4, 33, 60, 113, 131, 1000, 1001 ], "config": { "target_defaults": { "cflags": [], "default_configuration": "Release", "defines": [], "include_dirs": [], "libraries": [ "-lz", "-lcares", "-lv8", "-lssl", "-lcrypto" ] }, "variables": { "clang": 0, "gcc_version": 49, "host_arch": "x64", "node_install_npm": false, "node_prefix": "/usr", "node_shared_cares": true, "node_shared_http_parser": false, "node_shared_libuv": false, "node_shared_openssl": true, "node_shared_v8": true, "node_shared_zlib": true, "node_tag": "", "node_unsafe_optimizations": 0, "node_use_dtrace": false, "node_use_etw": false, "node_use_openssl": true, "node_use_perfctr": false, "node_use_systemtap": false, "python": "/usr/bin/python", "target_arch": "x64", "v8_enable_gdbjit": 0, "v8_no_strict_aliasing": 1, "v8_use_snapshot": false } }, "features": { "debug": false, "uv": true, "ipv6": true, "tls_npn": true, "tls_sni": true, "tls": true }, "pid": 29376, "title": "node", "modules": [ "Binding evals", "Binding natives", "NativeModule events", "NativeModule buffer", "Binding buffer", "NativeModule assert", "NativeModule util", "NativeModule path", "NativeModule module", "NativeModule fs", "Binding fs", "Binding constants", "NativeModule stream", "NativeModule _stream_readable", "NativeModule _stream_writable", "NativeModule _stream_duplex", "NativeModule _stream_transform", "NativeModule _stream_passthrough", "NativeModule http", "NativeModule net", "NativeModule timers", "Binding timer_wrap", "NativeModule _linklist", "Binding cares_wrap", "NativeModule url", "NativeModule punycode", "NativeModule querystring", "NativeModule freelist", "Binding http_parser", "NativeModule https", "NativeModule tls", "NativeModule crypto", "Binding crypto", "NativeModule string_decoder", "NativeModule constants", "NativeModule os", "Binding os", "NativeModule tty", "Binding tty_wrap", "Binding pipe_wrap", "NativeModule child_process", "NativeModule dgram", "Binding udp_wrap", "Binding process_wrap", "NativeModule console", "Binding tcp_wrap", "NativeModule dns", "NativeModule zlib", "Binding zlib", "NativeModule cluster" ] }
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Hi!
Using this code:
index.js
var MongoClient = require("mongodb").MongoClient; var mc = new MongoClient(); mc.connect("mongodb://mongodb-01/boomerang",function(err,db) { var coll = db.collection("webcollections",{ strict: true }); });
I accomplished breaking the mongodb node driver, due to a typo
in the collection.js sourcecode:
bash
Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
$> node index.js
/home/andreas/tmp/mg/node_modules/mongodb/lib/mongo_client.js:386
throw err
^
ReferenceError: utils is not defined
at collection (/home/andreas/tmp/mg/node_modules/mongodb/lib/db.js:302:13)
at /home/andreas/tmp/mg/index.js:5:16
at /home/andreas/tmp/mg/node_modules/mongodb/lib/mongo_client.js:383:11
at process._tickCallback (node.js:419:13)
(21:05) andreas@[kemp] ~/tmp/mg $> cat index.js
var MongoClient = require("mongodb").MongoClient;
var mc = new MongoClient();
mc.connect("mongodb://mongodb-01/boomerang",function(err,db) {
var coll = db.collection("webcollections",{ strict: true });
});
$> cat node_modules/mongodb/package.json | jq .version
"2.0.5"
$>
Same is also true in "2.0.2"
The offending line is:
collection.js
if(typeof callback != 'function') { throw utils.toError(f("A callback is required in strict mode. While getting collection %s.", collectionName)); }
There is not variable utils as such defined in the code, however require() points to a utils.js. I haven't had the chance yet to look at the code or understand it or contribute to it but slowly considering it.
Anyway thanks in advance!