Allow document to be null