我有一個動態的票證狀態堆棧。其中每張票可以處於狀態「處理中」並具有不同的「this.statusStack.currentStatus」值。MongoDB通過動態查詢第N個元素來獲取數據收集
下一個代碼(即不工作)試圖解釋什麼,我試圖做
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
},
......
}
您能否爲門票收藏提供示例文檔,並且更詳細地說明您需要什麼。 –
完成@LaharShah –