新增批量写入方法
This commit is contained in:
+3
@@ -76,6 +76,7 @@ class SeaweedAroundPoiSingal {
|
||||
filter.put("lat", 1)
|
||||
|
||||
List<WriteModel<Document>> writeModelList = new ArrayList<>()
|
||||
def count = 0
|
||||
DbUtils.seaweed.find(query, filter).batchSize(10000).each {obj ->
|
||||
Document updateBson = new Document()
|
||||
Document update = new Document()
|
||||
@@ -102,6 +103,8 @@ class SeaweedAroundPoiSingal {
|
||||
writeModelList.add(updateOneModel)
|
||||
if (writeModelList.size() == 5000) {
|
||||
conn136.bulkWrite(writeModelList)
|
||||
count += 5000
|
||||
println(count)
|
||||
writeModelList.clear()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user