Opens the database object associated with this ObjectId object, in the specified mode, or throws and exception if unsucessful.
Returns a SmartPointer to the opened object.
openMode must be one of the following: