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
0
votes
3 answers
How to do $lookup in an array's field and add the foreign table's content in the same query?
I am trying to make a query in which I have a db_task query that contains the task id and the users assigned to it. I have to fetch the user details which are present in db_user collection and add the incoming details into the same…

Shivam Chand
- 55
- 8
0
votes
1 answer
Laravel and jenssegers mongodb relationship data not saving
I have 2 classes in Laravel
class Company
{
public function people()
{
return $this->hasMany('Person');
}
}
class Person
{
public function company()
{
return $this->belongsTo('Company');
}
}
Now in another class, I am…

Yograj Gupta
- 9,811
- 3
- 29
- 48
0
votes
0 answers
Initializing with new users via a js initdb script
I created a mongo docker container with an additional js script:
ADD graylog.js /docker-entrypoint-initdb.d/graylog.js
The script creates two users:
root = db.getSiblingDB('root');
root.createUser(
{
user: "root",
pwd: "pass",
roles:…

Matthieu Brucher
- 21,634
- 7
- 38
- 62
0
votes
0 answers
How to fetch a field from a referenced model in mongoose?
Hey Guys need a bit of help with query, the following is the model and i am referencing it to another Model Called Project
const User= new mongoose.Schema({
featured_projects: {
type: [
{
type: Schema.Types.ObjectId,
ref:…

Sijan Shrestha
- 2,136
- 7
- 26
- 52
0
votes
0 answers
MongoDB replica set not electing new primary after primary is manually stopped
I have a mongoDB 4.0.1 replica set with 4 nodes setup with the following configuration
var cfg = {
"_id": "rs0",
"version": 1,
"members": [
{
"_id": 0,
"host": "mongo-1:27017",
"priority": 3
…

Andrew Edwards
- 1,005
- 1
- 9
- 24
0
votes
0 answers
Connect mongodb 4.0 with robomongo
Here are the logs for my mongodb status which show in it is in running status
ubuntu@ip-172-31-9-130:/etc$ sudo service mongod status
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor…

Dark Knight
- 995
- 4
- 22
- 48
0
votes
0 answers
Mongodb installation and configuration with zip
I downloaded mongodb from here. When I unzip it only has 3 *.pdb. How can I use them and how can i create replica sets.
UPDATE
In mongodb 4 how can i create replicasets ?

Raghuveer
- 2,859
- 7
- 34
- 66
-1
votes
1 answer
Aggregation on aggregate
We have a collection as follows - Batches(0,1,2 etc) running jobs in chunks.
Each batch would have multiple chunks/documents having jobs.
We need to aggregate jobs for each batch.
Thereafter,job count of each batch needs to be subtracted from that…

IUnknown
- 9,301
- 15
- 50
- 76
-1
votes
1 answer
Why can't mongo push my ObjectId in a predefined array?
I have made my model, it has this Schema:
const CompanySchema = new Schema({
companyName: {
type: String,
required: [true,'the name of the companies working on the game are missing.']
},
companyAge: {
type: Number,
…

Jordy
- 3
- 2