drop.js 964 B

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.DropSearchIndexOperation = void 0;
  4. const operation_1 = require("../operation");
  5. /** @internal */
  6. class DropSearchIndexOperation extends operation_1.AbstractCallbackOperation {
  7. constructor(collection, name) {
  8. super();
  9. this.collection = collection;
  10. this.name = name;
  11. }
  12. executeCallback(server, session, callback) {
  13. const namespace = this.collection.fullNamespace;
  14. const command = {
  15. dropSearchIndex: namespace.collection
  16. };
  17. if (typeof this.name === 'string') {
  18. command.name = this.name;
  19. }
  20. server.command(namespace, command, { session }, err => {
  21. if (err) {
  22. callback(err);
  23. return;
  24. }
  25. callback();
  26. });
  27. }
  28. }
  29. exports.DropSearchIndexOperation = DropSearchIndexOperation;
  30. //# sourceMappingURL=drop.js.map