Implement $type and sorting for ObjectID, Date, and Binary.