简体   繁体   中英

Meteor 1.3 collection reference error

Meteor 1.3: My project architecture is:

  • .meteor
  • both
    • articles.js
    • tags.js ...
  • client
    • templates
      • templates.html
      • templates.js
  • server
    • main.js

I want to use my collection both for some checks in client and in server so for that i use:

import { CollectionName } from "path/to/Collection"

both on client side and server side

In collection file I have:

export const CollectionName = new Mongo.Collection("collection");

I've tried with global.Collection name, without any word before collection name like it was before Meteor 1.3 -> still get :

Exception from sub articles id 2irSGEkWinCGvB33z ReferenceError: Articles is not defined

If I use just import './../both/collections/collectionName'; I get CollectionName is not defined;

If you want to use import , you'll need to put your code under the imports directory. See the application structure section of the guide. In particular, read the file structure section for an example layout.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM