按时间间隔查询数据 MongoDB


  • 註冊用戶

    有个问题想请求,数据库表中的数据如何按一定时间间隔提取数据,

    数据如下:

    { "_id" : ObjectId("5a39c32aff6583393c37d981"),  "uploadDate" : ISODate("2017-12-20T01:55:54Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d982"),  "uploadDate" : ISODate("2017-12-20T01:55:55Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d983"),  "uploadDate" : ISODate("2017-12-20T01:55:56Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d984"),  "uploadDate" : ISODate("2017-12-20T01:55:57Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d988"),  "uploadDate" : ISODate("2017-12-20T01:56:01Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d989"),  "uploadDate" : ISODate("2017-12-20T01:56:02Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d98a"),  "uploadDate" : ISODate("2017-12-20T01:56:03Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d98b"),  "uploadDate" : ISODate("2017-12-20T01:56:04Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d98c"),  "uploadDate" : ISODate("2017-12-20T01:56:05Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d98d"),  "uploadDate" : ISODate("2017-12-20T01:56:06Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d98c"),  "uploadDate" : ISODate("2017-12-20T01:56:09Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d98d"),  "uploadDate" : ISODate("2017-12-20T01:56:10Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d98d"),  "uploadDate" : ISODate("2017-12-20T01:56:11Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d98d"),  "uploadDate" : ISODate("2017-12-20T01:56:12Z"), "A" : "1" }


    按时间间隔5秒提取
    结果如下:

    { "_id" : ObjectId("5a39c32aff6583393c37d981"),  "uploadDate" : ISODate("2017-12-20T01:55:54Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d988"),  "uploadDate" : ISODate("2017-12-20T01:56:01Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d98d"),  "uploadDate" : ISODate("2017-12-20T01:56:06Z"), "A" : "1" }
    { "_id" : ObjectId("5a39c32aff6583393c37d98d"),  "uploadDate" : ISODate("2017-12-20T01:56:12Z"), "A" : "1" }

    没找到合适的方法,不知道那位兄台有好办法,谢谢!


登录后回复
 

与 萌阔论坛 的连接断开,我们正在尝试重连,请耐心等待