修改代码字符编码

This commit is contained in:
2026-02-24 17:53:50 +08:00
parent 2495fe5f6d
commit c8418c7d4b
5195 changed files with 121754 additions and 121754 deletions
@@ -6,61 +6,61 @@ import com.mongodb.DBObject;
public interface DSCollection {
/**
* 查询
* 查询
*
* @return
*/
DSCursor find();
/**
* 查询
* 查询
*
* @param query
* 查询条件
* 查询条件
* @return
*/
DSCursor find(DBObject query);
/**
* 查询
* 查询
*
* @param query
* 查询条件
* 查询条件
* @param fields
* 需要返回的字段,例:{title:1, name:1}
* 需要返回的字段,例:{title:1, name:1}
* @return
*/
DSCursor find(DBObject query, DBObject fields);
/**
* 查询第一个结果
* 查询第一个结果
*
* @return
*/
DBObject findOne();
/**
* 查询第一个结果
* 查询第一个结果
*
* @param query
* 查询条件
* 查询条件
* @return
*/
DBObject findOne(DBObject query);
/**
* 查询第一个结果
* 查询第一个结果
*
* @param query
* 查询条件
* 查询条件
* @param fields
* 需要返回的字段,例:{title:1, name:1}
* 需要返回的字段,例:{title:1, name:1}
* @return
*/
DBObject findOne(DBObject query, DBObject fields);
/**
* 根据id查询
* 根据id查询
*
* @param id
* @return
@@ -68,103 +68,103 @@ public interface DSCollection {
DBObject findById(String id);
/**
* 根据id查询
* 根据id查询
*
* @param id
* @param fields
* 需要返回的字段,例:{title:1, name:1}
* 需要返回的字段,例:{title:1, name:1}
* @return
*/
DBObject findById(String id, DBObject fields);
/**
* 删除
* 删除
*
* @param query
* 删除的条件,为null则删除所有
* 删除的条件,为null则删除所有
*/
void remove(DBObject query);
/**
* 保存
* 保存
*
* @param dbObjects
*/
void save(DBObject... dbObjects);
/**
* 保存
* 保存
*
* @param isSafe
* 是否同步保存
* 是否同步保存
* @param dbObjects
*/
void save(boolean isSafe, DBObject... dbObjects);
/**
* 保存
* 保存
*
* @param dbObjects
*/
void save(List<DBObject> dbObjects);
/**
* 保存
* 保存
*
* @param isSafe
* 是否同步保存
* 是否同步保存
* @param dbObjects
*/
void save(boolean isSafe, List<DBObject> dbObjects);
/**
* 更新(默认异步)
* 更新(默认异步)
*
* @param query
* 更新的条件
* 更新的条件
* @param data
* 要更新的数据
* 要更新的数据
*/
void update(DBObject query, DBObject data);
/**
* 更新
* 更新
*
* @param query
* 更新的条件
* 更新的条件
* @param data
* 要更新的数据
* 要更新的数据
* @param isSync
* 是否同步更新
* 是否同步更新
*/
void update(DBObject query, DBObject data, boolean isSync);
/**
* 查询所有结果集数量
* 查询所有结果集数量
*
* @return
*/
int count();
/**
* 查询结果集数据
* 查询结果集数据
*
* @param query
* 查询条件
* 查询条件
* @return
*/
int count(DBObject query);
/**
* 重建索引
* 重建索引
*
* @param query
* 重建的条件
* 重建的条件
*/
void reIndex(DBObject query);
/**
* facet 查询
* facet 查询
*
* @param facetQuery
* @return
@@ -18,7 +18,7 @@ public interface DSCursor extends Iterable<DBObject> {
DSCursor skip(int skip);
/**
* findAll的limit为0,只要facet结果的limit为-1,其他正常
* findAll的limit为0,只要facet结果的limit为-1,其他正常
*
* @param limit
* @return
@@ -30,8 +30,8 @@ public interface DSCursor extends Iterable<DBObject> {
DSCursor sort(DBObject sort);
/**
* 是否为大批量数据遍历, 默认为true,如果设置为false,查询的数据量将会受到限制,超过限制后会有异常抛出<br>
* bulk查询模式下,设置skip参数可能并不能达到预期的效果
* 是否为大批量数据遍历, 默认为true,如果设置为false,查询的数据量将会受到限制,超过限制后会有异常抛出<br>
* bulk查询模式下,设置skip参数可能并不能达到预期的效果
*
* @param bulk
* @return
@@ -31,14 +31,14 @@ public class MongoDbTest {
// DBCollection collection = db.getCollection("house");
// DBObject obj = new BasicDBObject();
// obj.put("city", "sh");
// obj.put("house_name", "房源标题");
// obj.put("district_name", "沪亭苑");
// obj.put("district_address", "沪亭路168弄");
// obj.put("house_name", "房源标题");
// obj.put("district_name", "沪亭苑");
// obj.put("district_address", "沪亭路168弄");
// obj.put("room", 1);
// obj.put("house_area", 93);
// collection.save(obj);
DSCollection seawater = new DataStore("192.168.0.65", 27777).getCollection("fangjia.seawater");
Iterator<DBObject> cursor = seawater.find(new BasicDBObject("city","上海").append("district_name","风伟二村").append("cat","sell")).batchSize(30).sort(new BasicDBObject("p_date",-1)).iterator();
Iterator<DBObject> cursor = seawater.find(new BasicDBObject("city","上海").append("district_name","风伟二村").append("cat","sell")).batchSize(30).sort(new BasicDBObject("p_date",-1)).iterator();
Set<String> ids = new HashSet<String>();
while(cursor.hasNext()){
String id = cursor.next().get("_id").toString();