I am currently facing an issue where I need to assign a JS variable to a MongoDB field. The code I have written is returning the entire object instead of just the string value assigned to the field. For instance, if I have a document with the field
{name: "dylan"}
I don't want the entire object to be returned, I only need the string "dylan". Below is the code I have attempted:
var game = SearchLobby.findOne(
{profile: Meteor.userId()},
{game: 1,_id: 0}
);