mongoose.Types.ObjectId adalah ObjectId fungsi konstruktor, yang ingin Anda gunakan dalam definisi skema adalah mongoose.Schema.Types.ObjectId (atau mongoose.Schema.ObjectId ).
Jadi deviceSchema seharusnya terlihat seperti ini:
var deviceSchema = schema({
name : String,
type : String,
room: {type: mongoose.Schema.Types.ObjectId, ref: 'Room'},
users: [{type:mongoose.Schema.Types.ObjectId, ref: 'User'}]
});