INNER CODE UNIT · Java

addDocumentIfMissing

bwaldvogel/mongo-java-server · core/src/main/java/de/bwaldvogel/mongo/MongoCollection.java:45

    default void addDocumentIfMissing(Document document) {
        if (!handleQuery(document, 0, 1).iterator().hasNext()) {
            addDocument(document);
        }
    }

    default Iterable<Document> queryAll() {
        return handleQuery(new Document());
    }

    default Stream<Document> queryAllAsStream() {
        Spliterator<Document> documents = queryAll().spliterator();
        return StreamSupport.stream(documents, false);
    }

    default Iterable<Document> handleQuery(Document query) {
        return handleQuery(query, 0, 0);
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…