JSON reader was expecting a value but found 'function'
<p>I have a collection that contains BsonJavascript object.</p>

<pre><code>{ 
    "Name" : "HourlyMP", 
    "MapFunction" : function(){
        var _id = this.srcip + " - " + this.hour
        var valueData = {
            ip: this.srcip,
            session: 1
        }
        emit(_id, valueData);
    } 
}
</code></pre>

<p>As you see the value of "MapFunction" field is BsonJavascript. I can Export and Import this data successfully. But when I Deserialize exported json into BsonDocument i get this error:</p>

<pre><code>JSON reader was expecting a value but found 'function'
</code></pre>

<p>By the way i am using official C# 2.2 driver and my deserialize code is below:</p>

<pre><code>BsonSerializer.Deserialize&lt;BsonDocument&gt;(myjsonstring)
</code></pre>

<p><strong>Edit</strong></p>

<p>I defined function as string then converted it to BsonJavascriptFunction inside my code. This solved my problem. Thanks for reply</p>