伙计们
在 node.js 中,不支持 mongolian 或 mongo-native 的 group 功能?
mongo本机代码,
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)
和蒙古语代码,
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)