title: How can we ensure Data integrity in mongoDb?
body: <p>i am trying to migrate from relational database (mysql) data to nosql (mongoDb) . But how can i ensure data integrity in mongodb . what i have found that we cannot do it on server side. what should i use on application side to handle data integrity ?</p>
  
  <p>For eg: i have two tables user and task . Both have userId field common . if i add a new entry in task table it should check if userid present in user table.
  this is one of the requirement others like adding constraints , updating values etc</p>