Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1743

tying to use $function but got error syntax

    • Type: Icon: Improvement Improvement
    • Resolution: Gone away
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.4.1
    • Component/s: API, BSON
    • None

      I am trying new feature on mongo-driver for `$function` , here is my syntax

       

      function := fmt.Sprintf("function(p) { return p; }")
      addFunc := bson.D{
         {"$addFields", bson.D{
            {"addFunc", bson.D{
               {"$function", bson.D{
                  {"body", function},
                  {"args", bson.A{"yes"}},
                  {"lang", "js"},
               }},
            }},
         }},
      }
      

      I use that addFunc init my aggregate pipeline, and it took long to proses if add that `addFunc` into my pipeline aggregate, and at the end, I got error "must not be null" , I don't know what's wrong with it, is that any idea for my case? or mongodb go not support $function yet??
      I am using latest mongo atlas 

       

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            justtemporary@niepodam.pl Virtual Database
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: