mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: security: add operateIp for oplog
This commit is contained in:
1 parent
d058f7a208
commit
b902b54409
3 files changed
+30
-5
No files matched your search
@@ -5,7 +5,12 @@ import db from '../service/db';
|
||||
export const coll = db.collection('oplog');
|
||||
|
||||
export async function add(data: Partial<OplogDoc> & { type: string }): Promise<ObjectID> {
|
||||
const res = await coll.insertOne({ _id: new ObjectID(), ...data });
|
||||
const _data = { ...data };
|
||||
if (_data._id) {
|
||||
_data.id = _data._id;
|
||||
delete _data._id;
|
||||
}
|
||||
const res = await coll.insertOne({ _id: new ObjectID(), ..._data });
|
||||
return res.insertedId;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user