'MongoDB/DocumentDB bson_append_array(): invalid array detected. first element of array parameter is not "0"

Recently I have migrated one of my projects (PHP 7.4/Lumen/Ubuntu 20.04) from MongoDB to MongoDB compatible AWS DocumentDB. Since the migration all the CLI Scripts are triggering this strange notice/warning

bson_append_array(): invalid array detected. first element of array parameter is not "0".

enter image description here

Everything seems to be functionally working apart from this message (Even though I have all the PHP errors hidden from ini file this still shows up). Not really sure what is going on.

Message is actually coming from "find" method. I also did try to suppress the msg but no luck.

Does anyone have any idea what is going on here ? Appreciate and thanks for all your responses in advance.

  • DocumentDB version 4.0
  • PHP SDK Composer version 1.9.0


Solution 1:[1]

I am answering my own questions based on my findings so far.

Seems like there is no solution for this issue since AWS DocumentDB is not 100% compatible with MongoDB (As per mongo over 66% of all of the correctness tests failed). Also it is extremely difficult get AWS support for these sort of incompatibility issues, they always refer you to public user forum.

MongoDB recently put up a blog post summering incompatibility issues with DocumentDB and it makes a lot of sense. You can read it in detail here - https://www.mongodb.com/atlas-vs-amazon-documentdb/compatibility

My recommendation is if you are considering using documentDB as a replacement of Mongo do not bother. Save your precious time by sticking with MongoDB.

Solution 2:[2]

If you add &authMechanism=SCRAM-SHA-1 to the connexion string, the warning disepear.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 codetiger