0

I'm trying to automate modifications made on tag ranges. But I keep getting an "SyntaxError: Unexpected identifier at ..." error at the first 'db.tags.remove...'.

...
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");
};
...

Any help would be most welcome,

Thanks,

Greg.

Icu
  • 103
  • 1

1 Answers1

0

Misplaced " - took me a while to see it!

db.tags.remove({ _id: { ns: "mydb.mycoll", "min": { **"day:"** MinKey }}, tag: "LTS" });
db.tags.remove({ _id: { ns: "mydb.mycoll", "max": { **"day:"** MaxKey }}, tag: "STS" });

Change it to "day" :

wdberkeley
  • 11,531
  • 1
  • 28
  • 23