You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to add custom fields to the users collection and change the default _id from ObjectId to String .
But The users getting created still have their _id as Object Id. The console also warns, "You are using the default secret "secret" which is not secure.
Please change it with a strong random token."
const accountsPassword = new AccountsPassword({
// This option is called when a new user create an account
// The user returned will be inserted into the database
// For example here we allow a new `firstName` field on the user object
validateNewUser: async(user) => {
console.log('user', user)
// You can apply some custom validation
if (user.password.length < 8) {
throw new Error('Password too short');
}
user._id = user._id.toString()
// We specify all the fields that can be inserted in the database
return pick(user, ['username', 'email', 'password', "displayName", "hideMe", "status", "createdAt", "picture", "coverImg", "description", "brief", "badges"]);
},
});
const accounts = (await accountsBoost({
accountsServer: new AccountsServer({
db: accountsMongo,
tokenSecret: process.env.TOKEN_SECRET || 'tkn1gR2NBXDSxvusp2VFcZ97g8vNBoz1TM5duaDldza8YyarGpJqU9OpVsMGWXZYUOSXx',
services: [{
accountsPassword
}]
})
}, )).graphql(); `
The text was updated successfully, but these errors were encountered:
I have also tried initialize the accountsboost with this: const accounts = (await accountsBoost({ db: accountsMongo, tokenSecret: process.env.TOKEN_SECRET || 'tkn1gR2NBXDSxvusp2VFcZ97g8vNBoz1TM5duaDldza8YyarGpJqU9OpVsMGWXZYUOSXx', services: [{ accountsPassword }] }, )).graphql();
The warning about token secret seem gone but not for the _id , which is still passed as Object Id.
Because My existing database was populated with Meteor users. I have to use String _id
I want to add custom fields to the users collection and change the default _id from ObjectId to String .
But The users getting created still have their _id as Object Id. The console also warns, "You are using the default secret "secret" which is not secure.
Please change it with a strong random token."
` const accountsMongo = new Mongo(db, {
// options
convertUserIdToMongoObjectId: false,
convertSessionIdToMongoObjectId: false
});
The text was updated successfully, but these errors were encountered: