2

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
M_R_K
  • 5,929
  • 1
  • 39
  • 40
  • 1
    Some info (but not a solution) can be found in this thread https://github.com/jenssegers/laravel-mongodb/issues/2300 . My guess - it's some inconsistency with AWS DocumentDB and PHP mongo driver. BTW, did you notice any slow downs in your CLIs since migrating? I have a suspicion this warning may affect the performance. – Denis Chmel Dec 27 '21 at 16:45

3 Answers3

6

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

codetiger
  • 2,650
  • 20
  • 37
2

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 mongoDb documentation over 66% of all of the correctness tests have failed for DocumentDB). 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.

M_R_K
  • 5,929
  • 1
  • 39
  • 40
0

Add [ "retryWrites"=>false] in connection to allow write operation via php script and to disable warning add &authMechanism=SCRAM-SHA-1

 $this->mb = new MongoDB\Driver\Manager('mongodb://'.$config_data['mongo_username'].':'.$config_data['mongo_password'].'@'.$config_data['mongo_hostname'], [ "retryWrites"=>false]);
insoftservice
  • 820
  • 8
  • 15