Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
mongo join在node.js中不起作用_Node.js_Mongodb - Fatal编程技术网

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(客户端)

我正在使用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(客户端).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);
                        });


                    });
                });  
            });