
오류는 MongoDB\BSON\Document 클래스의 생성자에서 인자 타입이 배열(array)이어야 하지만, 문자열(string)로 주어졌기 때문입니다.
정확한 오류 메시지는 인자 타입이 잘못되었기 때문입니다.
해결 방법은 MongoDB\BSON\Document 클래스의 생성자에 배열을 전달하는 것입니다.
#hostingforum.kr
php
$document = new MongoDBBSONDocument([
'_id' => '12345',
'name' => 'John Doe',
'age' => 30
]);
위 코드에서 '_id'의 값은 문자열로 주어졌습니다. 만약 '_id'의 값이 숫자일 경우, 숫자로 주어야 합니다.
#hostingforum.kr
php
$document = new MongoDBBSONDocument([
'_id' => 12345,
'name' => 'John Doe',
'age' => 30
]);
2025-05-26 07:34