/ / Meteor.users追加フィールド - mongodb、meteor、mongoose

Meteor.users追加フィールド - mongodb、meteor、mongoose

"Meteor.user()"を使用して、ドキュメント内の現在ログインしているユーザーに新しいフィールドを追加する方法を教えてください。

注:私は使っています 流星 ユーザーを作成および管理するためのパッケージ

回答:

回答№1は1

あなたは使うことができます

 Meteor.users.update({ _id: Meteor.userId() },{ $set: { "propertyHere": valueOfPropertyHere } });

注:クライアントからユーザーを更新している場合は、正しいアクセス権を持っていることを確認する必要があります。 Meteor.userId() うまくいくでしょう。

サーバーからそれをしているならば Meteor.userId()this.userId .. Meteor 1.6でテスト済み