mongodb - How does a json data insert as well as Mongo DB? -


this json data

 0: {name: "dubai campaign", status: "active", start_time: "2017-06- 30t12:07:49+0530", id: "23842596088330291", objective:  "lead_generation"} 1: {  name: "onam campaign", status: "paused", start_time: "2017-06-  27t19:16:56+0530", id: "23842595270760291", objective:   "lead_generation"  } 

how json data insert mongo db ?like

db.userdata.insert({ });

to insert multiple documents in single query, can pass array of document in insert command did follows

db.userdata.insert([{name: "dubai campaign", status: "active", start_time: "2017-06-30t12:07:49+0530", id: "23842596088330291", objective: "lead_generation"},{name: "onam campaign", status: "paused", start_time: "2017-06-27t19:16:56+0530", id: "23842595270760291", objective: "lead_generation"}])

and insert document can use db.userdata.save(yourdocument) also


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -