Answers for "mongoose foreign key example"

0

mongoose foreign key example

const mongoose = require('mongoose');
  const Schema = mongoose.Schema;

  const IngredientSchema = new Schema({
      name: String
  });

  const RecipeSchema = new Schema({
      name: String,
      ingredients:[
        { type: Schema.Types.ObjectId, ref: 'Ingredient' }
      ]
  });
Posted by: Guest on October-12-2021

Code answers related to "mongoose foreign key example"

Code answers related to "Javascript"

Browse Popular Code Answers by Language