First commit
This commit is contained in:
29
node_modules/mongodb/lib/operations/search_indexes/create.js
generated
vendored
Normal file
29
node_modules/mongodb/lib/operations/search_indexes/create.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CreateSearchIndexesOperation = void 0;
|
||||
const operation_1 = require("../operation");
|
||||
/** @internal */
|
||||
class CreateSearchIndexesOperation extends operation_1.AbstractOperation {
|
||||
constructor(collection, descriptions) {
|
||||
super();
|
||||
this.collection = collection;
|
||||
this.descriptions = descriptions;
|
||||
}
|
||||
execute(server, session, callback) {
|
||||
const namespace = this.collection.fullNamespace;
|
||||
const command = {
|
||||
createSearchIndexes: namespace.collection,
|
||||
indexes: this.descriptions
|
||||
};
|
||||
server.command(namespace, command, { session }, (err, res) => {
|
||||
if (err || !res) {
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
const indexesCreated = res?.indexesCreated ?? [];
|
||||
callback(undefined, indexesCreated.map(({ name }) => name));
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.CreateSearchIndexesOperation = CreateSearchIndexesOperation;
|
||||
//# sourceMappingURL=create.js.map
|
Reference in New Issue
Block a user