Meteor using a local connection results in error: insert failed: 404 — Method not found

后端 未结 2 1519
滥情空心
滥情空心 2020-12-16 04:00

I\'ve got a meteor collection on the client side

Friends = new Meteor.Collection(\"Friends\");
Meteor.subscribe(\"Friends\");

I have a user

相关标签:
2条回答
  • 2020-12-16 04:26

    You need that Collection declaration on both the client and the server.

    // common code, do not put under /client or inside Meteor.is_client test
    Friends = new Meteor.Collection("Friends");
    
    0 讨论(0)
  • 2020-12-16 04:28

    If you want to use Collection only on Client side and you don't need to save that data to server you can declare your collection in "client" folder or in .isClient() function by passing null to the constructor like this:

    if(Meteor.isClient()){
    // Some other code
    ...
    
    onlyClientCollection = new Meteor.Collection(null);
    
    // Some other code
    ...
    }
    
    0 讨论(0)
提交回复
热议问题