This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | //Sample email that is received and whose details are extracted: | |
| /* | |
| *Someone* just submitted your form named Online Course Booking from your | |
| website | |
| https://www.abcd.com/ | |
| Message Details | |
| Full Name: Mohamed Ali | |
| Email Address: abcd123@gmail.com | |
| Phone Number: 009725991122334 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | db = db.getSiblingDB("whyd_music") // explicitely select collection | |
| var jan2014 = ObjectId("52c35a800000000000000000"); // created using http://steveridout.github.io/mongo-object-time/ | |
| db.post.aggregate([ | |
| {"$sort": {"_id": -1}}, // order: antichronological | |
| {"$match": {"_id": {"$gt": jan2014}}}, // only documents that were created after the 1syt january 2014 | |
| {"$group": {"_id": "$eId", // group by value of the eId attribute -> _id attribute in the resulting output collection | |
| "name": {"$first": "$name"}, // -> include the name of each grouped category | |
| "count": {"$sum": 1}}}, // -> count attribute will contain the number of documents for each value of _eid | |
| {"$match": {"count": {"$gt": 50}}}, // limit output to results with count > 50 | |
| {"$sort": {"count": -1}} // output order: highest count first | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |