【发布时间】:2014-11-23 22:45:51
【问题描述】:
我正在尝试自动对标签范围进行修改。但我在第一个 'db.tags.remove...' 处不断收到“SyntaxError: Unexpected identifier at ...”错误。
...
today = yyyy+mm+dd;
balancing = sh.getBalancerState();
if (! balancing) {
conn = new Mongo("mongoserver.mydomain.com:27017");
db = conn.getDB("config");
db.tags.remove({ _id: { ns: "mydb.mycoll", "min": { "day:" MinKey }}, tag: "LTS" });
db.tags.remove({ _id: { ns: "mydb.mycoll", "max": { "day:" MaxKey }}, tag: "STS" });
sh.addTagRange("mydb.mycoll", { day: MinKey }, { day: today }, "LTS");
sh.addTagRange("mydb.mycoll", { day: today }, { day: MaxKey }, "STS");
};
...
欢迎任何帮助,
谢谢,
格雷格。
【问题讨论】:
-
这是什么语言?这看起来像是一个编程问题——属于 Stackoverflow。
-
由 mongo shell 运行的 shell javascript。有没有办法把它移到stackoverflow?
-
我不是 Javascript 语言大师,但也许应该是
db.tags().remove?
标签: replication mongodb sharding