我有一个MongoDB模式,如:
PostacSchema = new mongoose.Schema({
username: { type: String, unique: true, requierd: true},
nr_logari: { type: Number, default: 0 },
rating: { type: Number, default: 1 }
});
和此说明:
dbo.collection("postacs").updateOne({
username: req.user.username
},{
$inc: {
"nr_logari": 1,
"rating": 0.000001
},
});
反复登录“评级”字段后,取下一个值:1.000001; 1.0000019999999998; 1.0000029999999998; 1.0000039999999997;等等 我预计为:1.000001; 1.000002; 1.000003; 1.000004;等
您能帮助我了解问题是什么吗?