cult-of-coders / grapher

Grapher: Meteor Collection Joins + Reactive GraphQL like queries
https://atmospherejs.com/cultofcoders/grapher
MIT License
275 stars 53 forks source link

Collection not found #409

Closed chidugit closed 4 years ago

chidugit commented 4 years ago

Upfront sorry for raising this here as this may be coding error, but I am not getting any help on meteor forum or on stackoverflow.

Im using package cultofcoders:grapher, when I’m trying to link two collections Im getting error -

Error: Could not find a collection with the name: Products [invalid-collection]
at Linker._validateAndClean (packages/cultofcoders:grapher/lib/links/linker.js:159:23)

Below is my code

products/collection.js

import {Mongo} from "meteor/mongo";
import ProductSchema from "./schema"

const Products = new Mongo.Collection("products");
Products.attachSchema(ProductSchema);
Products.attachBehaviour("timestampable");

export default Products;

products/link.js

import Products from "./collection";
import Categories from "../categories/collection";

Products.addLinks({
    productsCategory:{
        type: "one",
        collection: "Categories",
        field: "category"
    }
});

complete repo can be found at https://github.com/chidugit/publicapp/tree/master/shoppingcart

No error is triggered when attaching schema, but why is there an error when I am trying to add links? WHat am I missing here?

chidugit commented 4 years ago

issues was resolved after I passed the actual collection instead of string. sorry for wasting time and creating a silly issue