1234567891011121314151617181920212223242526272829 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.CollectionsOperation = void 0;
- const collection_1 = require("../collection");
- const operation_1 = require("./operation");
- class CollectionsOperation extends operation_1.AbstractOperation {
- constructor(db, options) {
- super(options);
- this.options = options;
- this.db = db;
- }
- execute(server, session, callback) {
- const db = this.db;
-
- db.listCollections({}, { ...this.options, nameOnly: true, readPreference: this.readPreference, session }).toArray((err, documents) => {
- if (err || !documents)
- return callback(err);
-
- documents = documents.filter(doc => doc.name.indexOf('$') === -1);
-
- callback(undefined, documents.map(d => {
- return new collection_1.Collection(db, d.name, db.s.options);
- }));
- });
- }
- }
- exports.CollectionsOperation = CollectionsOperation;
|