If I have a collection defined as,
const userSchema = new mongoose.Schema({
username: {
type: String,
required: true
},
password: {
type: String,
required: true
},
How can I query for all documents, but replace every password into asterisks?
Something like,
const users = await User.find({
password: password.replace(/./gi, '*');
})
Is this possible?