public class DocumentOperation extends Object
| 构造器和说明 |
|---|
DocumentOperation() |
| 限定符和类型 | 方法和说明 |
|---|---|
static List<org.bson.Document> |
aggregate(String collectionName,
List<? extends org.bson.conversions.Bson> pipeline)
聚合
|
static List<org.bson.Document> |
aggregateCount(String collectionName,
org.bson.conversions.Bson filter,
String fieldName,
boolean unwind)
聚合统计某个属性的值总共出现的次数
|
static List<org.bson.Document> |
aggregateCount(String collectionName,
String fieldName,
boolean unwind)
聚合统计某个属性的值总共出现的次数
|
static long |
countDocuments(String collectionName)
统计文档的数量
|
static long |
countDocuments(String collectionName,
org.bson.conversions.Bson filter)
统计文档的数量
|
static void |
deleteById(String collectionName,
List<String> ids)
通过文档数据id删除文档
|
static void |
deleteById(String collectionName,
String id)
通过文档数据id删除文档
|
static void |
deleteMany(String collectionName,
org.bson.conversions.Bson filter)
通过查询对象删除文档
|
static List<org.bson.Document> |
find(String collectionName,
org.bson.conversions.Bson filter)
查询文档
|
static List<org.bson.Document> |
find(String collectionName,
org.bson.conversions.Bson filter,
org.bson.conversions.Bson projection)
查询文档
|
static List<org.bson.Document> |
find(String collectionName,
org.bson.conversions.Bson filter,
org.bson.conversions.Bson projection,
org.bson.conversions.Bson sort)
查询文档
|
static PageResult |
find(String collectionName,
org.bson.conversions.Bson filter,
PageAbstract page)
获取分页文档信息
|
static PageResult |
find(String collectionName,
org.bson.conversions.Bson filter,
PageAbstract page,
org.bson.conversions.Bson projection)
获取分页文档信息
|
static List<org.bson.Document> |
findAll(String collectionName)
获取集合的所以文档数据
|
static List<org.bson.Document> |
findAll(String collectionName,
org.bson.conversions.Bson projection)
获取集合的所以文档数据
|
static List<org.bson.Document> |
findAndSort(String collectionName,
org.bson.conversions.Bson filter,
org.bson.conversions.Bson sort)
查询文档
|
static List<org.bson.Document> |
findById(String collectionName,
List<String> ids)
通过文档数据id集合获取文档集合
|
static org.bson.Document |
findById(String collectionName,
String id)
通过id获取文档数据
|
static org.bson.Document |
findById(String collectionName,
String id,
org.bson.conversions.Bson projection)
通过id获取文档数据
|
static org.bson.Document |
findOne(String collectionName,
org.bson.conversions.Bson filter)
查询文档
|
static org.bson.Document |
findOne(String collectionName,
org.bson.conversions.Bson filter,
org.bson.conversions.Bson projection)
查询文档
|
static List<String> |
insertMany(String collectionName,
List<org.bson.Document> documents)
批量插入文档数据
|
static String |
insertOne(String collectionName,
org.bson.Document document)
插入文档数据
|
static void |
replaceOne(String collectionName,
org.bson.conversions.Bson filter,
org.bson.Document newDocument)
替换文档集合内的数据
|
static void |
replaceOne(String collectionName,
String id,
org.bson.Document newDocument)
替换文档集合内的数据
|
static void |
updateMany(String collectionName,
org.bson.conversions.Bson filter,
org.bson.conversions.Bson update)
更新文档集合内的数据
|
static void |
updateMany(String collectionName,
org.bson.conversions.Bson filter,
org.bson.conversions.Bson update,
com.mongodb.client.model.UpdateOptions updateOptions)
更新文档集合内的数据
|
static void |
updateOne(String collectionName,
org.bson.conversions.Bson filter,
org.bson.conversions.Bson update)
更新文档集合内的数据
|
static void |
updateOne(String collectionName,
org.bson.conversions.Bson filter,
org.bson.conversions.Bson update,
com.mongodb.client.model.UpdateOptions updateOptions)
更新文档集合内的数据
|
public static String insertOne(String collectionName, org.bson.Document document)
collectionName - 集合名称document - 文档数据public static List<String> insertMany(String collectionName, List<org.bson.Document> documents)
collectionName - 集合名称documents - 文档数据集合public static List<org.bson.Document> find(String collectionName, org.bson.conversions.Bson filter)
collectionName - 集合名称filter - 查询对象public static List<org.bson.Document> findAndSort(String collectionName, org.bson.conversions.Bson filter, org.bson.conversions.Bson sort)
collectionName - 集合名称filter - 查询对象sort - 排序规则public static List<org.bson.Document> find(String collectionName, org.bson.conversions.Bson filter, org.bson.conversions.Bson projection)
collectionName - 集合名称filter - 查询对象projection - 需要投影的字段public static List<org.bson.Document> find(String collectionName, org.bson.conversions.Bson filter, org.bson.conversions.Bson projection, org.bson.conversions.Bson sort)
collectionName - 集合名称filter - 查询对象projection - 需要投影的字段sort - 排序规则public static org.bson.Document findById(String collectionName, String id)
collectionName - 集合名称id - 文档数据的idpublic static List<org.bson.Document> findById(String collectionName, List<String> ids)
collectionName - 集合名称ids - 文件数据idpublic static org.bson.Document findById(String collectionName, String id, org.bson.conversions.Bson projection)
collectionName - 集合名称id - 文档数据的idprojection - 需要投影的字段public static org.bson.Document findOne(String collectionName, org.bson.conversions.Bson filter)
collectionName - 集合名称filter - 查询对象public static org.bson.Document findOne(String collectionName, org.bson.conversions.Bson filter, org.bson.conversions.Bson projection)
collectionName - 集合名称filter - 查询对象projection - 需要投影的字段public static List<org.bson.Document> findAll(String collectionName)
collectionName - 集合名称public static List<org.bson.Document> findAll(String collectionName, org.bson.conversions.Bson projection)
collectionName - 集合名称projection - 需要投影的字段public static PageResult find(String collectionName, org.bson.conversions.Bson filter, PageAbstract page)
collectionName - 集合名称filter - 查询对象page - 分页对象public static PageResult find(String collectionName, org.bson.conversions.Bson filter, PageAbstract page, org.bson.conversions.Bson projection)
collectionName - 集合名称filter - 查询对象page - 分页对象projection - 需要投影的字段public static List<org.bson.Document> aggregate(String collectionName, List<? extends org.bson.conversions.Bson> pipeline)
collectionName - 集合名称pipeline - 聚合条件public static List<org.bson.Document> aggregateCount(String collectionName, org.bson.conversions.Bson filter, String fieldName, boolean unwind)
collectionName - 集合名称filter - 查询条件fieldName - 属性名unwind - 是否平铺属性值,只对于属性值为数组时有效public static List<org.bson.Document> aggregateCount(String collectionName, String fieldName, boolean unwind)
collectionName - 集合名称fieldName - 属性名unwind - 是否平铺属性值,只对于属性值为数组时有效public static long countDocuments(String collectionName, org.bson.conversions.Bson filter)
collectionName - 集合名称filter - 查询条件public static long countDocuments(String collectionName)
collectionName - 集合名称public static void deleteById(String collectionName, String id)
collectionName - 集合名称id - 文件数据idpublic static void deleteById(String collectionName, List<String> ids)
collectionName - 集合名称ids - 文件数据idpublic static void deleteMany(String collectionName, org.bson.conversions.Bson filter)
collectionName - 集合名称filter - 查询对象public static void replaceOne(String collectionName, String id, org.bson.Document newDocument)
collectionName - 集合名称id - 文档集合idnewDocument - 新文档集合对象public static void replaceOne(String collectionName, org.bson.conversions.Bson filter, org.bson.Document newDocument)
collectionName - 集合名称filter - 查询对象newDocument - 新文档集合对象public static void updateOne(String collectionName, org.bson.conversions.Bson filter, org.bson.conversions.Bson update)
collectionName - 集合名称filter - 查询对象update - 更新语句public static void updateOne(String collectionName, org.bson.conversions.Bson filter, org.bson.conversions.Bson update, com.mongodb.client.model.UpdateOptions updateOptions)
collectionName - 集合名称filter - 查询对象update - 更新语句updateOptions - 设置更新配置public static void updateMany(String collectionName, org.bson.conversions.Bson filter, org.bson.conversions.Bson update)
collectionName - 集合名称filter - 查询对象update - 更新语句Updatespublic static void updateMany(String collectionName, org.bson.conversions.Bson filter, org.bson.conversions.Bson update, com.mongodb.client.model.UpdateOptions updateOptions)
collectionName - 集合名称filter - 查询对象update - 更新语句updateOptions - 设置更新配置Copyright © 2019. All rights reserved.