Validate values in query projection

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.6.0-rc0
    • Component/s: Querying
    • Query Optimization
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            [DO NOT USE] Backlog - Query Optimization
            Reporter:
            Siyuan Zhou
            Votes:
            1 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated: