All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.anwen.mongo.toolkit.ExecuteUtil Maven / Gradle / Ivy

There is a newer version: 2.1.5
Show newest version
package com.anwen.mongo.toolkit;

import com.anwen.mongo.constant.SqlOperationConstant;
import com.anwen.mongo.domain.MongoPlusFieldException;
import com.mongodb.BasicDBObject;

import java.util.Map;

/**
 * @author JiaChaoYang
 **/
public class ExecuteUtil {

    public static BasicDBObject getFilter(Map entityMap) {
        if (!entityMap.containsKey(SqlOperationConstant._ID)) {
            throw new MongoPlusFieldException("_id undefined");
        }
        Object _idValue = entityMap.get(SqlOperationConstant._ID);
        BasicDBObject filter = new BasicDBObject(SqlOperationConstant._ID, ObjectIdUtil.getObjectIdValue(_idValue));
        entityMap.remove(SqlOperationConstant._ID);
        return filter;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy