Sunday, 24 June 2018

get current date and time with plain javascript and by using moment.

var moment=require('moment');
const currentDate = new Date();
const currentDateISOstring = currentDate.toISOString();

var data=moment.utc().format('YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');

console.log(currentDateISOstring);
console.log(data);

Friday, 22 June 2018

git tutorial

`1 - git stash
2 - git checkout develop
3 - git pull
4 - git rebase develop <your branch>
5 - git stash apply


Please wait, that is for a situation where you're working on a branch and you've uncommited changes and you suddenly want to move to other branch for some work. Lets say you need to fix some bug (edited)
Git stash will stash your changes and once you come to the same branch and execute `git stash apply` it will provide you those changes

But lets say you don't have that situation, you're working as normal feature branch and you've done with your changes and planning to push a PR then you don't need any stash related commands
In that case you need, `git checkout develop`, `git pull`, `git rebase develop <your branch>`, `fix conflicts if any`, `git push origin your branch name` if failed then `git push --force origin your branch name`
got it?`

mongoDb query


collection -> table

use db mydb ->create database if not exist and switch to database
show dbs -> list database
create user

db.createuser({
user:"a",
pwd:"",
roles:["read",write]
})

collections
create collection
db.createCollection('cusomer');
insert data into collection
db.customer.insert({ojectof data});
see data customer collection

db.customer.find([{insert multipale data at a time }]);
create index for each record

update collection filed data
db.cllectionname.update({filename with value to update},{new object which replace existing})
it will update hole object

user $set key word with filed to just update the required filed.
db.collection.update({username:"pawn"},{$set:{gender:"male"});
increment the age with five use $inc:{age:5}

unset->remove an attributes from collection object
$unset:{age:50}

if not found then insert user third param {upset:true}
rename
db.collectionname.update({},{$rename:{"gender":"sex"}})

db.collectionname.remove({name:"Pawan"}) ;
delete one
db.collectionname.remove({name:"Pawan"},{justOne:"true"}) ;

db.collectionname.find($or[{name:"Pawan"},{name:"Sumit"}]) ;









Tuesday, 5 June 2018

moment. experiment

const moment = require('moment');
const _ = require('lodash');
const currentDateTime = moment();
const releseDateTime = moment("2018-06-07T10:49:16.672");
const seatingDateTime = moment("2018-06-04T10:49:16.672");
let currentPhase;
console.log("---current-----",currentDateTime);
console.log(releseDateTime);
console.log(seatingDateTime);
if (currentDateTime.isSameOrBefore(releseDateTime)) {
console.log("1");
} else if (currentDateTime.isAfter(releseDateTime) && currentDateTime.isSameOrBefore(seatingDateTime)) {
console.log("2");
} else {
console.log("3");
}

var constants= {
"PHASE_NO_DATES": 'nodates',
"PHASE_DATES": 'dates',
"PHASE_SEATING": 'seating'
}

Git commit message change