now working on both mongodb and nedb