throw error if  is not a MongoDB