-
Type: Bug
-
Resolution: Won't Do
-
Priority: Major - P3
-
Affects Version/s: None
-
Labels:None
The documentation for the $where operator makes a misleading statement in regard to usage with other drivers outside of it's usage in the MongoDB shell environment:
Additionally, if the query consists only of the $where operator, you can pass in just the JavaScript expression or JavaScript functions, as in the following examples:
db.myCollection.find( "this.credits == this.debits || this.credits > this.debits" ); db.myCollection.find( function() { return (this.credits == this.debits || this.credits > this.debits ) } );
The problem is particularly with the initial syntax showing the expression as a string being the only argument to .find(), which of course only applies to the shell method syntax and is not supported in any other drivers.
The statement in the documentation needs clarification that this is the supported shell syntax and at the very least may not be supported in other available drivers.
Ref: Mongo not behaving according to docs, with regards to implicit $where clause