mongo shell,如何将查询定向到辅助

mar*_*ark 6 mongodb mongo-shell

我对 mongo 非常陌生,我想从 mongo shell 将一些查询定向到辅助节点。

我读过的文档说要设置读取首选项。

具体来说

在 mongo shell 中, readPref() 游标方法提供对读取首选项的访问。

我已经阅读了有关 readPref 游标方法的文档(如果您感兴趣的话,请访问:http://docs.mongodb.org/manual/reference/method/cursor.readPref/#cursor.readPref),但是我无法这行得通。

mongos> cursor.readPref(secondary);
2015-10-15T10:03:47.480+0000 E QUERY    ReferenceError: cursor is not defined
    at (shell):1:1

readPref(secondary);
2015-10-15T10:04:16.224+0000 E QUERY    ReferenceError: secondary is not defined
    at (shell):1:10

mongos> readPref('secondary');
2015-10-15T10:04:37.848+0000 E QUERY    ReferenceError: readPref is not defined
    at (shell):1:1
Run Code Online (Sandbox Code Playgroud)

我已经尝试了我能想到的所有组合,但总是遇到引用错误。

我错过/不明白什么?