[46594597] replace mongodb with postgresql[4]

more code refine to make code look better

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