UNPKG

mongodb-stitch

Version:

[![Join the chat at https://gitter.im/mongodb/stitch](https://badges.gitter.im/mongodb/stitch.svg)](https://gitter.im/mongodb/stitch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

40 lines 1.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var CoreRemoteMongoReadOperation = (function () { function CoreRemoteMongoReadOperation(command, args, service, decoder) { this.command = command; this.args = args; this.service = service; if (decoder) { this.collectionDecoder = new (function () { function class_1() { } class_1.prototype.decode = function (from) { if (from instanceof Array) { return from.map(function (t) { return decoder.decode(t); }); } return [decoder.decode(from)]; }; return class_1; }())(); } } CoreRemoteMongoReadOperation.prototype.iterator = function () { return this.executeRead().then(function (res) { return res[Symbol.iterator](); }); }; CoreRemoteMongoReadOperation.prototype.first = function () { return this.executeRead().then(function (res) { return res[0]; }); }; CoreRemoteMongoReadOperation.prototype.toArray = function () { return this.executeRead(); }; CoreRemoteMongoReadOperation.prototype.asArray = function () { return this.toArray(); }; CoreRemoteMongoReadOperation.prototype.executeRead = function () { return this.service.callFunction(this.command, [this.args], this.collectionDecoder); }; return CoreRemoteMongoReadOperation; }()); exports.default = CoreRemoteMongoReadOperation; //# sourceMappingURL=CoreRemoteMongoReadOperation.js.map