Skip to content
Andrew edited this page Jul 26, 2019 · 11 revisions

General Notes

Use this command to remove all references to the config file in every branch as well as delete the file (will not delete file locally). Remember to add the config.js file to your .gitignore file.

git filter-branch --force --index-filter \ 'git rm --cached --ignore-unmatch ./config.js' \--prune-empty --tag-name-filter cat -- --all

Using React transitions (https://reactjs.org/docs/animation.html) is neat but has issues when component unmounts and transitions out, see: https://github.com/reactjs/react-transition-group/issues/303

How to delete 'x' weather events that meet a query:

db.weather.find({start: {$eq: "2020-07-07T00:00:00-07:00"}}).limit(x).
toArray().forEach( doc => { 
db.weather.remove({_id:doc._id})
})

How to backup a collection to json file (run mongoexport in the command line):

mongoexport --uri <URI> --collection <collection name> --out fileName.json

How to import a collection from a mongoexport-ed file (run mongoimport in the command line):

mongoimport --uri <URI> --collection <collection name> --file fileName.json

How to update the fields of every record to change the type (note there are different integer codes for the field type):

db.weather.find({start: {$type: 2  } } ).forEach( function(doc) {
doc.start = new Date(doc.start); db.weather.save(doc); })
Clone this wiki locally