_id get converted from ObjectId to string in MEAN application
<p>I have a MEAN stack application.</p>

<p>In my database, a document has a mongo ObjectId like such : </p>

<pre><code>{ "_id" : ObjectId("57e15b1009cb82cafafafd73"), "name" : "Hello", "artist_id" : "world", "year" : "2000" }
</code></pre>

<p>But when I load the document in my front end, the _id gets converted to a string, and my object looks like this when logged in the browser:</p>

<pre><code>{ "_id" : "57e15b1009cb82cafafafd73", "name" : "Hello", "artist_id" : "world", "year" : "2000" }
</code></pre>

<p>What is annoying is that when I want to modify my database from my front end (update or delete an existing document), I have to convert the _id from string to ObjectId in order to target the document in my database...
So in my node application, I have to systematically massage the _id with <code>new ObjectId(stringId)</code> because the Id's sent by the browser are strings...</p>

<p>Obvisouly I'm missing out on something.
How can I make things more elegant ?</p>