I think its reasonable to switch from Random.id() to _id as a part of the insert callback.
https://github.com/VeliovGroup/Meteor-Files/blob/master/files.coffee#L1412
Moreover, it should be noted that fileRef in the callback of addFile is not the inserted document like described in https://github.com/VeliovGroup/Meteor-Files/blob/dd59d886db69e8d74db3ebb5e1c7bde74f0b64c9/docs/addFile.md
callback {Function} - Triggered after new record is added to Collection. With error, and fileRef, where fileRef is a new record from DB
Instead it's a predicted document, as data is not fetched from the database after insert. This may also fail on the next calls like proceedAfterUpload. We subclass collection.insert and add some extra fields like timestamps, in those cases we findOne(fileRef._id) to fetch the real document) and pass it to proceedAfterUpload on callback.
I think its reasonable to switch from
Random.id()to_idas a part of the insert callback.https://github.com/VeliovGroup/Meteor-Files/blob/master/files.coffee#L1412
Moreover, it should be noted that
fileRefin the callback ofaddFileis not the inserted document like described in https://github.com/VeliovGroup/Meteor-Files/blob/dd59d886db69e8d74db3ebb5e1c7bde74f0b64c9/docs/addFile.mdInstead it's a predicted document, as data is not fetched from the database after insert. This may also fail on the next calls like
proceedAfterUpload. We subclass collection.insert and add some extra fields like timestamps, in those cases wefindOne(fileRef._id)to fetch the real document) and pass it toproceedAfterUploadon callback.