Meteor collection hook direct not working #147

Hello, I’m going to talk about a bug we noticed. We use priority redis oplog and we don’t have the problem when we don’t use it. During the use of meteor-collection-hook with publishComposite, we enter the before hook in the collection queries we make with direct and our queries do not work correctly.


    children: [
        find(session) {
          return{ _id: session.channelId });

Normal publish works correctly:

Meteor.publish('name', function () {
  return{  _id: session.channelId })

I’m open to any help and ideas. Thank you so much.

I’m having trouble understanding what is meant here. Could you please explain?

I apologize for my English. While using “direct” to query without going into the “before” and “after” hooks that we set while using meteor-collection-hook, the “before” hook is also entered.

Re: Meteor collection hook direct not working · Issue #147 · Meteor-Community-Packages/meteor-publish-composite · GitHub

If I understand correctly,

When you use without specifying the life cycle hook, you get expected behavior.

But when you try to do the same thing in with publishComposite using the .before hook, it fails.

Is that right?

If so, what is the expected behavior and what do you see?

Namely, I have a “softRemove” package that I wrote myself. Soft remove adds “removedAt” to the removed data. I use to bypass this.

The sample code of the package is below.

export const name = 'soft-remove';
import { checkNpmVersions } from 'meteor/tmeasday:check-npm-versions';

  'simpl-schema': '1.12.0'
}, 'bordo:soft-remove');

const SimpleSchema = require('simpl-schema');

const _schema = new SimpleSchema({
  removedAt: {
    denyInsert: true,
    optional: true,
    type: Date

const _beforeFindHook = function (_userId, _selector, _options) {
  _selector.removedAt = { $exists: false };

Mongo.Collection.prototype.softRemovable = function () {
  const collection = this;

  collection.softRemove = function (selector) {
    collection.update(selector, {
      $set: {
        removedAt: new Date()
    }, { multi: true });