These are chat archives for Automattic/mongoose

Apr 2016
Albert Szekely
Apr 27 2016 11:51
hi guys
any example query on updating a subdocument ? ( i know the id of both document and subdocument )
db.collection.update( { "_id" : ObjectId("5719fe21e78b06f20616ee00"), "" : ObjectId("572072e4260cd05e07e5df30") }, { $set : { "consumers.$.email" : "update@mongo.db" } }, false, true )
got something like this but does not work :(
objectids are correct
sry not really mongoose problem
Vlado Tesanovic
Apr 27 2016 13:02
@pixeldublu Array of documents or sub document, if it is sub document, than you can with
Apr 27 2016 13:04
consumers is subschema
consumers: [Consumerslist] this is in model declaration
but i belive cannot even find
db.emaillists.find( { "_id" : ObjectId("5719fe21e78b06f20616ee00"), "" : ObjectId("572072e4260cd05e07e5df30") } )
no result
Vlado Tesanovic
Apr 27 2016 13:08
@pixelul === @pixeldublu ?
Apr 27 2016 13:12
one is personal the other is work :))
is there any software to connect to mongo ( similar to robomongo ) that also shows you queries ? (Ex: i delete something and show me the query of deletion like phpmyadmin :) )
Vlado Tesanovic
Apr 27 2016 14:23
@pixelul copy document from database here, using this
 "key": "vlue
Ean McLaughlin
Apr 27 2016 14:48
Is there some conflict with setting the timestamps option on the base model of a discriminator?
I was trying to do it last night and was getting:
    if (typeof to[key] === 'undefined') {

TypeError: Cannot read property 'background' of null
Ean McLaughlin
Apr 27 2016 15:02
where the schema is defined as:

var options = {discriminatorKey: 'event_name', timestamps: true};

var Event = new mongoose.Schema({
        timestamp: {type: Date, index: true},
        world_id: {type: Number, ref: 'World', index: true},
        zone_id: {type: Number, index: true}
Event.path('createdAt').expires('3 days');
Valeri Karpov
Apr 27 2016 17:17
@vladotesanovic yep lean() is all about better performance. Mongoose has a non-negligible amount of overhead
@computertechie hmm can you open up an issue for this on github? shouldn't be anything wrong with that but you may well have stumbled on a bug
Ean McLaughlin
Apr 27 2016 18:39
@vkarpov15 sure
I'll do some tests first; I'm using mongoose-fill so that may be causing it