These are chat archives for Automattic/mongoose

Jun 2017
kailash k yogeshwar
Jun 12 2017 05:07

@XHMM you got to pass the {new:true} to findOneAndUpdate

// syntax
db.model.findOneAndUpadte(query, document, { new: true }, callback)

kinldy read the mongodb docs for all collection functions

Yang Li
Jun 12 2017 08:13
hi. I am working on a simple todo list app
I use mongoDb to store my data
var todoSchema = new mongoose.Schema({
text: {
type: String,
default: ''
mongoose.model('Todo', todoSchema);
somehow, the model is not stored
{ "_id" : ObjectId("593e3910c741540e90a990e9"), "v" : 0 }
{ "_id" : ObjectId("593e4b9bd3a0693504854609"), "
v" : 0 }
{ "_id" : ObjectId("593e4c3ad3a069350485460a"), "__v" : 0 }
the model and routes are in the same file, so I did not export the model
Jun 12 2017 09:22
here is my mongoose schema.
I have two model: channel, channelLabel.
channelLabel has many channel through 'channels' field on channelLabel
And I want trace channel model remove operation for updating my channelLabel collection's count fields. Should I add 'post' hook to channel?
Jun 12 2017 09:34
who can help me..
Jun 12 2017 11:14
after using new () keyword for creating model user;