Skip to content

Instantly share code, notes, and snippets.

@svasva
Created February 21, 2013 12:55
Show Gist options
  • Save svasva/5004557 to your computer and use it in GitHub Desktop.
Save svasva/5004557 to your computer and use it in GitHub Desktop.
Meteor.publish 'bike', (id) ->
Meteor.publishWithRelations
handle: @
collection: Bikes
filter: id
mappings: [
key: 'userId'
options: { fields: config.users.publicFields }
collection: Meteor.users
,
reverse: true
key: 'bikeId'
collection: Pictures
,
reverse: true
key: 'bikeId'
collection: Comments
options: {sort: {createdAt: -1}}
mappings: [
key: 'userId'
collection: Meteor.users
options: { fields: config.users.publicFields }
]
,
reverse: true
key: 'bikeId'
collection: BikeParts
mappings: [
key: 'partId'
collection: Parts
mappings: [
key: 'typeId'
collection: PartTypes
,
key: 'vendorId'
collection: PartVendors
]
,
key: 'userId'
collection: Meteor.users
options: { fields: config.users.publicFields }
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment