This file contains 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
var MongoClient = require('mongodb').MongoClient; | |
var url = "mongodb://localhost:27017/"; | |
MongoClient.connect(url, function(err, db) { | |
if (err) throw err; | |
var dbo = db.db("mydb"); | |
// ----------Insert Records------------ | |
dbo.collection("customers").deleteMany({}); |
This file contains 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
//afterSave | |
public function afterSave($insert, $changedAttributes) | |
{ | |
if ($insert){ | |
//New record | |
}else{ | |
//Old record | |
} | |