MongoDB InsertOne中的点表示法

时间:2019-03-07 10:16:13

标签: mongodb insert mongodb4.0

从PHP在MongoDB(4.0.5)中执行InsertOne时,出现以下异常:

[0] Detected unsupported PHP type for field path "context.trace.1.args.2": 7

根据MongoDB documentation,允许在更新命令中使用点符号。不过,该文档以$set为背景讨论了这一事实。

在我看来,简单的更新不允许使用点表示法。 (只是猜测)

有人可以在这里解释细微差别/边缘情况吗?

=====根据要求进行跟进:

该文档由Monolog创建。 InsertOne中使用的文档如下所示:

Array
(
    [message] => file_get_contents( ...obfuscated... ): failed to open stream: Connection timed out
    [context] => Array
        (
            [code] => 2
            [file] =>  ...obfuscated...
            [line] => 127
            [trace] => Array
                (
                    [0] => Array
                        (
                            [function] => handleError
                            [class] => Whoops\Run
                            [type] => ->
                            ...obfuscated...
                        )

                    [1] => Array
                        (
                            [function] => file_get_contents
                            [args] => Array
                                (
                                    [0] => https:// ...obfuscated...
                                    [1] =>
                                    [2] => 0
                                )

                        )

                    [2] => Array
                        (
                            [file] =>  ...obfuscated... .php
                            [line] => 127
                            [function] => file_get_contents
                            [args] => Array
                                (
                                    [0] => https:// ...obfuscated...
                                )

                        )

                    [3] => Array
                        (
                            [file] =>  ...obfuscated... .php
                            [line] => 91
                            [args] => Array
                                (
                                    [0] =>  ...obfuscated... .php
                                )

                            [function] => require_once
                        )

                )

            [notThrown] => 1
            [type] => Whoops\Exception\ErrorException
        )

    [level] => 500
    [level_name] => CRITICAL
    [channel] =>  ...obfuscated...
    [datetime] => MongoDB\BSON\UTCDateTime Object
        (
            [milliseconds] => 1551951362000
        )

    [extra] => Array
        (
            [cli] => Array
                (
                    [user] =>  ...obfuscated...
                    [script] =>  ...obfuscated... .php
                    [argv] => Array
                        (
                            [0] =>  ...obfuscated...
                        )

                )

            [server_name] =>  ...obfuscated...
            [server_ip] =>  ...obfuscated...
            [process_id] => 3273
            [memory_peak_usage] => 5.75 MB
            [memory_usage] => 5.75 MB
            [git] => Array
                (
                    [ ...obfuscated... ] => Array
                        (
                            [branch] =>  ...obfuscated...
                            [commit] =>  ...obfuscated...
                        )

                    [publisher] => Array
                        (
                            [branch] =>  ...obfuscated...
                            [commit] =>  ...obfuscated...
                        )

                )

        )

    [server_name] =>  ...obfuscated...
    [_id] => MongoDB\BSON\ObjectId Object
        (
            [oid] => 5c81e6029caba40cc96bd831
        )

)

我怀疑尼尔·伦恩已经回答了这个问题。

但是现在我想知道这是否是Monolog的缺点。以及采取什么方法来解决这个问题。

0 个答案:

没有答案