|
@@ -100,9 +100,9 @@ func RepoAddDoc1(ctx *RepoSession, collectName string, doc interface{}, recordLo
|
|
|
if err != nil {
|
|
|
return "", err
|
|
|
}
|
|
|
- insertId, err := result.InsertedID.(primitive.ObjectID).Hex(), nil
|
|
|
- if len(insertId) > 0 {
|
|
|
- _id, _ := primitive.ObjectIDFromHex(insertId)
|
|
|
+ _id := result.InsertedID.(primitive.ObjectID)
|
|
|
+ insertId, err := _id.Hex(), nil
|
|
|
+ if !_id.IsZero() {
|
|
|
if isShouldRecordHistoryByName(collectName) {
|
|
|
var newData Map
|
|
|
colls.FindOne(ctx.Ctx, bson.M{"_id": _id}).Decode(&newData)
|