Replace a `scalar` by `only.as_pymongo`