Skip to content

Instantly share code, notes, and snippets.

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({});
@pptyasar
pptyasar / Yii2Snippets.txt
Last active February 24, 2018 10:08
Yii2 copy paste snippets
//afterSave
public function afterSave($insert, $changedAttributes)
{
if ($insert){
//New record
}else{
//Old record
}