summaryrefslogtreecommitdiff
path: root/jstests/core/timeseries/timeseries_list_collections_filter_name.js
blob: 673fb40a99e38e68a531bf7b9d02f1e148373a50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
 * Tests that listCollections includes time-series collections and their options when filtering on
 * name.
 *
 * @tags: [
 *   does_not_support_transactions,
 *   requires_getmore,
 * ]
 */
(function() {
'use strict';

const timeFieldName = 'time';

const coll = db.timeseries_list_collections_filter_name;
coll.drop();

assert.commandWorked(db.createCollection(coll.getName(), {timeseries: {timeField: timeFieldName}}));

const collections =
    assert.commandWorked(db.runCommand({listCollections: 1, filter: {name: coll.getName()}}))
        .cursor.firstBatch;
assert.eq(collections, [{
              name: coll.getName(),
              type: 'timeseries',
              options: {
                  timeseries:
                      {timeField: timeFieldName, granularity: 'seconds', bucketMaxSpanSeconds: 3600}
              },
              info: {readOnly: false},
          }]);
})();