// Next, we add three documents with a field "externalDocId" to let us identify them
Set<String> externalDocumentIds = createDocuments(3);
// Now we just have to wait for all three documents to end up in the "oldDocuments" repository
MongoTailableIterator inactiveIterator = mongoConnector.getDocumentReader().getInactiveIterator(new MongoQuery());
Set<String> finishedDocumentIds = new HashSet<String>();
while(!finishedDocumentIds.equals(externalDocumentIds)) {
if(inactiveIterator.hasNext()) {
MongoDocument finishedDocument = inactiveIterator.next();