Find an element in an array and save its ID to a variable with Mongoose

How do I find and element in an array and save its ID in a variable? I already know how to find the element in array. All I need now is how to save its ID in a variable.

Here's the Mongoose Schema

    var dummySchema = new mongoose.Schema({
    courseName: String,
    data: [
        {
            dummyData: String,
        }
    ]
});

And here's the find function

subjectsModel.find({"data.dummyData": "hello"}, function(err, doc){
      //save the found element's ID to variable x
      console.log(x);
});