dongshi6528 2016-07-03 10:51
浏览 14
已采纳

使用`now()`重新思考DB changefeed过滤

I was hoping to create a sort of 'time tigger' using RethinkDB changefeeds:

        return r.
            Table("Checks").
            Filter(r.Row.Field("ScheduledFor").Le(r.Now())).
            Changes(r.ChangesOpts{
                    IncludeInitial: true,
            }).Run(db)

However, while it picks up things that initially fulfill the Filter predicate, it does not appear to pick up records where ScheduledFor goes from being in the future to being in the past.

i.e. r.Now() appears to be evaluated upon being received by the server and never again.

Is there any way to make the Now() term dynamically evaluated? Or should I just do a table scan?

  • 写回答

1条回答 默认 最新

  • dssk35460 2016-07-03 22:11
    关注

    Currently r.now always evaluates to the time the server received the query. It's probably best to repeatedly do a table scan for any documents scheduled between the last table scan and the current time.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 数字取证课程 关于FAT文件系统的操作
  • ¥15 如何使用js实现打印时每页设置统一的标题
  • ¥15 安装TIA PortalV15.1报错
  • ¥15 能把水桶搬到饮水机的机械设计
  • ¥15 Android Studio中如何把H5逻辑放在Assets 文件夹中以实现将h5代码打包为apk
  • ¥15 使用小程序wx.createWebAudioContext()开发节拍器
  • ¥15 关于#爬虫#的问题:请问HMDB代谢物爬虫的那个工具可以提供一下吗
  • ¥15 vue3+electron打包获取本地视频属性,文件夹里面有ffprobe.exe 文件还会报错这是什么原因呢?
  • ¥20 用51单片机控制急停。
  • ¥15 孟德尔随机化结果不一致