It sounds like you need a compound unique index:
db.users.createIndex( { "email": 1, "friends_email": 1 }, { unique: true } )
… and you can verify at the ORM layer that email =/= friends_email.
It sounds like you need a compound unique index:
db.users.createIndex( { "email": 1, "friends_email": 1 }, { unique: true } )
… and you can verify at the ORM layer that email =/= friends_email.