Fix removeUndefined to bypass non-plain objects

/to @ritch 

traverse.map() transform custom objects such as Date or ObjectID into
plain objects and it breaks the BSON serialization