diff --git a/lib/processors/getStrategy.js b/lib/processors/getStrategy.js index 6170e3b1..f05deb88 100644 --- a/lib/processors/getStrategy.js +++ b/lib/processors/getStrategy.js @@ -1,5 +1,21 @@ import { Strategy } from '../constants'; +function canUseDedicatedChannels(selector) { + if (!selector || !selector._id) { + return false; + } + + if (typeof selector._id === 'string') { + return true; + } + + if (typeof selector._id === 'object' && '$in' in selector._id) { + return true; + } + + return false; +} + /** * @param selector * @param options @@ -15,7 +31,7 @@ export default function getStrategy(selector = {}, options = {}) { return Strategy.LIMIT_SORT; } - if (selector && selector._id) { + if (canUseDedicatedChannels(selector)) { return Strategy.DEDICATED_CHANNELS; }