This post is being ignored -> Adding checkboxes

This is topic is the continuance of the following topic.

In the post submit page I’d like to add checkboxes with tags name right after it.
I want to list up all existing tag, so that I can select tag by ticking checkboxes.

Related parts:


Tags = new Mongo.Collection('tags');

    update: function (userId, tag) {
        return ownsDocument(userId, tag);
    remove: function (userId, tag) {
        return ownsDocument(userId, tag);

    tagInsert: function (tagAttributes) {
        check(Meteor.userId(), String);
        check(tagAttributes, {
            postId: String,
            title: String
        var user = Meteor.user();
        var tag = _.extend(tagAttributes, {
            userId: user._id,
            author: user.username,
            submitted: new Date()
        var tagId = Tags.insert(tag);
        return {
            _id: tagId


<template name="postSubmit">
    <form class="main form page">
        <div class="form-group">
            <label class="control-label" for="title">Title</label>

            <div class="controls">
                <input name="title" id="title" type="text" value="" placeholder="Name your post" class="form-control"/>
        <div class="form-group">
            <label class="control-label" for="body">Body</label>

            <div class="controls">
                <textarea name="body" id="body" value="" placeholder="Post content" class="form-control"

        <input type="submit" value="Submit" class="btn btn-primary"/>

    'submit form': function (e) {

        var post = {
            title: $('[name=title]').val(),
            body: $('[name=body]').val()
        };'postInsert', post, function (error, result) {
            // display the error to the user and abort
            if (error)
                return alert(error.reason);
            Router.go('postPage', {_id: result._id});

To do:

  1. I will need to add var tags = Tags.find() in post_submit.js if I’m not mistaken as I will need all tags to list with check boxes on the post submit page, but I’m sure how to declare it in right way.
  2. I need to add a snippet in page_submit.html with input type="checkbox" by listing up all tags. Don’t know how to do that. By ticking check box it should apply that corresponding tag.


Please someone point me out what’s wrong with this post?


There is nothing wrong at all with your post. This post and your initial post are cogent, important.

As for the post being ignored, my take is that few people understand, at this point, many-to-many with Mongo. I’m not aware of any mainstream language evolving to discuss many-to-many with Mongo and no simplified techniques / packages / patterns have appeared – with the possible exception of Publish Composite with which I have yet to experiment. So, what we get is people with no real experience telling us only we can’t say “many-to-many”. It amuses me.

I, for one, would value your continued writing and hope that people with concrete knowledge and experience in this area would chime in.

All the best,


1 Like

From the UX point of view, how many tags do you plan to have? 10, 50, 200? Have you thought of multiply select field instead of checkboxes?

@steinitz Thanks for recalling me this post. I forgot about it :smile:

I’m still wondering why the case I brought is so confused. This is a classical posts and tags example. Let’s put a side the term many-to-many, do you mean it’s not easy to implement post has many tags and tag has many posts in Meteor?

@brajt Oh, thanks for the idea - I’ve never thought about it. I assume, you mean one field, where I will enter already existing tags. I like it too, but I think I will need to implement autocomplete as I type a tag. Is it possible? On the other side I’m still interested checkbox implementation.

Yes, the common way to do it is with autocomplete. You can also enable or disable adding new tags by the user in the same select field.

You can see an example implementation here (multiple select boxes):

1 Like

Thanks. I see this is not a Meteor-specific, but general. I’ll bookmark the link.


By the way, though we I called here many-to-many relations for posts and tags their schema still will look like

posts : { _id: String, title: String, body: String }

tags : { title: String, post_id: String }

(Ref.: Defining schemas for 2 models in `many-to-many` relationship)

So, I meant to implement checkboxes from that contest. I had to mention about it from the beginning.