title: Querying "like" in pymongo
body: <p>I have researched this but can not find why what I am trying is not working, and will warn that I am somewhat new to python and very new to mongodb. I have a mongo database of tweets in JSON which I am trying to query through Python and pymongo. I want returned the 'text' and 'created_at' fields for all tweets that contain "IP".</p>
  
  <p>I have tried the following, which works perfectly when I do this through the terminal:</p>
  
  <pre><code>db.tweets.find({text:/IP/},{text:1,created_at:1})
  </code></pre>
  
  <p>In Python, after experimenting I have found that I need to put the field names between quotes. I have gotten the following similar query to work:</p>
  
  <pre><code>cursor = db.tweets.find({'created_at':"Thu Apr 28 09:55:57 +0000 2016"},{'text':1,'created_at':1})
  </code></pre>
  
  <p>But when I try: </p>
  
  <pre><code>db.tweets.find({"text": /.*IP.*/},{'text':1,'created_at':1})
  </code></pre>
  
  <p>or </p>
  
  <pre><code>cursor = db.tweets.find({'text':/IP/},{'text':1,'created_at':1})
  </code></pre>
  
  <p>I get a </p>
  
  <pre><code>'SyntaxError: invalid syntax' at the "/IP/" part of the code.
  </code></pre>
  
  <p>I am using mongo 3.4.6 and python 3.5.2</p>