You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
1000 B
JavaScript
25 lines
1000 B
JavaScript
11 months ago
|
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
exports.IsCappedOperation = void 0;
|
||
|
const error_1 = require("../error");
|
||
|
const operation_1 = require("./operation");
|
||
|
/** @internal */
|
||
|
class IsCappedOperation extends operation_1.AbstractOperation {
|
||
|
constructor(collection, options) {
|
||
|
super(options);
|
||
|
this.options = options;
|
||
|
this.collection = collection;
|
||
|
}
|
||
|
async execute(server, session) {
|
||
|
const coll = this.collection;
|
||
|
const [collection] = await coll.s.db
|
||
|
.listCollections({ name: coll.collectionName }, { ...this.options, nameOnly: false, readPreference: this.readPreference, session })
|
||
|
.toArray();
|
||
|
if (collection == null || collection.options == null) {
|
||
|
throw new error_1.MongoAPIError(`collection ${coll.namespace} not found`);
|
||
|
}
|
||
|
return !!collection.options?.capped;
|
||
|
}
|
||
|
}
|
||
|
exports.IsCappedOperation = IsCappedOperation;
|
||
|
//# sourceMappingURL=is_capped.js.map
|