Tag Info

New answers tagged

0

There is no create table on mongo. What you need to do is read from the source collection and insert to the target using a javascript foreach loop. I am going to give you an example and not the solution for your case: db.previous_data.find().forEach(function(InsRec){db.my_hll.insert({"_id" : "+ InsRec._id +"});}) Since you are using group by instead of ...


0

Unfortunately this appears to be, per your description, a network issue. I believe it to be so whereas you imply the error goes away and the replica set effectively believes it does have a master. As requested, some things to investigate would be to check the mongo logs for connectivity errors. I have experienced, in Azure, a scenario where I had to use the ...


0

The answer of eoinbrazil is partly incorrect. A new Node can be in STARTUP2 for a long time. The link the posted says: Each member of a replica set enters the STARTUP2 state as soon as mongod finishes loading that member’s configuration, at which time it becomes an active member of the replica set. The member then decides whether or not to undertake an ...


0

At first you should move to a 3 node replica set to ensure High Availability. At your case i would suggest to add an arbiter to your set, and give higher priority to the server A to ensure that will be the Primary. 1) Probably your question is about atomicity rather than consistency (correct me if i am wrong) the most safe choice is command findAndModify ...


0

You need something like the flag { auto_reconnect: true } as described here http://mongodb.github.io/node-mongodb-native/api-generated/db.html. According to documentation: The server option auto_reconnect is defaulted to true which can be overridden.


2

Yes, create a new record for every reading. MongoDB and other document stores are designed for efficient retrieval of de-normalized or irregularly structured data. A MongoDB collection is essentially a set of key-value pairs with a rich value type. Updating the value is an atomic operation, which means that constantly appending to a list within the value is ...


0

There is no way to specify your own sizes, the only way to alter the sizes of data files is to specify (or not) the smallfiles option. That will bring the file sizes down to 25% of the default (max of 512MB rather than 2GB etc.) You can pre-allocate the files yourself in advance (with dd, fallocate or similar). I have a sample bash script using fallocate ...


1

OK, we solved this. Issue is that mongo auto creates the collection when incoming data comes in. So the problem was: Drop collection // transactions are coming in Create collection as capped But #3 comes too late, as the collection is already present, as not capped, because of #2. Solution: stop mongo bring up mango on non standard port // to ...


0

The question to answer first is, are any of the possible children bounded or unbounded sets of data? The next question is, how are you going to be requesting the data? Another question would be, how often will the data be written? One of the things you'll learn quickly with MongoDB is the answer to any schema questions is almost always "It depends". It ...


0

I have an idea about mongoDB. You can pre-create the quiz by using as field names the correct answer (true or false). When the player gives an answer you will have to check if the field exists. An example document is the below one: {Question:"":{true:{Question:{"text goes here",false:{}...}}} So if he answer true the first in order to validate you have to ...


0

When you are exporting to .csv file you should use --field/-f/fieldFile option. http://docs.mongodb.org/manual/reference/program/mongoexport/ Try this mongoexport -d central -c alerts -q "{updated_at:{\$gte:new Date(1420936780121)}}" -f --csv --out alerts_11_12_Jan_20151.csv


0

openExisting size 12288 less than minimum file size expectation /Users/SGudimela/Workspace/mongodata/local.0 Indicates that your datafile local.0 is less than the minimum file size that mongo expects. From Assertion failure false src/mongo/db/storage/data_file.cpp 112, we can go to the source code and see that during startup, mongo did not pass a file ...


1

In relational database, you should create a table called Questions which should contain following fields: ID QuestionString QuestionType (Master, Individual, sub-question) TrueCase (here you should store the ID of the next question. Since we'll store all questions in this table, therefore each questions shall have unique ID) FalseCase (ID of the question ...


0

It is showing error warning database /Users/SGudimela/Workspace/mongodata/ local could not be opened, check whether you have permission to access the data directory.


0

That's true. You can put hierarchical data in MongoDB. But I think you could perfectly fit what you got in one MySQL table? Let's say structure would look like ID ParentID TypeID Value 1 NULL 1 'Dr. Mittens' 2 1 2 'Doc. Woofer' 3 2 3 'Name of Subject' 4 3 4 'Post 1' 5 3 4 ...


0

Nothing here immediately looks like a Sharding issue. Sharding will have a more significant impact on your Reads than your Writes. There are other areas, for Write performance, I would explore prior to spinning up more resources. There is also a larger topic of how your collection is sharded. You could easily, as per your description, have some documents be ...


0

Whatever you do, do not shut down that mongod process until you back up your data (see below). There are missing files in that database directory, and I suspect they have been manually deleted at the OS level. The data files should not have any gaps in them, ever. In other words you should have files starting at myBase.0 all the way up to myBase.37, there ...


0

There are two things which take a meta data lock on a collection - the balancer (to move a chunk) and a mongos (to split a chunk). Now, sometimes you will get this warning (it is just that, a warning) if, for example, a mongos attempts to split while another mongos is already performing a split. Or, it might be that the balancer is moving chunks and so the ...


1

Here's a working example that I just tested using 2.6.6 - I specified two parameters just to show how it is done for reference: storage: dbPath: "/data/db/test" systemLog: destination: file path: "/data/db/test/mongodb.log" processManagement: fork: true setParameter: enableLocalhostAuthBypass: 1 enableTestCommands: 1


0

How did you change the chunk size? Did you follow this guide? To recap, one should: connect to mongos switch to config db issue change chunk size command: db.settings.save( { _id:"chunksize", value: <sizeInMB> } ) AFAIK, warning: chunk is larger than 1024 bytes because of key ... won't bring down a shard, it will only result in a unbalanced ...


1

About _id generation, as long as you don't specify _id explicitly, Mongo would handle the id for you. It generates different nonce for different collection. So you should not need to worry about duplicated _id across different collection. Reference here. I agree with other answer, use same collection and put an extra field to differentiate regular user and ...


1

You should not have two collections, that will give you headache. Have a user collection which has admin and regular users. You can then query users as a whole or look for a given type only. So if you are looking for user id x you don't have two search two collections. As for the question on duplicate ids with 2 collections, it simply depends how the ids ...


1

One possible cause is that your secondary become "stale" as stated here . When you are resyncing a member, make sure the RS is not under heavy load.


2

If your data exist on a node then this node is named Primary from now on and the other 2 secondaries. 1) Start the Primary as standalone and drop the index. 2) Take a backup of your data just in case 3) Stop secondaries and delete their data directory. 4) Start the Primary as a member of the replica set. 5) Start the first secondary. This will cause an ...



Top 50 recent answers are included