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

$function examples seem overcomplicated

      Description

      On this page there are some examples which I think could be simplified. As the most striking example, I think

      db.players.find( {$expr: { $function: {
            body: function(userFn, doc) { return userFn.call(doc); },
            args: [
               function() { return hex_md5(this.name) == "15b0a220baa16331e8d80e15367677ad" ; },
               "$$CURRENT"
            ],
            lang: "js"
      } } } )
      

      Could be simplified into just

      db.players.find( {$expr: { $function: {
            body: function(name) { return hex_md5(name) == "15b0a220baa16331e8d80e15367677ad"; },
            args: [ "$name" ],
            lang: "js"
      } } } )
      

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

            Assignee:
            kay.kim@mongodb.com Kay Kim (Inactive)
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              3 years, 45 weeks, 3 days ago