Meteor-Community-Packages / meteor-collection-hooks

Meteor Collection Hooks
https://atmospherejs.com/matb33/collection-hooks
MIT License
657 stars 92 forks source link

Can't get Id on after insert #152

Closed rafaelcorreiapoli closed 9 years ago

rafaelcorreiapoli commented 9 years ago

Hi, I have a collection like this:

Folhas = new Mongo.Collection('Folhas');

Folhas.Schema = new SimpleSchema({
  data:{
    type: Date
  },
  status:{
    type: String,
    allowedValues:['fechada','aberta']
  },
});

And im using this hook:

Folhas.after.insert(function(userId, doc){
  // how to grab the inserted document id? 
//doc._id is not defined

});

How to get the inserted document id ?

patrickbolle commented 8 years ago

Hey @rafaelcorreiapoli were you able to solve this? I'm getting the same problem.