Adding a column in MongoDB
-
My goal is to add a number value that is attached to every user who creates an account. When the user creates an account, they type in a number that is sent to them. Once they start using the account that number increases as time goes on. I'm not worried about the logic, I've already got that figured out. But I am new to Mongo...how do I add a column into Mongo that will take in and store a number that a user types in when creating an account?
-
You can just use the
User.setUserField(uid, field, value, callback)
function, by importing themodule.parent.require('./user')
To set the value while creating the account, I suggest you to check the custom registration field (or something like that) plugin and use it, or taking inspiration from it.
Copyright © 2024 NodeBB | Contributors