axiodb
Version:
The Pure JavaScript Alternative to SQLite. Embedded NoSQL database for Node.js with MongoDB-style queries, zero native dependencies, built-in InMemoryCache, and web GUI. Perfect for desktop apps, CLI tools, and embedded systems. No compilation, no platfor
52 lines • 2.13 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const command_types_1 = require("../tcp/types/command.types");
/**
* Delete Operation Proxy - Delete builder for remote deletes
* Mirrors the DeleteOperation class API
*/
class DeleteOperationProxy {
constructor(client, dbName, collectionName, query) {
this.client = client;
this.dbName = dbName;
this.collectionName = collectionName;
this.query = query;
}
/**
* Delete one document matching the query
*/
deleteOne() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.client.sendCommand(command_types_1.CommandType.DELETE_DOCUMENTS_BY_QUERY, {
dbName: this.dbName,
collectionName: this.collectionName,
query: this.query,
deleteOne: true,
});
});
}
/**
* Delete many documents matching the query
*/
deleteMany() {
return __awaiter(this, void 0, void 0, function* () {
return yield this.client.sendCommand(command_types_1.CommandType.DELETE_DOCUMENTS_BY_QUERY, {
dbName: this.dbName,
collectionName: this.collectionName,
query: this.query,
deleteOne: false,
});
});
}
}
exports.default = DeleteOperationProxy;
//# sourceMappingURL=DeleteOperationProxy.js.map