override the equals method for document