title: mLab REST API - Query by string
body: <p>I recently set up a new database/collection with a simple Json document on mLab. I enabled the data API and am experimenting with filtering the results via the query parameter. The complete document is too large to host within my app, unfortunately.</p>
  
  <p>Here is what the document looks like:</p>
  
  <pre><code>{
      "_id": {
      "$oid": "5c59f496hv7ec06f4f560f4c"
      },
      "songs": [
          {
              "title": "title 1",
              "artist": "musician 1",
              "album": "fake album",
              "minsec": "2:04",
              "songid": "11100"
          },
          {
              "title": "fake title",
              "artist": "musician 1",
              "album": "album 2",
              "minsec": "2:57",
              "songid": "11102"
          },
          {
              "title": "title 3",
              "artist": "musician 2",
              "album": "album 3",
              "minsec": "3:06",
              "songid": "11078"
          },
          {
              "title": "title 4",
              "artist": "fake musician",
              "album": "album 4",
              "minsec": "2:28",
              "songid": "11103"
          }
      ]
  }
  </code></pre>
  
  <p>I would love to be able to search the document with a string that would return any object from the array that has a value that includes that string. For example, searching for 'fake' which would return the first, second and fourth object with the following url: </p>
  
  <pre><code>https://api.mlab.com/api/1/databases/&lt;my-db&gt;/collections/&lt;my-collection&gt;?q=fake&amp;apiKey=&lt;my-apikey&gt;
  </code></pre>
  
  <p>It appears that mLab's data API only processes queries("q=") using json notation, and even knowing that I still can't figure out how to return anything other than an empty array or a </p>
  
  <p>"Could not parse JSON parameter, please double-check syntax and encoding"</p>
  
  <p>error.</p>
  
  <p>Thanks for any help you guys can offer!</p>
  
  <p><strong>Update</strong> I inserted each song object as an individual document, rather than a single large document, and can filter them using using specific queries...still unsure of how to implement a more wildcard solution to filtering results with values that include/contain the query.</p>
  
  <p>For anyone seeking assistance with mlab related issues, I would suggest reaching out to their very helpful support team.</p>
  
  <p><strong>Final Update</strong> I figured out how to use regex to filter my results satisfactorily:</p>
  
  <p><code>{$regex: '(?i).*&lt;string&gt;.*'}</code></p>