gs-accessing-data-mongodb icon indicating copy to clipboard operation
gs-accessing-data-mongodb copied to clipboard

How can I return fields like this find({},{"field1.field2":1})

Open charlee2025 opened this issue 6 years ago • 0 comments

The query : db.getCollection('homework').find({},{"field1.field2":1}) work well in robomongo. When I use spring @query like this: @Query(value = "{}", fields="{ ?0 : 1}") public List<Homework> findByDoRecordKey(String key); // key is "field1.field2"

It is not work well. And it works like: db.getCollection('homework').find({},{"field1":1}) removed the field2.

charlee2025 avatar Jan 21 '19 03:01 charlee2025