These are chat archives for Automattic/mongoose

14th
Aug 2018
mongoosebot
@mongoosebot
Aug 14 2018 01:32
:tada: We just released version 5.2.8 :tada:

5.2.8 / 2018-08-13

  • docs: update execPopulate() code example #6851 WJakub
  • fix(document): allow passing callback to execPopulate() #6851
  • fix(populate): populate with undefined fields without error #6848 #6845 Fonger
  • docs(migrating_to_5): Add objectIdGetter option docs #6842 jwalton
  • chore: run lint in parallel and only on Node.js v10 #6836 Fonger
  • fix(populate): throw helpful error if refPath excluded in query #6834
  • docs(migrating_to_5): add note about removing runSettersOnQuery #6832
  • fix: use safe-buffer to avoid buffer deprecation errors in Node.js 10 #6829 Fonger
  • docs(query): fix broken links #6828 yaynick
  • docs(defaults): clarify that defaults only run on undefined #6827
  • chore: fix flakey tests #6824 Fonger
  • docs: fix custom inspect function deprecation warning in Node.js 10 #6821 yelworc
  • fix(document): ensure subdocs get set to init state after save() so validators can run again #6818
  • fix(query): make sure embedded query casting always throws a CastError #6803
  • fix(document): ensure required function only gets called once when validating #6801
  • docs(connections): note that you must specify port if using useNewUrlParser: true #6789
  • fix(populate): support options.match in virtual populate schema definition #6787
  • fix(update): strip out virtuals from updates if strict: 'throw' rather than returning an error #6731
lykeosovandara
@keo_012_gitlab
Aug 14 2018 08:24
anyone know the cheapest mongodb service ?
mongoosebot
@mongoosebot
Aug 14 2018 15:13
:tada: We just released version 4.13.15 :tada:

4.13.15 / 2018-08-14

  • fix(mongoose): add global usePushEach option for easier Mongoose 4.x + MongoDB 3.6 #6858
  • chore: fix flakey tests for 4.x #6853 Fonger
  • feat(error): add version number to VersionError #6852 freewil
Kev
@lineus
Aug 14 2018 16:38
Anyone having issues connecting to https://mongoosejs.com ?
Maurizio Bellemo
@mbellemo_twitter
Aug 14 2018 20:47

I might be completely wrong, but I do not get the validation work for embedded arrays.. I create the following model

var mongoose = require('mongoose')
var Schema = mongoose.Schema;

var projectSchema = new Schema({
    name: {
        type: String,
        required: true,
        trim: true
    },
    owner_id: {
        type: Schema.Types.ObjectId,
        required: true,
        ref: 'User'
    }
});

var Company = mongoose.model('Company', {
    name: {
        type: String,
        required: true,
        trim: true
    },
    projects: [projectSchema]
});

module.exports = {
    Company
}

and even if the name for the project is mandatory, I can still create empty Project (no name)... what am I doing wrong?

Kev
@lineus
Aug 14 2018 21:15
@mbellemo_twitter are you calling save()? The validators don’t run until you try to save the document.
hillct
@hillct
Aug 14 2018 22:08
Good evening. Can someone remind me how to retrieve the default for an enumerated type, from a compiled schema? where console.log(Temp.schema.path('salutation').enumValues); yields an array of all enum values, how do I retrieve the default value?
did some mild browsing but didn’t see it in the docs