Currently, I am in the process of developing an app using Angular for the front end and Meteor for the back end. My goal is to fetch all users from the "Users" collection (I have integrated the accounts-ui and accounts-password modules). However, when I run the code below, it only retrieves a single object (the most recently added user) despite there being 3 users in total.
if(Meteor.isClient){
angular.module('timeAppApp')
.controller('SignInCtrl', function($scope, $meteor, $location) {
$scope.LogIn = function() {
console.log($meteor.collection(Meteor.users).subscribe('users_by_email', $scope.username));
console.log($meteor.collection(Meteor.users).subscribe('all_users'));
};
});
}
if (Meteor.isServer) {
// Retrieves users by email
Meteor.publish('users_by_email', function(emailE){
return Meteor.users.find({'emails.address': emailE});
});
Meteor.publish('all_users', function(){
return Meteor.users.find({}, {fields: {emails: 1}});
})
As someone new to Meteor, I am still learning and experimenting with different functionalities. At the moment, I am facing a roadblock in this particular scenario.