I wrote a mongodb query and trying to join(look up) two collections using Mongo query but it is throwing me an error saying maximum document size exceeds. Same query in running on small collection where 150 documents are there but failing to work on 2.9 million documents. I need help in this.
I am using Studio 3T for MongoDB 2018.6.1 IDE
db.collection.aggregate([
{
$lookup: {
from: "collection2",
localField: "id",
foreignField: "id",
as: "joined_data"
}
}
])
Unable to execute the selected commands
Mongo Server error (MongoCommandException): Command failed with error 4568 (Location4568): 'Total size of documents in collection2 matching pipeline { $match: { $and: [ { id: { $eq: null } }, {} ] } } exceeds maximum document size' on server 168.152.169.555:27017.
The full response is:
{
"ok" : 0.0,
"errmsg" : "Total size of documents in collection2 matching pipeline { $match: { $and: [ { id: { $eq: null } }, {} ] } } exceeds maximum document size",
"code" : NumberInt(4568),
"codeName" : "Location4568"
}