UNPKG

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

54 lines 2.21 kB
"use strict"; 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"); /** * Update Operation Proxy - Update builder for remote updates * Mirrors the UpdateOperation class API */ class UpdateOperationProxy { constructor(client, dbName, collectionName, query) { this.client = client; this.dbName = dbName; this.collectionName = collectionName; this.query = query; } /** * Update one document matching the query */ UpdateOne(data) { return __awaiter(this, void 0, void 0, function* () { return yield this.client.sendCommand(command_types_1.CommandType.UPDATE_DOCUMENTS_BY_QUERY, { dbName: this.dbName, collectionName: this.collectionName, query: this.query, updateData: data, updateOne: true, }); }); } /** * Update many documents matching the query */ UpdateMany(data) { return __awaiter(this, void 0, void 0, function* () { return yield this.client.sendCommand(command_types_1.CommandType.UPDATE_DOCUMENTS_BY_QUERY, { dbName: this.dbName, collectionName: this.collectionName, query: this.query, updateData: data, updateOne: false, }); }); } } exports.default = UpdateOperationProxy; //# sourceMappingURL=UpdateOperationProxy.js.map