Package mungbean.protocol.bson

Examples of mungbean.protocol.bson.Code


            builder.field("foo").where("this.a>3");
            return builder;
        }

        public void queryMapCanBeConstructed() {
            specify(context.build(), does.equal(map("foo", new Code("this.a>3"))));
        }
View Full Code Here


        group.put("ns", collection.collectionName());
        if (keys != null) {
            group.put("key", keyMap());
        }
        if (keyFunction != null) {
            group.put("keys", new Code(keyFunction));
        }
        group.put("$reduce", new Code(reduceScript));
        if (finalizeScript != null) {
            group.put("finallize", new Code(finalizeScript));
        }
        return map;

    }
View Full Code Here

    @Override
    public Map<String, Object> requestMap(DBCollection<?> collection, QueryBuilder query) {
        Map<String, Object> request = new LinkedHashMap<String, Object>();
        request.put("mapreduce", collection.collectionName());
        request.put("map", new Code(map));
        request.put("reduce", new Code(reduce));
        if (!query.build().isEmpty()) {
            request.put("query", query.build());
        }
        if (!query.order().isEmpty()) {
            request.put("sort", query.order());
        }
        if (query.limit() > 0) {
            request.put("limit", query.limit());
        }
        if (outputCollection != null) {
            request.put("out", outputCollection);
        }
        if (keepTemp != null) {
            request.put("keeptemp", keepTemp);
        }
        if (finalizeFunction != null) {
            request.put("finalize", new Code(finalizeFunction));
        }
        if (verbose != null) {
            request.put("verbose", verbose);
        }
        return request;
View Full Code Here

        put(map("$exists", value));
        return this;
    }

    public QueryField where(String script) {
        putResult(new Code(script));
        return this;
    }
View Full Code Here

TOP

Related Classes of mungbean.protocol.bson.Code

Copyright © 2018 www.massapicom. 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.