"use strict"; // Autogenerated by cport.py on 2013-09-17 14:37 var IndexKeyMatchableDocument = module.exports = function IndexKeyMatchableDocument(pattern, doc){ this._pattern = pattern; this._doc = doc; }, klass = IndexKeyMatchableDocument, base = Object , proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}}); // File: matcher.cpp lines: 52-52 proto._doc = undefined; // File: matcher.cpp lines: 51-51 proto._pattern = undefined; // File: matcher.cpp lines: 52-52 proto._doc = undefined; // File: matcher.cpp lines: 51-51 proto._pattern = undefined; /** * * get the element at the input path * @method _getElement * @param path * */ proto._getElement = function _getElement(path){ // File: matcher.cpp lines: 63-77 var patternElement, docElement; for (var i in this._pattern) { patternElement = this._pattern[i]; //verify( docIterator.more() ); if(i >= this._doc.length) throw new Error("Ran out of docs in IndexKeyMatchableDocument:35"); docElement = this._doc[i]; if (path.equalsDottedField(patternElement.fieldName())) { return docElement; } } return {}; }; /** * * This method returns a JSON representation of the Document * @method toBSON * @param * */ proto.toJSON = function toJSON(){ // File: matcher.cpp lines: 39-42 // TODO: this isn't quite correct because of dots // don't think it'll ever be called though return this._doc.replaceFieldNames(this._pattern); };