title: Should I return an array or data one by one in Mongoose
body: <p>I have this simple app that I created using IOS, it is a questionnaire app, whenever user clicks play, it will invoke a request to node.js/express server </p>
  
  <p><a href="https://i.stack.imgur.com/sY6Vk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sY6Vk.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/4pC6v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4pC6v.png" alt="enter image description here"></a></p>
  
  <p>Technically after a user clicks an answer it will go to the next question</p>
  
  <p><a href="https://i.stack.imgur.com/x0ROF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x0ROF.png" alt="enter image description here"></a></p>
  
  <p>I'm confused to use which method, to fetch the questions/question</p>
  
  <ol>
  <li>fetch all the data at once and present it to the user - which is an array</li>
  <li>Fetch the data one by one as user progress with the next question - which is one data per call</li>
  </ol>
  
  <p>API examples</p>
  
  <pre><code>// Fetch all the data at once
  app.get(‘/api/questions’, (req, res, next) =&gt; {
    Question.find({}, (err, questions) =&gt; {
      res.json(questions);
    });
  });
  
  // Fetch the data one by one
  app.get('/api/questions/:id', (req, res, next) =&gt; {
    Question.findOne({ _id: req.params.id }, (err, question) =&gt; {
     res.json(question);
    });
  });
  </code></pre>
  
  <p>The problem with number 1 approach is that, let say there are 200 questions, wouldn’t it be slow for mongodb to fetch at once and possibly slow to do network request</p>
  
  <p>The problem with number 2 approach, I just can’t imagine how to do this, because every question is independent and to trigger to next api call is just weird, unless there is a counter or a level in the question mongodb.</p>
  
  <p>Just for the sake of clarity, this is the question database design in Mongoose</p>
  
  <pre><code>const mongoose = require('mongoose');
  const Schema = mongoose.Schema;
  
  const QuestionSchema = new Schema({
      question: String,
      choice_1: String,
      choice_2: String,
      choice_3: String,
      choice_4: String,
      answer: String
  });
  </code></pre>