I have a CosmosDB collection called plotCasts, which has objects that look like this:
{
...
"owner" : "winery",
"grower" : "Bill Jones",
...
}
I have the following Mongoose schema:
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const plotCastSchema = new Schema({
owner: String,
grower: String,
...
});
const ModelClass = mongoose.model('plotCast', plotCastSchema);
module.exports = ModelClass;
However, when I query the database using the query below, I get an empty array for a result. Any idea why?
PlotCast.find({ owner: 'winery' }).lean().exec(function(err, results) {
if (err) {
res.send(err);
} else if (!results) {
res.send(null);
} else {
res.send(results);
}
});