Reputation: 21469
I have a collection: people. I wish to query documents where people.lastname = people.firstname
Is this possible ?
Upvotes: 0
Views: 105
Reputation: 311935
As Sergio correctly points out, $where
has poor performance, but if that's still acceptable to you, this is how you'd do it:
db.people.find( { $where: "this.lastname == this.firstname" } );
Upvotes: 1
Reputation: 230366
No, this is not possible at the moment (in efficient manner). It might be possible using $where
but it has terrible performance and I wouldn't advise using it in real applications.
Upvotes: 0