Difficulty with referencing data. Help needed

I want to access planSchema in planDetailsSchema but I can’t. Note both are on different routes. planDetailsSchema does not have a POST only a GET route which means the data from planSchema should be available to planDetailsSchema when a POST request is made to planSchema


import mongoose from "mongoose";

export interface IPlan {
  planName: string;
  personalName: string;

const PlanSchema = new mongoose.Schema<IPlan>(
    planName: {
      type: String,
      required: [true, "Please provide plan name"],
    personalName: {
      type: String,
      required: [true, "Please provide personal name"],
  { timestamps: true }

export default mongoose.model<IPlan>("Plan", PlanSchema);


import mongoose, { SchemaTypes } from "mongoose";
import { IPlan } from "./Plan";

interface IPlanDetails {
  planSchema: IPlan;
  status: "Processing" | "Active" | "Expired" | "Declined" | "Refunded";

const PlanDetailsSchema = new mongoose.Schema<IPlanDetails>({
  planSchema: {
    type: SchemaTypes.ObjectId,
    ref: "Plan",
  status: {
    type: String,
    default: "Processing",
    enum: {
      values: ["Processing", "Active", "Expired", "Declined", "Refunded"],
      message: "{VALUE} is not supported",

export default mongoose.model<IPlanDetails>("PlanDetails", PlanDetailsSchema);


const addPlan = async (req: Request, res: Response) => {
  const plan = await new Plan(...req.body);

  res.status(201).json({ plan });


which should include plans but it doesn’t(GET only route)
export const getPlanDetails = async (req: Request, res: Response) => {
  const planDetails = await PlanDetails.find({}).populate("Plan");

  res.status(200).json({ planDetails });