Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert Multiple Rows RockMongo

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?

like image 828
Benjamin Kaiser Avatar asked Aug 30 '13 07:08

Benjamin Kaiser


1 Answers

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.

like image 101
Benjamin Kaiser Avatar answered Oct 17 '22 04:10

Benjamin Kaiser