初始化

This commit is contained in:
2026-05-26 15:57:55 +08:00
parent 4efab9dceb
commit c47f12a740
20 changed files with 270 additions and 34129 deletions
+26
View File
@@ -0,0 +1,26 @@
// Insert authority role with _id=1 (used by admin fish01).
// Run:
// mongosh "mongodb://stat_center:v5weEdNvXnJCMr9TeFFm@172.104.52.130:27017,172.104.52.26:27017,172.104.52.242:27017/stat_center?authSource=stat_center&replicaSet=fish0" script/add_role_1.js
//
// Schema mirrors models/authorityMod/type.go (Authority struct).
const now = new Date();
const doc = {
_id: NumberLong(1),
role: "super_admin",
authJson: "*",
createdAt: now,
updatedAt: now,
};
const existing = db.authority.findOne({ _id: doc._id });
if (existing) {
print("authority role _id=1 already exists, skipping insert:");
printjson(existing);
} else {
const res = db.authority.insertOne(doc);
print("inserted:");
printjson(res);
printjson(db.authority.findOne({ _id: doc._id }));
}