q.addCriteria(Criteria.where("mongod库对应field") .regex(Pattern.compile(Pattern.quote(field对应的值), Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE)));
eg: the attribute fileName corresponding to the mongodb collection
Criteria criteria=new Criteria();
if(Stringutils.isNotBlank(req.getFileName())){
criteria.and("file_name").regex(Pattern.compile(Patter.quote(req.getFileName())))
}