[Open New] How to get current user `Meteor.userId()` in Collection Extends?


#1
class AutoTimestampCollection extends Mongo.Collection {
   insert(document, ...rest) {
     document.createdAt = new Date();
     document.createdBy = Meteor.isServer && Meteor.userId();
     super.insert(document, ...rest);
  }
}

Get error when fixture run

Error: Meteor.userId can only be invoked in method calls or publications.

#3

Now open new Error: Meteor.userId can only be invoked in method calls or publications in Collection Extends