title: Search for string or number in field
body: <p>I have about 200k documents in a MongoDB collection and I need to get only the documents that has specific contents.</p>
  
  <p>For example, </p>
  
  <pre><code>{
    "_id": ObjectID("593ddb4f02a8b0e23446ad65"),
    "instance_id": "166143",
    "json": {
      "o": {
        "2": [9]
      }
    }
  }
  </code></pre>
  
  <p>I want to get documents that have 9 in json.o.2 but the problem is, json.o.2 can be an object, it can be a string &amp; also an integer for example I wanna get all these ones</p>
  
  <pre><code>"2": [9]
  ...
  "2": 9
  ...
  "2": "9"
  ...
  "2": ["9"]
  </code></pre>
  
  <p>I tried to use regex but it didn't work</p>
  
  <pre><code> 'json.o.2': { '$regex': /^(\[?)(.*)(,?)("?)9("?)(,?)(.*)(\]?)$/i } 
  </code></pre>
  
  <p>I also need to get all documents that don't contain a specific number, I use regex too for that case but it don't work too </p>
  
  <pre><code>'json.o.2': { '$regex': /^([?)([^3]*)(,?)("?)([^3]*)("?)(,?)([^3]*)(]?)$/i } 
  </code></pre>