title: Insert MongoDB document with React.js
body: <p>I was wondering if there's a way to insert documents into a MongoDB collection directly from a React component. </p>
  
  <p>My current personal project (for training purpose) is a little chat web application. So for example, when my user wants to post a new message in a room, the input component should look something like this:</p>
  
  <pre><code>var NewMessageInput = React.createClass({
    postMessage: function(value) {
      db.collection.insert({
        content: value
      });
    },
    render: function() {
      return (
        &lt;div&gt;
          &lt;input onSubmit={() =&gt; this.postMessage(value)}&gt;Type your message here&lt;/input&gt;
        &lt;/div&gt;
      );
    }
  });
  </code></pre>
  
  <p>I know how to get an app running with Express, React, and MongoDB but I'm only able to insert document with the mongo shell and querying them at the route loading. Plus, I would like to use only <code>react-router</code> for my routes and that's why I have this question.</p>