thinkphp5使用mongo进行$elemMatch等查询的问题

浏览:854 发布日期:2017/08/30 分类:ThinkPHP5专区 关键字: thinkphp5 mongo select
在实际业务逻辑中,有这样的mongo数据结构:{
"_id" : ObjectId("5992c90beeb45634df1c2be4"),
    "status" : {
        "line" : [ 
            {
                "id" : ObjectId("59a37efeef887a1d58b59f43"),
                "status" : true
            }, 
            {
                "id" : ObjectId("59a37f03ef887a1d58b59f44"),
                "status" : false
            }, 
            {
                "id" : ObjectId("59a3801cef887a1d58b59f55"),
                "status" : false
            }
        ],
},
{
"_id" : ObjectId("5992c90beeb45634df1c2be4"),
    "status" : {
        "line" : [ 
            {
                "id" : ObjectId("59a37efeef887a1d58b59f43"),
                "status" : false
            }, 
            {
                "id" : ObjectId("59a37f03ef887a1d58b59f44"),
                "status" : false
            }, 
            {
                "id" : ObjectId("59a3801cef887a1d58b59f55"),
                "status" : true
            }
        ],
}
现在想查找到status.line里id为objectId("59a37efeef887a1d58b59f43"),并且status为true的集合的_id,查官方文档可能要用到$elemMatch关键字,求解用tp的模型类where条件应该如何写?用whereExp好像也不行
最佳答案
评论( 相关
后面还有条评论,点击查看>>