MongoDB Indexing Part 3


Sort Direction for index

When we created the index, we specified the sort direction for the index, in this case both ascending. Sorting on this indexes would work only is they are both indexed ascending or descending. But if you ix the direction of either fields, mongo will skip indexing all together.

Continue reading

Advertisements

MongoDB Indexing Part 2


Multi Term Query

db.animals.find({name:’cat’, tags:’land’}).explain()

— Looking for the name ‘cat and the tag ‘land’. the result

vlcsnap-2016-10-06-05h11m34s177

As you can see there is an index and the same index is being used.

Continue reading

Which is the Best MongoDB GUI?


A good UI is an important part of the development experience. The MongoDB Shell works great for administrative actions, but when working with larger amounts of data, the UI becomes fairly important.

In 2014, we discussed 4 of the top MongoDB GUIs: MongoVue, MongoHub, RockMongo, and Robomongo. We left those at the end of this post for your review. Since then, however, many new options have emerged and we thought we’d share our updates.

Comparing MongoDB GUIs

In this article, we are going to compare 4 of the top MongoDB User Interfaces that help developers increase their productivity and manage their database. We’ll be focusing on data visualisation, presentation, and editing. As always, your mileage will vary depending on your scenario and preferences. Read on to find out which is the best MongoDB GUI for you, updated for 2016.

Continue reading

MongoDB : Finding Documents


Query Criteria

Find

db.foo.find(query, projection)

Query: which documents to find

projection: Fields to be included (optional)

Example :

db.foo.find({_id:1}, {_id:1})
{"_id":1}

In the above query we have asked to return the _ID field with a matching criteria of 1

Continue reading

MongoDB CRUD Operations


Previous Article: Data Storage Internals

Create Documents

Assuming you are in the test database in Mongo and you want to find out the tables (There are no tables in Mongo) and collections (only collections) in the database.

>DB
Test
>Show collections
>db.Foo.Save({_id:1, x:10})
>db.Foo.find()
{"_id":1, "x":10}
>Show collections()
foo
system.indexes
>db.Bar.Save({_id:1, x:10})
>show collections()
Foo
Bar
System.indexes

Since it is a test DB there are no collections.

Remember that collections in Mongo defines the scope of interaction with documents

Continue reading