Hot answers tagged

2

The simplest way to do what you’re asking would be to use a well-considered compound index. This article from MongoDB explains it pretty well: Compound indexes are indexes composed of several different fields. For example, instead of having one index on "Last name" and another on "First name", it is typically most efficient to create an ...


1

You can filter the array using the $elemMatch projection operator (this is different from the $elemMatch query operator). db.collection.find( { }, { dammfield: { $elemMatch: { "f7.ff1": "123123123" } } } ) You can also use the aggregate operator $filter with the same result.


1

You can try this one: for (let d of db.adminCommand( { listDatabases: 1 } ).databases ) { db.getSiblingDB(d.name).getUsers() } This is javascript code in mongo shell, should be no big issue to convert it into python.


1

If DB system is designed (and build) to handle that load of X inserts per second, it won't impose abnormal strain on physical hardware. Hardware is built to handle it. When you are building your MongoDB, remember that MongoDB likes memory over CPU-power (ie. More memory makes Mongo faster than more CPU) and a fast disk (higher IOPS) is always better than a ...


1

That ",{Nombre:1, Apellidos:2}" part is 'projection', where you tell what fields you want to be in the result. Without it, all fields are included to result. Normally you use 0 to remove field 1 to include a field But, any positive value will work as "include field". This example find will return fields _id, Nombre, Apellidos Field _id ...


1

Yes, easily! Set priority of node 1 to higher than 1... Node 1 = 10.1.0.1 (Primary) - priority 2 Node 2 = 10.1.0.2 (Secondary) - priority 1 Node 3 = 10.1.0.3 (Secondary) - priority 0.5


1

The main factor here is the Replica Set Elections. Replica sets use elections to determine which set member will become primary. Replica sets can trigger an election in response to a variety of events, such as: Adding a new node to the replica set, Initiating a replica set, Performing replica set maintenance using methods such as rs.stepDown() or rs....


1

There is no access control enabled with MongoDB by default, so this is something you'll need to configure separately. Fortunately, it's not too difficult thanks to the well-written MongoDB Manual. Here is the gist: Start MongoDB without access control (which I believe you've already done) Connect to the instance (which you've stated you've already done) ...


Only top voted, non community-wiki answers of a minimum length are eligible