简体   繁体   English

在mongoDB中保存对象数组并转义双引号

[英]Save an array of objects in mongoDB and escape double quotes

I am trying to save an array of objects from node to MongoDB . 我试图将array objects从node保存到MongoDB

I use: 我用:

    _id: ObjectID(request.body.connectionId)
}, {
    $set: {
        status: accepted,
        networks: connectedProfiles
    }

but at MongoDB record i get: 但在MongoDB记录中,我得到:

"networks": "\"(\\n        {\\n        netowrk = TWITTER;\\n        \\\"profile_name\\\" = primary;\\n    }\\n)\""

Any idea why i get the escape quotes? 知道为什么我会得到escape报价吗?

Thanks for the responses. 感谢您的答复。 I finally fixed this issue by stringify the request before sending it to node js, and after parse it. 我最终通过在将请求发送到节点js以及解析之后对请求进行字符串化来解决此问题。 This solved the problem. 这样就解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM