title: Shuffle sub documents in mongoose query
body: <p>I have following models:</p>
  
  <p><strong>Question Model</strong></p>
  
  <pre><code>var OptionSchema = new Schema({
      correct : {type:Boolean, default:false}
      value : String
  });
  
  var QuestionSchema = new Schema({
      value  : String
      , choices : [OptionSchema]
      , quiz : {type:ObjectId, ref:'quizzes'}
      , createdOn : {type:Date, default:Date.now}
      ...
  });
  
  var Question = mongoose.model('questions', QuestionSchema);
  </code></pre>
  
  <p><strong>Quiz Model</strong></p>
  
  <pre><code>var QuizSchema = new Schema({
  name : String
  , questions : [{type:ObjectId, ref:'questions'}]
  ,company : {type:ObjectId, ref:'companies'}
  ...
  });
  
  var Quiz = mongoose.model('quizzes', QuizSchema);
  </code></pre>
  
  <p><strong>Company Model</strong></p>
  
  <pre><code>var CompanySchema = new Schema({
  name :String
  ...
  });
  </code></pre>
  
  <p>I want to shuffle <code>choices</code> of each question per each query, and I am doing It as follows :</p>
  
  <pre><code>shuffle = function(v){
      //+ Jonas Raoni Soares Silva
      //@ http://jsfromhell.com/array/shuffle [rev. #1]
  
      for(var j, x, i = v.length; i; j = parseInt(Math.random() * i), x = v[--i], v[i] = v[j], v[j] = x);
      return v;
  };
  
  app.get('/api/companies/:companyId/quizzes', function(req, res){
  
      var Query = Quiz.find({company:req.params.companyId});
      Query.populate('questions');
      Query.exec(function(err, docs){
          docs.forEach(function(doc) {
          doc.questions.forEach(function(question) {
              question.choices = shuffle(question.choices);
              })
          });
          res.json(docs);
      });
  
  });
  </code></pre>
  
  <p>My Question is :
  <strong>Could I randomize the <code>choices</code> array without looping through all documents as now I am doing?</strong></p>