-
Notifications
You must be signed in to change notification settings - Fork 6
fix addToSet and push to support each op #16
New issue
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
base: master
Are you sure you want to change the base?
Conversation
if strings.HasPrefix(p.conf.SchemaPath, "example.json") { | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to skip watcher for unit test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not skip, unit test will stuck on watcher. Cuz watcher is setup on Configure func, and unit test also need call this func: https://github.com/wish/mongoproxy/blob/master/pkg/mongoproxy/plugins/schema/schema_test.go#L19-L21
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my understanding is that watcher should not be blocking, it's a async go routing
the whole mongoproxy service will be continuously running to serve requests, but this watcher function should not be a blocking one
return err | ||
} | ||
|
||
<-done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have we tested it with sending queries to local mongodb? if my reading/understanding is correct, this done
will block SchemaPlugin.Configure()
return, thus no query could be processed?
fix issue:
https://logicians.slack.com/archives/C0133DZ2WE8/p1658528214943319
in mongodb $addToSet and $push command support each operator:
https://www.mongodb.com/docs/manual/reference/operator/update/addToSet/#-each-modifier
https://www.mongodb.com/docs/manual/reference/operator/update/push/#modifiers