Populate nesting usage of mongodb

has the following two Model

(1) user Model

var usersSchema = new Schema({
    f_id: {
        unique: true,
        type: String
    },
    f_name: String
})

(2) record Model

var batchMainSchema = new Schema({
        f_id: {
            unique: true,
            type: String
        },
        f_user_log: [{
            f_option: String,
            f_time: Date,
            f_user_model: { type: Schema.Types.ObjectId, ref: "users" },
        }]
    })

user action records need to be saved in the f_user_log field in the record Model

can you get the value of f_user_model when querying record data

?

the writing method in the following figure can not get the desired user information

clipboard.png

do you have any corresponding solutions? thank you!

Mar.10,2021

populate cannot, use aggregate .


.populate ({path: 'fame username log. Fancy username model'})

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9d707-4771e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9d707-4771e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?