0

How to make this query also work in 3.6 mongodb?

  def get_metadata(self, job_id_list):
    # Gets all the document attributes except for `xml` and `_id` field
    resultList = list(self.collection.find({'jobId': {"$in": job_id_list}}, {'xml': 0, '_id': 0}))
    return resultList

The thing is that, we're migrating to use documentdb and documentDB by defaults runs mongo 3.6.

I've been getting this error and I think it's a version thing.

pymongo.errors.OperationFailure: $in array size must not be greater than 10000

B. Fleming
  • 7,170
  • 1
  • 18
  • 36

1 Answers1

0

The problem is not with MongoDB, it's with DocumentDB. I was only able to find one other search result on AWS regarding this problem.

Posted Problem:

FYI, I ran into this error with DocumentDB:

$in array size must not be greater than 10000

I've checked the docs and I don't see this limitation mentioned. It was possible to use larger arrays with MongoDB, and I cannot find any such limit on the array in MongoDB's docs.

AWS's Response:

Thanks for taking the time to report the issue.We are working on a fix. We will post an update to this thread once the fix is rolled out.

The above response was on May 29, 2019, which was 8 days ago as of this answer. This is a problem they're currently working on resolving, but the lack of an update suggests that no fix currently exists. You'll simply have to wait until they issue a fix and either work around the limitation or continue using MongoDB rather than DocumentDB until the fix is in place.

Community
  • 1
  • 1
B. Fleming
  • 7,170
  • 1
  • 18
  • 36
  • what's the status of this if you know – christopher de jesus Jun 21 '19 at 22:08
  • @christopherdejesus Unfortunately I don't have any information about the status of this problem. AWS doesn't appear to have replied in the linked forum post, however, so if we use that as any indication, they're probably still working on it. – B. Fleming Jun 22 '19 at 00:34