{
"isbn": "123-456-222",
"author": {
"_id": 1,
"lastname": "Doe",
"firstname": "Jane"
},
"editor": [
{
"_id": 1,
"lastname": "Smith",
"firstname": "Jane"
},
{
"_id": 2,
"lastname": "Lopez",
"firstname": "Jennifer"
}
],
"title": "The Ultimate Database Study Guide",
"category": [
"Non-Fiction",
"Technology"
]
}
I am using the MongoDB database and MongoDB .NET driver library in .NET Core. I can search by isbn
, but I want to find all books with editor firstname: Jane
, lastname: Smith
and firstname: Jennifer
, lastname: Lopez
. How can I do that?
2
Answers
I don’t know
C#/.NET
, but here’s a query that you may be able to translate to retrieve the documents you want.Try it on mongoplayground.net.
@rickhg12hs provided the correct filter in the MongoDB query.
To convert it into MongoDB .NET Driver syntax:
Assume that you have these model classes for your collection: