Ich bin neu zu Mongo und ich bin auf der Suche nach einer Hilfe.Mongo Database Update
MongoDB Enterprise > db.servmon.find({ "hostName" : “server-prf-004”})
{ "_id" : ObjectId("58f0a4a2ff980d97cce0a79c"), "hostName" : “server-prf-004", "thresholds" : [ { "warn" : "None", "crit" : "None", "contact_mail" : "None", "type" : "loadcheck", "contact_page" : "None" }, { "warn" : "None", "crit" : "None", "contact_mail" : "None", "type" : "mu_check", "contact_page" : "None" }, { "map" : "/ora,/arch", "crit" : "None", "warn" : "None", "contact_mail" : "None", "type" : "diskmon", "contact_page" : "None" } ] }
Wenn ich will nur ein Eintrag in der Datenbank
{ "warn" : "None", "crit" : "None", "contact_mail" : "None", "type" : "loadcheck", "contact_page" : "None” } to to { "warn" : “90", "crit" : “80", "contact_mail" : "None", "type" : "loadcheck", "contact_page" : "None” }
Was ist die beste Option ändern?
Ich habe versucht, mit Update und findModify, aber es wird alle Einträge nach Schwellenwerte, wie diese Aktualisierung:
MongoDB Enterprise > db.servmon.findAndModify ({ query:{"hostName" : “server-prf-004","thresholds" : { "warn" : "None", "crit" : "None", "contact_mail" : "None", "type" : "mu_check", "contact_page" : "None" } }, update :{ "hostName" : "server-prf-002","thresholds" : { "warn" : "80", "crit" : "90", "contact_mail" : "None", "type" : "mu_check", "contact_page" : "None" } } ,upsert: true })
MongoDB Enterprise > db.servmon.find({ "hostName" : “server-prf-004"})
{ "_id" : ObjectId("58f0a4a2ff980d97cce0a799"), "hostName" : "server-prf-001", "thresholds" : { "warn" : "80", "crit" : "90", "contact_mail" : "None", "type" : "mu_check", "contact_page" : "None" } }
MongoDB Enterprise >
Sie möchten nur eine ändern, aber basierend auf was? –