title: how to determine whether a field exists?
body: <p>I'm connecting to my <em>mongodb</em> using <em>pymongo</em>:</p>
  
  <pre><code>client = MongoClient()
  mongo = MongoClient('localhost', 27017)
  mongo_db = mongo['test']
  mongo_coll = mongo_db['test']   #Tweets database
  </code></pre>
  
  <p>I have a cursor and am looping through every record:</p>
  
  <pre><code>cursor = mongo_coll.find() 
  for record in cursor:    #for all the tweets in the database
      try:
        msgurl = record["entities"]["urls"]    #look for URLs in the tweets
      except:
        continue
  </code></pre>
  
  <p>The reason for the <code>try/except</code> is because if <code>["entities"]["urls"]</code> does not exist, it errors out. </p>
  
  <p><strong>How can I determine whether <code>["entities"]["urls"]</code> exists?</strong></p>