Why do I get an error log when I find query by view for a sharded collection?

The version of my shard cluster is 4.4.5.

I’m using it to create a view on a sharding collection like this.
//testCol → sharded collection
db.createView(“testView”,“testCol”,[])

And if you find the query with that view through mongos, the value is returned successfully from the client.

However, I can see that the log of the mongos server is caused by the query.

{"t":{"$date":"2021-08-19T19:53:51.918+09:00"},"s":"I",  "c":"QUERY",    "id":4625501, "ctx":"conn128877","msg":"Unable to establish remote cursors","attr":{"error":{"code":169,"codeName":"CommandOnShardedViewNotSupportedOnMongod","errmsg":"On sharded systems, resolved views must be executed by mongos","resolvedView":{"ns":"test.testCol","pipeline":[],"collation":{"locale":"simple"}}},"nRemotes":0}}

Why am I getting this error in mongos?
Could this error have any adverse effect on the cluster?

The error message seems to be from a mongod process rather than a mongos process.

Please provide more details about your configuration.

  • port and address configuration
  • log file paths
  • command use to connect before db.createView()

Sometimes a screenshot is better that a text saying you ran such and such commands. With a screenshot we see the context. From the shell prompt we may see if you are connected to mongod or mongos.

1 Like