How to use collection.Watch without the slice/array error?

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 1.0.0-rc2
    • Component/s: Core API
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When using the following code always getting the same error for the 'pipeline' variable that is passed in:
       
      can only transform slices and arrays into aggregation pipelines, but got
       
      Example code:
       
      client, err := mongo.NewClient(options.Client().ApplyURI("mongodb://mongo1:27017,mongo2:27018,mongo3:27019/?replicaSet=my-mongo-set"))

          

      ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)     err = client.Connect(ctx) 
      db := DocumentationDatabase(client) 
      documentation_examples.InsertExamples(t, db) 
      
      // we are going to monitor the inventory collection     
      // for changes     
      coll := db.Collection("inventory") 
      
      var pipeline interface{} // set up pipeline - 
      // in new version has to be a some bsontype.Array but does not work??
      cur, err := coll.Watch(ctx, pipeline, options.ChangeStream()) 
      // above always returns with an error?

       

            Assignee:
            Kristofer Brandow (Inactive)
            Reporter:
            Melle
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: