title: NodeJS view results of mongoDB insert
body: <p>I'm trying to learn nodeJS in combination with mongoDB. I'm using the expressJS framework for routing. I've created a connection to a local database and inserting some rows by using the following code. </p>
  
  <pre><code>var MongoClient = require('mongodb').MongoClient,
  url = 'mongodb://localhost:27017/sssdb';
  
  MongoClient.connect(url, function (err, db) {
      if (err) {
          console.log('Unable to connect. Error:', err);
      } else {
          console.log('Connected to:', url);
  
          var defaultRows = [{'naam':'Test user 1'}, {'naam':'Test user 2'}];
          insertRows(db, 'clients', defaultRows, function(defaultResults) { 
              console.log(defaultResults);
  
              // Close after insert
              db.close();
          });
      }
  });
  
  
  function insertRows(db, collectionName, data,cb) {
      var collection = db.collection(collectionName);
      collection.insert(data, function(err, res) {
          if (err) {
              console.log(err);
          } else {
              console.log('Inserted into ' + collectionName);
              cb(res);
          }
      });
  }
  </code></pre>
  
  <p>In my terminal I'm running <code>node app.js</code> and in an another window a <code>mongod</code> shell in the same system map. Everything seems to run fine and my terminal logs:</p>
  
  <pre><code>Connected to: mongodb://localhost:27017/sssdb
  Inserted into clients
  { result: { ok: 1, n: 2 },
    ops: 
     [ { naam: 'Test user 1', _id: 565570547d27dc440284602d },
       { naam: 'Test user 2', _id: 565570547d27dc440284602e } ],
    insertedCount: 2,
    insertedIds: [ 565570547d27dc440284602d, 565570547d27dc440284602e ] }
  </code></pre>
  
  <p>Maybe I'll misunderstood mongoDB documentation, but I would like to see the results of above insert in a table view or something (like phpMyAdmin for mySQL). Is something possible for mongoDB? I couldn't find anything about this. </p>
  
  <p>I was also wondering if the insert is running every time I'll open my application and a connect to mongoDB is made?!</p>
  
  <p>Thanks :)</p>