Examples of AggregationOutput


Examples of com.mongodb.AggregationOutput

    public void projectComputedTest() {
        String testName = "projectComputedTest";
        DBCollection collection = getCollection(testName);
        insertArticle1(collection);
        // TODO Add better support for expression operators
        AggregationOutput output = AggregateBuilder
                .aggregate(collection)
                .project(
                        DBO.of("title", 1,
                                "doctoredPageViews",
                                DBO.of("$add", DBL.of("$pageViews", 10))
View Full Code Here

Examples of com.mongodb.AggregationOutput

    @Test
    public void projectRenameTest() {
        String testName = "projectRenameTest";
        DBCollection collection = getCollection(testName);
        insertArticle1(collection);
        AggregationOutput output = AggregateBuilder
                .aggregate(collection)
                .project(
                        DBO.of("title", 1, "page_views", "$pageViews", "bar",
                                "$other.foo"))
                .run();
View Full Code Here

Examples of com.mongodb.AggregationOutput

    public void projectSubdocumentTest() {
        String testName = "projectSubdocumentTest";
        DBCollection collection = getCollection(testName);
        insertArticle1(collection);
        // TODO Add better support for expression operators
        AggregationOutput output = AggregateBuilder
                .aggregate(collection)
                .project(
                        DBO.of("title",
                                1,
                                "stats",
View Full Code Here

Examples of com.mongodb.AggregationOutput

    @Test
    public void matchFieldEqualityTest() {
        String testName = "matchFieldEqualityTest";
        DBCollection collection = getCollection(testName);
        insertArticles(collection);
        AggregationOutput output = AggregateBuilder.aggregate(collection)
                .match("author", "dave")
                .run();
        verifyAggregationOutputFromResources(testName, output);
    }
View Full Code Here

Examples of com.mongodb.AggregationOutput

    @Test
    public void matchQueryTest() {
        String testName = "matchQueryTest";
        DBCollection collection = getCollection(testName);
        insertScoredTests(collection);
        AggregationOutput output = AggregateBuilder
                .aggregate(collection)
                .match(QueryBuilder.start("score").greaterThan(50)
                        .lessThanEquals(90))
                .run();
        verifyAggregationOutputFromResources(testName, output);
View Full Code Here

Examples of com.mongodb.AggregationOutput

    @Test
    public void limitTest() {
        String testName = "limitTest";
        DBCollection collection = getCollection(testName);
        insertScoredTests(collection);
        AggregationOutput output = AggregateBuilder.aggregate(collection)
                .limit(4)
                .run();
        verifyAggregationOutputFromResources(testName, output);
    }
View Full Code Here

Examples of com.mongodb.AggregationOutput

    @Test
    public void skipTest() {
        String testName = "skipTest";
        DBCollection collection = getCollection(testName);
        insertScoredTests(collection);
        AggregationOutput output = AggregateBuilder.aggregate(collection)
                .skip(2)
                .run();
        verifyAggregationOutputFromResources(testName, output);
    }
View Full Code Here

Examples of com.mongodb.AggregationOutput

    @Test
    public void unwindTest() {
        String testName = "unwindTest";
        DBCollection collection = getCollection(testName);
        insertArticles(collection);
        AggregationOutput output = AggregateBuilder.aggregate(collection)
                .project(DBO.of("author", 1, "title", 1, "tags", 1))
                .unwind("$tags")
                .run();
        verifyAggregationOutputFromResources(testName, output);
    }
View Full Code Here

Examples of com.mongodb.AggregationOutput

    @Test
    public void groupWithSingleFieldIdTest() {
        String testName = "groupWithSingleFieldIdTest";
        DBCollection collection = getCollection(testName);
        insertArticles(collection);
        AggregationOutput output = AggregateBuilder.aggregate(collection)
                .group(GroupBuilder.start()
                        .put("_id").to("$author")
                        .put("docsPerAuthor").sum(1)
                        .put("viewsPerAuthor").sum("$pageViews")
                )
View Full Code Here

Examples of com.mongodb.AggregationOutput

    @Test
    public void groupWithMultiFieldIdTest() {
        String testName = "groupWithMultiFieldIdTest";
        DBCollection collection = getCollection(testName);
        insertArticles(collection);
        AggregationOutput output = AggregateBuilder.aggregate(collection)
                .group(GroupBuilder.start()
                        .put("_id")
                        .to(DBO.of("author", "$author", "title", "$title"))
                        .put("docsPerAuthor").sum(1)
                        .put("viewsPerAuthor").sum("$pageViews")
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.