jstests/aggregation/group_conversion_to_distinct_scan.js
// and will default to a $natural hint.
and will default to a $natural hint.
and will default to a $natural hint .
function assertResultsMatchWithAndWithoutHintandIndexes(pipeline,
                                                        expectedResults,
                                                        hintObj = {
                                                            $natural: 1
                                                        },
                                                        options = {}) {
    assert.commandWorked(coll.dropIndexes());
    const resultsNoIndex = coll.aggregate(pipeline, options).toArray();
    createIndexes();
    const resultsWithIndex = coll.aggregate(pipeline, options).toArray();
    const passedOptions = Object.assign({}, {hint: hintObj}, options);
    const resultsWithHint = coll.aggregate(pipeline, passedOptions).toArray();
    assert.sameMembers(resultsNoIndex, resultsWithIndex);
    assert.sameMembers(resultsWithIndex, resultsWithHint);
    assert.sameMembers(resultsWithHint, expectedResults);
}
function assertResultsMatchWithAndWithoutHintandIndexes ( pipeline , expectedResults , hintObj = { $natural : 1 } , options = { } ) { assert . commandWorked ( coll . dropIndexes ( ) ) ; const resultsNoIndex = coll . aggregate ( pipeline , options ) . toArray ( ) ; createIndexes ( ) ; const resultsWithIndex = coll . aggregate ( pipeline , options ) . toArray ( ) ; const passedOptions = Object . assign ( { } , { hint : hintObj } , options ) ; const resultsWithHint = coll . aggregate ( pipeline , passedOptions ) . toArray ( ) ; assert . sameMembers ( resultsNoIndex , resultsWithIndex ) ; assert . sameMembers ( resultsWithIndex , resultsWithHint ) ; assert . sameMembers ( resultsWithHint , expectedResults ) ; }
and will default to a $natural hint.
and will default to a $natural hint .