草庐IT

maxAwaitTime

全部标签

mongodb - 使用 mongodb java 驱动程序,maxAwaitTime 无法处理更改流

我使用的是Javamongodb驱动程序版本3.8.0和mongodb3.6.3。我用这个在集合上创建了一个watch:MongoCursor>cursor=collection.watch().maxAwaitTime(500,TimeUnit.MILLISECONDS).iterator();文档here关于maxAwaitTime的状态:Themaximumamountoftimefortheservertowaitonnewdocumentstosatisfyachangestreamquery.但是,我看到的是cursor.hasNext()仅在集合发生变化时返回,而不是在传