Mongodb发现结果有限

时间:2015-11-25 00:12:43

标签: javascript node.js mongodb

我在mongodb中有一个集合,其嵌套数据如下:

{ 
    "lat" : "-33.890542", 
    "lng" : "151.274856", 
    "city" : "San Jose", 
    "area" : "SJSU", 
    "sensordata" : [
        {
            "timestmp" : NumberLong(1414850400000), 
            "temp" : NumberInt(21)
        }, 
        {
            "timestmp" : NumberLong(1414850460000), 
            "temp" : NumberInt(12)
        }, 
        {
            "timestmp" : NumberLong(1414850520000), 
            "temp" : NumberInt(13)
        }, 
        {
            "timestmp" : NumberLong(1414850580000), 
            "temp" : NumberInt(15)
        } 

    ]
}

{ 
    "lat" : "-33.890542", 
    "lng" : "151.274856", 
    "city" : "San Jose", 
    "area" : "SJSU1", 
    "sensordata" : [
        {
            "timestmp" : NumberLong(1414850400000), 
            "temp" : NumberInt(21)
        }, 
        {
            "timestmp" : NumberLong(1414850460000), 
            "temp" : NumberInt(12)
        }, 
        {
            "timestmp" : NumberLong(1414850520000), 
            "temp" : NumberInt(13)
        }, 
        {
            "timestmp" : NumberLong(1414850580000), 
            "temp" : NumberInt(15)
        } 

    ]
}

我想要做的是根据timestmp的某些条件获取记录。 例如:  时间戳> 1414850460000

因此将获取整个记录,但不会获取传感器数据字段下的所有记录。 我无法为此制定查询。 感谢

0 个答案:

没有答案