jstests/noPassthrough/libs/change_stream_pre_image_time_based_expiration_utils.js
// Helper to verify if expected pre-images are present in pre-image collection.
Helper to verify if expected pre-images are present in pre-image collection.
Helper to verify if expected pre - images are present in pre - image collection .
function verifyPreImages(preImageColl, expectedPreImages, collectionsInfo) {
    const preImageDocs = preImageColl.find().sort({"preImage._id": 1}).toArray();
    assert.eq(preImageDocs.length, expectedPreImages.length, preImageDocs);
    for (let idx = 0; idx < preImageDocs.length; idx++) {
        const [collIdx, preImageId] = expectedPreImages[idx];
        const nsUUID = collectionsInfo[collIdx]["info"].uuid;
        assert.eq(preImageDocs[idx]._id.nsUUID,
                  nsUUID,
                  "pre-image in collection: " + tojson(preImageDocs[idx]) +
                      ", expected collIdx: " + collIdx + ", docIdx: " + idx);
        assert.eq(preImageDocs[idx].preImage._id,
                  preImageId,
                  "pre-image in collection: " + tojson(preImageDocs[idx]) +
                      ", expected _id: " + preImageId);
    }
}
function verifyPreImages ( preImageColl , expectedPreImages , collectionsInfo ) { const preImageDocs = preImageColl . find ( ) . sort ( { "preImage._id" : 1 } ) . toArray ( ) ; assert . eq ( preImageDocs . length , expectedPreImages . length , preImageDocs ) ; for ( let idx = 0 ; idx < preImageDocs . length ; idx ++ ) { const [ collIdx , preImageId ] = expectedPreImages [ idx ] ; const nsUUID = collectionsInfo [ collIdx ] [ "info" ] . uuid ; assert . eq ( preImageDocs [ idx ] . _id . nsUUID , nsUUID , "pre-image in collection: " + tojson ( preImageDocs [ idx ] ) + ", expected collIdx: " + collIdx + ", docIdx: " + idx ) ; assert . eq ( preImageDocs [ idx ] . preImage . _id , preImageId , "pre-image in collection: " + tojson ( preImageDocs [ idx ] ) + ", expected _id: " + preImageId ) ; } }
Helper to verify if expected pre-images are present in pre-image collection.
Helper to verify if expected pre - images are present in pre - image collection .