如何解决将价值从另一个节点应用程序更新到猫鼬中的现有模型?
我正在尝试更新另一个节点(节点-A)创建的模型。编译后出现“无法覆盖'...”模型。
这是由'Node-A'创建的模型
const UserProfileSchema = new Schema({
userProfileExist: {
type: Boolean,},userEmailVerified: {
type: Boolean,userPhoneNumberVerified: {
type: Boolean,{
userProfile: {
userEmail: {
type: String,required: true,});
module.exports = UserProfile = mongoose.model('userprofilemodels',UserProfileSchema);
而且,我有“ Node-B”用户个人资料模型
const AAA = new Schema(
{
userProfile: {
userEmail: {
type: String,{ collection: 'userprofilemodels' }
);
module.exports = UserProfile = mongoose.model(
'userprofilemodels',AAA
);
这是更新模型'UserProfile'的代码
const AAA = require('../models/AAA')
AAA.findOneAndUpdate({'userProfile.userEmail': email},{userEmailVerified: true})
如何更新另一个节点使用Mongoose创建的集合?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。