jstests/core/list_collections_filter.js
/**
 * Asserts that the names of the collections returned from running the listCollections
 * command with the given filter match the expected names.
 */
Asserts that the names of the collections returned from running the listCollections
command with the given filter match the expected names.
Asserts that the names of the collections returned from running the listCollections command with the given filter match the expected names .
function testListCollections(filter, expectedNames) {
    if (filter === undefined) {
        filter = {};
    }
    var cursor = new DBCommandCursor(mydb, mydb.runCommand("listCollections", {filter: filter}));
    function stripToName(result) {
        return result.name;
    }
    var cursorResultNames = cursor.toArray().map(stripToName);
    assert.eq(cursorResultNames.sort(), expectedNames.sort());
    var shellResultNames = mydb.getCollectionInfos(filter).map(stripToName);
    assert.eq(shellResultNames, expectedNames.sort());
}
function testListCollections ( filter , expectedNames ) { if ( filter === undefined ) { filter = { } ; } var cursor = new DBCommandCursor ( mydb , mydb . runCommand ( "listCollections" , { filter : filter } ) ) ; function stripToName ( result ) { return result . name ; } var cursorResultNames = cursor . toArray ( ) . map ( stripToName ) ; assert . eq ( cursorResultNames . sort ( ) , expectedNames . sort ( ) ) ; var shellResultNames = mydb . getCollectionInfos ( filter ) . map ( stripToName ) ; assert . eq ( shellResultNames , expectedNames . sort ( ) ) ; }
Asserts that the names of the collections returned from running the listCollections
 command with the given filter match the expected names.
Asserts that the names of the collections returned from running the listCollections command with the given filter match the expected names .
// Assert the shell helper returns the same list, but in sorted order.