我有一堆动态票的状态。其中,每个票证可以处于"In Process“状态,并具有不同的值。
下一段代码(不起作用)试图解释我要做什么
var tickets = Tickets.find({
driverAsigned: Meteor.userId(),
'statusStack.stack.(this.statusStack.currentStatus).name': "In Process"
});*新数据*
我使用"this.statusStack.currentStatus“的意思是内部文档值,而不是代码中的变量。
这是一张票的结构
{
......
"statusStack" : {
"stack" : [
{
"sortable" : false,
"removable" : false,
"order" : 0,
"name" : "Draft",
"customName" : "Draft",
"description" : "When the ticket has been created",
"color" : "#4d4d4d"
},
{
"sortable" : false,
"removable" : false,
"order" : 1,
"name" : "New",
"customName" : "New",
"description" : "When the ticket info has been updated",
"color" : "#f4f93e"
},
{
"sortable" : true,
"removable" : false,
"order" : 2,
"name" : "Assigned",
"customName" : "Assigned",
"description" : "When the ticket info has been asigned to a driver",
"color" : "#3e89f9"
},
{
"sortable" : true,
"removable" : false,
"order" : 3,
"name" : "In Process",
"customName" : "In Process",
"description" : "When the ticket has been created",
"color" : "#f0883c"
},
{
"sortable" : true,
"removable" : true,
"order" : 4,
"name" : "Frodo",
"customName" : "Blank",
"description" : "New Blank Status",
"color" : "#4d4d4d"
},
{
"sortable" : true,
"removable" : false,
"order" : 5,
"name" : "Resolved",
"customName" : "Resolved",
"description" : "When the Driver has resolved the Ticket",
"color" : "#42f93e"
},
{
"sortable" : false,
"removable" : false,
"order" : 6,
"name" : "Closed",
"customName" : "Closed",
"description" : "When the Admin has been closed the Ticket",
"color" : "#217b1f"
}
],
"currentStatus" : 5
},
......
}发布于 2016-05-13 16:02:07
苏丹法典:
使用“查找”中的查询文档。
https://stackoverflow.com/questions/37191655
复制相似问题