Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-632

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

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

      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:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            tyler@10gen.com Tyler Brock
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: