mongoose.Types.ObjectId ObjectIdです コンストラクター関数。スキーマ定義で使用するのはmongoose.Schema.Types.ObjectIdです。 (またはmongoose.Schema.ObjectId 。
したがって、deviceSchema 代わりに次のようになります:
var deviceSchema = schema({
name : String,
type : String,
room: {type: mongoose.Schema.Types.ObjectId, ref: 'Room'},
users: [{type:mongoose.Schema.Types.ObjectId, ref: 'User'}]
});