0
0 Comments

use mydatabase;
var count = 0;
db.strategy.find().forEach(function(strategy) {
var packetId = ObjectId().valueOf();
db.claim.find({‘strategyId’: strategy._id}).forEach(function(claim) {
db.packet.find({‘claimId’: claim._id}).forEach(function(packet) {
if (!packet.packetNumber || packet.packetNumber == ” || packet.packetNumber == ‘null’) {
packet.packetNumber = packetId;
db.getCollection(‘packet’).save(packet);
count++;
}
});
});
});
print (count + ‘ records updated’);

Changed status to publish