Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mongodb 如何在iron路由器路径中使用文档id以外的参数_Mongodb_Meteor_Iron Router - Fatal编程技术网

Mongodb 如何在iron路由器路径中使用文档id以外的参数

Mongodb 如何在iron路由器路径中使用文档id以外的参数,mongodb,meteor,iron-router,Mongodb,Meteor,Iron Router,我目前有下面的路线,它的工程伟大。我想将正在使用的路径更改为同一文档中的不同id(而不是mongoDB生成的id)。如何更改此路由以在路径中使用其他id this.route('thanks', { path: ':root/thanks/:_id', waitOn: function() { return Meteor.subscribe('donate', this.params._id)}, data: function () {

我目前有下面的路线,它的工程伟大。我想将正在使用的路径更改为同一文档中的不同id(而不是mongoDB生成的id)。如何更改此路由以在路径中使用其他id

this.route('thanks', {
      path: ':root/thanks/:_id',
      waitOn: function() { 
        return Meteor.subscribe('donate', this.params._id)},
      data: function () {
        var root = Meteor.settings.root;
      return Donate.findOne(this.params._id);
          },
      action: function () {
          if (this.ready())
              this.render();
          else
              this.render('Loading');
      }
  });
在客户端代码中,我这样做是为了返回页面


Router.go('/give/thanky/'+result)

您只需在路由参数中传递所需的参数:

 Router.go('thanks', {root: 'give', _id: something._id});