meteor-pages icon indicating copy to clipboard operation
meteor-pages copied to clipboard

Ability to publish composite?

Open jeffpatzer opened this issue 9 years ago • 5 comments

Hi there

Love the package. I'm trying to publish a list of items that have images tied to them. The images are in a FS collection (and such are separate from the items collection). According to auth docs, we should be able to publish an Array of cursors. However when I try to do that I get an error. Am I misunderstanding the docs? Or should you not be able to do

var itemsCursor = items.find({});
var imagesCursor = images.find({});
return [ itemsCursor, imagesCursor ]

error I get back is

Exception from sub pages_products id o24ydfdYKQtEck6kf TypeError: Object [object Object],[object Object] has no method 'observe'
    at Pages.__Pages.Pages.publish (packages/alethes:pages/lib/pages.coffee:566:16)
    at [object Object]._handler (packages/alethes:pages/lib/pages.coffee:138:20)
    at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1617:1)
    at [object Object]._.extend._runHandler (packages/ddp/livedata_server.js:950:1)
    at [object Object].MeteorX.Subscription._runHandler (packages/meteorhacks:unblock/lib/unblock.js:47:1)
    at [object Object].MeteorX.Session._startSubscription (packages/meteorhacks:unblock/lib/unblock.js:35:1)
    at [object Object]._.extend.protocol_handlers.sub (packages/ddp/livedata_server.js:582:1)
    at [object Object].MeteorX.Session.protocol_handlers.sub (packages/meteorhacks:unblock/lib/unblock.js:9:1)
    at packages/ddp/livedata_server.js:546:1

jeffpatzer avatar May 05 '15 23:05 jeffpatzer

+1

xpluscal avatar Oct 07 '15 12:10 xpluscal

+1

tangruixing avatar Dec 02 '15 04:12 tangruixing

+1

achirkof avatar Dec 29 '15 11:12 achirkof

+1

Siphion avatar Dec 30 '15 12:12 Siphion

+1

The offending code is: https://github.com/alethes/meteor-pages/blob/f666386d6c38397d745e4ecd0b616739171eb959/lib/pages.coffee#L621

else if _.isArray(r) and r.length is 2
          if _.isFunction r[0].fetch
            c = r

abhishekbatra avatar Mar 19 '16 16:03 abhishekbatra