We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A method that will add the bson.M{"$set": query}
bson.M{"$set": query}
To prevent dumm errors like:
document.Update(ctx, Collection, bson.M{"field": "value"}, doc)
The text was updated successfully, but these errors were encountered:
We could just modify this condition:
go-utils/mongo/document/document.go
Lines 212 to 215 in 8396dba
Replace it with:
if _, ok := update["$set"]; !ok { update["$set"] = update } update["$set"].(bson.M)["updated_at"] = now
?
Sorry, something went wrong.
Or we could just check that the keys of update are all starting with a $ character and returning an error if there is none.
update
$
As a result it won't break code using '$inc' for instance.
Or a method like:
document.Set(ctx, Collection, bson.M{"field": "value"}, doc)
No branches or pull requests
A method that will add the
bson.M{"$set": query}
To prevent dumm errors like:
document.Update(ctx, Collection, bson.M{"field": "value"}, doc)
The text was updated successfully, but these errors were encountered: