相关模型的数据格式问题(Laravel / jenssegers / laravel-mongodb)

时间:2019-04-05 13:25:30

标签: laravel mongodb jenssegers-mongodb

这是laravel-mongodb软件包的open bug on Github,但没有响应。也许有人知道解决方案..?

选择为单个文档时,日期显示为日期

{
    "_id": "5ca71ce0d542352064004034",
    "title": "General review",
    "status": "active",
    "start_date": "2019-04-05 09:16:16.000000",
    "end_date": "2038-01-19 03:14:07.000000",
    "start_review_date": "2019-04-05 09:16:16.000000",
    "submission_fee": 100,
    "reward": 0,
    "is_general_review_round": true,
    "created_at": "2019-04-05 09:16:16.000000",
    "updated_at": "2019-04-05 09:16:16.000000",
    "proposals": [],
    "demography": null
}

但是在选择作为相关对象(嵌套数组)时,我遇到了这个日期转换问题...

{
    "title": "Omnis perspiciatis aut voluptatem dolores vel repudiandae.",
    "start_date": {
        "$date": {
            "$numberLong": "1554542206000"
        }
    },
    "end_date": {
        "$date": {
            "$numberLong": "1556183806000"
        }
    },
    "start_review_date": {
        "$date": {
            "$numberLong": "1555406206000"
        }
    },
    "updated_at": {
        "$date": {
            "$numberLong": "1554455806312"
        }
    },
    "created_at": {
        "$date": {
            "$numberLong": "1554455806312"
        }
    }
}

0 个答案:

没有答案