I’ve been trying to query my database for a specific array element thats contained inside a user model, the schema looks a bit like this:
const schemaUser = new mongoose.Schema({
username: { type: String, required: true, unique: true },
email: {type: String, unique: true},
password: { type: String, required: true},
accounts: [{
id : String,
account_name : String,
name : String,
password : String,
description: String
}]
});
How could I go about selecting a specific account out of the “accounts” array using its custom id shown (not the Mongodb one) that is also contained inside a specific users object?
Cheers.