| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- "use strict";
- var ArrayMatchingMatchExpression = require('./ArrayMatchingMatchExpression.js');
- // Autogenerated by cport.py on 2013-09-17 14:37
- var ElemMatchObjectMatchExpression = module.exports = function ElemMatchObjectMatchExpression(){
- base.call(this);
- }, klass = ElemMatchObjectMatchExpression, base = ArrayMatchingMatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
- // File: expression_array.h lines: 77-77
- proto._sub = undefined;
- /**
- *
- * Writes a debug string for this object
- * @method debugString
- * @param level
- *
- */
- proto.debugString = function debugString(level){
- // File: expression_array.cpp lines: 106-109
- var debug = this._debugAddSpace(level);
- debug = debug + this.path() + " $elemMatch\n";
- return debug + this._sub.debugString(level + 1);
- };
- /**
- *
- * Return the _sub property
- * @method getChild
- *
- */
- proto.getChild = function getChild(){
- // File: expression_array.h lines: 74-73
- return this._sub;
- };
- /**
- *
- * Initialize the necessary items
- * @method init
- * @param path
- * @param type
- *
- */
- proto.init = function init(path, sub){
- // File: expression_array.cpp lines: 85-87
- this._sub = sub;
- return this.initPath(path);
- };
- /**
- *
- * Check if one of the items in the input array matches _sub
- * @method matchesArray
- * @param anArray
- * @param details
- *
- */
- proto.matchesArray = function matchesArray(anArray, details){
- // File: expression_array.cpp lines: 90-103
- for (var i in anArray) {
- var inner = anArray[i];
- if (!(inner instanceof Object))
- continue;
- if (this._sub.matchesBSON(inner, null)) {
- if (details && details.needRecord()) {
- details.setElemMatchKey(i);
- }
- return true;
- }
- }
- return false;
- };
- /**
- *
- * Return 1 since we have a single "sub"
- * @method numChildren
- *
- */
- proto.numChildren = function numChildren(){
- // File: expression_array.h lines: 73-72
- return 1;
- };
- /**
- *
- * clone this instance to a new one
- * @method shallowClone
- *
- */
- proto.shallowClone = function shallowClone(){
- // File: expression_array.h lines: 65-68
- var element = new ElemMatchObjectMatchExpression();
- element.init(this.path(), this._sub.shallowClone());
- return element;
- };
|