diff --git a/cmd/mongo_struct.go b/cmd/mongo_struct.go index 15d959a..91f4802 100644 --- a/cmd/mongo_struct.go +++ b/cmd/mongo_struct.go @@ -43,6 +43,9 @@ const ( mLogKeyHostId = mLogKeyHostInfo + "." + mLogKeyId ) +// Don't use direct strings in bson types. Use the constants as keys. +// This ensures keys (and subkeys) are consistent, at least within the package. + const ( mLogKeyHostInfo = "host_info" mLogKeyId = "id" @@ -59,7 +62,6 @@ const ( // not using marshal, since it is <0.1x performance func (l *mLog) toBson() bson.M { - // DO NOT USE QUOTED STRINGS! Move them to const and use variable instead return bson.M{ mLogKeyHostInfo: bson.M{ mLogKeyId: l.HostInfo.Id,