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多文档查询的更多相关文章

  1. MongoDB入门---文档查询操作之条件查询&and查询&or查询

    经过前几天的学习之路,今天终于到了重头戏了.那就是文档查询操作.话不多说哈,直接看下语法: db.collection.find(query, projection) query :可选,使用查询操作 ...

  2. MongoDB入门---文档查询之$type操作符&limit方法&skip方法&简单排序(sort)操作

    上一篇文章呢,已经分享过了一部分查询操作了,这篇文章呢?就来继续分享哈.接下来呢我们直接看MongoDB中的$type操作符哈.它呢是基于BSON类型来检索集合中匹配的数据类型,并且返回结果,在Mon ...

  3. mongoDB的文档查询

    1.简单查询: find() 方法以非结构化的方式来显示所有文档. 语法 MongoDB 查询数据的语法格式如下:      collection是集合名字,注意应该是当前数据库的集合,collect ...

  4. MongoDB快速入门学习笔记4 MongoDB的文档查询操作

    先把student删除,再重新插入数据 > db.student.drop() true > db.student.insert([{ "_id" : 1, " ...

  5. SpringMVC MongoDB之“基本文档查询(Query、BasicQuery)”

    一.简介 spring Data  MongoDB提供了org.springframework.data.mongodb.core.MongoTemplate对MongoDB的CRUD的操作,上一篇我 ...

  6. Spring Data MongoDB 三:基本文档查询(Query、BasicQuery)(一)

    一.简单介绍 Spring Data  MongoDB提供了org.springframework.data.mongodb.core.MongoTemplate对MongoDB的CRUD的操作,上一 ...

  7. Spring Data MongoDB 三:基本文档查询(Query、BasicQuery

    一.简介 spring Data  MongoDB提供了org.springframework.data.mongodb.core.MongoTemplate对MongoDB的CRUD的操作,上一篇我 ...

  8. Spring Data MongoDB 五:进阶文档查询(分页、Morphia)(二)

    Spring Data MongoDB 三:基本文档查询(Query.BasicQuery)(一) 学习MongoDB 六: MongoDB查询(游标操作.游标信息)(三) 一.简单介绍 Spring ...

  9. MongoDB数据库文档操作

    前面的话 本文将详细介绍MongoDB数据库关于文档的增删改查 数据类型 在介绍文档操作之前,首先要了解MongoDB的数据类型 MongoDB支持许多数据类型,包括 1.字符串 - 这是用于存储数据 ...

随机推荐

  1. iOS开发-应用管理

    // //  ViewController.m //  21-应用管理-1 // //  Created by hongqiangli on 2017/8/2. //  Copyright © 201 ...

  2. java只使用try和finally不使用catch的原因和场景

    JDK并发工具包中,很多异常处理都使用了如下的结构,如AbstractExecutorService,即只有try和finally没有catch. class X { private final Re ...

  3. CSS动画实现菜单栏从左边滑出

    盗用一下图片吧:实际效果图如下: 1,有一个nav的侧边栏,有一个遮罩层,随着侧边栏打开,然后点击遮罩层关闭侧边栏 关键代码: 1.给slideNav(侧边栏设置如下属性) .slideNav { p ...

  4. TNS-12518,TNS-12536,TNS-00506,Linux Error: 11: Resource temporarily unavailable

    TNS-12518: TNS:listener could not hand off client connection TNS-12536: TNS:operation would block  T ...

  5. MySQL5.7 利用keepalived来实现mysql双主高可用方案的详细过程

    Reference:  http://blog.csdn.net/mchdba/article/details/51377989 服务器准备 Keepalived:192.168.13.15 Keep ...

  6. 定位被选中的select

    <script> var countryId = "{$user['country']}"; $("select[@name='country'] optio ...

  7. TCP 和 UDP 在socket编程中的区别(转)

    一.TCP与UDP的区别 基于连接与无连接  对系统资源的要求(TCP较多,UDP少)  UDP程序结构较简单  流模式与数据报模式  TCP保证数据正确性,UDP可能丢包  TCP保证数据顺序,UD ...

  8. Linux 使用tty0 显示10分钟自动关闭功能

    如果用屏幕显示控制台,10分钟左右会自动关闭,有如下方法可以解决 在应用层调用如下代码: #include <fcntl.h> #include <stdio.h> #incl ...

  9. 将安卓手机短信导入到iPhone6 plus中

    不越狱的情况下短信不能直接同步到iphone手机,视频.图片.联系人可以直接使用itools的手机搬家功能超方便从android到iphone中.短信得变通的处理才能导入. 工具: 安卓手机iPhon ...

  10. js 控制输入文字个数(换行不算)

    如题,换行符在textarea中是要当成一个字符的.用普通的maxlength属性就不行了,于是想到通过事件来控制输入文字的长度. 注意哦,回车换行不能算成字符.这样的话,普通的substring等方 ...