title: converting Mongoose returned array to regular JSON
body: <p>In a <code>Node.js</code> App, i want to fetch some data from database via <code>Mongoose</code>. i do it like this:</p>
  
  <pre><code>Users.find({_id:userID}).exec(function(err, users){
  
  });
  </code></pre>
  
  <p>because <code>users</code> is an Array like <code>Mongoose</code> object, i cant do this:</p>
  
  <pre><code>users.toJSON();
  </code></pre>
  
  <p>this works if i use <code>findOne</code> but right now doesn't work. also <code>users.toObject()</code> doesn't work and i get this error:</p>
  
  <pre><code>object has no method 'toObject'
  </code></pre>
  
  <p>if i use <code>lean()</code> in query like this:</p>
  
  <pre><code>Users.find({_id:userID}).lean().exec(function(err, users){
  
  });
  </code></pre>
  
  <p>this works but it has other problems. for example, if an array value has no value, instead of showing it like this:</p>
  
  <pre><code>myval:[]
  </code></pre>
  
  <p>doesn't show that key/value pair at all!! </p>
  
  <p>What i want is that i have to edit that users result and apparently, its <code>Mongoose</code> object and i cant. because of that i have to convert it to a regular <code>JSON</code> but how?</p>