MongoDB Update Statement Set Value From Other Collection
Ok I had to take off my SQL Server hat and think about it in JS terms. For each project in project I want to update these collections with the project _id. So I came up with this:
var proj = db.proj.find(); //load all the projectsproj.forEach(function(proj){ //loop through each one and update matching records in the collection db.forecast.update( { "projectNo" : proj.projectNo, "$isolated" : true },{ $set: { projId : proj._id } }, { "multi" : true });});
I'm sure there is another way to do this, I'm very open to suggestions.