Tuesday, December 20, 2016

Do any visual tools exist for MongoDB (for Windows)? [closed] stackoverflow


I'm currently using MongoDB in a reporting system and have to delete a whole bunch of test documents. While I don't have too much trouble using the JSON-based command-line tools, it gets extremely tedious to have to keep searching for documents, copy-and-pasting OIDs, etc., especiallyfrom a command prompt window (ever tried to "mark" text that wraps multiple lines?)
A quick Google search didn't turn up much (just a Mac tool), but I thought I'd ask here.
I realize that there's unlikely to be anything even close to SQL Server Management Studio in terms of the feature set, but is there anything at least similar? Just something that will allow me to visually inspect the databases and collections, perform some simple CRUD tasks and manage multiple scripts in a proper window (not a DOS prompt)?
If not, is there a work in progress anywhere? I might even be willing to contribute if I knew what I was looking for, but I can't even seem to find a hint of a germ of an inkling that somebody might be thinking about building something like this for Windows.
I'd appreciate it if anyone could point me in the right direction.
shareimprove this question

closed as not constructive by Brian DiggsЯegDwightkprobstMysticialdSquared Oct 12 '12 at 1:17

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.
3 
I'm voting to close my own question; at the time it was written, the landscape was barren and even one or two answers was a miracle. But now there seem to be plenty of tools and the answers are just going to turn into a poll over time. – Aaronaught Feb 25 '12 at 16:34
2 
9 
My one and only issue with SO is how aggressive we are in closing questions. Take this one - I found it via a Google search, it's highly upvoted, and has an excellent and well-maintained accepted answer that was extremely helpful to me, a developer. Why close it then? This question has not proven to solicit debates, argument, polling or extended discussion. If it is closed, we reduce the body of knowledge that programmers have access to, which is the opposite of the spirit and intent of SO, IMHO. – Ryan Shripat Feb 20 '15 at 1:56
   
@RyanShripat: I don't know why my name doesn't appear in the list, but you do realize that this is myquestion and I voted to close it? There are a lot of obsolete and/or unhelpful answers here, some duplicate answers, and some actual spam that you can't see right now because it was deleted. I got value out of this question at the time, but it's just not necessary anymore, and eliminating this kind of noise was precisely the spirit and intent of Stack Overflow. I'd probably say it shouldn't be deleted, but it should definitely stay closed. – Aaronaught Feb 20 '15 at 6:46 
3 
Hi @Aaronaught - I saw your comment saying that you're voting to close it, but ignored it because I think that's actually irrelevant. 'Your' question now belongs to the Community. There ARE obsolete and unhelpful answers here, but the top-voted one, with 70 votes, is extremely up-to-date and helpful. I made this Google search yesterday, and found this, so I'd say it's very much necessary - I got value out of this just yesterday.– Ryan Shripat Feb 20 '15 at 11:48

9 Answers

up vote153down voteaccepted
Several GUIs have been created to help developers visualize their data. Mongo-tools lists many of them (check "GUI" under "Purpose"), albeit without any comments. Some popular ones are:
  • MongoDB Compass – provides a graphical user interface that allows you to visualize your schema and perform ad-hoc queries against the database – all with zero knowledge of MongoDB's query language. Developed by MongoDB, Inc
  • Robomongo – a shell-centric cross-platform open source MongoDB management tool. Shell-related features only, e.g. multiple shells and results, autocomplete. No export/ import or other features are mentioned. Last commit: 2016-Mar-04
  • RockMongo – a MongoDB administration tool, written in PHP5. Allegedly the best in the PHP world. Similar to PHPMyAdmin. Last version: 2014-Jun-06
  • Mongo3 – a Ruby/Sinatra-based interface for cluster management. Last commit: Apr 16, 2013
  • Database Master – a Windows based MongoDB Management Studio, supports also RDBMS. (not free)
  • 3T MongoChef – a multi-platform in-place data browser and editor desktop GUI for MongoDB (free for personal and non-commercial use)
  • MongoBooster – a shell-centric cross-platform GUI tool for MongoDB v2.2-3.2, which provides update-in-place, fluent query builder, ES6 syntax support and intellisense experience... Last commit: 2016-May-24. (free for personal and non-commercial use)
  • SlamData - an open source web-based user-interface that allows you to upload and download data, run queries, build charts, explore data.
Abandoned projects:
  • Fang of Mongo – a web-based UI built with Django and jQuery. Last commit: 2012-Jan-26, in a forked project.
  • Opricot – a browser-based MongoDB shell written in PHP. Latest version: 2010-Sep-21
  • Futon4Mongo – a clone of the CouchDB Futon web interface for MongoDB. Last commit: 2010-Oct-09
  • MongoVUE – an elegant GUI desktop application for Windows. Free and non-free versions.Latest version: 2014-Jan-20
  • UMongo – a full-featured open-source MongoDB server administration tool for Linux, Windows, Mac; written in Java. Last commit 2014-June

Tuesday, December 13, 2016

Multiple Joins Work just like Single Joins (holy count! the great explanation!)


Before reading this article, you should have a good understanding of single joins between two tables and be clear on the differences between inner and outer joins. Check out my previous post A Primer on Joins to help you accomplish this.
Have you ever looked at a query like the one below and wondered how to read it, how the different joins work together, and what aliens on what planet wrote such a thing?
001-Multiple-Joins-Work-just-like-Single-Joins
Queries with multiple joins like this one often lead to confusion, such as the one behind this question that I have often heard from students: “There seems to be three tables joined to the Employee table in this query—two are inner joins and the other is an outer join. How can the same table have its non-matching rows eliminated and preserved at the same time in the same query?”
In this article, I will show you that confusions like this one arise from a syntax that encourages us to misunderstand joins, and I’ll offer another way of looking at multiple-join queries that makes questions like the one above melt away.
So, what leads to the confusion? Initially, it might seem that every table that is joined to this query is joined to a previous table; the ON clause suggests this with its references to columns in previous tables.
002-ON-clause-Multiple-Joins-Work-just-like-Single-Joins
But this is not what actually happens in a multi-join query, and so looking at things in this way will lead to head-scratching.
So, what does a multi-join query actually do? It actually does something very simple. It performs a series of incremental, single joins between two tables at a time (while this article refers only to tables for simplicity sake, joins can be between tables, views, table valued functions, CTEs, and derived table subqueries). Each single join produces a single derived table (DT) that is then joined to the next table and so on. Like this:
multiple-joins-work-like-single-joins
JOIN 1: Inner join between Employee and Contact resulting in a derived table, DT1. Because this is an inner join, rows in Employee are excluded if they don’t match any rows in Contact, and vice-versa.
JOIN 2: Outer join between DT1 and JobCandidate resulting in a derived table, DT2. Because this is a left outer join, all rows in DT1 are preserved.
JOIN 3: Inner join between DT2 and SalesPerson resulting in a derived table, DT3. Because this is an inner join, rows in DT2 are excluded if they don’t match any rows in SalesPerson, and vice-versa.
JOIN 4: Outer join between DT3 and SalesOrderHeader resulting in a derived table, DT4. Because this is a left outer join, all rows in DT3 are preserved.
JOIN 5: Outer join between DT4 and SalesTerritory resulting in a derived table, DT5. Because this is a left outer join, all rows in DT4 are preserved. DT5 is the final result of the query.
So, what about that confusion arising from the ON clause? With this new way of looking at multiple-join queries, we can now see that the proper way to read an ON clause is not that it joins the new table to a single table that came before it in the query! The only join that does that is the first one; all subsequent ones join a new table to the derived table that is a result of all the joins before it. If an ON clause includes a table alias, that is only to identify the column properly to the query. Table aliases are only required when there is ambiguity—when two or more columns have the same name in the derived table that precedes the current join because they came from different tables.
004-derived-table-DT-Multiple-Joins-Work-just-like-Single-Joins
I hope this new way of looking at multiple-join queries helps make it easier and more productive for you to work with joins.
Have fun!
Peter Avila
SQL Server Instructor – Interface Technical Training
Phoenix, AZ

Methods of visualizing joins


Just wondering if anyone has any tricks (or tools) they use to visualize joins. You know, you write the perfect query, hit run, and after it's been running for 20 minutes, you realize you've probably created a cartesian join.
I sometimes have difficulty visualizing what's going to happen when I add another join statement and wondered if folks have different techniques they use when trying to put together lots of joins.
shareimprove this question
8 
Know your data, and know your joins - codinghorror.com/blog/2007/10/… – OMG Ponies Jul 30 '10 at 21:48
1 
@OMGPonies that's about the best answer to this I've thought of. – Matthew Jones Jul 30 '10 at 21:50

4 Answers

Always keep the end in mind.
  1. Ascertain which are the columns you need
  2. Try to figure out the minimum number of tables which will be needed to do it.
  3. Write your FROM part with the table which will give max number of columns. eg FROM Teams T
  4. Add each join one by one on a new line. Ensure whether you'll need OUTER, INNER, LEFT, RIGHT JOIN at each step.
Usually works for me. Keep in mind that it is Structured query language. Always break your query into logical lines and it's much easier.

Joins explained by Venn Diagram with more than one join


have been very helpful in learning the basics of joins using Venn diagrams. But I am wondering how you would apply that same thinking to a query that has more than one join.
Let's say I have 3 tables:
Employees
EmployeeID
FullName
EmployeeTypeID
EmployeeTypes (full time, part time, etc.)
EmployeeTypeID
TypeName
InsuranceRecords
InsuranceRecordID
EmployeeID
HealthInsuranceNumber
Now, I want my final result set to include data from all three tables, in this format:
EmployeeID | FullName | TypeName | HealthInsuranceNumber
Using what I learned from those two sites, I can use the following joins to get all employees, regardless of whether or not their insurance information exists or not:
SELECT 
    Employees.EmployeeID, FullName, TypeName, HealthInsuranceNumber 
FROM Employees
INNER JOIN EmployeeTypes ON Employees.EmployeeTypeID = EmployeeTypes.EmployeeTypeID
LEFT OUTER JOIN InsuranceRecords ON Employees.EmployeeID = InsuranceRecords.EmployeeID
My question is, using the same kind of Venn diagram pattern, how would the above query be represented visually? Is this picture accurate?
multiple joins
shareimprove this question
   
Not to be to picky but that's a Euler diagram, not a Venn diagram. – Jesse Jul 30 '12 at 6:58

2 Answers

I think it is not quite possible to map your example onto these types of diagrams for the following reason:
The diagrams here are diagrams used to describe intersections and unions in set theory. For the purpose of having an overlap as depicted in the diagrams, all three diagrams need to contain elements of the same type which by definition is not possible if we are dealing with three different tables where each contains a different type of (row-)object.
If all three tables would be joined on the same key then you could identify the values of this key as the elements the sets contain but since this is not the case in your example these kind of pictures are not applicable.
If we do assume that in your example both joins use the same key, then only the green area would be the correct result since the first join restricts you to the intersection of Employees and Employee types and the second join restricts you the all of Employees and since both join conditions must be true you would get the intersection of both of the aforementioned sections which is the green area.
Hope this helps.