title: mongoose .find() method returns object with unwanted properties
body: <p>so, I've been working with mongoose for some time and I found some really weird stuff going on. It would be great if someone could enlighten me.</p>
  
  <p>The thing is, when using the .find() method of mongoose, the object I get as response is full of properties I don't know where It came from (I'm guessing they are built-in properties, but whatever) and I want to iterate only through the properties I .select(). Got it? No? ok... explaining better:</p>
  
  <p>I have my schema and model declared:</p>
  
  <pre><code>var mySchema = mongoose.Schema({
    name: String,
    prop1: String,
    prop2: String,
    prop3: String
  })
  var myModel = DB.model('myDataBase', mySchema)
  </code></pre>
  
  <p>Then I want to find a document with the name, let's say, John and retrieve all but the 'name' field, so I go:</p>
  
  <pre><code>myModel.find({name: 'John'}, '-name', function(err, results){
    log(results[0])
  }
  </code></pre>
  
  <p>and log(results[0]) logs</p>
  
  <pre><code>{ prop1: 'one',
    prop2: 'two',
    prop3: 'three' }
  </code></pre>
  
  <p>So far, so good. But the problems is, now I want to iterate through these properties and check one by one, and I don't know for sure how many 'props' each result will have, so I wanted to do something like:</p>
  
  <pre><code>for(var key in results[0]){
    log(key)
  }
  </code></pre>
  
  <p>So, I'm hoping it will log 'prop1', 'prop2' and 'prop3', but no! Ok, I get props 1, 2 and 3, but also I get a lots of other properties and functions like: isNew, error, _maxListeners, _doc, etc. Not only these extras properties, I also get the 'name' property, the one I excluded from the selection (and it was excluded, like shown in the first log). Weird huh? </p>
  
  <p>But wait! There's more! I've searched online and found some people saying "Dude, when iterating through object properties use the hasOwnProperty method!". So there I went:</p>
  
  <pre><code>for (var key in results[0]){
    if (results[0].hasOwnProperty(key)) log(key)
  }
  </code></pre>
  
  <p>the log result is a few properties (to be specific: $__, isNew, error, _maxListeners, _doc, _pres, _posts, save, _events) and doesnt include any of the props I wanted in the first place.</p>
  
  <p>My question is, how can I iterate through only prop 1, 2 and 3, excluding these, I don't know, built-in properties and the one I explicitly excluded in the parameters? (ps: I was thinking of a solution that doesnt involve having to convert my object into an array, if thats possible)</p>
  
  <p>Also, not a question per se, but for curiosity, where does these properties come from? Why do they appear in the for loop and not when I log the object? Why the property I excluded ('-name') also appears in the for loop? What the hell is hasOwnProperty for if it doesnt recognize the properties that were just logged?</p>
  
  <p>Thanks for your time and help!
  Bye!</p>