[mongoose] how does populate relate to a non-_ id field?

new Schema({
    pid: {type: String, ref:  "product" },
    sid: {type: String, ref:  "sale" },
}));

suppose there are product and sale two collections

pid and sid both specify user_id of the product and sale collections instead of _ id

padding with populate always associates pid with the _ id of product, and then cannot be queried

is there any way that pid and sid specify user_id instead of _ id

seek the answer of the Great God

Mar.20,2021
Menu