title: CosmosDB - Invalid BSON field name 'places.$id'
body: <p>I'm using Azure CosmoDB on MongoDB document model and I face odd behavior on updating some documents using <a href="https://docs.mongodb.com/manual/reference/database-references/#dbref-explanation" rel="nofollow noreferrer">DBRefs $id</a></p>
  
  <p>Take look this script sample:</p>
  
  <pre><code>original_id = ObjectId()
  
  db.places.insert({
      "_id": original_id,
      "name": "Broadway Center",
      "url": "bc.example.net"
  })
  
  db.people.insert({
      "name": "Erin",
      "places":{"$ref":"places","$id": original_id},
      "url":  "bc.example.net/Erin"
  })
  
  db.people.find({"places.$id": original_id}) //works like charm
  db.people.update({"places.$id": original_id}, {$set:{"NEW_FIELD": false}}, {multi:true}) //doesn't works =/
  </code></pre>
  
  <p>Then return:</p>
  
  <pre><code>Failed to execute script.
  
  Error: Error: error: {
      "_t" : "OKMongoResponse",
      "ok" : 0,
      "code" : 2,
      "errmsg" : "Invalid BSON field name 'places.$id'",
      "$err" : "Invalid BSON field name 'places.$id'"
  } :
  DBCollection.prototype.update@src/mongo/shell/collection.js:589:23
  @(shell):1:1
  </code></pre>
  
  <p>I'm really appreciate if someone have a clue whats going on.</p>