title: Display all collections in mongodb+express
body: <p>This is my code for sending data to a database:</p>
  
  <pre><code>app.post('/thanks', function(req, res) {
    if (atendees.checkin === req.body.dbstring) {
      dbConn.then(client =&gt; {
        delete req.body._id;
        const db = client.db('mydata')
        db.collection(atendees.checkin).insertOne(req.body);
      })
  (...)
  </code></pre>
  
  <p>This is how I display on the page after clicking on a href link:</p>
  
  <pre><code>app.get('/view-feedbacks',  function(req, res) {
      dbConn.then(client =&gt; {
        const db = client.db('mydata')
        db.collection(atendees.checkin).find({}).toArray().then(function(feedbacks) {
              res.status(200).json(feedbacks);
              atendees.checkin = ' '
            }).catch(err =&gt; {
              throw(err);
            })
      });
  
  });
  </code></pre>
  
  <p>That works fine. How can I do something similar to display all collections from the database instead of just the individual ones?</p>
  
  <p>This is what I tried to do:</p>
  
  <pre><code>app.get('/view-history',  function(req, res) {
    dbConn.then(client =&gt; {
      const db = client.db('mydata')
      db.listCollections().toArray().then(function(collInfos) {
            res.status(200).json(collInfos);
            atendees.checkin = ' '
          }).catch(err =&gt; {
            throw(err);
          })
    });
  });
  </code></pre>
  
  <p>But it just gives me the name of each collection. I want to show all collections and all of their elements.</p>
  
  <p>Edit: my question is different from this one: <a href="https://stackoverflow.com/questions/24985684/mongodb-show-all-contents-from-all-collections">MongoDB Show all contents from all collections</a> .I'm trying to do this on express.js, not on the terminal</p>
  
  <p>Edit2: Using db.collection:</p>
  
  <pre><code>app.get('/view-history',  function(req, res) {
    dbConn.then(client =&gt; {
      const db = client.db('mydata')
      db.collections().then(function(feedbacks) {
            res.status(200).json(feedbacks);
            atendees.checkin = ' '
          }).catch(err =&gt; {
            throw(err);
          })
    });
  </code></pre>
  
  <p>But this gives the error: TypeError: converting circular structure to JSON</p>