Node.js 如何在nestjs中连接两个模式?

Node.js 如何在nestjs中连接两个模式?,node.js,mongoose,nestjs,Node.js,Mongoose,Nestjs,我有两个类似的模式 feature.schema.ts `import * as mongoose from 'mongoose'; import { settings } from '../_settings'; export const FeatureSchema = new mongoose.Schema({ feature_name :{ type : String }, module_id :{

我有两个类似的模式

feature.schema.ts

`import * as mongoose from 'mongoose';
import { settings } from '../_settings';
  export const FeatureSchema = new mongoose.Schema({
     feature_name :{
            type : String
        },
        module_id :{
            type : mongoose.Schema.Types.ObjectId,
            ref : 'Modules'
        },
        status :{
            type : String,
            default: false
        }
}, {...settings.options, collection: 'Features'}
);`
import * as mongoose from 'mongoose';
import { settings } from '../_settings';

export const MenusSchema = new mongoose.Schema({
    name :{
        type : String
    },
    feature_id: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Features',
    },
    status :{
        type : String
    }
}, {...settings.options, collection: 'Menus'}
);
menus.schema.ts

`import * as mongoose from 'mongoose';
import { settings } from '../_settings';
  export const FeatureSchema = new mongoose.Schema({
     feature_name :{
            type : String
        },
        module_id :{
            type : mongoose.Schema.Types.ObjectId,
            ref : 'Modules'
        },
        status :{
            type : String,
            default: false
        }
}, {...settings.options, collection: 'Features'}
);`
import * as mongoose from 'mongoose';
import { settings } from '../_settings';

export const MenusSchema = new mongoose.Schema({
    name :{
        type : String
    },
    feature_id: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Features',
    },
    status :{
        type : String
    }
}, {...settings.options, collection: 'Menus'}
);
我尝试加入功能菜单,尝试像这样加入菜单.service.ts

import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { Model } from 'mongoose';
import { IDMenus, IDFeature } from '@core/interfaces';
import { MenusDto, FeatureDto } from '@core/dto';
var ObjectId = require('mongoose').Types.ObjectId;

@Injectable()
export class MenusService {
    constructor(@InjectModel('Menus') private dataModel :Model<IDMenus>,
                @InjectModel('Features') private ftModel :Model<IDFeature> ) {} 

  async findjoin(): Promise<IDMenus[]> {
    return this.dataModel.find().populate('Features.feature_id')
    .exec();
  }

}

如何获得连接结果,这是正确的连接方式?

在异步函数中返回wait如下:
返回wait this.dataModel.find().populate('feature_id').exec()
返回this.dataModel.find().populate('Features.feature_id').populate('feature_id').exec(),我将尝试这个相同的答案没有改变,dataModel是菜单模式调用构造函数