我希望有一个选项,用户可以在mondgod数据库中更改其用户名。我使用猫鼬作为ODM。 我的用户的架构是:
UserSchema = new mongoose.Schema({
username: String,
phone: {
type: Number,
default: 9999999999
},
credits: {
type: Number,
default: 0
},
password: String
});
答案 0 :(得分:1)
userschema.js
FirebaseRecyclerAdapter
在您的app.js或index.js文件中:
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
UserSchema = new mongoose.Schema({
username: String,
phone: {
type: Number,
default: 9999999999
},
credits: {
type: Number,
default: 0
},
password: String
});
var User = module.exports = mongoose.model('User', UserSchema);
答案 1 :(得分:-1)
说出与您要编辑的人有关的用户,例如user1 user1.password = YourHashingFunctionHere(newPass); user1.Save();