To practice using following commands simply create a database with <name of your choice> in MongoDB and add collections named authors , books, users.
- Using MongoDB connection string , connect your database from VS Code using
MongoDB extension. - Now you will find the
databaseandcollectionswhich you named in VS Code side panel with MongoDB icon. Right Clickon each collection name and chooseinsert document.- Change
db.getCollection('authors').insertOnetodb.getCollection('authors').insertMany. - Get all data from source.
- To get data press
Rawand copy the contents. - Insert
data.jsonintouserscollection. - Copy and paste the json object within the function and then run using 🔺 on top.
- All the documents will now be added to your DB.
- Now within your
databaseopenusers, now go toAggregationand selectText. - Start writing your commands till exercise 5 one by one according to the question.
- Exercise 6 or lookup is to be used in
books->Aggregation->Text.