Creating forms by passing unique ID

I’ve a collection “Country” which displays a list of countries and their info. A book option leads a user to the “Activity” form which has dropdown fields like To,From. How do I pass the “Country” ID so that the form fields in “Activity” belong to the “Country” whose Book button the user has clicked.

PS:Tutorials , Sample Code or similar github would be deeply appreciated. Thanks! I’m very very newbie :blush:

change you collection query to like this

CollectionName.find({}, {fields: {'_id':0}});

@vladmekh I’m sorry I didn’t understand you.I currently have two separate collections one “Country” and Other “Activity”. Each entry in country has as a Book option in it which opens up “Activity” which has forms. I want to generate form field options (dropdown values) based on the Country on which the Book option was clicked.

sorry, I thought you want to pass _id field, please paste you code.

if I understand you, you need join?
https://www.discovermeteor.com/blog/reactive-joins-in-meteor/

you can use publish-composite package too

Meteor.publishComposite('rides', function() {
    return {
        find: function() {
            return Rides.find({ });
        },
        children: [
          {
            find: function(rides) {
                  return Activity.find({_id : rides._id})
            }
          }
        ]
    }
});

Ok so here are the two collection rides and activity.(I used country to refer to it here on the forum but its named rides :grin:) I’ve added the main two js files feel free if you need more.

Activity form (activity_submit.js)

Template.activitySubmit.onRendered(function () {
	
	if (Session.get("submit-bypass") === true) {
		Session.set("submit-bypass", false);
		window.history.back();
	}

	$("#activity-goal").material_select();
});

Template.activitySubmit.events({
	"submit form": function (e) {
		e.preventDefault();

		var title = $(e.target).find("#activity-title").val()
		if (title.length === 0) {
			throwError("You must have a title.");
			$("activity-title").focus();
			return;
		}

		var activty = {
			title: title,
			goal: parseInt($(e.target).find("#activity-goal").val())
		};

		Meteor.call("activityInsert", activty, function (error, result) {
			if (error) {
				throwError(error.reason);
				return;
			}

			Session.set("submit-bypass", true);
			Router.go("activityPage", { _id: result._id });
		});
	}
});

This is the list (rides_list.js)

Template.ridesList.helpers({
	rides: function() {
		return Rides.find();
	}
});