Extending the users package of mean.io

自作多情 提交于 2019-12-03 16:54:58

You can make your players package be dependent on users.

Players.register(function(app, auth, users, database) {...});

You now have access to the database and can load the user schema with

var userModel = database.connection.model('User');

and you can use the schema.add function to extend the schema

userModel.schema.add({ scrore: 'string'});

This should add the score field to the user model

I think this might work for you. But I was told from a member of mongoose team that schema.add only works before compiling the model. See this link for more info about schema add http://mongoosejs.com/docs/api.html#schema_Schema-add

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!