Details

    • Backport:
      No
    • # Replies:
      0
    • Last comment by Customer:
      true

      Description

      I keep wishing I could have a computed field:

      Basic idea:
      db.people.find(

      { firstname : "John" }

      , { _id: 1, name : function()

      {return this.firstname + ' ' + this.lastname;}

      } )

      Where it gets interesting:
      db.people.find( { score:

      {'$gt': 10}

      }, { _id: 1, score: function()

      {return this.foo + this.bar + this.baz;}

      } ).sort(score: 5)

      Obviously if you know in advance that you're going to need to run a query like this frequently it makes sense to try to precompute the value, but sometimes a query is so rare that precomputing is a waste, and in some cases you don't know enough information in advance.

        Issue Links

          Activity

          • Comments
          There are no comments yet on this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              John Crenshaw
              Participants:
              Last commenter:
              Ian Whalen
            • Votes:
              6 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since reply:
                2 years, 27 weeks, 1 day ago