USE ONLY IF YOUR QUESTION IS VERSION-SPECIFIC. For questions about MongoDB programming that are specific to version 4+ of the language. Use the more generic [mongodb] tag on all MongoDB questions.
Questions tagged [mongodb4.0]
39 questions
17
votes
3 answers
Mongodb can not start because of WiredTiger.turtle permissions
I am trying to start mongodb 4.0.4 on ubuntu 16.04, but the database denies all my tries. I checked mongodb log files and find out that the file named WiredTiger.turtle has no needed permissions. Here log errors:
2018-11-26T15:14:32.438+0600 E…

user3151148
- 375
- 2
- 3
- 8
12
votes
4 answers
bind multiple IP in mongoDb 4.x.x
for mongoDB 4.0.3,
unable to add multiple ips in bindIp
following config works for localhost
net:
port:27017
bindIp:127.0.0.1
Following works for logging from other ip:
net:
port:27017
bindIp:0.0.0.0
following doesn't work
…

cartman619
- 552
- 4
- 17
4
votes
1 answer
$concat string with $cond in mongodb aggregation
[
{
"user_id" : 12453,
"profile_type" : "demo_type_1",
"records" : [
{
"type" : "typ_11",
"value" : {
"high" : 115,
"low" : 78
},
"_meta" : {
…

infinitywarior
- 379
- 4
- 16
2
votes
2 answers
Why aggregate two collections with $out never ends ? MongoDB
OK, so, I have two collections. One of them has 6M documents, the other one has 25M documents. I want them in a new collection:
Collection 1 example:
Movie
{"movieId" : "1", "name" : "Titanic"},
{"movieId" : "2", "name" : "King Kong"}
Collection…

andrea
- 23
- 3
2
votes
1 answer
mongodb4.0 start a transaction in c# (drive rversion 2.7+), in the duration of transaction, the whole database will be locked, how to fix it?
(updated on 2019-7-2) 7 days after, finally, I solved this question.
Well, my code is OK, WTF, wasted so much time.
The question is my team use AliCloud(a chinese company, like Amazon, Azure), and the Mongodb has many versions, We created the…

Nick.Jane
- 31
- 5
2
votes
0 answers
Mongodb got signal 15 (Terminated), will terminate after current cmd ends centos 7.5
I am getting Mongodb 4.0.4 crash got signal 15 (Terminated) in Centos 7.5 after server restart. I have found mongodb log from log file. please suggest me what should I need to do for start this service.
2019-02-28T17:00:52.978+0530 I CONTROL …

Jain Hemant
- 150
- 2
- 19
1
vote
2 answers
MongoDB - directly query a unique index instead of a collection
Looking for way to directly query a MongoDB index, instead of the collection that the index belongs to.
For example, here are two collections:
User:
{
id: ObjectId(),
username: string
...
}
SpecialUser:
{
id: ObjectId(),
specialUsername:…

Dimitar Spasovski
- 2,023
- 9
- 29
- 45
1
vote
0 answers
How to subtract and add days and months in a mongodb 4.4 aggregation
I am trying to add and subtract few days and months from current date depending on the frequency and sequence of the notifications to be sent on these days. i.e
Here if the frequency is days and sequence is before means I have to notify it before…

Jeet
- 5,569
- 8
- 43
- 75
1
vote
1 answer
Replace empty result from group stage output in mongo aggregation
I have a group stage in my pipeline like:
$group: {
_id: null,
count: {$sum: 1},
results: {$push: '$$ROOT'}
}
Sometimes $$ROOT is empty and there are no results. In theses cases, I get an empty result after the group stage which is not my…

Web Jigooli
- 49
- 1
- 6
1
vote
1 answer
get everage value of certain key form 3 diffrent collection
I have 3 collection that have many records.
Each of them have some key like price, name, ...
As you see price filed on collection c unlike the other collection is in data.detail field.
I want to calculate the everage of price of there collection…

devmrh
- 1,171
- 4
- 19
- 46
1
vote
1 answer
Pass an aggregate intermediate result field as python function argument in Pymongo
Using MongoDB 4.0 I have to compute a new field basing on existing field. An example of documents in mycollection:
{
_id: ...,
f1: 'a',
f2: 'b'
}
My python code, after connecting to DB:
Please note that myJoin is here just for example.…

shogitai
- 1,823
- 1
- 23
- 50
1
vote
0 answers
MongoDB v4 explain() doesn't return number of scanned docs (unlike the previous version). How to be?
I am reading the book "MongoDB in Action" and there is an example of the explain() method.
Shell command: db.values.find({}).sort({close: -1}).limit(1).explain()
Result:
db.values.find({}).sort({close: -1}).limit(1).explain()
{
"cursor" :…

Артем Поликарпов
- 26
- 2
1
vote
1 answer
Conditional aggregation stage
We have 3 collections to track a machine shop.
PARTS gives total items against against a shopID
We need to confirm if the sum of items in INPROCESS and REJECT equal to the count in PARTS for the shop.
However,we will go to look into REJECT - ONLY…

IUnknown
- 9,301
- 15
- 50
- 76
1
vote
2 answers
ColdFusion 2016 and MongoDB 4.0.13
I am trying to connect ColdFusion 2016 (local machine developer mode) to MongoDB 4.0.13 (server). I installed mongodb-driver-core-3.8.2.jar, bson-3.8.2.jar and mongodb-driver-3.8.2.jar into my lib folder. when I try to run this code, it never…

Ashok Ramkumar
- 21
- 7
1
vote
1 answer
How can I create a replica set on MongoDB 4.0
How do I run replica set on MongoDB version 4.0. I am able to do it on the lower versions but I get an error asking me to downgrade my version and protocol version.
Replication is not working on 4.0.

Karan Gaikwad
- 11
- 1