[46594597] replace mongodb with postgresql[2]

code refine based on comments

Signed-off-by: Henry Chen <hchen@vmware.com>