title: MongoDB $oid vs ObjectId
body: <p>I'm trying to get mongodb query working. Collection comes in the format:</p>
  
  <pre><code>{
  "_id": {
      "$oid": "54651022bffebc03098b4567"
  },
  "browser": "ie",
  "browser_version": "10.0 Desktop",
  "os_version": "8",
  "device": null,
  "os": "Windows"
  }
  </code></pre>
  
  <p>The following works:</p>
  
  <pre><code>{
      "_id": {
          "$in": [
              {
                  "$oid": "54651022bffebc03098b4567"
              },
              {
                  "$oid": "54651022bffebc03098b4568"
              }
          ]
     }
  }
  </code></pre>
  
  <p>However, I get a syntax error for the following:</p>
  
  <pre><code>{
      "_id": {
          "$in": [
              ObjectId("54651022bffebc03098b4567"),
              ObjectId("54651022bffebc03098b4568")
          ]
      }
  }
  </code></pre>
  
  <p>There are a similar questions that suggested that ObjectId should work: </p>
  
  <p><a href="https://stackoverflow.com/questions/17771297/how-to-create-query-with-objectids-using-java">How to create query with ObjectIds using java?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/9977499/all-parameter-in-mongodb-does-not-work-with-objectid-list">$all parameter in mongodb does not work with ObjectId list</a></p>