Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circumventing hooks of CollectionFS #225

Open
GhassenRjab opened this issue Aug 6, 2017 · 2 comments
Open

Circumventing hooks of CollectionFS #225

GhassenRjab opened this issue Aug 6, 2017 · 2 comments

Comments

@GhassenRjab
Copy link

GhassenRjab commented Aug 6, 2017

Based on #84 I could add hooks to CollectionFS

Attachments = new FS.Collection('attachments', ...);
Attachments.files.before.insert((userId, doc) => {});

Now, in some cases, I need to directly insert attachments without calling any hooks using direct.
I first tried this instruction :

Attachments.direct.insert(attachment, () => {});

But it raised an exception Cannot read property 'insert' of undefined.
And then tried this :

Attachments.files.direct.insert(attachment, () => {});

No exceptions were raised but the file was not added.
Is there any way I can use direct and avoid CollectionFS hooks?

@xet7
Copy link

xet7 commented Aug 12, 2017

@GhassenRjab

When you get exception, does it mention where in CollectionFS code (file and line of code) it happends? It could be possible to add some option to bypass that hook.

Other alternatives:

  1. When looking at repo network
    https://github.com/matb33/meteor-collection-hooks/network

There is this code error try-catch code, I'm not sure is it related in any way:
lawrentiy@0189c25

  1. Look at what would it take to replace CollectionFS
    Replace CollectionFS with meteor-file-collection wekan/wekan#875

@zimme
Copy link
Member

zimme commented Aug 12, 2017

If any fixes are needed to resolve this I'm happy to accept a PR.
I don't have time to look into this issue, but If I do I'll let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants