我有一系列数字。我想将数组中的每个项目与集合中特定键的所有值进行比较。那可能吗?在下面的示例中,我只抓取那些id为05,07,21,36和42的对象..但这次尝试失败了 -
library(shiny)
ui <- fluidPage(
tags$img(src='photo.png'))
server <- function(input,output){}
shinyApp(ui=ui, server=server)
查询:
var playlist =[05,07,21,36,42]
收藏品:
Track.find({ id: playlist })...
该物业实际上是&#34; _id&#34; - Track.find({&#34; _id&#34;:{$ in:playlist}}) - 当我尝试这个时,我收到了下面打印的错误。有任何想法吗?
消息:&#39; Cast即可的ObjectId失败值&#34; 597e2f68c83f5d5ba6723427,597e2f68c83f5d5ba6723429,597e2f68c83f5d5ba672342c,597e2f68c83f5d5ba6723429,597e2f68c83f5d5ba672342c,597e2f68c83f5d5ba672342b,597e2f68c83f5d5ba672342d&#34;在路径&#34; _id&#34;对于模型&#34; Track&#34;&#39;, 名称:&#39; CastError&#39;, stringValue:&#39;&#34; 597e2f68c83f5d5ba6723427,597e2f68c83f5d5ba6723429,597e2f68c83f5d5ba672342c,597e2f68c83f5d5ba6723429,597e2f68c83f5d5ba672342c,597e2f68c83f5d5ba672342b,597e2f68c83f5d5ba672342d&#34;&#39;, 善良:&#39; ObjectId&#39;, 值:&#39; 597e2f68c83f5d5ba6723427,597e2f68c83f5d5ba6723429,597e2f68c83f5d5ba672342c,597e2f68c83f5d5ba6723429,597e2f68c83f5d5ba672342c,597e2f68c83f5d5ba672342b,597e2f68c83f5d5ba672342d&#39;, 路径:&#39; _id&#39;,
答案 0 :(得分:0)
你需要使用$ in。试试foreach ($query->result() as $row) {
$cal_data[(int)substr($row->date,8,2)] = $row->data;
}