I just installed RockMongo on my OpenShift app. I am trying to create some of the collections manually, however the collection insert view does not seem to be able to insert multiple rows at a time.
I have tried searching around but could not find any spec/wiki to help me.
The Array option seems to be for creation of an Object in the PHP array format.
Here are the JSON options I have tried so far.
{name: "Object 1", category: "Cat 1"},
{name: "Object 2", category: "Cat 2"}
Result: Only added the last object into the database
[
{name: "Object 1", category: "Cat 1"},
{name: "Object 1", category: "Cat 1"}
]
Result: Added it all as one object with two objects inside it.
Does anyone know a way to use the Insert
option in RockMongo to insert multiple items?
Because I was unable to use the Insert
view to bring in an array of data. I ended up just using the Import
feature of RockMongo.
The file I imported looked like the following:
db.mycollection.insert([
{"name": "Object 1", category: "Cat 1"},
{"name": "Object 2", category: "Cat 2"}
]);
Corresponding to the example data I posted in the question. Where mycollection
is the collection you are importing the data to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With