Which of the following actions are granted to the built-in readWrite role?
We have an accounts collection with the following document structure: { _id: ObjectId("5ca4bbc7a2dd94ee5816239d"), account_id: 864905, limit: 10000, products: [ 'Commodity', 'InvestmentStock' ] }, { _id: ObjectId("5ca4bbc7a2dd94ee5816239e"), account_id: 299072, limit: 10000, products: [ 'InvestmentFund', 'InvestmentStock' ] }, { _id: ObjectId("5ca4bbc7a2dd94ee5816239f"), account_id: 137994, limit: 10000, products: [ 'CurrencyService', 'InvestmentStock' ] } We need to use Aggregation Framework to find the distribution of products field. Sort the result set by decreasing total number of products. Expected output: [ { _id: 'InvestmentStock', total: 1746 }, { _id: 'CurrencyService', total: 742 }, { _id: 'Brokerage', total: 741 }, { _id: 'InvestmentFund', total: 728 }, { _id: 'Commodity', total: 720 }, { _id: 'Derivatives', total: 706 } ] Which pipeline should you use?
Suppose you have a companies collection in your database. Only the following documents are stored in this collection:
{ _id: ObjectId("52cdef7c4bab8bd675297da4"), name: 'Powerset', category_code: 'search', founded_year: 2006 }, { _id: ObjectId("52cdef7c4bab8bd675297da5"), name: 'Technorati', category_code: 'advertising', founded_year: 2002 }, { _id: ObjectId("52cdef7c4bab8bd675297da7"), name: 'AddThis', category_code: 'advertising', founded_year: 2004 }, { _id: ObjectId("52cdef7c4bab8bd675297da8"), name: 'OpenX', category_code: 'advertising', founded_year: 2008 }, { _id: ObjectId("52cdef7c4bab8bd675297daa"), name: 'Sparter', category_code: 'games_video', founded_year: 2007 }, { _id: ObjectId("52cdef7c4bab8bd675297dac"), name: 'Veoh', category_code: 'games_video', founded_year: 2004 }, { _id: ObjectId("52cdef7c4bab8bd675297dae"), name: 'Thoof', category_code: 'web', founded_year: 2006 }
How many documents will be deleted when executing the following query?
db.companies.deleteMany( { "category_code": "advertising" } )
Suppose you are connected to mongod instance that is already running on port 27000 as admin user. You have to create a new user for an application that has the readWrite role. Use the db.createUser() command to create a user for data analysis. The requirements for this user are: -> role: read on esmartdata database -> username: dataScientist -> password: ds123sci456 Which command should you use?
The $sortByCount stage is equivalent to: