Working with embedded documents in Typescript

Mongoose is doing that, not mongo.

When you update with

You basically say set the field product of the root document to the object {type:Vegetable}.

When you update with

You basically say set the field type of the sub-object product.

Both type of updates are needed for different use-case.

For

see Find - $text search with $or + other optional values - #2 by steevej