Thanks for your reply znewsham.
For now, on server part, we create a array for each brand’s collection (invoice[brand] = connection) and on publish or method, we send brand as parameter to use corresponding collection.
BRANDS.forEach((brand) => {
const connectionUrl = BRAND_CONNECTION_URLS[brand.id]
const connection = new MongoInternals.RemoteCollectionDriver(connectionUrl)
const collection = new Mongo.Collection(collectionName, {
idGeneration: 'MONGO',
_suppressSameNameError: true,
_driver: connection,
})
FavoritesCollection[brand.id] = collection
})
It works, but we’re unable to use redis oplog. When we enable debug, it never change pubsub channel (only connected to last brand on startup array). But I am afraid that this is unmanageable with respect to performance.
publishComposite('allMyFavorites', ({ brand }) => {
return {
find: () => {
return FavoritesCollection[brand].find(
{ user: user._id },
{ sort: { createdAt: -1 } },
)
},
}
})
Cursor returned is not link to brand choice. If we debug with
console.log(FavoritesCollection[brand].find(
{ user: user._id },
{ sort: { createdAt: -1 } },
).fetch())
Here it return good result depend of brand sended.
We try with COLLECTION.configureRedisOplog, without success.
We’ve a meteor database, wich countains account & different global parameters, and one database for each brands (wich contains exactly same collections / fields on)
If someone have idea…