DataObject::getById() give not the last version

When using DataObject::getById() I don’t get the last version of the document and now have to explicitly get the versions and return the latest one.
Is this wanted and if so what does the function return to me exactly?

You need to put true in second argument in getById($id, true ) to force cache

If you’re talking about the latest non-published version, the behavior is correct.