1
在node.js中,不支持mongolian或mongo-native組函數嗎?
蒙戈本地代碼,
var mongodb = require('mongodb');
var Db = mongodb.Db;
var Server = mongodb.Server;
var db = new Db("test", new Server("localhost", 27017), { w:0 });
db.collection("user").group({
key: { },
reduce: function (curr, result) { },
initial: { }
});
結果,
/node/ex1/node_modules/mongodb/lib/mongodb/collection.js:1400
if(err != null) return callback(err);
^
TypeError: undefined is not a function
at Collection.group.scope (/node/ex1/node_modules/mongodb/lib/mongodb/collection.js:1400:30)
at Db._executeQueryCommand (/node/ex1/node_modules/mongodb/lib/mongodb/db.js:1812:12)
at Collection.group (/node/ex1/node_modules/mongodb/lib/mongodb/collection.js:1399:13)
at Object.<anonymous> (/node/ex1/repository.js:34:25)
和mongolign代碼,
var Mongolian = require("mongolian");
var server = new Mongolian;
var db = server.db("test");
db.collection("user").group({
key: { },
reduce: function (curr, result) { },
initial: { }
});
結果,
db.collection("user").group({
^
TypeError: Object Mongolian[mongo://localhost:27017]/assistor.user has no method 'group'
at Object.<anonymous> (/node/ex1/repository.js:77:25)