Support list containing pair of (str, dict) in sort

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • 2.7
    • Affects Version/s: 2.6.2
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I'd like to do a query where the sort parameter to find allows me to sort on a meta field for $text search:

          results = COMBINED.find(
              {'$text': {'$search': 'whatever'}},
              limit=limit,
              fields={'score': {'$meta': 'textScore'}},
              sort=[('score', {'$meta': 'textScore'})]
          )
      

      The projection works but having the sort produces the following error: "TypeError: second item in each key pair must be 1, -1, '2d', 'geoHaystack', or another valid MongoDB index specifier."

              Assignee:
              A. Jesse Jiryu Davis
              Reporter:
              Tyler Brock (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: