Meteor - 未插入数据库的数据

时间:2015-11-14 20:19:59

标签: meteor meteor-accounts meteor-methods

嘿伙计们,我在我当地的环境中运行了第二个网络应用程序,它运行得非常完美,但是当我使用时

meteor deploy kortmotmenneskeheten.meteor.com/

我有一个Meteor.methods,我用它来让用户创建一个新游戏,它应该向数据库添加一个新游戏,但它似乎对数据库没有影响。这是方法:

"newGame": function() {
  console.log("gameCount: " + Games.find().count());
  console.log(!Meteor.userId());
  if (!this.userId) {
    console.log("error is being thrown");
    throw new Meteor.Error("UserNotLoggedIn", "You are not logged in");
  }

  console.log("kden");
  try {
    console.log("game: " + {
      players: [
        createPlayer(null, "master")
      ],
      owner: Meteor.userId(),
      ownerName: Meteor.user().username,
      board: createBoard(),
      master: Meteor.userId(),
      createdAt: new Date()
    });

    gameId = Games.insert({
      players: [
        createPlayer(null, "master")
      ],
      owner: Meteor.userId(),
      ownerName: Meteor.user().username,
      board: createBoard(),
      master: Meteor.userId(),
      createdAt: new Date()
    });
  } catch (e) {
    console.log(e.name + ": " + e.message);
  }
  console.log("gameID: " + gameId);
  return gameId;
},

显然有很多console.log()语句被添加用于调试,它们表明方法正在运行直到try块,我有点不知所措,任何帮助或指针都很受欢迎。< / p>

修改:此外,在我运行方法后,您无法退出帐户。

Github repo

The site deployed on meteor servers

0 个答案:

没有答案