Hello, I know I already asked something about this already but after reading my question I wasn’t really clear about a few things.
I have published all of my users because there is a section where I need to look for them all but I don’t know if this is the right way, also I have published all of the users alongside the profiles, I’ve created a separate collection for security reasons.
Meteor.publish('profiles', function() {
return Meteor.users.find() || Profiles.findOne();
});
When I delete Meteor.users.find() this error appears
Exception from sub profiles id BdHAnsFJWWYXBFSXX TypeError: Profiles.findOne(...).fetch is not a function
I20190103-23:55:19.411(-4)? at Subscription.<anonymous> (server/Publish.js:12:32)
I20190103-23:55:19.413(-4)? at packages/matb33_collection-hooks.js:307:21
I20190103-23:55:19.414(-4)? at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12)
I20190103-23:55:19.414(-4)? at Subscription._handler (packages/matb33_collection-hooks.js:306:28)
I20190103-23:55:19.415(-4)? at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1767:12)
I20190103-23:55:19.416(-4)? at DDP._CurrentPublicationInvocation.withValue (packages/ddp-server/livedata_server.js:1043:15)
I20190103-23:55:19.417(-4)? at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12)
I20190103-23:55:19.418(-4)? at Subscription._runHandler (packages/ddp-server/livedata_server.js:1041:51)
I20190103-23:55:19.419(-4)? at Session._startSubscription (packages/ddp-server/livedata_server.js:859:9)
I20190103-23:55:19.419(-4)? at Session.sub (packages/ddp-server/livedata_server.js:625:12)
I20190103-23:55:19.421(-4)? at packages/ddp-server/livedata_server.js:559:43
After adding the Meteor.users.find() again it disappears
And when I insert data in my inputs to fill the collection and display then, the subscription works for a second showing me with the meteortoys that indeed it was inserted but it disappears and I have no clue as to why of this, when I check minimongo the data is there.
Here’s my insert method:
if (Meteor.user) {
Profiles.insert({
_id: Meteor.user()._id,
Age: evt.target.age.value,
Phone: evt.target.phone.value,
Job: evt.target.job.value,
BirthDate: evt.target.bday.value,
City: evt.target.city.value,
HealthInsurance: evt.target.hi.value,
SecurityNumber: evt.target.sn.value,
Rnc: evt.target.rnc.value,
Exequatur: evt.target.exe.value
});
Bert.alert("Insercion exitosa", "success", "growl-top-right");
}
Any help is really appreciated.