Created
October 3, 2017 14:13
-
-
Save kamiljozwik/977036aa5a173d1ed9785ee96c7a9f9f to your computer and use it in GitHub Desktop.
main.js file for Meteor server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Meteor } from 'meteor/meteor'; | |
import { collectionName } from '../../imports/collections/collectionName'; | |
Meteor.startup(() => { | |
// Place to generate data | |
// or Check to see if data exists in the collection | |
// or See if the collection has any records | |
// or ny other logic... | |
Meteor.publish('publicationName', function([arg]) { // arguments 'arg' is optional | |
return collectionName.find({}, { limit: arg }); // find everything, but limit to whatever passed to arg - optional | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bardziej skomplikowany publish:
Look at the
sharedWith
property, inside this property this should be an array and inside of this array do an$elemMatch
operation, where we want to find an element equal toemail
.Możemy mieć zdefiniowanych kilka publications w jednym pliku.