I have an issue.
I should use mongoose find() method some queries. While using find() method, when i giving filter; find method() works but it doesnt give me value/values.
const messages = await MessageSchema.find({sessionId: sessionId}, {__v: 0, _id: 0, updatedAt: 0}).exec();
Above code is my find method. This code give me as value, empty array. []
But in this code,
const messages = await MessageSchema.find({}, {__v: 0, _id: 0, updatedAt: 0}).exec();
give me an array and all of messages is in the array.
But i should use filtering.
This is my message Schema.
const mongoose = require('mongoose');
var schema = new mongoose.Schema({
participant_name: {type: String},
message: {type: String},
sessionId: {type: String},
participantId: {type: Object}
}, {
timestamps: true
});
module.exports = mongoose.model("Message", schema)
Could you help me pls.