These are chat archives for Automattic/mongoose

Jan 2017
Paul "Joey" Clark
Jan 09 2017 05:30
@zakiirjuman As I understand it, since save() only sends the changed fields (not all the fields), then you should be fine.

I am not sure if your updates will be:

{$set: {field_1: 1}}
{$set: {field_2: 1}}


{$set: {field_1: 1}}
{$set: {field_1: 1, field_2: 1}}

But if you wanted to find out, you could do:

mongoose.set('debug', true);
Zakiir Juman
Jan 09 2017 17:27
I'm going to try that. Thanks!
John Webb
Jan 09 2017 22:28

Recently I've been trying to get virtual population to work. The object shows up on the document when I find it but it's always null. I have toObject/toJSON virtuals set to true and use other virtuals that use syncronous functions on the model fine. I'm doing this:

categorySchema.virtual('Assets', {
  ref: 'Assets',
  localField: '_id', // field on category schema
  foreignField: 'category' // field on assets schema

I've tried similar in two different schemas and they always just end up returning null. Anyone have any experience with this issue or any ideas?