I'm creating a basic app for a school project. I want to match dog owners with dogs they own. I have set up two models one for dogs and one for the owners. A dog owner can have multiple dogs so I guess it's a one to many. One owner can have multiple dogs...
I have the following models for Dog:
var mongoose = require('mongoose'); var Schema = mongoose.Schema;
var DogSchema = new Schema({
name: String,
age: Number,
location: String,
breed: String,
sex: String
});
module.exports = mongoose.model('Dog', DogSchema);
and owner:
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var OwnerSchema = new Schema({
firstName: String,
lastName: String,
age: Number,
location: String,
favorite: String,
numberOfBreeds: Number,
numberOfDogs: String,
username: String,
password: String
});
module.exports = mongoose.model('Owner', OwnerSchema);
how can I join the two? I'm not sure I understand the process of joining in mongo (or sql for that matter)...
Thanks in advance!