简体   繁体   中英

Meteor: accounts-password

I'm using accounts-password but I can't locate the user collection. Please help. 在此处输入图片说明

注册后,我应该看到以下内容 相反,我一直在获取没有注册数据的空数组 Also, in which file can I find the code for the users collection? In an effort to use best practices, I have separated my code into isClient, isServer, and both but I don't see the code anyway.

When I attempt to register a user in the browser I can't retrieve it using Meteor.users.find().fetch(); in the console.

Here's the my code:

Template.register.events({
    'submit form': function(event){
        event.preventDefault();
        var email = $('[name=email]').val();
        var password = $('[name=password]').val();
        Accounts.createUser({
            email: email,
            password: password
        });
        Router.go('home');
    }
});

When I attempt to register a user in the browser I can't retrieve user information using Meteor.users.find().fetch(); in the console. Registration form code:

<template name="register">
    <h2>Register</h2>
    <form class="register">
        <p>Email: <input type="email" name="email"></p>
        <p>Password: <input type="password" name="password"></p>
        <p><input type="submit" value="Register"></p>
    </form>
</template>
meteor create hello
cd hello
meteor

=> go to http://localhost:3000

Then the collection is just Meteor.users . Try Meteor.users.find().fetch() in your console, you should get an empty Array : [] => it means it's all set up

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM