


















Having recently migrated Graticule’s backend to MongoDB 3 (which was surprisingly easy), I’ve noticed a lot of the methods used in the Java driver have been deprecated.
Most of them were easy to figure out, but tailable cursors presented a bit of a challenge.
I haven’t been able to find a clear-cut example online, so here’s one:
find(query).projection(fields).cursorType(CursorType.TailableAwait).iterator();
That code applies to the MongoCollection class.
CursorType is an enum and it has the following values:
TailableTailableAwaitCorresponding to the old DBCursor.addOption Bytes types:
Bytes.QUERYOPTION_TAILABLEBytes.QUERYOPTION_AWAITDATAI hope that helps.
Happy coding!
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。