Examples of BasicDBList


Examples of com.mongodb.BasicDBList

    }

    private void convertToCursorObject(BasicDBObject query, FilterItem item) {
        if (item.isCompoundFilter()) {

            BasicDBList orList = new BasicDBList();

            final FilterItem[] childItems = item.getChildItems();
            for (FilterItem childItem : childItems) {
                BasicDBObject childObject = new BasicDBObject();
                convertToCursorObject(childObject, childItem);
                orList.add(childObject);
            }

            query.put("$or", orList);

        } else {
View Full Code Here

Examples of com.mongodb.BasicDBList

        AggregationOutput aggregationResult = null;

        // Allow body to be a pipeline
        // @see http://docs.mongodb.org/manual/core/aggregation/
        if (query instanceof BasicDBList) {
            BasicDBList queryList = (BasicDBList)query;
            aggregationResult = dbCol.aggregate((DBObject)queryList.get(0), queryList
                .subList(1, queryList.size()).toArray(new BasicDBObject[queryList.size() - 1]));
        } else {
            aggregationResult = dbCol.aggregate(query);
        }

        dbIterator = aggregationResult.results();
View Full Code Here

Examples of com.mongodb.BasicDBList

                                firstRevisionId, secondRevisionId));
        NodeAssert.assertDeepEquals(expected, actual);
    }

    private MongoConnection createMissingNodeScenario(Node expected, String missingPath) {
        BasicDBList results1 = new BasicDBList();
        BasicDBList results2 = new BasicDBList();

        Set<NodeMongo> expectedNodeMongos = NodeMongo.fromNodes(expected.getDescendants(true));
        for (NodeMongo nodeMongo : expectedNodeMongos) {

            BasicDBObject groupDbObject = new BasicDBObject();
            groupDbObject.put("result", nodeMongo);
            if (!nodeMongo.getPath().equals(missingPath)) {
                results1.add(groupDbObject);
            }
            results2.add(groupDbObject);
        }

        DBCollection mockNodeCollection = EasyMock.createMock(DBCollection.class);
        EasyMock.expect(
                mockNodeCollection.group(EasyMock.anyObject(DBObject.class), EasyMock.anyObject(DBObject.class),
View Full Code Here

Examples of com.mongodb.BasicDBList

        return mockConnection;
    }

    private MongoConnection createStaleNodeScenario(Node expected, String stalePath) {
        BasicDBList results1 = new BasicDBList();
        BasicDBList results2 = new BasicDBList();

        Set<NodeMongo> expectedNodeMongos = NodeMongo.fromNodes(expected.getDescendants(true));
        for (NodeMongo nodeMongo : expectedNodeMongos) {
            BasicDBObject groupDbObject = new BasicDBObject();
            groupDbObject.put("result", nodeMongo);
            results2.add(groupDbObject);

            if (nodeMongo.getPath().equals(stalePath)) {
                NodeMongo nodeMongoStale = new NodeMongo();
                nodeMongoStale.putAll(nodeMongo.toMap());
                nodeMongoStale.setRevisionId(1L);
View Full Code Here

Examples of com.mongodb.BasicDBList

     * @param greaterThanValue check to see if the field is >= this value
     * @param lessThanValue check to see if the field is <= this value
     * @return
     */
    public MatchAggregation greaterThanEqualOrLessThanEqual(String field, Object greaterThanValue, Object lessThanValue) {
        BasicDBList list = new BasicDBList();
        list.add(new BasicDBObject(field, new BasicDBObject("$gte", greaterThanValue)));
        list.add(new BasicDBObject(field, new BasicDBObject("$lte", lessThanValue)));
        ((BasicDBObject) match.get("$match")).append("$or", list);
        return this;
    }
View Full Code Here

Examples of com.mongodb.BasicDBList

     *
     * @param field The field we match as an non-empty object
     * @return the builder
     */
    public MatchAggregation notEmptyObject(String field) {
        BasicDBList listWithEmptyObject = new BasicDBList();
        listWithEmptyObject.add(new BasicDBObject());
        ((BasicDBObject) match.get("$match")).append(field, new BasicDBObject("$nin", listWithEmptyObject));

        return this;
    }
View Full Code Here

Examples of com.mongodb.BasicDBList

     *
     * @param field The field we match as an empty object
     * @return the builder
     */
    public MatchAggregation emptyObject(String field) {
        BasicDBList listWithEmptyObject = new BasicDBList();
        listWithEmptyObject.add(new BasicDBObject());
        ((BasicDBObject) match.get("$match")).append(field, new BasicDBObject());

        return this;
    }
View Full Code Here

Examples of com.mongodb.BasicDBList

        return arrayMatch("$nin", field, values);
    }

    private MatchAggregation arrayMatch(String inOrNotInOperator, String field, String... values) {
        BasicDBList matchArray = new BasicDBList();
        for (int i = 0; i < values.length; i++) {
            matchArray.add(values[i]);
        }
        ((BasicDBObject) match.get("$match")).append(field, new BasicDBObject(inOrNotInOperator, matchArray));

        return this;
    }
View Full Code Here

Examples of com.mongodb.BasicDBList

        return listMatch("$nin", field, values);
    }

    private MatchAggregation listMatch(String operator, String field, List<String> values) {
        if (values != null) {
            BasicDBList matchArray = new BasicDBList();
            for (String s : values) {
                matchArray.add(s);
            }
            ((BasicDBObject) match.get("$match")).append(field, new BasicDBObject(operator, matchArray));
        }
        return this;
    }
View Full Code Here

Examples of com.mongodb.BasicDBList

        return projectOperation("$add", outputfield, operands);
    }

    private ProjectAggregation projectOperation(String operator, String outputfield, String... operands) {

        BasicDBList inputFieldList = new BasicDBList();
        for (int i = 0; i < operands.length; i++) {
            inputFieldList.add(dollar(operands[i]));
        }

        BasicDBObject target = (BasicDBObject) project.get(parentKey);
        if (target == null)
            target = (BasicDBObject) project;
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.