Skip to content

Instantly share code, notes, and snippets.

@Climax777
Created June 5, 2020 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Climax777/ce6bb64db9fcd6cdb23293022d33fe68 to your computer and use it in GitHub Desktop.
Save Climax777/ce6bb64db9fcd6cdb23293022d33fe68 to your computer and use it in GitHub Desktop.
Fix snapshot timestamps
b = []; a = 0; db.snapshots.find({camera: {$in: ["5dfb35f7bd040908dd2bed04", "5df9e2cfbd040908dd2bec92"]}}, {timestamp:1}).sort({_id: 1}).forEach(function(item) {if(-(item._id.getTimestamp()) + item.timestamp > 5*60*1000) {print('WHAAAT: ' + Math.abs(+(item._id.getTimestamp()) - item.timestamp)/1000/60 + ' ' + +(item._id.getTimestamp()) + ' ' + item.timestamp + item._id.getTimestamp()); a++; b.push(item);}})
b.forEach(function(snap){printjson(snap); db.snapshots.updateOne({_id: snap._id},{$set: {timestamp: +(snap._id.getTimestamp())}})})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment