MEAN Technology(mongodb,express js,angular js,node js)

General Tech Technology & Software 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Technology & Software related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

In MEAN Technology,I need to develop the payroll application,In this I have two fields code and name,But code and name should be unique,how to code this in mongodb?

0 views
0 shares

profilepic.png
manpreet 2 years ago


Are you serious?

But still, do you mean code and name should be unique individually or do you mean the combination of code+name should be unique.

There is a difference, if code and name should be unique individually it means there cannot be same code in two different DB. if the combination should be unique means for one code there could be different names and vice versa.

I am going to provide a subjective answer as you haven't shown what you have tried or what you wish to try.

either you user _id as code+name making sure that it would be unique.

or you can have different key for code and name in document having a unique key indexing on both of them. or in second case having a compound unique indexing.


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.