Skip to content
This repository has been archived by the owner on Mar 14, 2019. It is now read-only.

Failing to remove file #1027

Open
bvanderdrift opened this issue Mar 7, 2018 · 0 comments
Open

Failing to remove file #1027

bvanderdrift opened this issue Mar 7, 2018 · 0 comments

Comments

@bvanderdrift
Copy link

bvanderdrift commented Mar 7, 2018

Dear CollectionFS team.

We have been using your package to store rendered PDF's on the server. Currently we're implementing an extremely basic function to remove those PDF's. The code is as simple as this: (it is an automated test).

let existDoc = FileCollection.findOne(fileID);
if(!existDoc) throw Error("File did not exist");

FileCollection.remove(fileID);
let goneDoc = FileCollection.findOne(fileID);

if(goneDoc) throw Error("Failed to remove file with ID: " + fileID);

This keeps on throwing Failed to remove file.... Remember: the findOne call is successful. We have tried:

  • Printing the result of remove (should be the amount of docs removed): undefined
  • Giving a fake ID: no errors, also returns undefined
  • Passing {_id: fileID} as selector.
  • Passing existDoc as selector: throws cannot remove file belongs to: "docs" not: "cfs.docs.filerecord"
  • Setting both allow and deny props, or just one of them. Nothing changes (but the allow and deny do get set, download stops working if we remove allow).
  • Tried setting a callback. Callback is never called, either with success or fail.
  • Used both GridFS and Filesystem
  • I even tried calling FileCollection.remove({}) and got Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters

This code is server-side and the collection is not available client side, purely on the server.

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

No branches or pull requests

1 participant