node.js - Mongodb collection intersection -
i'm new mongodb , need faster way write following script:
db.lth1.find().foreach( function(mydoc) { db.corpus.find({ 'p': mydoc._id.p, 's': mydoc._id.s, 'o': mydoc._id.o }).foreach(function(newdoc){ db.newdb1.insertone(newdoc, function(err, res) { if (err) throw err; console.log("1 document inserted"); }) } ); } )
wiki
Comments
Post a Comment