how to add AND in .find in mongoose code example
Example 1: mongoose find() example
await MyModel.find({});
await MyModel.find({ name: 'john', age: { $gte: 18 } }).exec();
MyModel.find({ name: 'john', age: { $gte: 18 }}, function (err, docs) {});
await MyModel.find({ name: /john/i }, 'name friends').exec();
await MyModel.find({ name: /john/i }, null, { skip: 10 }).exec();
Example 2: mongoose select
query.select('a b');
query.select(['a', 'b']);
query.select({ a: 1, b: 1 });
query.select('-c -d');
const schema = new Schema({
foo: { type: String, select: false },
bar: String
});
query.select('+foo');
query.select({ a: 1, b: 1 });
query.select({ c: 0, d: 0 });