title: Insert data into with pymongo and flask
body: <p>when i click on submit button i get an error which says:</p>
  
  <blockquote>
    <p><em>"TypeError: 'Collection' object is not callable. If you meant to call the 'insert' method on a 'Database' object it is failing because no such method exists."</em></p>
  </blockquote>
  
  <p>here is my signin.py code :</p>
  
  <pre><code>from flask import Flask, request, render_template
  from pymongo import MongoClient
  
  @app = Flask(__name__)
  connection = MongoClient()
  db = connection.project #database name.
  collection = connection.signup # collection name.
  
  @app.route('/signin/')
  def index_show():
       return render_template('signin.html')
  
  @app.route('/signin/', methods = ['POST'])
  def signup_form():
     username = request.form['user']
     passowrd = request.form['pass']
     collection.insert({'user': username, 'passoword': passowrd})
  
  if __name__ == '__main__':
     app.run(debug = True)
  </code></pre>
  
  <p>my html file code is here : </p>
  
  <pre><code>  &lt;!DOCTYPE html&gt;
   &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
       &lt;form method="post" action="."&gt;
         &lt;input type="text" name="user" /&gt;&lt;br/&gt;&lt;br/&gt;
         &lt;input type="password" name="pass" /&gt;&lt;br/&gt;&lt;br/&gt;
         &lt;input type="submit" name="submit" /&gt;&lt;br/&gt;&lt;br/&gt;
       &lt;/form&gt;
   &lt;/body&gt;
  </code></pre>
  
  <p></p>