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

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.6.2
    • 2.7
    • None

    Description

      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."

      Attachments

        Issue Links

          Activity

            People

              jesse@mongodb.com A. Jesse Jiryu Davis
              tyler@10gen.com Tyler Brock
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: