-1
ts 파일에 모델을 정의했습니다. 해당 모델과 관련된 특정 몽구스 연결 (기본 연결이 아님)을 사용하고 싶습니다. 모델을 연결에 연결하려면 어떻게해야합니까? 내 server.ts 파일에서몽구스와 Typescript - 특정 몽구스 연결로 모델 연결
export interface iSuppliers extends mongoose.Document {
suppliers: string[];
fields: number[];
}
export const supplierSchema = new mongoose.Schema({
suppliers: {type:[String], required: true},
fields: [Number]})
.index({suppliers: 1}); // Additional index
export const supplier = mongoose.model<iSuppliers>('supplier', supplierSchema);
: 내가 데이터를 찾을 수 내 공급 업체 모델을 사용하는 경우
import {supplier} from '....';
....
let database_2 = mongoose.createConnection(....);
아무런 변화가 없습니다
발췌 내 TS 파일을 형성한다. 는 분명히, 나는
내가 수출 ... 나는 내 길을 발견
정교한 비트를 자세히 설명해 주시겠습니까? –
자세한 내용으로 내 의견을 편집했습니다 ... – 3Pi
[몽구스로 2 개의 다른 모델 세트와 2 개의 연결 방법은 무엇입니까?] (http://stackoverflow.com/questions/12937883/how-to-have- 2 연결 -2 다른 모델 세트와 함께 - 몽구스) – cdbajorin