Adds and removes a reference to an instance. Instances should be referenced when they will be used outside of the routine in which they were initialized. (A typical example of this is maintaining a pointer
to the root of a graph.) Whenever the reference count for an instance is decremented to 0, the instance is automatically destroyed by the database (unless
unrefNoDelete() is used to unref it). The reference count of
a node is automatically incremented when the node is added as a child of another node or when a path points to the node. Likewise, the reference count is automatically decremented when the node is removed
as a child or when a path that points to the node is changed or destroyed.
unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference
count to zero. This is most useful in returning an object to a zero-reference-count state, like it was when it was created by
new.