mongo join在node.js中不起作用
我正在使用mongo join连接node.js中的两个集合。下面的代码显示了该查询,但它没有连接两个集合。谁来帮帮我 某物mongo join在node.js中不起作用,node.js,mongodb,Node.js,Mongodb,我正在使用mongo join连接node.js中的两个集合。下面的代码显示了该查询,但它没有连接两个集合。谁来帮帮我 某物 var client=newdb(config.dbname,新服务器(config.host,config.port1)); client.open(函数(err,client){ client.collection('proInfo',函数(err,proInfo){ proInfo.find({},函数(err,游标){ var join=new join(客户端)
var client=newdb(config.dbname,新服务器(config.host,config.port1));
client.open(函数(err,client){
client.collection('proInfo',函数(err,proInfo){
proInfo.find({},函数(err,游标){
var join=new join(客户端).on({
字段:“\u id”//
var client = new Db(config.dbname, new Server(config.host, config.port1));
client.open(function(err, client) {
client.collection('proInfo', function(err, proInfo) {
proInfo.find({}, function(err, cursor) {
var join = new Join(client).on({
field: '_id', // <- field in proInfo doc
to: 'purchasedItemId',// <- field in purchased doc. treated as ObjectID automatically.
from: 'purchased' // <- collection name for purchased doc
});
join.toArray(cursor, function(err, joinedDocs) {
// handle array of joined documents here
console.log(joinedDocs);
});
});
});
});