Santosh
05/02/2022, 6:22 PMconst UserSchema = new Schema({
email: {
type: String,
lowercase: true,
required: true
},
info: {
firstName: String,
lastName: String,
mobile: String
},
apps: [{type: Schema.Types.ObjectId, ref: 'AppList'}]
}, {timestamps: true});
module.exports = User = mongoose.model('user', UserSchema);
# AppSchema
const appSchema = new Schema({
name: {
type: String,
lowercase: true,
unique: true,
required: true
},
description: String,
}, {timestamps: true});
module.exports = AppList = mongoose.model('AppList', appSchema);Nurul
05/05/2022, 4:18 PM// This is your Prisma schema file,
// learn more about it in the docs: <https://pris.ly/d/prisma-schema>
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
email String
info String
apps app[]
}
type app {
name String
description String
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
}Santosh
05/05/2022, 6:30 PM