Creating object without key name – how is it possible? [duplicate]

In fullstackopen course in Part 4 I have encountered thing I dont understand.

https://fullstackopen.com/en/part4/user_administration#references-across-collections

How is it possible that object is created without the key name?

const passwordHash = await bcrypt.hash('sekret', 10)

const user = new User({ username: 'root', passwordHash })

User schema:

const userSchema = new mongoose.Schema({
  username: String,
  name: String,
  passwordHash: String,
  notes: [
    {
      type: mongoose.Schema.Types.ObjectId,
      ref: 'Note'
    }
  ],
})

I would imagine this should be done as below:

const passwordHash = await bcrypt.hash('sekret', 10)

const user = new User({ username: 'root', passwordHash: passwordHash })