0
私はMeteorアプリケーションのリセットデータメソッドを作成し、データベースを消去し、ユーザーを作成し、このユーザーなどの偽データを生成します。xolvioを使用してサーバーサイドメソッドを宣言しています:クリーンでこれを行うにはアカウントのパッケージ:データをリセットするメトラーメソッド
import {Accounts} from 'meteor/accounts-base';
import {resetDatabase} from 'meteor/xolvio:cleaner';
Meteor.methods({
// ..
'resetData':()=> {
resetDatabase(null,()=>{
Accounts.onCreateUser((options, user) => console.log(user));
Accounts.createUser({
username: 'bob',
email: '[email protected]',
password: 'rastamanvibration',
profile: {
first_name: 'Bob',
last_name: 'Marley'
}
});
});
}
});
これは非常にまっすぐ進む私には思えるまだ私は次のエラーを取得しています:
Exception while invoking method 'resetData' Error: insert requires an argument
W20170622-23:28:16.817(-7)? (STDERR) at [object Object].insert (packages/mongo/collection.js:468:11)
W20170622-23:28:16.819(-7)? (STDERR) at [object Object]._.each.Mongo.Collection.(anonymous function) [as insert] (packages/aldeed_collection2-core.js:232:19)
W20170622-23:28:16.820(-7)? (STDERR) at AccountsServer.meteorInstall.node_modules.meteor.accounts-base.accounts_server.js.Ap.insertUserDoc (packages/accounts-base/accounts_server.js:1328:25)
W20170622-23:28:16.821(-7)? (STDERR) at meteorInstall.node_modules.meteor.accounts-password.password_server.js.createUser (packages/accounts-password/password_server.js:1050:25)
W20170622-23:28:16.822(-7)? (STDERR) at AccountsServer.meteorInstall.node_modules.meteor.accounts-password.password_server.js.Accounts.createUser (packages/accounts-password/password_server.js:1119:10)
W20170622-23:28:16.823(-7)?
...
あなたはMeteorユーザーにシンプルなスキーマを結びましたか?また、このパッケージは、 '' debugOnly'' enveronmentでのみ動作すると述べています。 – blueren
Meteorユーザーのための単純なスキーマを作成していないので、必要ではありません。また、流星のデバッグを実行中に起こっています... – lvlzqz
実際には、Accounts.onCreatedUserコールバックでエラーを返していません!ウォーシーシー – lvlzqz