DEV Community

loading...

MongoDb Global Search

dhanushxeno profile image DHANUSH N ・1 min read

Hey Dev's,

The best possible approach or tool or service to do a global search across MongoDb database which holds millions of data.

I need some free tool/ product. Any suggestions.

Thanks in advance 👍

Discussion (10)

pic
Editor guide
Collapse
mattryanmtl profile image
Matt Ryan

You could try using Atlas Search

You could also try with js.

db.movies.findOne()
db.getCollectionNames().forEach(function(collection) {
  print(collection);
});
Enter fullscreen mode Exit fullscreen mode

Then run

mongo movies dbsearch.js
Enter fullscreen mode Exit fullscreen mode

Or you can use db.eval

Somthing like

db.eval( function() {
    var one = db.movies.find({"title":"The Matrix"});
    var two = db.movies.find({"title":"Black Panther"});
});
Enter fullscreen mode Exit fullscreen mode
Collapse
dhanushxeno profile image
DHANUSH N Author

Hi Matt, thanks for your input

Actually Atlas Search is good but it is paid when it comes to production use case & also while creating indexes, there is a limit.

Is there anyother tool which is free of cost or opensource & effective to deal with millions of records in db ?

Collapse
mattryanmtl profile image
Collapse
jordanfinners profile image
Jordan Finneran

You could also use Mongo Free Text Search Indexs
docs.mongodb.com/manual/core/index...

Collapse
dhanushxeno profile image
DHANUSH N Author

But if you have to use for production then we have to pay right ? Any free solution available ?

Collapse
jordanfinners profile image
Jordan Finneran

If you're going to use anything in production over 'millions of records' as you said, yes you will probably have to pay for it.
If you are productionising anything you'll have to pay for something.

The best you can do is look for a serverless option so only pay for what you use.

Thread Thread
dhanushxeno profile image
DHANUSH N Author

Just thinking of indexing MongoDb with elasticsearch in production so that the search would be free of cost. Still exploring more on that

Thread Thread
jordanfinners profile image
Jordan Finneran

Using mongodbs built in search functionality, if you already have mongodb would be free. If you use the link I provided.

Thread Thread
dhanushxeno profile image
DHANUSH N Author

Great Thanks , But do you know whats the key differences between MongoDb built in search vs Atlas search ?

Thread Thread
jordanfinners profile image
Jordan Finneran

Not myself but I'm sure your search engine of choice will 😊