We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9699059 commit 754c1f6Copy full SHA for 754c1f6
src/Controllers/CollectionController.php
@@ -30,6 +30,12 @@ public function insertOneAction() : Response {
30
return new JsonResponse(400, ErrorNormalizer::normalize($th, __METHOD__));
31
}
32
33
+ if ( isset($decodedRequestBody['document']['_id'])
34
+ && preg_match(MongoDBHelper::MDB_OBJECT_ID_REGEX, $decodedRequestBody['document']['_id']) ) {
35
+ $decodedRequestBody['document']['_id'] =
36
+ new \MongoDB\BSON\ObjectId($decodedRequestBody['document']['_id']);
37
+ }
38
+
39
foreach ($decodedRequestBody['document'] as &$insertValue) {
40
if ( preg_match(MongoDBHelper::ISO_DATE_TIME_REGEX, $insertValue) ) {
41
$insertValue = new \MongoDB\BSON\UTCDateTime(new \DateTime($insertValue));
0 commit comments