Computer scienceFundamentalsSQL and DatabasesDBMSMongoDBOperations and operators

Indexes in MongoDB

Practicing Unique Index

Report a typo

Suppose there is a list of employees in a company with their info: (name of database: employees)
The emails were added to the data to uniquely identify each of the employees:

name: John
fieldOfWork: engineering 
salary: 30000
email: [email protected]

name: Smith
fieldOfWork: marketing 
salary: 10000
hobbies: [email protected]

name: John
fieldOfWork: engineering 
salary: 30000
email: [email protected]

Make the email field unique so that no same email can be added to the database.

Enter a short text
___

Create a free account to access the full topic