Jiabao-Sun commented on PR #3:
URL: 
https://github.com/apache/flink-connector-mongodb/pull/3#issuecomment-1429801465

   Hi @rozza.
   
   Sorry to bother you. There's a question I want to ask you for advice.
   Looking forward to your reply, when you have time.
   
   In order to prevent the duplicate reading when restoring from a checkpoint, 
I keep the number of documents that have been read. When a failure occurs and 
retry, we can skip these documents and continue reading. 
   
   For this to work properly though MongoDB needs to return records in the 
exact same order for every query. 
   
   I want to confirm with you whether `hint()` will guarantee the same order of 
the returned data, or do we have to explicitly declare a `sort()` to ensure the 
same order.
   
   ```java
   FindIterable<BsonDocument> findIterable =
             mongoClient
                  .getDatabase(connectionOptions.getDatabase())
                  .getCollection(connectionOptions.getCollection(), 
BsonDocument.class)
                  .find()
                   // skip the documents has been read.
                  .skip(offset)
                  .min(currentSplit.getMin())
                  .max(currentSplit.getMax())
                  // hint _id or sharded key.
                  .hint(currentSplit.getHint());
                  //  Is sort() required ?
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to