i have a question: but how can i insert many json files inside one document collection? I have a ruby script connected with mongoDB which generate json files for each ID product. In mongo i should want a structure like this:
Id(document's name) : {
many json for same ID
}
how can i get this structure in ruby?
DB’s name is “test_db” and collection’s name is “test_coll”
Hi @gioele_valori and welcome to MongoDB community forums!!
If I understand your question correctly, you are trying to add a JSON file into the collection. If my understanding is correct, you can either make use of the MongoDB tools and use the mongoimport to import the json file.
The other way to solve at the application end would be by making use of the file system.
Please note that the following has been tested using Ruby Driver version 3.1.2 and would recommend to perform through testing before using in a production environment.
However if this is not you are looking for, could you help me a sample document that you wish to insert into the collection.