serializing objectId and datetimes