MongoDB – Basic Commands

Basic command :

show collections

Terminal Shortcuts

Edit your bash profile file

vi ~/.bash_profile

Add this to the end of the file :

goAndListAll() {
cd $1
ls -la

goAndList() {
cd $1
ls -l
alias l=’clear && ls -l’
alias la=’clear && ls -la’
alias cl=goAndList
alias cla=goAndListAll

gitCommit() {
git commit -m “$1”

gitAddCommitPush() {
git add .
git commit -m “$1”
git push

alias ga=’git add .’
alias gc=gitCommit
alias gp=’git push’
alias gcp=gitAddCommitPush
alias gs=’git status’

Git (Config)

Here, you will find how to config projects with git :

First of all you have to set your default ssh key, go to the ssh directory :

$ sudo -s
$ cd ~/.ssh
$ chown -R yourusername: ~/.ssh          (be sure that your user own the rights)
$ vi known_hosts                         (create this file if it's not exists)
$ sh-keygen -t rsa -b 4096 -C ""
$ ssh-keygen -lf ~/.ssh/       (show the fingerprint)
$ eval "$(ssh-agent -s)"                 (ensure ssh-agent is running)
$ ssh-add -l                             (list the ssh-key in ssh-agent)
$ ssh-add ~/.ssh/id_rsa                  (add your ssh-key in ssh-agent)
$ ssh -vT                 (test the connection on github)
$ pbcopy <~/.ssh/  (copy the ssh-key in clipboard)
Add the keygen in the ssh-keygen tab in your github account.
———————————–  A way to config multiple ssh-key with different projects ————————————–
First of all, be careful about the rights and you must realize this as a normal user and not root.
The ~/.ssh directory must be own by you if not : chown -R yourusername ~/.ssh
$ cd ~/.ssh
$ vi config

 PreferredAuthentications publickey
 IdentityFile ~/.ssh/projectname

$ ssh-keygen -f ~/.ssh/projectname -C "projectname"
$ pbcopy <~/.ssh/

Add the keygen in the ssh-keygen tab in your github account.

Go inside your project and set your current project git email developer :

$ git config
$ git config --global   (global settings example)

How to set the color visible in terminal :

$ git config --global color.ui true
Helpfull links :

Spring Jackson Rest debug

If you try to POST/PUT data on an REST Endpoint and if you have a 400 error response from your Spring backEnd as the json is not well recognized by the server; go to the DispatcherServlet class and put a breakpoint on doDispatch or doRun something like this, you can use log4j and set the TRACE level to make it traced in the console logs.