Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-10379

$where documentation misleading with regard to string expressions

    XMLWordPrintableJSON

Details

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            neillunn Neil Lunn
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              1 year, 14 weeks, 2 days ago