These are chat archives for Automattic/mongoose

Mar 2016
Brian Veltman
Mar 21 2016 13:29
Hello, is it possible to use upsert with mongoose for arrays? Currently I have{upsert:true, new:true},function (err) { … }; But it creates all new items with empty strings while newItem is a array with all tje json objects i.e: all the items.
James Lee
Mar 21 2016 14:51
@jhyland87 it will return a null
error will = null and response will = null
Mar 21 2016 15:41
This message was deleted

Hi there, how can i query by populated key value?
var ListItemSchema = new mongoose.Schema({ date:{ type: Date, default: }, postedBy: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }, product: { type: mongoose.Schema.Types.ObjectId, ref: 'Product' }, qty: { type: Number, max: 100 } });

var ProductSchema = new Schema({ name: {type: String,required: true, unique:true}, price: {type: String} });
I would really like do something like ListItem.findOne({postedBy: decodedToken._id,'test'})

Erinç Fırtına
Mar 21 2016 16:03
how can i populate not saved mongoose document??
var user = new User({name: test, group: id});
user.populate(‘group’, cb);
Erinç Fırtına
Mar 21 2016 16:43
how can i use virtual properties in virtual object?