Robomongo: Inserting multiple documents from UI

Created on 24 Jul 2013  路  59Comments  路  Source: Studio3T/robomongo

I would like to have an ability to insert multiple documents from "Insert Document" window.

Use case: I query collection and get the results. I want to copy some documents (in json), edit them and insert to another collection (maybe on another server).
I would like to
1) copy json (from text view)
2) right-click on another collection
3) choose "Insert Document"
4) paste my json (multiple documents)
5) edit json
6) click "Insert"
Like this (in the same format as result in a text mode)
screen shot 2013-07-24 at 9 38 52 pm
Right now we can only insert documents one at a time

high vote

Most helpful comment

While it would be nice to be able to paste an array of JSON documents into the collection using the UI editor, it's not that difficult to open a new editor tab on the collection in question and execute the equivalent .insertMany:

db.getCollection('foo').insertMany([{},{},{}])

All 59 comments

Please test.

verified in 0.8.3 beta 1

but it's weird that it does not support comma between records !! well, i might be talking about different functionalities, I was hoping to have a import Documents from JSON array :) , similar to http://zaiste.net/2012/08/importing_json_into_mongodb/

I had to manually remove all the commas. Robomongo should have a import functionality to import stuff from JSON, CSV etc.

@Ghost---Shadow thanks for suggestion! That's a good idea, so I have create a feature ticket https://github.com/paralect/robomongo/issues/1176 . Let me offer you to track progress within this card. Stay tuned!

totally need this feature during dev cycles

+1

Commas are there by default in say an api pull, so supporting them seems like a necessity. Please add this feature.

this feature is totally need.. It will be really usefull if you can insert many documents using an array of objects like in mongo.insertMany:

[
{ "name": "John", "surname": "Type" },
{ "name": "Master", "surname": "Freez" },
{ "name": "Top", "surname": "Cat" },
]

I tried like this since the json validator didn't complain and resulted in 1 object with inside all the stuff.

+1

Adding my voice, this feature would be very helpful.

+1

This would be really helpful to me as well.
+1

+1!!!

+1

+1

+1
it is adding it in one object

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

I'd also like to have that feature 馃檪

This seems like a common-sense approach; Hence a good UI idea :)

We should not need to manually remove so many commas in 2017. If the insert interface detects you are inserting an array, it should also not by default assume you are wrapping every single item with an integer key (that kind of makes no sense). One of the key features of JSON is simplicity between identifying iterable collections of things (arrays) or simple data structures (Object Literals).

As much as I like this GUI tool, it almost makes more sense to not rely on RoboMongo at all when we need to import a JSON file as a simple array (which is a very common use-case for MongoDB-centric data collections).

+1

+1

+1 Is this any closer to being implemented?

+1

While it would be nice to be able to paste an array of JSON documents into the collection using the UI editor, it's not that difficult to open a new editor tab on the collection in question and execute the equivalent .insertMany:

db.getCollection('foo').insertMany([{},{},{}])

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1

+1 (wanted to do this right now, and I'm surprised I couldn't)

+1

+1 for GUI feature. I'm using this approach!

> mongo
>
> use test
switched to db test
> 
> user = db.user
test.user
> 
> user.insertMany([{"full_name": "User 01", "email": "[email protected]"}, {"full_name": "User 02", "email": "[email protected]"}])
{
    "acknowledged" : true,
    "insertedIds" : [
        ObjectId("5c6fb64f8e54693b95a2daec"),
        ObjectId("5c6fb64f8e54693b95a2daed")
    ]
}
> 
> user.find({})
{ "_id" : ObjectId("5c6fb64f8e54693b95a2daec"), "full_name" : "User 01", "email" : "[email protected]" }
{ "_id" : ObjectId("5c6fb64f8e54693b95a2daed"), "full_name" : "User 02", "email" : "[email protected]" }
> 

I have try Insert Document feature with many records at once and it's working! The JSON will be:

{
    "full_name" : "User 01",
    "email" : "[email protected]"
}
{
    "full_name" : "User 02",
    "email" : "[email protected]"
}

Good to know it is possible now, but the input format of the JSON is weird. Adding commas should be acceptable, IMHO

@dalvarezsmiet adding commas is JSON 馃檭

Sorry, I tried to add an array of objects and added the entires array to the collection. Is it possible in Robot 3t to add multiple items?

Was this page helpful?
0 / 5 - 0 ratings