mongodb模糊查询

private IDAO mgDao = MongoServiceDAO.getInstance();

BasicDBObject conditions = new BasicDBObject();
Pattern pattern = Pattern.compile("^.*" + keyword + ".*$", Pattern.CASE_INSENSITIVE);
conditions.put("name", pattern);
pets = mgDao.queryForListByConExprMap(PetArchiveCategoryChild.class, conditions);

你可能感兴趣的:(mongodb)