我试图找出 Jongo 的优势,而不是简单地使用 (DBObject)JSON.parse(...) 解组 json 命令并以以下方式使用 DBObject。
有性能优势吗?
@Override
public List<T> getEntityList(Integer limit, String query) throws Exception {
log.entering(DaoImpl.class.toString(), "getEntityList, with criteria of " + query);
DBObject criteriaObject = null;
ArrayList<T> list = new ArrayList<T>();
if (query != null)
criteriaObject = (DBObject)JSON.parse(query);
DBCursor cursor = null;
try {
if (criteriaObject != null) {
log.log(Level.FINEST, "getting the objects using a search criteria: " + criteriaObject);
cursor = MongoDB.getInstance().getCollection(collection).find(criteriaObject);
} else {
log.log(Level.FINEST, "getting the objects without a criteria");
cursor = MongoDB.getInstance().getCollection(collection).find();
}
............etc, etc, etc
谢谢!