I want to use the my collection users
When i users = new Mongo.Collection('users');
Then error : here is already a collection named "users"
What should I do?
How to modify meteor users collection name?
332 Views Asked by zhouxiang At
2
There are 2 best solutions below
2
On
If you really want a second users collection then do:
Users = new Mongo.Collection('myusers');
or
Users = new Mongo.Collection('users2');
But this is really not recommended if you're using the accounts package because of the potential confusion, especially if someone else ends up working on your project.
There's also a de facto Meteor convention that collection variables are defined with an initial uppercase letter but are all lower case in mongo as above.
Actually you already have a collection name 'users' if you see your mongodb collections.
when you install package
'accounts-base'in your project it will create a collection with 'users' name automatically.so you can not create a new collection with same name. if you want to use '
users' collection data then simply useMeteor.userId()andMeteor.user(). Useconsole.log(Meteor.user())to see data.