jeudi 2 avril 2015

Push to array within subdocument in mongoose

I'd like to push to an array that's within a subdocument in Mongoose/MongoDB.


Here is the schema:



var UsersSchema = new mongoose.Schema({
user: String,
stream: String,
author: String,
tags: Array,
thumb: Number,
added: Number
})

var ContentSchema = new mongoose.Schema( {
title: String,
url: String,
description: String,
text: String,
users: [ UsersSchema ]
})


I'd like to push an array into the UserSchema.tags array for a specific users sub-document.


I have tried this and several variations: http://ift.tt/1aovKIX


Aucun commentaire:

Enregistrer un commentaire