Publications and Data Loading

This is the comment thread for an article in the Meteor Guide.

Read the article: http://guide.meteor.com/data-loading.html

The comment thread for each article appears at the very bottom of the page. Use this thread to post:

  1. Interesting articles related to the content
  2. New ways to do things that aren’t covered in the Guide
  3. Suggestions for Guide improvements

Or anything else related to this topic that people could find useful!

ESLint is throwing meteor/audit-argument-checks “is not checked” when I use SimpleSchema to validate the arguments to the publication. Is there a way to have ESLint recognize that SimpleSchema is indeed checking the values?

Here’s my code:

/* eslint-disable prefer-arrow-callback */
import { Meteor } from 'meteor/meteor';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { Comments } from '../comments';

Meteor.publish('comments', function(limit, projectId) {
  new SimpleSchema({
    limit: { type: Number },
    projectId: { type: String },
  }).validate({ limit, projectId });
  return Comments.find({ projectId }, { limit: limit || 10, sort: { createdAt: -1 } });
});
1 Like

For anyone trying to figure out the low level API, Matt Debergalis posted a really nice explanation on SO that makes it very simple to reason out.

Have a question regarding publish Meteor.publish(‘todos.inList’, function(listId, limit)
So, say I call it twice, first time limit is 100 and second time limit is 200. Will server really query 200 items for the second time? If yes, wouldn’t it cause performance issue?