Working Find example with OptSort

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Works as Designed
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I want use find with OptSort but this does not work as expected.

      I want do the following in my golang application

      db.getCollection('materialflow').find({station:1}).sort({outgoingtime:1})

      When I create my options instancen with

      sort, _ := mongo.Options{}.Sort(bson.NewDocument(bson.EC.Int32("station", 1)))
      cursor, err := coll.Find(context.Background(), bson.NewDocument(bson.EC.String(key, id)), sort)

      the find method returns 0 results.

      Am I using this wrong?

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

              Created:
              Updated:
              Resolved: