public static BasicDBObject buildFilterObject(PredicateInfo info) {

        String value = info.getCondition().replaceAll("'", "");
        switch (info.getOperatorName()) {
            case "=":
                return new BasicDBObject("$eq", value);
            case ">":
                return new BasicDBObject("$gt", value);
            case ">=":
                return new BasicDBObject("$gte", value);
            case "<":
                return new BasicDBObject("$lt", value);
            case "<=":
                return new BasicDBObject("$lte", value);
            case "<>":
                return new BasicDBObject("$ne", value);
            case "IN":
                Object[] values = Arrays.stream(StringUtils.split(value, ",")).map(String::trim)
                        .collect(Collectors.toList()).toArray();
                return new BasicDBObject("$in", values);
            case "NOT IN":
                return new BasicDBObject("$nin", StringUtils.split(value, ","));
            case "IS NOT NULL":
                return new BasicDBObject("$exists", true);
            case "IS NULL":
                return new BasicDBObject("$exists", false);
            default:
        }
        return null;
    }
Date: 2019/12/17
Company: www.dtstack.com
@author maqi
mongo/mongo-side/mongo-side-core/src/main/java/com/dtstack/flink/sql/side/mongo/utils/MongoUtil.java