Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.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
Ruby on rails 如何使用Mongoid finder,它接受一个项目数组作为参数,并搜索其值在数组中的记录_Ruby On Rails_Ruby_Mongodb - Fatal编程技术网

Ruby on rails 如何使用Mongoid finder,它接受一个项目数组作为参数,并搜索其值在数组中的记录

Ruby on rails 如何使用Mongoid finder,它接受一个项目数组作为参数,并搜索其值在数组中的记录,ruby-on-rails,ruby,mongodb,Ruby On Rails,Ruby,Mongodb,如何使用Mongoid finder,它接受一个项目数组作为参数,并搜索其值为的记录​​在数组中。 等价物 Model.where(:id => [1,2,3,4,5]) 使用ActiveRecord。我注意到,Mongoid中的类似调用不会带来期望的结果。试试看 Model.where(:id.in => [1,2,3,4,5]) 试一试

如何使用Mongoid finder,它接受一个项目数组作为参数,并搜索其值为的记录​​在数组中。 等价物

Model.where(:id => [1,2,3,4,5]) 
使用ActiveRecord。我注意到,Mongoid中的类似调用不会带来期望的结果。

试试看

Model.where(:id.in => [1,2,3,4,5])
试一试