I want to check whether the logged in user has a certain field true or false within their user document. My current rendition passes an object of information, but I just want a true or false.
This is the publish function I made on the server side. I wanted this to return true if the fields ‘profile.completeRegister’ were true
Meteor.publish('completeRegis', () => {
if (this.userId) {
return Meteor.users.find({ $and: [ { _id: this.userId }, {'profile.completeRegister': true}]}).count() !== 0
}
});
This is the function on the client side that I wanted to return the true or false dependant on the publish function.
function completeRegister(){
return Meteor.subscribe('completeRegis');
}
I did a cosole.log and ill show you the results
function logValue(){
var profileConfig = completeRegister();
//SOME OTHER CODE
console.log(profileConfig);
}
This is what the console.log shows
{stop: ƒ, ready: ƒ, subscriptionId: "gB7dtHFSyerJfkr5L"}
ready
:
ƒ ready()
stop
:
ƒ stop()
subscriptionId
:
"gB7dtHFSyerJfkr5L"
__proto__
:
constructor
:
ƒ Object()
hasOwnProperty
:
ƒ hasOwnProperty()
isPrototypeOf
:
ƒ isPrototypeOf()
propertyIsEnumerable
:
ƒ propertyIsEnumerable()
toLocaleString
:
ƒ toLocaleString()
toString
:
ƒ toString()
valueOf
:
ƒ valueOf()
__defineGetter__
:
ƒ __defineGetter__()
__defineSetter__
:
ƒ __defineSetter__()
__lookupGetter__
:
ƒ __lookupGetter__()
__lookupSetter__
:
ƒ __lookupSetter__()
get __proto__
:
ƒ __proto__()
set __proto__
:
ƒ __proto__()
How should I change the code?