create.js 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.CreateSearchIndexesOperation = void 0;
  4. const responses_1 = require("../../cmap/wire_protocol/responses");
  5. const operation_1 = require("../operation");
  6. /** @internal */
  7. class CreateSearchIndexesOperation extends operation_1.AbstractOperation {
  8. constructor(collection, descriptions) {
  9. super();
  10. this.SERVER_COMMAND_RESPONSE_TYPE = responses_1.MongoDBResponse;
  11. this.collection = collection;
  12. this.descriptions = descriptions;
  13. this.ns = collection.fullNamespace;
  14. }
  15. get commandName() {
  16. return 'createSearchIndexes';
  17. }
  18. buildCommand(_connection, _session) {
  19. const namespace = this.collection.fullNamespace;
  20. return {
  21. createSearchIndexes: namespace.collection,
  22. indexes: this.descriptions
  23. };
  24. }
  25. handleOk(response) {
  26. return super.handleOk(response).indexesCreated.map((val) => val.name);
  27. }
  28. buildOptions(timeoutContext) {
  29. return { session: this.session, timeoutContext };
  30. }
  31. }
  32. exports.CreateSearchIndexesOperation = CreateSearchIndexesOperation;
  33. //# sourceMappingURL=create.js.map