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

Working Find example with OptSort

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Works as Designed
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • None
    • None

    Description

      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?

      Attachments

        Activity

          People

            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            thomas.geulen Thomas Geulen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: