top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How is the mongodb performance "having multiple dbs" VS "too many collections in single db"?

+2 votes
314 views
How is the mongodb performance "having multiple dbs" VS "too many collections in single db"?
posted Oct 5, 2015 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+3 votes

I need a tool for rapidly recreating the proper "schema" (such as it is) of MongoDB instances between environments that pre-creates the right DB names, collections, sets collection caps, and creates the indexes for each collection. I do NOT want to copy all of the data between the instances, though. Each env I manage has different data but the DB/collection/caps/indexes are all the same. Is there an easy way to do this, preferably a tool that exports a JSON doc of all the names, caps and indexes that can then be re-ported into a new instance?

Thanks in advance

+1 vote

I have a project, which has 1000 images. From each image, I get 1 million documents that I currently store in a mongoDB collection.

I have 2 alternatives,
1. Create a separate collection for each image, over multiple projects, say 10 projects, and each image(collection) would have 1 million documents that will be indexed. OR
2. Have a single collection and have 1000x1,000,000 documents in one collection, which again will be indexed.

My research and reading suggests that it is not a very good idea to create 1000 collections (for each image) and create an index for each one of 1000, and go with adding a billion documents to a single collection, to which mongoDB caters with no major issue.
My main aim is to enhance performance for reading. There would be no updates and deletes. Only reads and writes. I can afford writes to be slow, but not reads. So am I right in choosing the 2nd alternative?

Any guidance is highly appreciated.

0 votes

We recently starting using MongoDB and the new Scala driver library (v 1.1.1). We have not made any custom configurations but we are consistently running out of connections and getting connection timeouts. I worry that we are using the driver incorrectly.

Please see my questions below -

  1. We are using dependency injection to manage the MongoClient. Should be injecting MongoClient or MongoDatabase into all of our CRUD classes?
  2. Should we treat the MongoClient and/or the MongoDatabase as a singleton?
  3. Are there any other common mistakes people have seen with the Scala driver?

Thanks in advance...

+2 votes

Is there a way to compare two fields from different MongoDB Collections?

I have a 2 collections:
collection_1: { "english" : { "orth" : "africa", "pron" : "frik" }, "francais" : { "orth" : "afrique" } }
collection_2: { "form" : { "orth" : "afrique", "pron" : "afik" } "sense" : { "cit" : { "quote" : "africa" } }}

I would like to find all where "collection_1.english.orth" == "collection_2.form.orth" and copy/add "form.pron" from collection_2 into collection_1 under "francais.pron".

...