Query other than current database

In mongoDB, can I query on DB other than the current DB? Example: If I have two different databases A and B, and my current database is A (in console), then, can I query on B database?

Answers


You can query another database on the same mongod / mongos instance with the .getSiblingDB() method, for example:

use A
db.getSiblingDB('B').collection.find(...)

Need Your Help

Floating button is AWT?

java user-interface button awt

So, I've always avoided using GUIs in java because, personally, I can't stand GUIs. But, I've started a project which requires me to use GUIs, and, unsurprisingly, I'm having problems.. I have this...

ScrollViewer does not react to the Grid.Row position

c# .net xaml windows-8 visual-studio-2012

My StackPanel and ScrollViewer seem to just not end at the Grid.Row position. I am making a Metro app so it is mandatory for the grid to be dynamic, as well as all the elements.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.