ElemMatchObjectMatchExpression.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. "use strict";
  2. var ArrayMatchingMatchExpression = require('./ArrayMatchingMatchExpression.js');
  3. // Autogenerated by cport.py on 2013-09-17 14:37
  4. var ElemMatchObjectMatchExpression = module.exports = function (ELEM_MATCH_OBJECT){
  5. base.call(this);
  6. }, klass = ElemMatchObjectMatchExpression, base = ArrayMatchingMatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
  7. // File: expression_array.h lines: 77-77
  8. proto._sub = undefined;
  9. /**
  10. *
  11. * This documentation was automatically generated. Please update when you touch this function.
  12. * @method debugString
  13. * @param
  14. *
  15. */
  16. proto.debugString = function debugString(level){
  17. // File: expression_array.cpp lines: 106-109
  18. var debug = this._debugAddSpace(level);
  19. debug = debug + this.path() + " $elemMatch\n";
  20. return debug + this._sub.debugString(level + 1);
  21. };
  22. /**
  23. *
  24. * This documentation was automatically generated. Please update when you touch this function.
  25. * @method getChild
  26. * @param
  27. *
  28. */
  29. proto.getChild = function getChild(i){
  30. // File: expression_array.h lines: 74-73
  31. return this._sub.get();
  32. };
  33. /**
  34. *
  35. * This documentation was automatically generated. Please update when you touch this function.
  36. * @method init
  37. * @param
  38. *
  39. */
  40. proto.init = function init(path, sub){
  41. // File: expression_array.cpp lines: 85-87
  42. this._sub.reset(sub);
  43. return this.initPath(path);
  44. };
  45. /**
  46. *
  47. * This documentation was automatically generated. Please update when you touch this function.
  48. * @method matchesArray
  49. * @param
  50. *
  51. */
  52. proto.matchesArray = function matchesArray(anArray, details){
  53. // File: expression_array.cpp lines: 90-103
  54. for (var i in anArray) {
  55. var inner = anArray[i];
  56. if (!(inner instanceof Object))
  57. continue;
  58. if (this._sub.matchesBSON(inner, null)) {
  59. if (details && details.needRecord()) {
  60. details.setElemMatchKey(inner.fieldName());
  61. }
  62. return true;
  63. }
  64. }
  65. return false;
  66. };
  67. /**
  68. *
  69. * This documentation was automatically generated. Please update when you touch this function.
  70. * @method numChildren
  71. * @param
  72. *
  73. */
  74. proto.numChildren = function numChildren(){
  75. // File: expression_array.h lines: 73-72
  76. return 1;
  77. };
  78. /**
  79. *
  80. * This documentation was automatically generated. Please update when you touch this function.
  81. * @method shallowClone
  82. * @param
  83. *
  84. */
  85. proto.shallowClone = function shallowClone(){
  86. // File: expression_array.h lines: 65-68
  87. var element = new ElemMatchObjectMatchExpression();
  88. element.init(this.path(), this._sub.shallowClone());
  89. return element;
  90. };