LearnBoost/mongoose — Issue #616: Schema with 'id' field (in addition to '_id') breaks Populate
Author: jmanero
Created: 2011-11-17 00:50:46+00:00
State: open

Calling `B.find({}).populate('someField').run(...);` with the following schema set will cause `someField` to be returned as an empty array regardless of it's contents on the database:

```javascript
var a = new Schema({
name : String,
id : String,
...
});

var b = new Schema({
name : String,
...,
someField : [{
type: Schema.ObjectId,
ref : 'A'
}]
});

var A = model('A', a);
var B = model('B', b);

```

Removing the 'id' field from schema `A` fixes the problem. I realize that it was poor form on my part to have a field called `id` in my schema, and that this probably isn't an issue that should be addressed. I'd just like to spare the next poor soul to stumble across this problem a few hours of hair pulling.