首页 > 解决方案 > Mongodb + PHP 无法使用数据库“Czechia”发送“find”命令:无法读取 4 个字节:套接字错误或超时

问题描述

我有一个 PHP 脚本,它应该将大约 200 万个项目从 MongoDB 发送到 Elasticsearch。有一个循环,其中一次迭代需要向查询简单调用的 MongoDB 发出 4 个请求

{"ico": {$in: [here are 50 items]}}
// collection has about 2M items and ico is indexed

但它仍然以这个错误结束Failed to read 4 bytes: socket error or timeout - MongoDB version is 4, PHP version 7.1。

这意味着什么?如果集合有大约 200 万个项目,那么 50 个带有 $in 查询的项目是否太多?如何解决?

标签: mongodbsocketstimeout

解决方案


推荐阅读