/** * Checks if a document exist in the database. * @param id The document _id field. * @return true If the document is found, false otherwise. */ public boolean contains(String id) { assertNotEmpty(id, "id"); HttpResponse response = null; try { response = head(buildUri(getDBUri()).pathEncoded(id).build()); } catch (NoDocumentException e) { return false; } finally { close(response); } return true; }