猫鼬获取特定的数组对象

时间:2020-05-23 13:46:46

标签: mongoose

我所需要做的就是获取等于“紧急”的数组对象trip_node的值,我遇到了困难,

我使用了这种语法,也没有用

Schema.find({'trip_node.node_type':'紧急'});

{ 

    "trip_node" : [
        {
            "_id" : ObjectId("5ec8c32a7c52c173677f471b"), 
            "device_video_name" : "trip_mayday.mp4", 
            "state" : "active", 
            "device_time" : ISODate("2020-05-23T06:31:06.497+0000"), 
            "device_node_id" : "1", 
            "node_type" : "MayDay", 
            "sensor" : {
                "gyro" : "0 0 0", 
                "speed" : {
                    "kmh" : "0.00", 
                    "mph" : "0.00"
                }, 
                "altitude" : NumberInt(18), 
                "latitude" : 6.886216666666667, 
                "direction" : NumberInt(0), 
                "longitude" : 79.87086166666667
            }
        }, 
        {
            "_id" : ObjectId("5ec8c3377c52c173677f471c"), 
            "device_video_name" : "trip_emergency.mp4", 
            "state" : "active", 
            "device_time" : ISODate("2020-05-23T06:31:19.907+0000"), 
            "device_node_id" : "1", 
            "node_type" : "Emergency", 
            "sensor" : {
                "gyro" : "0 0 0", 
                "speed" : {
                    "kmh" : "0.00", 
                    "mph" : "0.00"
                }, 
                "altitude" : NumberInt(18), 
                "latitude" : 6.886216666666667, 
                "direction" : NumberInt(0), 
                "longitude" : 79.87086166666667
            }
        }]

0 个答案:

没有答案