gs-accessing-data-mongodb
gs-accessing-data-mongodb copied to clipboard
How can I return fields like this find({},{"field1.field2":1})
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.