比如下面这个例子在expr表达式,and里面第二个$eq,我想表达,我的列tenant_virtual_account等于这个id“$-v2131231asdadsad2sadaasdasdass3”,但是由于$是特殊字符,在程序中会被任务这是一个名为“-v2131231asdadsad2sadaasdasdass3”的列,这就与我所需要的不相符合了。
db.t_application_business.aggregate(
[{
“$lookup”: {
“from”: “t_user_application_business_role_permission”,
“let”: {
“main_business_id”: “$business_id”
},
“pipeline”: [{
“$match”: {
“$expr”: {
“$and”: [{
“$eq”: [“$business_id”, “$$main_business_id”]
}, {
“$eq”: [“$tenant_virtual_account”, “$-v2131231asdadsad2sadaasdasdass3”]
}, {
“$eq”: [“$status”, 0]
}, {
“$eq”: [“$delete_flag”, 0]
}]
}
}
}, {
“$project”: {
“tenant_virtual_account”: 1,
“role_id”: 1,
“application_id”: 1,
“create_time”: 1,
“status”: 1
}
}],
“as”: “businessRolePermission”
}
}, {
“$lookup”: {
“from”: “t_business_role”,
“localField”: “businessRolePermission.role_id”,
“foreignField”: “role_id”,
“as”: “applicationBusinessRole”
}
}, {
“$match”: {
“seatBusinessRolePermission”: {
“$ne”: []
},
“seat_application_id”: {
“$in”: [“63299bd172f24fe18924598cd5695a1a”]
},
“status”: 0,
“delete_flag”: {
“$in”: [0]
}
}
}, {
“$project”: {
“business_name”: 1,
“business_id”: 1,
“businessRolePermission”: 1,
“applicationBusinessRole”: 1,
“create_time”: 1
}
}, {
“$sort”: {
“businessRolePermission.create_time”: 1
}
}, {
“$skip”: 0
}, {
“$limit”: 20
}]
)
比如下面例子在expr表达式,and里面第二个$eq,我想表达,我的列tenant_virtual_account等于这个id“$-v2131231asdadsad2sadaasdasdass3”,但是由于$是特殊字符,在程序中会被任务这是一个名为“-v2131231asdadsad2sadaasdasdass3”的列,这就与我所需要的不相符合了。
db.t_application_business.aggregate(
[{
“$lookup”: {
“from”: “t_user_application_business_role_permission”,
“let”: {
“main_business_id”: “$business_id”
},
“pipeline”: [{
“$match”: {
“$expr”: {
“$and”: [{
“$eq”: [“$business_id”, “$$main_business_id”]
}, {
“$eq”: [“$tenant_virtual_account”, “$-v2131231asdadsad2sadaasdasdass3”]
}, {
“$eq”: [“$status”, 0]
}, {
“$eq”: [“$delete_flag”, 0]
}]
}
}
}, {
“$project”: {
“tenant_virtual_account”: 1,
“role_id”: 1,
“application_id”: 1,
“create_time”: 1,
“status”: 1
}
}],
“as”: “businessRolePermission”
}
}, {
“$lookup”: {
“from”: “t_business_role”,
“localField”: “businessRolePermission.role_id”,
“foreignField”: “role_id”,
“as”: “applicationBusinessRole”
}
}, {
“$match”: {
“seatBusinessRolePermission”: {
“$ne”: []
},
“seat_application_id”: {
“$in”: [“63299bd172f24fe18924598cd5695a1a”]
},
“status”: 0,
“delete_flag”: {
“$in”: [0]
}
}
}, {
“$project”: {
“business_name”: 1,
“business_id”: 1,
“businessRolePermission”: 1,
“applicationBusinessRole”: 1,
“create_time”: 1
}
}, {
“$sort”: {
“businessRolePermission.create_time”: 1
}
}, {
“$skip”: 0
}, {
“$limit”: 20
}]
)
比如下面这个例子在expr表达式,and里面第二个$eq,我想表达,我的列tenant_virtual_account等于这个id“$-v2131231asdadsad2sadaasdasdass3”,但是由于$是特殊字符,在程序中会被任务这是一个名为“-v2131231asdadsad2sadaasdasdass3”的列,这就与我所需要的不相符合了。
db.t_application_business.aggregate(
[{
“$lookup”: {
“from”: “t_user_application_business_role_permission”,
“let”: {
“main_business_id”: “$business_id”
},
“pipeline”: [{
“$match”: {
“$expr”: {
“$and”: [{
“$eq”: [“$business_id”, “$$main_business_id”]
}, {
“$eq”: [“$tenant_virtual_account”, “$-v2131231asdadsad2sadaasdasdass3”]
}, {
“$eq”: [“$status”, 0]
}, {
“$eq”: [“$delete_flag”, 0]
}]
}
}
}, {
“$project”: {
“tenant_virtual_account”: 1,
“role_id”: 1,
“application_id”: 1,
“create_time”: 1,
“status”: 1
}
}],
“as”: “businessRolePermission”
}
}, {
“$lookup”: {
“from”: “t_business_role”,
“localField”: “businessRolePermission.role_id”,
“foreignField”: “role_id”,
“as”: “applicationBusinessRole”
}
}, {
“$match”: {
“businessRolePermission”: {
“$ne”: []
},
“application_id”: {
“$in”: [“63299bd172f24fe18924598cd5695a1a”]
},
“status”: 0,
“delete_flag”: {
“$in”: [0]
}
}
}, {
“$project”: {
“business_name”: 1,
“business_id”: 1,
“businessRolePermission”: 1,
“applicationBusinessRole”: 1,
“create_time”: 1
}
}, {
“$sort”: {
“businessRolePermission.create_time”: 1
}
}, {
“$skip”: 0
}, {
“$limit”: 20
}]
)