These are chat archives for Automattic/mongoose

12th
Nov 2016
James Lee
@uptownhr
Nov 12 2016 07:59
@vkarpov15 is possible to disable _id on a subdocument schema declaration?
i know you can do it on a schema declaration using _id: false
but how about inside something like this?
new mongoose.Schema({
  _user: { type: mongoose.Schema.ObjectId, ref: 'User' },
  networks: [ { network: String, status: {type: String, enum: ['pending', 'sent'], default: 'pending'} } ]
})
I'd like to disable _id on the networks array objects
James Lee
@uptownhr
Nov 12 2016 08:09
scratch that
Yogesh Patel
@ycpatel813
Nov 12 2016 15:23
@uptownhr { _id: ObjectId subdocArray: [ { _id: false, field: "String" } ] }
Jeroen Rinzema
@jeroenrinzema
Nov 12 2016 23:36
I got something strange going on with mongoose. I try to make use of promises and mongoose but for some reason is then/yield not called when done. I make use of the npm module 'co' and in the co wrapper do i make a findOne request.
let users = yield users.findOne({"_id": user}).exec();
i set the promise library before i open my mongoose connection:
mongoose.Promise = bluebird;
i see nicely that mquery is starting the search but returns nothing
mquery findOne +0ms users { _id: 57a3c6ba5ce75e0528ab8ac7 } { fields: undefined }