Query javascript collection with same syntax as MongoDB
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/8695718/is-there-a-way-to-use-mongodb-query-objects-to-filter-regular-javascript-arrays">Is there a way to use MongoDB query objects to filter regular JavaScript arrays?</a>  </p>
</blockquote>



<p>So I have an array of objects stored in javascript, and I want to query that array of objects using the same type of syntax you would you in MongoDB.</p>

<p>For example</p>

<pre><code>var collection = [
{color:'blue', name:'obj1'},
{color:'green', name:'obj2', size:3},
{color:'red', name:'obj2', size:4}
]
</code></pre>

<p>I would like to do something like,</p>

<pre><code>doQuery(collection, query, function(result_array){...});
</code></pre>

<p>where the query could be any of the following</p>

<pre><code>var query = {color:'blue'}
var query = { $or :[color:'blue', size: {$gt: 3}] }
</code></pre>

<p>Are there any libraries that are like this?</p>
