MongoDB 1) The customers collection includes documents that have accounts as a field that contains an array of values. Write a statement to retrieve a cursor containing all documents where there is only one account.
MongoDB
1) The customers collection includes documents that have accounts as a field that contains an array of values. Write a statement to retrieve a cursor containing all documents where there is only one account.
2) Write a statement that returns only the email addresses of all customer documents.
3) Write a statement to retrieve a cursor containing all customer documents where the active field within the main document (i.e., do not worry about nested documents) is set to true.
4) Write a statement to retrieve a cursor containing all customer documents that do not have the active field within the main document (i.e., do not worry about nested documents). (Hint: Take a look at the Query and Projection operators in the MongoDB documentation to find an operator that helps determine whether a field exists within a document.)
Step by step
Solved in 2 steps