This is my publish function:
Meteor.publish('coinbaseinfo', function() {
if (this.userId) {
return Meteor.users.find({
_id: this.userId
}, {
fields: {
'services.coinbase.name': 1,
'services.coinbase.email': 1,
}
});
} else {
this.ready();
}
});
This is where I’m calling my info for the client side template:
Template.finishCoinbase.onCreated(function userProfile() {
Meteor.subscribe('coinbaseinfo');
const info= Meteor.users.find({_id: Meteor.userId()}, {
fields: {
'services.coinbase.name': 1,
'services.coinbase.email': 1,
}
});
console.log(info);
return info;
});
Im trying to retrieve certain fields from a user’s document from Mongo.
This is what the console.log is giving me :
Cursor {collection: LocalCollection, sorter: null, matcher: Matcher, _selectorId: "sYm6R2ZqJvpyFyZbj", skip: 0, …}
collection
:
LocalCollection {name: "users", _docs: _IdMap, _observeQueue: M…r._SynchronousQueue, next_qid: 25, queries: {…}, …}
fields
:
{services.coinbase.name: 1, services.coinbase.email: 1}
limit
:
undefined
matcher
:
Matcher {_paths: {…}, _hasGeoQuery: false, _hasWhere: false, _isSimple: true, _matchingDocument: undefined, …}
reactive
:
true
skip
:
0
sorter
:
null
_projectionFn
:
doc => {…}
_selectorId
:
"sYm6R2ZqJvpyFyZbj"
_transform
:
null
__proto__
:
Object
How do I get just the fields i am asking for.