I'm getting the following when trying to do a MongoDB Atlas Search query using mongodb Java driver, I'm using the java driver 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, "i": 1}}, "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)

following the code snippet, it was generated from mogodb atlas console itself.

testingCollection.aggregate(Arrays.asList(
    eq("$search",
            eq("wildcard",
                    and(
                            eq("path", "name"),
                            eq("query", "dushan*"),
                            eq("allowAnalyzedField", true)
                       )
              )
      ))).first();

Any idea what would be the cause?

0

There are 0 answers