问题描述
当尝试使用mongodb Java驱动程序进行MongoDB Atlas Search 查询时,我得到了以下信息,而我正在使用Java驱动程序4.1。
exception in thread "main" com.mongodb.MongoCommandException: Command Failed with error 8 (UnkNownError): 'Remote error from mongot :: caused by :: "path" is required (from "wildcard")' on server ***. The full response is {"operationTime": {"$timestamp": {"t": 1603099324,"i": 1}},"ok": 0.0,"errmsg": "Remote error from mongot :: caused by :: \"path\" is required (from \"wildcard\")","code": 8,"codeName": "UnkNownError","$clusterTime": {"clusterTime": {"$timestamp": {"t": 1603099324,"signature": ***},"keyId": ***}}}
at com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:175)
at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:359)
at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:280)
at com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceive(UsageTrackingInternalConnection.java:100)
at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.sendAndReceive(DefaultConnectionPool.java:490)
at com.mongodb.internal.connection.CommandProtocolImpl.execute(CommandProtocolImpl.java:71)
在代码段之后,它是从mogodb Atlas控制台本身生成的。
testingCollection.aggregate(Arrays.asList(
eq("$search",eq("wildcard",and(
eq("path","name"),eq("query","dushan*"),eq("allowAnalyzedField",true)
)
)
))).first();
你知道是什么原因吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)