How to remove array element in mongodb?

Here is array structure contact: { phone: [ { number: “+1786543589455”, place: “New Jersey”, createdAt: “” } { number: “+1986543589455”, place: “Houston”, createdAt: “” } ] } Here I only know the mongo id(_id) and phone number(+1786543589455) and I need to remove that whole corresponding array element from document. i.e zero indexed element in phone … Read more

MongoDB logging all queries

The question is as basic as it is simple… How do you log all queries in a “tail”able log file in mongodb? I have tried: setting the profiling level setting the slow ms parameter starting mongod with the -vv option The /var/log/mongodb/mongodb.log keeps showing just the current number of active connections… 16 Answers 16

mongodb, replicates and error: { “$err” : “not master and slaveOk=false”, “code” : 13435 }

I tried mongo replica sets for the first time. I am using ubuntu on ec2 and I booted up three instances. I used the private IP address of each of the instances. I picked on as the primary and below is the code. mongo –host Private IP Address rs.initiate() rs.add(“Private IP Address”) rs.addArb(“Private IP Address”) … Read more