These are chat archives for Automattic/mongoose

8th
Jan 2018
JasonhjKim
@JasonhjKim
Jan 08 2018 06:42 UTC

Hey guys, I've been stuck on this problem for couple hours. I was hoping you guys could point me to right direction

I have these two basic Schema one with extra field called "org price"

var schemaOne = new mongoose.Schema({
    name:  String,
    price: String,
    site:String
})
var schemaTwo = new mongoose.Schema({
    name:  String,
    price: String,
    orgPrice: String,
    site:String
})

I want to combine these collection to make a single collection with fields name, price, site. Thus, I'll be taking all the fields from schemaOne and only three fields from schemaTwo

var combinedSchema = new mongoose.Schema({
    name:  String,
    price: String,
    site:String
})

This seems like a easy problem.. but cant seem to get my head around it. Thank you

RENAN.BASTOS
@renanbastos93
Jan 08 2018 11:45 UTC
@theoutlander Yep I did see.
sudhir113
@sudhir113
Jan 08 2018 12:05 UTC
Use foregin key
Ivan Nesteruk
@hushino
Jan 08 2018 19:24 UTC
solve it with this code <% for(var i=0; i<serie.episodes.length; i++) {%> <li> <%- link_to(serie.episodes[i].slug, '/'+serie.episodes[i].slug) %> </li> <% } %>