Mongoose: why is $addtoset adding incorrect ObjectId

I'm trying to use mongoose to add an item to an array of ObjectId's - I'm using $addtoset because I only want the item to be added if it doesn't already exist.

I'm getting very strange behaviour however. $addtoset is appending an objectId to the array, but it's not the one that I'm passing to it.

I've removed everything else from my code to try and narrow this down, and now that the method is as simple as below, it is still happening.

userSchema.statics.addPlaylistToUser = function(user, playlistId, done){

    var toss =  playlistId.toString(); //I verify at this point the playlistId is correct, eg. ObjectId("53cf855ac551004417e54da2") 

    User.findByIdAndUpdate(
        user._id,
        {$addToSet: {playlists: playlistId } },
        {safe: true, upsert: false},
        function(err, model) {
//at this point, an object Id has been added to the array, but it is not the same as verified above, the objectid added is eg. ObjectId("53cf8572c551004417e54da4")
                done(err, model);
        })
    }

Interestingly, the ObjectIds are consistently almost the same, suggesting that the new id is generated immediately after the one that I'm actually adding. The example objectid's above are actual examples from running the code.

This method is being called in the callback from a method which actually generated the ObjectId I'm trying to add ... is my issue related to that perhaps?

Any help/ideas on why this might be happening would be much appreciated.

I found this similar question on SO, but their solution seems very specific to their situation, I wasn't able to get any ideas from the answer there...

According to API doc, the property 'new' in options field needs to be true for returning modified document. Otherwise, it returns original document by default.

http://mongoosejs.com/docs/api.html#model_Model.findByIdAndUpdate