I have a simple app with socialize:user-profiles
package.
in my fixtures file which is loaded on startup I have:
Meteor.startup(() => {
if (Meteor.users.find().count() === 0) {
Accounts.createUser({
username: "admin",
email: "aaa@bbb.com",
password: "p",
firstName: "fName",
lastName: "lName"
});
}
});
And I have a Profiles.js file:
import { Profile } from "meteor/socialize:user-profile";
Profile.methods({
fullName() {
return `${this.firstName} ${this.lastName}`;
}
});
// Profile Schema:
Profile.attachSchema({
firstName: {
type: String,
required: true,
},
lastName: {
type: String,
required: true,
}
});
Yet, upon running after meteor reset
, the admin user is inserted but the profile is not. And I receive the following error:
W20190919-20:43:27.646(3)? (STDERR) /home/andrey/.meteor/packages/meteor-tool/.1.8.1.wwsr.8jx4hub++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20190919-20:43:27.670(3)? (STDERR) throw(ex);
W20190919-20:43:27.671(3)? (STDERR) ^
W20190919-20:43:27.671(3)? (STDERR)
W20190919-20:43:27.671(3)? (STDERR) Error: First name is required in socialize:profiles insert
W20190919-20:43:27.671(3)? (STDERR) at getErrorObject (packages/aldeed:collection2/collection2.js:498:17)
W20190919-20:43:27.671(3)? (STDERR) at doValidate (packages/aldeed:collection2/collection2.js:470:13)
W20190919-20:43:27.671(3)? (STDERR) at ns.Collection.Mongo.Collection.(anonymous function) [as insert] (packages/aldeed:collection2/collection2.js:195:14)
W20190919-20:43:27.671(3)? (STDERR) at Object.afterInsertUser (packages/socialize:user-profile/server/server.js:28:28)
W20190919-20:43:27.672(3)? (STDERR) at packages/matb33_collection-hooks.js:382:18
W20190919-20:43:27.672(3)? (STDERR) at Array.forEach (<anonymous>)
W20190919-20:43:27.672(3)? (STDERR) at Function._.each._.forEach (packages/underscore.js:139:11)
W20190919-20:43:27.672(3)? (STDERR) at after (packages/matb33_collection-hooks.js:381:9)
W20190919-20:43:27.672(3)? (STDERR) at Object.<anonymous> (packages/matb33_collection-hooks.js:396:12)
W20190919-20:43:27.672(3)? (STDERR) at Object.collection.(anonymous function) [as insert] (packages/matb33_collection-hooks.js:146:21)
W20190919-20:43:27.672(3)? (STDERR) at Collection.insert (packages/mongo/collection.js:520:39)
W20190919-20:43:27.672(3)? (STDERR) at Collection.Mongo.Collection.(anonymous function) [as insert] (packages/aldeed:collection2/collection2.js:213:19)
W20190919-20:43:27.672(3)? (STDERR) at AccountsServer.insertUserDoc (packages/accounts-base/accounts_server.js:1100:27)
W20190919-20:43:27.673(3)? (STDERR) at createUser (packages/accounts-password/password_server.js:1078:25)
W20190919-20:43:27.673(3)? (STDERR) at AccountsServer.Accounts.createUser (packages/accounts-password/password_server.js:1147:10)
W20190919-20:43:27.673(3)? (STDERR) at Meteor.startup (server/fixtures.js:7:14)
Is there a method for inserting user-profiles with extended schema? Or do I miss something?