I am very new to mongodb, my requirement is need to search a value in two fields. ex: first_name, last_name
I am using PHP as serverside and mongodb as backend.
Can you please suggest, How can I write the query in PHP.
Below is the things, I tried to implement but not succeeded.
db.users.aggregate(
[
{ $project: { userName: { $concat: [ "$first_name", " - ", "$last_name" ] } } }
]
)