title: MongoDB/C++ - Convert string into BsonElement
body: <p>I have a MongoDb Database. A process is writing into a collection something like this:</p>
  <pre><code>{ &quot;_id&quot; : ObjectId(&quot;4d773fdbe916004e36de5c55&quot;), &quot;worker&quot; : [ &quot;172.27.93.231&quot;, &quot;172.27.93.232&quot; ], &quot;lock&quot; : [ &quot;172.27.93.230&quot;, &quot;172.27.93.232&quot; ] }
  </code></pre>
  <p>After that my C++ process get this document.</p>
  <p>Now I want that C++ process to add the IP address to the lock field. The other address should stay there too. I have to get the IP addresses which are in this Field. So I created a vector which will filled with them. Looks like this:</p>
  <pre><code>mongo::BSONElement helping = task.getField(&quot;lock&quot;);
  vector&lt;mongo::BSONElement&gt; vectorhelp  = helping.Array();
  </code></pre>
  <p>But how it is possible to write the vector and the new IP address back in the lock field.</p>