I'm creating basic Administration Panel and I didn't work with MongoDB yet.
For development purposes I left autopublish
and insecure
in the project.
In order to render users from database (Accounts-ui
+ Accounts-facebook
) i need a handler for Users = new Mongo.Collection("users");
but during compilation there is following error:
'/users/insert' is already defined.
HTML
<body>
{{> loginButtons}}
{{#each users}}
{{> user}}
{{/each}}
</body>
<template name="user">
<li>{{profile.name}}: {{_id}}</li>
</template>
JS
Users = new Mongo.Collection("users");
if (Meteor.isClient) {
Template.body.helpers({
users: function () {
return Users.find({});
}
});
Accounts.onLogin(function(){
console.log("logged in: " + Meteor.userId());
});
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
}
- facebook login is configured in another file
Since the user's collection is automatically defined you can't re-define it.
You can though reference the existing collection:
Instead of:
Use