【发布时间】:2023-03-14 22:40:01
【问题描述】:
我有两个 JSON 对象,每个对象都有一个名字字段。我想将名字重命名为名字,也想使用猫鼬将现有的名字值导入名字。
架构:
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const user = new Schema({
firstname:{ type:String },
lastname:{ type:String },
username:{ type:String },
password:{ type:String },
user_type:{ type:String },
})
module.exports = mongoose.model('user', user)
数据样本:
_id: "5bf5fbef16a06667027eecc2", firstname: "Hareesh", lastname: "Pitchikala", username: "123", password: "123", user_type: "employer", __v: 0
【问题讨论】:
-
这个问题是关于 Mongoose 的,但它被标记为重复并链接到 MongoDB。来吧,不一样的
标签: node.js database mongodb rest