Food Schema
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const foodSchema = new Schema({
foodName: {
type: String,
required: true
},
price: {
type: String,
required: true
},
offerPrice:{
type: String,
required: true
},
shopName: {
type: String,
required: true
}
});
module.exports = mongoose.model('Food', foodSchema);
how to select the foods where food.price>food.offerPrice "price": { $gt: 100} this selects the food where the price is greater than 100 but i need to compare two values defined in schema "price": { $gt:offerPrice } is invalid syntax