properly reference mongodb documents and cleanup code
use proper mongodb interaction in all pimometer code