Prerequisites
Mongoose ^7.0.3
Node.js ^22
Issue
Hi!
There is one query that looks like this:
const readPreference = 'secondaryPreferred';
const getItems= Vendor.find(filter, {
name: 1
})
.read(readPreference)
.populate('populateItems');
...
await getItems.exec();
There is another query that looks like this
const readPreference = 'secondaryPreferred';
const getItems= Vendor.find(filter, {
name: 1
})
.populate('populateItems');
...
await getItems.read(readPreference).exec();
Interesting but in the first case both queries are run on secondary, while in second case in mongoose logs with enabled debug i see that only Vendor.find is run on secondary, while .populate('populateItems') is run on primary.
Is it expected documented behavior that i missed or a bug?
Prerequisites
Mongoose ^7.0.3
Node.js ^22
Issue
Hi!
There is one query that looks like this:
There is another query that looks like this
Interesting but in the first case both queries are run on secondary, while in second case in mongoose logs with enabled debug i see that only Vendor.find is run on secondary, while .populate('populateItems') is run on primary.
Is it expected documented behavior that i missed or a bug?