v3.8.6, population's "-_id" not work as expected, it returns _id:undefined #1922

zhujj2008 opened this Issue Feb 7, 2014 · 0 comments


None yet
1 participant

I believe the schema declaration is right.

var username = validator.toString(msg.name).trim();
    db.User.findOne({name: username})
        path :'friends',
        select : 'name'
      }).exec(function (err, user) {
  friends: [ { _id: 52f35a399a2fab32699ab8fe, name: '6' } ],

I want only 'name' return, so change the select condition as doc says:

        select : 'name -_id'

but the return is:

  friends: [ { _id:undefined, name: '6' } ],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment