简体   繁体   English

如何将我的数组 object 推入 MongoDB

[英]how to push my object of array into MongoDB

I had a.txt file full of names, I got the data, I turned it into an object of array.我有一个充满名字的.txt文件,我得到了数据,我把它变成了一个object的数组。

Now I need to push my array into MongoDB but I don't know how to do it.现在我需要将我的阵列推入 MongoDB 但我不知道该怎么做。

enter image description here在此处输入图像描述

You need to connect to the database and then use collection.insertOne() or collection.insertMany() to add the names to your collection.您需要连接到数据库,然后使用collection.insertOne()collection.insertMany()将名称添加到您的集合中。

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

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