Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-12890

Validate values in query projection

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • 2.6.0-rc0
    • Querying
    • Query Optimization

    Description

      When using query projection, only 1/0 and true/false are valid for the values (plus null and undefined maybe):

      > db.foo.find({ $text: { $search: "dog" } }, { foo: 1 })
      > db.foo.find({ $text: { $search: "dog" } }, { foo: true, _id: 0 })
      

      Other values should be disallowed, for example:

      > db.foo.find({ $text: { $search: "dog" } }, { foo: "bar" })
      > db.foo.find({ a:1}, { $foo: {} })
      > db.foo.find({ $text: { $search: "dog" } }, { $meta: "textScore" })
      

      Especially for text search, $meta: "textScore" can be very confusing.

      Attachments

        Activity

          People

            backlog-query-optimization Backlog - Query Optimization
            siyuan.zhou@mongodb.com Siyuan Zhou
            Votes:
            1 Vote for this issue
            Watchers:
            13 Start watching this issue

            Dates

              Created:
              Updated: