File tree 1 file changed +4
-10
lines changed
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query
1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,6 @@ public Field projectAs(MongoExpression expression, String field) {
125
125
* @since 3.1
126
126
*/
127
127
public Field include (String ... fields ) {
128
-
129
128
return include (Arrays .asList (fields ));
130
129
}
131
130
@@ -134,15 +133,13 @@ public Field include(String... fields) {
134
133
*
135
134
* @param fields the document field names to be included.
136
135
* @return {@code this} field projection instance.
136
+ * @since 4.4
137
137
*/
138
138
public Field include (Collection <String > fields ) {
139
139
140
140
Assert .notNull (fields , "Keys must not be null" );
141
141
142
- for (String key : fields ) {
143
- criteria .put (key , 1 );
144
- }
145
-
142
+ fields .forEach (this ::include );
146
143
return this ;
147
144
}
148
145
@@ -169,7 +166,6 @@ public Field exclude(String field) {
169
166
* @since 3.1
170
167
*/
171
168
public Field exclude (String ... fields ) {
172
-
173
169
return exclude (Arrays .asList (fields ));
174
170
}
175
171
@@ -178,15 +174,13 @@ public Field exclude(String... fields) {
178
174
*
179
175
* @param fields the document field names to be excluded.
180
176
* @return {@code this} field projection instance.
177
+ * @since 4.4
181
178
*/
182
179
public Field exclude (Collection <String > fields ) {
183
180
184
181
Assert .notNull (fields , "Keys must not be null" );
185
182
186
- for (String key : fields ) {
187
- criteria .put (key , 0 );
188
- }
189
-
183
+ fields .forEach (this ::exclude );
190
184
return this ;
191
185
}
192
186
You can’t perform that action at this time.
0 commit comments