Is Mongodb getting the whole document after conditional query?

  mongodb, question

For example, there is group data:

name: 'food',
 data: {
 fruit: [
 {
 name: 'apple',
 stock: 10
 },
 {
 name: 'pear',
 stock: 66
 }
 ...
 ]
 
 }
 
 db.col.find({'data.fruit.stock': 66}, {data.fruit.stock: 1})

The query is the wholedata.fruite;

Q1: Is there any way to obtain only the data queried by the filter? What if this document has a large number of objects?
Q2: Is this a feature of Mongodb? After hitting the filter condition, is the entire document object returned?
Q3: Is there any API documentation for this?

The main question is actually related to the trade-off between Data Model and business query.

1. MongoDB basically returns the document Document as the unit each time. If the document contains an Array, it also needs to return all arrays.

2. As the subject wishes, if you want to return only the qualified data in the array according to the query criteria, you can consider

1) redesign data model without using array nesting;
 
 2) Use $unwind to expand the array according to Flat. Please refer to the following post:

https://segmentfault.com/q/10 …

For reference.

Love MongoDB! Have Fun!

-Gorgeous Splitter-

MongoDB Chinese Community has many activities offline. Please poke at the bottom:

2017 Hua Shan Lun Jian |MongoDB Chinese Community

Hangzhou station is approaching in March! ! ! Interested friends quickly sign up! ! !