Fetching json from Mongo with Meteor

Hi,

I am trying to fetch a json object from the mongodb using meteor, but I have no clue why I’m unable to do so.

One of the entries of the collection looks like this:
json

I’m trying to fetch the value part by passing the name.

Code on front end:
export default withTracker(() => {
let aSub = Meteor.subscribe(‘allEntries’);
return {
aBoundaries: DataCollection.find({}).fetch()
}
})(Component Name);

The Meteor Call Statement on front-end:
dataFromDb = Meteor.call(‘functionToBeCalled’, ‘Sydney’);

Server-side Code:
Meteor.publish(‘allEntries’, function(){
return DataCollection.find();
});

Meteor.methods({
functionToBeCalled(aName){
return DataCollection.find({name: aName});
}
});

Another of my questions is:
Is there any way that we publish only all the names in the beginning and then publish the values on demand?

Thanks for your help in advance!

Just in case anyone comes here to look for the answer ~~~ So… I was able to make it work with this code on the server:

Meteor.methods({
functionToBeCalled(aName){
console.log(aName);
return DataCollection.findOne({name: aName});
}
});
And this on the client:

Meteor.call(‘functionToBeCalled’, nameToBePassed, (error,response) => {
console.log(error, “error”);
console.log(response, “response”); //response here
})