These are chat archives for Automattic/mongoose

13th
Jun 2017
matrixbirds
@Matrixbirds
Jun 13 2017 03:15
okay I found pre(‘remove’,callback) can resolve my question
Yang Li
@Chelsea-li
Jun 13 2017 04:28
thanks @Muthukumars1994
XHMM
@XHMM
Jun 13 2017 06:03
@kailashyogeshwar85 thanks a lot. I have found that my study method is not correct. And i will correct it .Thanks again .😂
matrixbirds
@Matrixbirds
Jun 13 2017 06:50
How can I get _id fields from ctx variables which in pre('update') hook?
Here is my case:
Model.findOne(conditions).update({field_A: ‘A’})
Model.pre(‘update’, function(next) {
   const ctx = this;
   next();
});
matrixbirds
@Matrixbirds
Jun 13 2017 08:57
Ok stupid ask… i found the document say update is Query middleware..But, I still want to write into hook by event emit way..it’s the right way to process my case?