I have documents in mongodb
which has a transaction_id
. Data type of transaction_id
is ObjectId
.
If I do below query, I get the document:
db.collection.find({ 'transaction_id': ObjectId('609cfef4ad16361274eb12e2') })
.projection({})
.sort({_id:-1})
.limit(100)
But what if I want to get all the documents for multiple transaction ids. So I did:
db.collection.find({ 'transaction_id': [ObjectId('609cfef4ad16361274eb12e2'), ObjectId('609cfeecad16361274eb12e1')] })
.projection({})
.sort({_id:-1})
.limit(100)
I get no documents. How can I get all the documents for matching transaction ids. Thanks