mongodb 随笔
作者:互联网
- 报错:db.collection.find({}, { "record" : 0 , "index.teacher_base_name" : 1 , "_id" : 0})
queryObject.fields().exclude("_id");
queryObject.fields().exclude("record");
queryObject.fields().include("index." + indexName);
- mongodb内容过大
/usr/bin/mongod --config /etc/mongod.conf --fork --wiredTigerCacheSizeGB 1
- Aggregation.group
db.teacher_record.aggregate([{$group: {
_id: "$cardId",
approvalStatus: {
$first: "$approvalStatus"
}
}}])
{
_id: {cardId:"$cardId", tenantId:"$tenantId"},
approvalStatus: {
$push: "$approvalStatus"
}
}
Aggregation.group("cardId", "tenantId")
.first("operationUser.userName").as("operationUser.userName")
.first("operationUser.unitName").as("operationUser.unitName")
.first("approvalTime").as("approvalTime")
.sum(ConditionalOperators.when(Criteria.where("approvalStatus").is(0)).then(1).otherwise(0)).as("pendingNum")
.push("recordId").as("recordIds")
标签:group,approvalStatus,mongodb,first,cardId,随笔,id,operationUser 来源: https://www.cnblogs.com/JOKI/p/15129884.html