FindOne result is showing as null with ObjectId
Overall, the FindAll function is working as intended. The main issue comes into play with the FindById function. This database was made a few years ago, just redoing the project now.
time out mongo db err how can i resolve this please any one
Error connecting to MongoDB: MongooseServerSelectionError: Server selection timed out after 30000 ms
at _handleConnectionErrors (D:developmentdevopProductnode_modulesmongooselibconnection.js:909:11)
at NativeConnection.openUri (D:developmentdevopProductnode_modulesmongooselibconnection.js:860:11)
at runNextTicks (node:internal/process/task_queues:65:5)
at listOnTimeout (node:internal/timers:555:9)
at process.processTimers (node:internal/timers:529:7)
at async connectDB (D:developmentdevopProductconfigdb.js:15:9) {
reason: TopologyDescription {
type: ‘ReplicaSetNoPrimary’,
servers: Map(0) {},
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
setName: ‘atlas-xxxxx-shard-0’,
maxElectionId: null,
maxSetVersion: null,
commonWireVersion: 0,
logicalSessionTimeoutMinutes: null
},
code: undefined
}
Unable to get collection name from MongoDB error
I am working on a Node JS and MongoDB project. I need to get the collection name from the MongoDB error.
Mongo BI Connnector not connecting with mongodb atlas
enter image description here
MongoDB/Mongoose: How to filtered based on a existing array?
I need to search through one MongoDB collection
issue in getting total upserted count and total matched count using mongodb bulkwrite updateMany
Below is the bulkWrite
method where I am inserting 1000 docs. The issue is I could not able to extract total upsertedCount
from the results.
Resume mongodb stream from the point where it stopped
I am streaming huge amount of data from mongodb to other service.
For this i am using mongodb stream. But due to some reason if stream stops i want to rerun the job from where it stopped rather than starting it from start.
My question is if i store the last document id where it failed and rerun the stream from that document will this work ? Does streaming mongodb collection preserve same order every time or do i need to add sortBy for this ?
Mongoose model not enforcing unique in two places
I’m working on a personal project and I’m working on user signup, one of the major things is having users with unique usernames and unique emails. So far I have it enforcing it on email, but for some reason it just will not do it for usernames either. It seems that when I put it in both areas it just overrides each other and allows for duplicates. Here is my model code:
Unable to connect to mongoDB cluster using the program but no problem in connecting with mongoDB compass
Whenever I start my nodejs server, I get this error: “MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you’re trying to access the database from an IP that isn’t whitelisted.”
I am getting this error : Error connecting to MongoDB: MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
enter image description here
Here is my node js application code and it’s error .