File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -60,3 +60,32 @@ func PrepareUpdateOptions(upsert bool) *options.UpdateOptions {
6060
6161 return updateOptions
6262}
63+
64+ // PrepareFindOneAndUpdateOptions prepares the find one and update options
65+ func PrepareFindOneAndUpdateOptions (
66+ projection interface {},
67+ sort interface {},
68+ upsert bool ,
69+ returnDocument options.ReturnDocument ,
70+ ) * options.FindOneAndUpdateOptions {
71+ // Create the find one and update options
72+ findOneAndUpdateOptions := options .FindOneAndUpdate ()
73+
74+ // Set the projection
75+ if projection != nil {
76+ findOneAndUpdateOptions .SetProjection (projection )
77+ }
78+
79+ // Set the sort
80+ if sort != nil {
81+ findOneAndUpdateOptions .SetSort (sort )
82+ }
83+
84+ // Set the upsert
85+ findOneAndUpdateOptions .SetUpsert (upsert )
86+
87+ // Set the return document
88+ findOneAndUpdateOptions .SetReturnDocument (returnDocument )
89+
90+ return findOneAndUpdateOptions
91+ }
You can’t perform that action at this time.
0 commit comments