code: private void copyObjectIDsToBatch(BatchResult batchResult, DBObjectBatch dbObjBatch) {
          if (batchResult.getResultObjectCount() < dbObjBatch.getObjectCount()) {
              m_logger.warn("Batch result returned fewer objects ({}) than input batch ({})",
                            batchResult.getResultObjectCount(), dbObjBatch.getObjectCount());
          }
          Iterator<ObjectResult> resultIter = batchResult.getResultObjects().iterator();
          Iterator<DBObject> objectIter = dbObjBatch.getObjects().iterator();
          while (resultIter.hasNext()) {
              if (!objectIter.hasNext()) {
                  m_logger.warn("Batch result has more objects ({}) than input batch ({})!",
                                batchResult.getResultObjectCount(), dbObjBatch.getObjectCount());
                  break;
              }
              ObjectResult objResult = resultIter.next();
              DBObject dbObj = objectIter.next();
              if (Utils.isEmpty(dbObj.getObjectID())) {
                  dbObj.setObjectID(objResult.getObjectID());
              } else if (!dbObj.getObjectID().equals(objResult.getObjectID())) {
                  m_logger.warn("Batch results out of order: expected ID '{}', got '{}'",
                                dbObj.getObjectID(), objResult.getObjectID());
              }
          }
      }
docs: within the given DBObjectBatch.