Added support for ObjectIds which are of arbitrary types