Query and clusterTime

Hi all,

I’m trying to use the events stream with the golang drivers. What I’m trying to achieve is:

  1. find all documents of a collection + get the current clusterTime in an atomic operation
  2. start a watcher with the clusterTime obtained at step 1

This way, we are sure to not miss events after we read the collection a first time.

I’m failing to do that.
If I use a runCommand(find), I get some documents + clusterTime, but I can’t reuse the cursor to iterate over all documents.
If I just do a runCommand(ping) I get the clusterTime, but I can’t find a way to use readConcern=snapshot + atClusterTime with the golang drivers.

Is there a way to achieve what I’m trying to do in general, and with the golang drivers specifically?

Thx for your help.

I think the functionality you’re looking for was just released in version 1.7.0 of the Go driver:

1 Like