/** * Returns if a document identified by the document id is present in the database or not. * * @param docId document id. * @return true if the document is in the database; false otherwise. */ public boolean containsDocument(String docId) { return dbConnector.contains(docId); }
/** * Returns if a document identified by the document id is present in the database or not. * * @param docId document id. * @return true if the document is in the database; false otherwise. */ public boolean containsDocument(String docId) { return dbConnector.contains(docId); }
public boolean contains(String docId) { return db.contains(docId); }
/** * Update or insert a document identified by docId in the database. * * @param docId document id. * @param document document. */ public void upsertDocument(String docId, @Nonnull Object document) { if (docId != null && dbConnector.contains(docId)) { dbConnector.update(document); } else { //create a document & if docId is null then couch db will generate a random id. dbConnector.create(document); } }
private boolean designDocContainsAllView() { if (db.contains(stdDesignDocumentId)) { DesignDocument dd = db.get(DesignDocument.class, stdDesignDocumentId); return dd.containsView("all"); } return false; }
/** * Update or insert a document identified by docId in the database. * * @param docId document id. * @param document document. */ public void upsertDocument(String docId, @Nonnull Object document) { if (docId != null && dbConnector.contains(docId)) { dbConnector.update(document); } else { //create a document & if docId is null then couch db will generate a random id. dbConnector.create(document); } }
private void initDesignDocInternal(int invocations) { DesignDocument designDoc; if (db.contains(stdDesignDocumentId)) { designDoc = getDesignDocumentFactory().getFromDatabase(db, stdDesignDocumentId); } else {
public static ViewQuery createAndFetchViewQuery() { if (!connector.contains(DESIGN_DOC_ID)) { //The design document doesn't exist in the database so we create it. JsonNode rootNode = mapper.createObjectNode(); ((ObjectNode)rootNode).put("language", "javascript"); ((ObjectNode)rootNode).putObject("views").putObject(TEST_VIEW).put("map", "function(doc) {\n emit(doc._id, doc);\n}"); connector.create(DESIGN_DOC_ID, rootNode); } return new ViewQuery().designDocId(DESIGN_DOC_ID).viewName(TEST_VIEW); }