Questions tagged [mongodb]

All versions of MongoDB - a scalable, high-performance, open source, document-oriented database.

Filter by
Sorted by
Tagged with
1
vote
0answers
14 views

mongodb - Replica set creation error: Quorum check failed because not enough voting nodes responded

I am configuring a mongodb replica set. From my current primary node, when rs.add('host1:27017'), it yields this error Quorum check failed because not enough voting nodes responded; required 2 but ...
1
vote
0answers
17 views

Does restarting Mongodb config servers restart the mongos?

Our environment is a 2 node Shard of 5 node replica set with a 3 node replica set config servers and 6 mongos. We happened to change the hostname(short to FQDN) of 1 of the config server and we ...
0
votes
0answers
6 views

How to mongodb stitch webhook service with any content-type [migrated]

I have to create the webhook API to get the POST request from the external server. They are sending the details with Content-Type:application/x-www-form-urlencoded. But I dont see any option to change ...
0
votes
0answers
12 views

How to query Groupy by and count with lookup in Mongodb?

I am trying To use group by in a collection and COUNT in another collection. I have 2 collections. One for customer and other for order_fact. Example Sample data for collection customer. {"Id_Cust":...
0
votes
0answers
17 views

How would I structure embedded fields such that 2 collections can access them?

Sorry for the vague title had trouble trying to word it. Essentially I'm making a Discord bot and I'm making a ranking system for it. I have Users and Guilds collections and I'm wondering how I'd ...
-4
votes
0answers
10 views

Connecting to the MongoDB on windows 10 [closed]

I have installed mongoDB on my Windows 10 PC and created the data/db files in a certain directory.Now i have a node app in a different directory.I want to connect the node app to the database.How do i ...
0
votes
0answers
18 views

I am trying to run mongod --repair command. But It always fails

I am trying to run mongodb --repair command after running for a considerable amount of time it shutsdown with following logs. t.oplogTruncateAfterPoint" } 2019-07-11T20:36:14.034+0000 I INDEX [...
0
votes
0answers
10 views

How to add calculated value as a field into an existed array of sub document using MongodB aggregation

I'm working on MongoDB and I have a document like below structure. I am trying to calculate total services cost and each services lane cost. Here services are sub document. My document structure: { ...
0
votes
0answers
12 views

How does the MongoDB $filter (aggregation) stage work internally?

I was asked a question by a colleague today whether the MongoDB $filter aggregation stage is implemented efficiently. The aggregation stage in question: $project: { absences: { $filter: {...
0
votes
0answers
21 views

Native and SQL Queries in Metabase [closed]

My Application's data is stored in both MongoDB and MYSQL. Is there any way to write queries in Metabase that will help in fetching data from both MYSQL and Mongo Databases?
0
votes
1answer
20 views

Mongo replication sync halfway SocketException: remote: 192.168.168.122:27017 error: 9001 socket exception [RECV_ERROR] server [192.168.168.122:27017]

I got one mongo v2.4.10 server with 1.7TB data, I am trying to migrate and upgrade the mongo to mongo v.3.0.15 server I've setup a new mongo v.3.0.15 and configured replication for v3.0.15 to be ...
0
votes
0answers
27 views

How to get custom function result in query in MongoDB

I have experience in MySQL and new to MongoDB. What I need to achieve is below. MongoDb collection is like: What I want is a query similar to MySQL as: Select title,binary,hummingDistance(this....
0
votes
1answer
14 views

MongoDb Join VS Nested Query

I'm trying to build a game server and we are using MongoDb as the database. We have a collection Games that has models like this: { "_id" : ObjectId("5d1b345b8ea742034db76431"), "Users" : [ ...
0
votes
0answers
13 views

MongoDB date range index bounds

I have a mongodb (V3.6.10) collection with the following stats&indexes: { "ns" : "RepoProd.raiding", "size" : 145312567936, "count" : 6776728, "avgObjSize" : 21442, "...
0
votes
1answer
39 views

MongoDB stuck in startup2 state

I have a Mongo replica set (MongoDB server version: 4.0.3) with primiry, secondary and arbiter. Size of database is about 7 Tb. I add a member to replica set. It stucks in sturtup2 mode for a month! ...
0
votes
2answers
30 views

Auto scaling MongoDB as a service in Microsoft Azure

I see a MongoDB service in Microsoft Azure but that deploys a VM and installs MongoDB in that. I am guessing this will not auto scale and also charge me for the entire VM and MongoDB management (not ...
1
vote
0answers
25 views

MongoDB: why does a DB with 0 connections still get “commands” and “getMores”?

I'm in the process of migrating an old mongoDB database. Before shutting down the old one, I want to make sure nothing is still writing to it or reading from it. Looking at Compose's MongoDB classic ...
0
votes
0answers
35 views

How to delete a user in MongoDB 3.6

I was in trouble with deleting the users in mongodb3.6. I created a user with: db.createUser({ user: "username" , pwd: "password", roles: ["root"]}) And I deleted it with: db.dropUser("username") ...
0
votes
1answer
30 views

What is a good practice for storing unstructured tables as a field in mongodb

Context: I am developing an application that requires handling tables that do not necessarily have an uniform structure (eg. different/extra columns). Those unstructured files also need to be grouped ...
1
vote
1answer
58 views

MongoDB replica set quorum config (network partitioning behaviour)

I use mongodb 4.0.10. I want to establish a quorum for a cluster of one primary node and two secondary nodes as written here. When the number of nodes is less than the quorum, 3 nodes in my case, ...
1
vote
1answer
45 views

How to shutdown mongodb sharded cluster temporary

I have setup mongodb sharded cluster with following topology 3x3 shards (each have 2 replica sets) 1x3 config server replica cluster 2 mongos routers I want to shutdown whole cluster temporary ...
0
votes
1answer
26 views

Slow performance of query with $and & $or operators

My query with $and, $or operators is performing poorly. Even though I've built a compound index on all three fields that are specified in my query criteria, the query does a complete collection scan. ...
1
vote
0answers
21 views

Coverting MongoDB timestamp to postgres [closed]

I have an export of MongoDB data that includes time stamp such as lastRunEnd = 1549036780246 When I select this value as select to_timestamp (('1549036780246'::double precision)) as lastRunEnd I ...
0
votes
1answer
19 views

Spliting changes in separate collection/table or not?

I am using MongoDB to store products, user accounts and stuff on my server and so far it's going nice. But now I'm stuck deciding how do I "split" things apart, like: I have a database where ...
1
vote
0answers
26 views

Lots of CLOSE_WAIT and SYN_RECV Captured From ARBITERS With 'netstat'

I have a cluster with 7 nodes: 1 primary, 3 secondary and 3 arbiters. I also have several more app servers which communicate with the cluster. Recently, we've received lots of errors in the mongodb ...
0
votes
1answer
208 views

Can't solve MongoParseError: Invalid connection string

I'm not able to solve MongoParseError. First my I tried this mongoose.connect(`mongodb://${process.env.DB_USER}:${process.env.DB_PASSWORD}@db:27017/${process.env.DB_NAME}`, {useNewUrlParser: true}); ...
-2
votes
1answer
16 views

Please guide me to change 1 node standlone to 2 node 1 arbiter Replicate Set [closed]

Please guide me to change 1 node standlone (have data) to 2 node 1 arbiter Replicate Set
1
vote
1answer
42 views

Is MongoDB secondary index size affected by primary key size?

If I understand correctly, secondary index leaf nodes in MySQL InnoDB engine hold the table primary key value (at least for a unique index). Thus, looking up a value in the secondary index results ...
1
vote
0answers
33 views

MongoDB Fails due to permission error even though its setup

Attempting to start my MongoDB server using service mongod start fails for the reason: exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /var/lib/...
0
votes
0answers
20 views

compund MongoDB index with _id

I have database with few fields: _id, field0, field1, field2, field3, field4, field5.. I created index on as follows: db.usertable.createIndex( { _id: 1, field1:1} ) The expected that a query ...
0
votes
0answers
15 views

Is it recommended to monthly planned restart MongoDB production server to clean non-mapped virtual memory?

We have a replica set of production mongoDB 3.6.10 , large volume of 5.5 TB , over 10,000 connections anytime , applications read both from primary and secondary servers , we see almost every month a ...
1
vote
1answer
39 views

Is it possible to move mongodb indexes to another file system?

Is it possible to separate MongoDB files location so the indexes are on another file system? In the example below, I have database with 1.5TB of data + indexes of 330GB. I have a very fast storage ...
0
votes
1answer
18 views

distinct values from multiple fields in array

I have a similar mongodb collection: [{ "country": "France", "exchange": { export: [{ resource: 'MILK', origin: ['Toulouse', 'Bordeaux'] }] ...
0
votes
1answer
19 views

Is mongodb upsert the right option for write intensive use case?

I'm designing a data model for a transactional use case which is write intensive. The write load would be 900 - 1,600 Transactions Per Second (TPS) which would account for 30 million Inserts/Updates ...
0
votes
2answers
24 views

mongodb schema design advice

I have a users index which has fields like id, email, password, etc. A user can see all other users except the ones who had blocked him. I want to design a database schema for this problem. So I'm ...
0
votes
0answers
27 views

Mongodb Replica Set Collection Has Different Document Count

I've created a new 3 node replica set and rsync'ed data from an existing mongo database for initial population. The secondary nodes went into STARTUP2 mode and seemed to successfully sync from the ...
0
votes
0answers
24 views

is it possible to make multiple mongo routers connected to just one shard on a mongoDB shard cluster?

I'd like to make a mongo cluster with multiple mongo routers(mongos) with just one shard(mongod) like thses figures. So I made two mongo routers named 'mongorouter-1', 'mongorouter-2', and also ...
1
vote
1answer
24 views

MongoDB query choosing the wrong index in winning plan, Though in executionTimeMillisEstimate as lower for the other index?

MongoDB Query chooses the wrong index in the winning plan. I have two indexes for the same field, one is a single field index and a Compound index with another field. Eg. Field name: Field1, ...
0
votes
1answer
184 views

can't update user password on Mongodb 4.0.5 (Use of SCRAM-SHA-256 requires undigested passwords)

I'm trying to update a password from a user, using changeUserPassword(), and I just receive the following message: Error: Updating user failed: Use of SCRAM-SHA-256 requires undigested passwords &...
1
vote
0answers
18 views

Mongodb throwing an error when I run the query to record last position from oplog

I am getting an error when I run the query in the secondary member to record the last position from the oplog. below is the query. db.oplog.rs.find().sort({$natural:-1}).limit(1).next().ts and the ...
0
votes
1answer
27 views

Why a query is not covered when using a range operator on documents?

I have created the following 1000 documents: for(i=0;i<1000;i++){db.doc.insert({"doc":{"k1":"v_"+i,"k2":i},"scal":i})} So a document looks like this: var d1 = db.doc.findOne() { "_id" : ...
0
votes
0answers
84 views

Mongodb return Error : $cursor stage :: caused by :: operation was interrupted

In recently, i meet a problem with mongodb. After i surveyed on google, there is no good result unfortunately. So i really wish anyone could answer it. As title, there is a kind of error message in ...
1
vote
0answers
22 views

Mongodb - Security weakness while using --authenticationDatabase admin? [duplicate]

I was trying to create a new Mongodb instance based on my old Mongo Database. In my current DB I have an user and password configured. So, I can access my database using: $ mongo --host $MONGO_HOST -...
1
vote
0answers
22 views

MongoDB / PHP - How to change data type for every occurrence of field in a document

I'm trying to learn how to use MongoDB with PHP. I Have built a web application that loads data from database etc. The issue I am having is that when I import my data from a .CSV using MongoDB Compass,...
0
votes
0answers
12 views

MongoDB user password changed for already open connection

We're introducing this new password management infrastructure that changes passwords every X days, but there're these existing implementations in place that use singleton repositories, so once a ...
0
votes
0answers
17 views

mongodb after restoring replica-set from backup the primary is not master

after recovering replica-set from a snapshot (for testing) when I run commands on the primary I got error not master and slaveOk=false does primary not equal to master? I got this output for the ...
0
votes
1answer
41 views

Exception during recovery in mongo

I tried to recover from a sudden shutdown of mongo, but I am experiencing some problems. Here is the log file ***** SERVER RESTARTED ***** Thu Apr 25 01:09:17 [initandlisten] MongoDB starting : pid=...
0
votes
1answer
12 views

mongoDB: Limit user to find documents only by ObjectId

I'm using mongoDB version 4.0.9 for various things. One of them is storing and retrieving files in mongoDB via GridFS. For that purpose, I have created a role/user in mongo with the privileges "...
1
vote
0answers
10 views

Mongo DB sharding concept of read/write [closed]

I am trying to set up mongodb sharding and almost done. 1. completed 1 config replicaSet 2. completed 1 shardsvr replicaSet 3. multiple mongos routers connected to config and shardsvr also done I ...
-1
votes
1answer
49 views

What are the pros and cons of having more data-bearing members in a MongoDB replica set? [closed]

A 3 member replica set has the same fault tolerance if all 3 members contain a copy of the data or if one is an arbiter so why would I ever want all 3 members to have a copy of the data? What is a ...