Kaynağa Gözat

Refs #3360. Removed unneeded class, updated docs.

Spencer Rathbun 12 yıl önce
ebeveyn
işleme
3f17cde41f

+ 20 - 32
lib/pipeline/matcher/AllElemMatchOp.js

@@ -35,13 +35,13 @@ proto._path = undefined;
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * This method checks the input array and determines if each item inside matches
  * @method _allMatch
- * @param
+ * @param anArray
  *
  */
 proto._allMatch = function _allMatch( anArray ){ //  const BSONObj& anArray
-// File: expression_array.cpp lines: 208-215
+	// File: expression_array.cpp lines: 208-215
 	if(this._list.length === 0) { return false; }
 
 	for (var i = 0; i < this._list.length; i++) {
@@ -54,18 +54,13 @@ proto._allMatch = function _allMatch( anArray ){ //  const BSONObj& anArray
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * This method adds a new expression to the internal array of expression
  * @method add
- * @param
+ * @param expr
  *
  */
 proto.add = function add( expr ){//  const ArrayMatchingMatchExpression* expr
-
-// File: expression_array.cpp lines: 184-186
-//     void AllElemMatchOp::add( const ArrayMatchingMatchExpression* expr ) {
-//         verify( expr );
-//         _list.push_back( expr );
-//     }
+	// File: expression_array.cpp lines: 184-186
 	if (!expr) throw new Error("AllElemMatchOp:add#68 failed to verify expr");
 	this._list.push(expr);
 };
@@ -73,20 +68,13 @@ proto.add = function add( expr ){//  const ArrayMatchingMatchExpression* expr
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * Writes a debug string for this object
  * @method debugString
- * @param
+ * @param level
  *
  */
 proto.debugString = function debugString( level ){ //   StringBuilder& debug, int level
-// File: expression_array.cpp lines: 219-224
-//     void AllElemMatchOp::debugString( StringBuilder& debug, int level ) const {
-//         _debugAddSpace( debug, level );
-//         debug << _path << " AllElemMatchOp: " << _path << "\n";
-//         for ( size_t i = 0; i < _list.size(); i++ ) {
-//             _list[i]->debugString( debug, level + 1);
-//         }
-//     }
+	// File: expression_array.cpp lines: 219-224
 	console.debug(this._debugAddSpace(level) + this._path + " AllElemMatchOp: " + this._path + '\n');
 	for (var i = 0; i < this._list.length; i++) {
 		this._list[i].debugString(level +1);
@@ -96,9 +84,9 @@ proto.debugString = function debugString( level ){ //   StringBuilder& debug, in
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * checks if this expression is == to the other
  * @method equivalent
- * @param
+ * @param other
  *
  */
 proto.equivalent = function equivalent( other ){//  const MatchExpression* other
@@ -126,9 +114,9 @@ proto.equivalent = function equivalent( other ){//  const MatchExpression* other
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * gets the specified item from the list
  * @method getChild
- * @param
+ * @param i
  *
  */
 proto.getChild = function getChild( i ){ //  size_t i
@@ -139,9 +127,9 @@ proto.getChild = function getChild( i ){ //  size_t i
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * Initialize the necessary items
  * @method init
- * @param
+ * @param path
  *
  */
 proto.init = function init( path ){ //  const StringData& path
@@ -184,9 +172,9 @@ proto.matches = function matches(doc, details){
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * Check if the input element matches
  * @method matchesSingleElement
- * @param
+ * @param e
  *
  */
 proto.matchesSingleElement = function matchesSingleElement( e ){ //  const BSONElement& e
@@ -200,7 +188,7 @@ proto.matchesSingleElement = function matchesSingleElement( e ){ //  const BSONE
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * return the length of the internal array
  * @method numChildren
  * @param
  *
@@ -213,7 +201,7 @@ proto.numChildren = function numChildren( /*  */ ){
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * return the internal path
  * @method path
  * @param
  *
@@ -226,7 +214,7 @@ proto.path = function path( /*  */ ){
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * clone this instance to a new one
  * @method shallowClone
  * @param
  *

+ 5 - 5
lib/pipeline/matcher/AndMatchExpression.js

@@ -13,9 +13,9 @@ var AndMatchExpression = module.exports = function AndMatchExpression(){
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * Writes a debug string for this object
  * @method debugString
- * @param
+ * @param level
  *
  */
 proto.debugString = function debugString( level ) { //  StringBuilder& debug, int level
@@ -49,9 +49,9 @@ proto.matches = function matches(doc, details) { //  const MatchableDocument* do
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * Check if the input element matches
  * @method matchesSingleElement
- * @param
+ * @param e
  *
  */
 proto.matchesSingleElement = function matchesSingleElement( e ){ //  const BSONElement& e
@@ -67,7 +67,7 @@ proto.matchesSingleElement = function matchesSingleElement( e ){ //  const BSONE
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * clone this instance to a new one
  * @method shallowClone
  * @param
  *

+ 2 - 2
lib/pipeline/matcher/ArrayMatchingMatchExpression.js

@@ -93,7 +93,7 @@ proto.matches = function matches(doc, details){
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * Check if the input element matches
  * @method matchesSingleElement
  * @param
  *
@@ -107,7 +107,7 @@ proto.matchesSingleElement = function matchesSingleElement(element){
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * return the internal path
  * @method path
  * @param
  *

+ 5 - 5
lib/pipeline/matcher/ElementPath.js

@@ -77,7 +77,7 @@ klass.isAllDigits = function isAllDigits ( str ){
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * return the internal fieldRef object
  * @method fieldRef
  * @param
  *
@@ -90,9 +90,9 @@ proto.fieldRef = function fieldRef( /*  */ ){
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * Initialize necessary items on this instance
  * @method init
- * @param
+ * @param path
  *
  */
 proto.init = function init( path ){  //  const StringData& path
@@ -105,7 +105,7 @@ proto.init = function init( path ){  //  const StringData& path
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * Set whether paths should traverse leaves inside arrays
  * @method setTraverseLeafArray
  * @param
  *
@@ -118,7 +118,7 @@ proto.setTraverseLeafArray = function setTraverseLeafArray( b ){ //  bool b
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * Return whether arrays should traverse leaf arrays
  * @method shouldTraverseLeafArray
  * @param
  *

+ 2 - 2
lib/pipeline/matcher/EqualityMatchExpression.js

@@ -9,8 +9,8 @@ var EqualityMatchExpression = module.exports = function EqualityMatchExpression(
 }, klass = EqualityMatchExpression, base =  ComparisonMatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 
 /**
- * 
- * This documentation was automatically generated. Please update when you touch this function.
+ *
+ * Return a new instance of this class, with fields set the same as ourself
  * @method shallowClone
  * @param
  *

+ 2 - 2
lib/pipeline/matcher/GTEMatchExpression.js

@@ -9,8 +9,8 @@ var GTEMatchExpression = module.exports = function GTEMatchExpression(){
 }, klass = GTEMatchExpression, base =  ComparisonMatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 
 /**
- * 
- * This documentation was automatically generated. Please update when you touch this function.
+ *
+ * Return a new instance of this class, with fields set the same as ourself
  * @method shallowClone
  * @param
  *

+ 1 - 1
lib/pipeline/matcher/GTMatchExpression.js

@@ -11,7 +11,7 @@ var GTMatchExpression = module.exports = function GTMatchExpression(){
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * Return a new instance of this class, with fields set the same as ourself
  * @method shallowClone
  * @param
  *

+ 1 - 1
lib/pipeline/matcher/IndexKeyMatchableDocument.js

@@ -20,7 +20,7 @@ proto._pattern = undefined;
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * get the element at the input path
  * @method _getElement
  * @param path
  *

+ 2 - 2
lib/pipeline/matcher/LTEMatchExpression.js

@@ -9,8 +9,8 @@ var LTEMatchExpression = module.exports = function LTEMatchExpression(){
 }, klass = LTEMatchExpression, base =  ComparisonMatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 
 /**
- * 
- * This documentation was automatically generated. Please update when you touch this function.
+ *
+ * Return a new instance of this class, with fields set the same as ourself
  * @method shallowClone
  * @param
  *

+ 2 - 2
lib/pipeline/matcher/LTMatchExpression.js

@@ -9,8 +9,8 @@ var LTMatchExpression = module.exports = function LTMatchExpression(){
 }, klass = LTMatchExpression, base = ComparisonMatchExpression, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 
 /**
- * 
- * This documentation was automatically generated. Please update when you touch this function.
+ *
+ * Return a new instance of this class, with fields set the same as ourself
  * @method shallowClone
  * @param
  *

+ 5 - 5
lib/pipeline/matcher/LeafMatchExpression.js

@@ -25,9 +25,9 @@ proto._path = undefined;
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * Initialize the ElementPath to the input path
  * @method initPath
- * @param
+ * @param path
  *
  */
 proto.initPath = function initPath( path ) { //  const StringData& path
@@ -42,9 +42,9 @@ proto.initPath = function initPath( path ) { //  const StringData& path
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * Check whether the input doc matches
  * @method matches
- * @param
+ * @param doc
  *
  */
 proto.matches = function matches( doc, details ) { //  const MatchableDocument* doc, MatchDetails* details
@@ -95,7 +95,7 @@ proto.matches = function matches( doc, details ) { //  const MatchableDocument*
 
 /**
  *
- * This documentation was automatically generated. Please update when you touch this function.
+ * Return the internal path
  * @method path
  * @param
  *

+ 0 - 208
lib/pipeline/matcher/WhereMatchExpression.js

@@ -1,208 +0,0 @@
-"use strict";
-
-/**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method WhereMatchExpression
- * @param WHERE
- *
- */
-// Autogenerated by cport.py on 2013-09-17 14:37
-var WhereMatchExpression = module.exports = function() {
-	this._func = 0;
-}, klass = WhereMatchExpression, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
-
-// DEPENDENCIES
-var errors = require("../../Errors.js"),
-	ErrorCodes = errors.ErrorCodes;
-
-// File: expression_where.cpp lines: 55-55
-//         string _code;
-
-proto._code = undefined;
-
-
-// File: expression_where.cpp lines: 59-59
-//         ScriptingFunction _func;
-
-proto._func = undefined;
-
-
-// File: expression_where.cpp lines: 54-54
-//         string _ns;
-
-proto._ns = undefined;
-
-
-// File: expression_where.cpp lines: 58-58
-//         auto_ptr<Scope> _scope;
-
-proto._scope = undefined;
-
-
-// File: expression_where.cpp lines: 56-56
-//         BSONObj _userScope;
-
-proto._userScope = undefined;
-
-
-// File: expression_where.cpp lines: 55-55
-//         string _code;
-
-proto._code = undefined;
-
-
-// File: expression_where.cpp lines: 59-59
-//         ScriptingFunction _func;
-
-proto._func = undefined;
-
-
-// File: expression_where.cpp lines: 54-54
-//         string _ns;
-
-proto._ns = undefined;
-
-
-// File: expression_where.cpp lines: 58-58
-//         auto_ptr<Scope> _scope;
-
-proto._scope = undefined;
-
-
-// File: expression_where.cpp lines: 56-56
-//         BSONObj _userScope;
-
-proto._userScope = undefined;
-
-/**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method debugString
- * @param debug
- * @param level
- *
- */
-proto.debugString = function debugString( debug, level){
-
-// File: expression_where.cpp lines: 113-124
-	/*
-	proto._debugAddSpace( debug, level );
-	debug = debug + "$where\n";
-
-	proto._debugAddSpace( debug, level + 1 );
-	debug = debug + "ns: " + proto._ns + "\n";
-
-	proto._debugAddSpace( debug, level + 1 );
-	debug = debug + "code: " + proto._code + "\n";
-
-	proto._debugAddSpace( debug, level + 1 );
-	debug = debug + "scope: " + proto._userScope + "\n";
-	console.log(debug);
-	*/
-
-};
-
-/**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method equivalent
- * @param other
- *
- */
-proto.equivalent = function equivalent(other){
-
-// File: expression_where.cpp lines: 127-134
-	if ( this.matchType() != other.matchType() ) return false;
-	var realOther = new WhereMatchExpression(other);
-	return (this._ns == realOther._ns && this._code == realOther._code && this._userScope == realOther._userScope);
-
-};
-
-/**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method init
- * @param string ns
- * @param theCode
- * @param scope
- *
- */
-proto.init = function init(ns, theCode, scope){
-	// File: expression_where.cpp lines: 62-86
-	if ( ns.size() === 0 )
-		return {code:ErrorCodes.BAD_VALUE, description:"ns for $where cannot be empty"};
-
-	if ( theCode.size() === 0 )
-		return {code:ErrorCodes.BAD_VALUE, description:"code for $where cannot be empty"};
-
-	this._ns = ns;
-	this._code = theCode.toString();
-	this._userScope = scope.getOwned();
-
-	// we don't have authentication yet
-	// var userToken = ClientBasic::getCurrent().getAuthorizationSession().getAuthenticatedUserNamesToken();
-
-	this._scope = globalScriptEngine.getPooledScope( this._ns.substr(0, this._ns.indexOf('.')), "where" + userToken );
-	this._func = this._scope.createFunction( this._code.c_str() );
-
-	if ( !this._func )
-		return {code:ErrorCodes.BAD_VALUE, description:"$where compile error"};
-
-	return {code:ErrorCodes.OK};
-
-};
-
-/**
- *
- * This documentation was automatically generated. Please update when you touch this function.
- * @method matches
- * @param doc
- * @param details
- *
- */
-proto.matches = function matches(doc /*, details */){
-	// File: expression_where.cpp lines: 89-110
-	verify( this._func );
-
-	if ( ! this._userScope.isEmpty() ) {
-		this._scope.init( this._userScope );
-	}
-	this._scope.setObject("obj", doc);
-	this._scope.setBoolean("fullObject", true); // this is a hack b/c fullObject used to be relevant
-
-	err = this._scope.invoke(this._func, 0, obj, 1000 * 60, false);
-	if ( err == -3 ) { // INVOKE_ERROR
-		throw new Error("16812 error on invocation of $where function:\n" + this._scope.getError().name);
-	}
-	else if ( err != 0 ) {   // ! INVOKE_SUCCESS
-		throw new Error("16813 unknown error in invocation of $where function");
-	}
-
-	return this._scope.getBoolean("__returnValue") != 0;
-};
-
-/**
- *
- * WhereMatchExpression never matches a single element
- * @method matchesSingleElement
- * @param e
- *
- */
-proto.matchesSingleElement = function matchesSingleElement(e){
-	// File: expression_where.cpp lines: 40-41
-	return false;
-};
-
-/**
- *
- * Create a new WhereMatchExpression and initialize it with our property values
- * @method shallowClone
- *
- */
-proto.shallowClone = function shallowClone(){
-	// File: expression_where.cpp lines: 44-47
-    e = new WhereMatchExpression();
-    e.init(this._ns, this._code, this._userScope);
-    return e;
-};