MongoDB多文档查询
db.getCollection('transactionCompensation').find(
{
"$and":[
{
"status":{
"$eq":0
}
},
{
"count":{
"$lt":5
}
}
]
}
); {
"aggregate":"order",
"pipeline":[
{
"$lookup":{
"from":"order",
"localField":"_id",
"foreignField":"_id",
"as":"order"
}
},
{
"$lookup":{
"from":"businessOrderHandling",
"localField":"_id",
"foreignField":"orderId",
"as":"businessOrderHandling"
}
},
{
"$lookup":{
"from":"buyerInformationPreparation",
"localField":"_id",
"foreignField":"orderId",
"as":"buyerInformationPreparation"
}
},
{
"$lookup":{
"from":"mortgageAndWarrantOrder",
"localField":"_id",
"foreignField":"orderId",
"as":"mortgageAndWarrantOrder"
}
},
{
"$lookup":{
"from":"slOrder",
"localField":"_id",
"foreignField":"orderId",
"as":"slOrder"
}
},
{
"$lookup":{
"from":"activateTask",
"localField":"_id",
"foreignField":"orderId",
"as":"activateTask"
}
},
{
"$match":{
"activateTask.statementHandling":Object{...},
"$and":[
{
"$or":[
{
"businessManCityId":523353
},
{
"creatorCityId":523353
}
]
}
]
}
}
]
}
db.businessOrderHandling.find({
"redemptionHouseHandlingPol.rhHandlingNode": {
"$elemMatch": {
"processNode": 'rFloorFinanceAudit',
"isInAliyun": 0
}
}
}); db.businessOrderHandling.find({
"redemptionHouseHandlingPol.rhHandlingNode": {
"$elemMatch": {
"processNode": {
"$in": ['rFloorFinanceAudit', 'rFloorLoan']
},
"isInAliyun": 0
}
}
});
{
"aggregate":"order",
"pipeline":[
{
"$lookup":{
"from":"order",
"localField":"_id",
"foreignField":"_id",
"as":"order"
}
},
{
"$lookup":{
"from":"mortgageAndWarrantOrder",
"localField":"_id",
"foreignField":"orderId",
"as":"mortgageAndWarrantOrder"
}
},
{
"$lookup":{
"from":"buyerInformationPreparation",
"localField":"_id",
"foreignField":"orderId",
"as":"buyerInformationPreparation"
}
},
{
"$lookup":{
"from":"slOrder",
"localField":"_id",
"foreignField":"orderId",
"as":"slOrder"
}
},
{
"$lookup":{
"from":"businessOrderHandling",
"localField":"_id",
"foreignField":"orderId",
"as":"businessOrderHandling"
}
},
{
"$lookup":{
"from":"businessOrderAuditing",
"localField":"_id",
"foreignField":"orderId",
"as":"businessOrderAuditing"
}
},
{
"$lookup":{
"from":"activateTask",
"localField":"_id",
"foreignField":"orderId",
"as":"activateTask"
}
},
{
"$match":{
"activateTask.slHandling":{
"$exists":true
},
"slOrder.handlerName":{
"$exists":true
},
"$and":[
{ },
{ }
]
}
},
{
"$project":{
"_id":"$order._id"
}
}
]
}
[
{
"$lookup":{
"from":"order",
"localField":"orderId",
"foreignField":"_id",
"as":"order"
}
},
{
"$match":{
"order.businessSource.organizationStoreId":"01005201706290948060003000000"
}
},
{
"$group":{
"_id":"$feeUseDetail",
"count":{
"$sum":1
},
"totalLoanCount":{
"$sum":"$rpFee"
}
}
},
{
"$project":{
"groupById":"$_id",
"count":1,
"totalLoanCount":1
}
},
{
"$sort":{
"count":-1
}
}
]
{
"aggregate":"order",
"pipeline":[
{
"$lookup":{
"from":"order",
"localField":"_id",
"foreignField":"_id",
"as":"order"
}
},
{
"$lookup":{
"from":"mortgageAndWarrantOrder",
"localField":"_id",
"foreignField":"orderId",
"as":"mortgageAndWarrantOrder"
}
},
{
"$lookup":{
"from":"buyerInformationPreparation",
"localField":"_id",
"foreignField":"orderId",
"as":"buyerInformationPreparation"
}
},
{
"$lookup":{
"from":"slOrder",
"localField":"_id",
"foreignField":"orderId",
"as":"slOrder"
}
},
{
"$lookup":{
"from":"businessOrderHandling",
"localField":"_id",
"foreignField":"orderId",
"as":"businessOrderHandling"
}
},
{
"$lookup":{
"from":"businessOrderAuditing",
"localField":"_id",
"foreignField":"orderId",
"as":"businessOrderAuditing"
}
},
{
"$lookup":{
"from":"activateTask",
"localField":"_id",
"foreignField":"orderId",
"as":"activateTask"
}
},
{
"$match":{
"applyForDate":{
"$gte":{
"$date":"2017-11-08T16:00:00.000Z"
},
"$lt":{
"$date":"2017-12-01T16:00:00.000Z"
}
},
"_id":{
"$regex":"3ABC-201711220002"
},
"businessManId":192493,
"businessManDeptId":23968115,
"businessCityId":618012,
"buyers.name":{
"$regex":"阿斯蒂芬"
},
"buyers.cellphone":"18878788585",
"salers.name":{
"$regex":"范德萨"
},
"salers.cellphone":"18878788585",
"slOrder._id":"X_ABC-201711220002",
"slOrder.slCategory":1,
"activateTask.slHandling":"controlCard",
"slOrder.handlerName":{
"$exists":true
},
"$and":[
{
"$or":[
{
"buyers.certificateNumber":"234243199202021515"
},
{
"salers.certificateNumber":"234243199202021515"
}
]
},
{
"$or":[
{
"buyers.certificateType":1
},
{
"salers.certificateType":1
}
]
}
]
}
},
{
"$sort":{
"applyForDate":-1
}
},
{
"$skip":0
},
{
"$limit":10
}
]
}
^_^
MongoDB多文档查询的更多相关文章
- MongoDB入门---文档查询操作之条件查询&and查询&or查询
经过前几天的学习之路,今天终于到了重头戏了.那就是文档查询操作.话不多说哈,直接看下语法: db.collection.find(query, projection) query :可选,使用查询操作 ...
- MongoDB入门---文档查询之$type操作符&limit方法&skip方法&简单排序(sort)操作
上一篇文章呢,已经分享过了一部分查询操作了,这篇文章呢?就来继续分享哈.接下来呢我们直接看MongoDB中的$type操作符哈.它呢是基于BSON类型来检索集合中匹配的数据类型,并且返回结果,在Mon ...
- mongoDB的文档查询
1.简单查询: find() 方法以非结构化的方式来显示所有文档. 语法 MongoDB 查询数据的语法格式如下: collection是集合名字,注意应该是当前数据库的集合,collect ...
- MongoDB快速入门学习笔记4 MongoDB的文档查询操作
先把student删除,再重新插入数据 > db.student.drop() true > db.student.insert([{ "_id" : 1, " ...
- SpringMVC MongoDB之“基本文档查询(Query、BasicQuery)”
一.简介 spring Data MongoDB提供了org.springframework.data.mongodb.core.MongoTemplate对MongoDB的CRUD的操作,上一篇我 ...
- Spring Data MongoDB 三:基本文档查询(Query、BasicQuery)(一)
一.简单介绍 Spring Data MongoDB提供了org.springframework.data.mongodb.core.MongoTemplate对MongoDB的CRUD的操作,上一 ...
- Spring Data MongoDB 三:基本文档查询(Query、BasicQuery
一.简介 spring Data MongoDB提供了org.springframework.data.mongodb.core.MongoTemplate对MongoDB的CRUD的操作,上一篇我 ...
- Spring Data MongoDB 五:进阶文档查询(分页、Morphia)(二)
Spring Data MongoDB 三:基本文档查询(Query.BasicQuery)(一) 学习MongoDB 六: MongoDB查询(游标操作.游标信息)(三) 一.简单介绍 Spring ...
- MongoDB数据库文档操作
前面的话 本文将详细介绍MongoDB数据库关于文档的增删改查 数据类型 在介绍文档操作之前,首先要了解MongoDB的数据类型 MongoDB支持许多数据类型,包括 1.字符串 - 这是用于存储数据 ...
随机推荐
- python(57):私有变量,代码块
转载:http://blog.csdn.net/zhu_liangwei/article/details/7667745 引子 我热情地邀请大家猜测下面这段程序的输出: class A(object) ...
- Python 操作redis有序集合(sorted set)
#coding:utf8 import redis r =redis.Redis(host=") 1.Zadd Zadd 命令用于将一个或多个成员元素及其分数值加入到有序集当中.如果某个成员 ...
- HA&Federation【转】
转自:http://blog.csdn.net/tutucute0000/article/details/39756123 从nameNode1.namenode2克隆出namenode3.namen ...
- Lintcode: Majority Number II 解题报告
Majority Number II 原题链接: http://lintcode.com/en/problem/majority-number-ii/# Given an array of integ ...
- idea 同project添加多个module maven支持
选中新项目的pom.xml 会识别maven项目
- 正则表达式-python-无捕获分组与分支选择
无捕获分组 当你要将一部分规则作为一个整体对它进行某些操作,比如指定其重复次数时,你需要将这部分规则用 (?:) 把它包围起来. 分支条件 在正则表达式中,分支条件是一个很常用的条件. 满足条件A 或 ...
- 把git上面的scala工程转为eclipse工程
1,安装sbt工具,url:https://www.cnblogs.com/zeling/p/8494828.html 2,把插件添加到plugins.sbt文件中: addSbtPlugin(&qu ...
- C#学习笔记(21)——C#获取文件夹下的所有文件的文件名
说明(2017-7-30 23:11:59): 1. 文件处理老是忘,学的不扎实. 2. 路径用Directory,文件名用file. 3. 我也推荐用第二种方法,可以拿到文件的所有信息,比如扩展名什 ...
- Java之线程状态
Java线程有6种状态: 1.New(新生),使用new Thread(r)创建一个新线程时,该线程处于新生状态,新生状态会为线程的执行做一些准备. 2.Runnable(可执行),调用线程的star ...
- 手写体识别中用到的Tensorflow函数复习
tf.truncated_normal(shape, stddev=0.1) 从截断的正态分布中输出随机值. 生成的值服从具有指定平均值和标准偏差的正态分布,如果生成的值大于平均值2个标准偏差的值则丢 ...