title: How insert an object inside a document using Pymongo?
body: <p>I'm using Pymongo to manipulate a collection witch has a structure that looks like the following:</p>
  
  <pre><code>{
      Client1:{
          "_id" : "Client1"
          Project1:{
              Software1:{
                  language : "Python",
                  complexity : "Low"
              }
              Software2:{
                  language : "C#",
                  complexity : "Low"
              }
              Software3:{
                  language : "Java",
                  complexity : "Hard"
              }
          }
      }
  }
  </code></pre>
  
  <p>In this case, I tryed of many ways to Update the document <code>Client1</code> inserting a new <code>Software</code>, but I could not find a way or function to do this.</p>
  
  <p>So my question is: In this scope, how could I insert a new <code>Software</code> without exclude the existing items?</p>
  
  <p>Here is what I was trying but didn't worked:</p>
  
  <pre><code>client = "Client1"
  client = collection.find_one({"_id": client})
  
  project = "Project1"
  
  software = str(raw_input("Enter with the software to be added to project: "))
  
  language = str(raw_input("Enter with the software language: "))
  
  complexity = str(raw_input("Enter with the software complexity: "))
  
  collection.update({"_id" : client["_id"], }, {"$set" : {
                                                              client[project] : {software : {"language": language, "complexity" : complexity}}
                                                          }
                                                 })
  </code></pre>
  
  <p>The error that I got was: <code>unhashable type: 'dict'</code> in the line that contains <code>client[project] : {software : {"language": language, "complexity" : complexity}}</code></p>
  
  <p>Since now, thanks for your attention!</p>