| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- "use strict";
- // Autogenerated by cport.py on 2013-09-17 14:37
- var Matcher2 = module.exports = function Matcher2(pattern, whereCallback){
- this._pattern = pattern;
- this.parser = new MatchExpressionParser();
- var result = this.parser.parse(pattern);
- if (result.code != ErrorCodes.OK)
- return {code:16810, description:"bad query: " + result};
- this._expression = result.result;
- }, klass = Matcher2, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
- // DEPENDENCIES
- var errors = require("../../Errors.js"),
- ErrorCodes = errors.ErrorCodes,
- MatchExpressionParser = require("./MatchExpressionParser.js"),
- proto._expression = undefined;
- proto._pattern = undefined;
- /**
- *
- * matches checks the input doc against the internal element path to see if it is a match
- * @method matches
- * @param doc
- * @param details
- *
- */
- proto.matches = function matches(doc, details){
- if (!this._expression)
- return true;
- if ((doc != {}) && (Object.keys(doc)[0]))
- return this._expression.matchesBSON(doc, details);
- return this._expression.matches(mydoc, details);
- };
- /**
- *
- * Return the _pattern property
- * @method getQuery
- *
- */
- proto.getQuery = function getQuery(){
- return this._pattern;
- };
- /**
- *
- * Convert _pattern into a string
- * @method toString
- *
- */
- proto.toString = function toString(){
- return this._pattern.toString();
- };
|