These are chat archives for Automattic/mongoose

Nov 2015
James Lee
Nov 04 2015 00:04
with es6, shouldn't i be able to do {Model,Schema} = mongoose
given mongose = require('mongoose') ?
Luke A. Greenleaf
Nov 04 2015 00:19
think you could do import mongoose, {Model, Schema} from 'mongoose';
James Lee
Nov 04 2015 00:26
got it
this works in node without transpilers right?
James Lee
Nov 04 2015 00:54
@vkarpov15 auto-populate plugin is using schema.pre('find') ...
if i wanted to write an alphanum filter, would i hook into the pre events as well?
and is there an event for when a document is instantiated?
Sathya Narrayanan
Nov 04 2015 05:16
@vkarpov15 thanks for your suggestion.
Chris Adams
Nov 04 2015 06:26
quick question, if I have an object (o) and it's model has an array (ar) and a mixed object (mo), if I do will it automatically deep copy mo or do I need to do that myself?
Valeri Karpov
Nov 04 2015 17:18
@uptownhr re: plugins.mongoose,
@uptownhr re: import in node, I'm pretty sure node doesn't support the import statement natively, at least in v4.0.x
and @uptownhr yep. To plug in to when a doc is instantiated, just call schema.queue() (this is how pre/post hooks work)
@chadams77 I don't think it'll automatically deep copy, clone it yourself if you need it