mongo database functions fixed