Reputation: 1
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?
Upvotes: 0
Views: 347
Reputation: 20226
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.
Upvotes: 0
Reputation: 6147
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 use Meteor.userId()
and Meteor.user()
. Use console.log(Meteor.user())
to see data.
Upvotes: 0