Solvedmeteor autoform Meteor 1.3 collection is not in the window scope


I updated application Meteor.1.3 and template error because it is not imported

> quickForm collection="Books"

import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';

import const Books = new Mongo.Collection("books");
Books.attachSchema(new SimpleSchema({
  title: {
    type: String,
    label: "Title",
    max: 200
  author: {
    type: String,
    label: "Author"
  copies: {
    type: Number,
    label: "Number of copies",
    min: 0
  lastCheckedOut: {
    type: Date,
    label: "Last date this book was checked out",
    optional: true
  summary: {
    type: String,
    label: "Brief summary",
    optional: true,
    max: 1000


<template name="insertBookForm">
  {{> quickForm collection="Books" id="insertBookForm" type="insert"}}

> Exception in template helper: Error: Books is not in the window scope

but so that the solution:

import { Template } from 'meteor/templating';
import { Books } from '/imports/books.js';

  books() {
    return Books;


<template name="insertBookForm">
  {{> quickForm collection=books id="insertBookForm" type="insert"}}

Any ideas? or another solution?


15 Answers

✔️Accepted Answer

@lnmunhoz it works but putting it in the window scope is probably not the best approach.

You could for example do something like:

import {Books} from "/imports/books.js";

    formCollection() {
        return Books;


{{> quickForm collection=formCollection id="insertBookForm" type="insert"}}

Other Answers:

Import your collections on a main.js client file and add them to the window scope.


import { Books } from '/imports/books.js';

window.Books = Books


With quotes, collection="Books", means "look for window.Books"

Without quotes, collection=Books, means "look for a helper or property or variable in current scope with the name Books"

So it sounds like you are just using quotes when you don't mean to.

In general, setting them on window isn't ideal. Docs should probably be updated in a few places. One solution I sometimes use is a global helper, where you have something like this in your client code:

import Books from '/imports/collections/Books';
import Another from '/imports/collections/Another';

const Collections = {

Template.registerHelper('Collections', Collections);

And then in the template:

{{> quickForm collection=Collections.Books id="insertBookForm" type="insert"}}

More Issues: