summaryrefslogtreecommitdiff
path: root/jstests/sharding/read_does_not_create_namespaces.js
blob: 8ee48576ba1fd4aac1d08e93ea549cc5b7f7c63b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// This test ensures that just attempting to read from a non-existent database or collection won't
// cause entries to be created in the catalog.
(function() {

    var shardingTest = new ShardingTest({name: 'read_does_not_create_namespaces', shards: 1});
    var db = shardingTest.getDB('NonExistentDB');

    assert.isnull(db.nonExistentColl.findOne({}));

    // Neither the database nor the collection should have been created
    assert.isnull(shardingTest.getDB('config').databases.findOne({_id: 'NonExistentDB'}));
    assert.eq(-1, shardingTest.shard0.getDBNames().indexOf('NonExistentDB'));

    shardingTest.stop();

})();