by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 10 23:37
    emadum review_requested #2510
  • Aug 10 23:37
    emadum review_requested #2510
  • Aug 10 23:37
    emadum review_requested #2510
  • Aug 10 23:37
    emadum ready_for_review #2510
  • Aug 10 23:37
    emadum ready_for_review #2510
  • Aug 10 23:37
    emadum ready_for_review #2510
  • Aug 10 23:37
    emadum edited #2510
  • Aug 10 23:37
    emadum edited #2510
  • Aug 10 23:37
    emadum edited #2510
  • Aug 10 23:14
    emadum opened #2510
  • Aug 10 23:14
    emadum opened #2510
  • Aug 10 23:14
    emadum opened #2510
  • Aug 10 23:13

    emadum on 3.5

    fix: add host/port to cmap conn… (compare)

  • Aug 10 23:13

    emadum on 3.5

    fix: add host/port to cmap conn… (compare)

  • Aug 10 23:13

    emadum on 3.5

    fix: add host/port to cmap conn… (compare)

  • Aug 10 20:26
    nbbeeken review_requested #2509
  • Aug 10 20:26
    nbbeeken review_requested #2509
  • Aug 10 20:26
    nbbeeken review_requested #2509
  • Aug 10 20:26
    nbbeeken review_requested #2509
  • Aug 10 20:26
    nbbeeken review_requested #2509
Lavanya Nagarajan
@nlavanya20
hillct
@hillct
Good afternoon. I’m having dicciculty with the output of collection.aggregate() as it related to (mongoose) subDocuments, when attempting to access the _id fields as strings. I realize Mongoose may be doing something odd with the output, and have sought feedback from those developers, but I wonder if you have any feedback as well. Thanks.
caspianlafitte
@caspianlafitte
I am looking to achieve the following operations with the MongoDB Node.JS driver, could this be performed with an optimal approach? There are three possible operations required: create, append, and update.
  1. Create the following document.
{
    "_id": "hello_world_cluster",
        "items": [
            {
                "item_name": "my_item_one",
                "first_seen": 1000,
                "last_seen": 1000,
                "logic": true
            }
        ]
}
  1. Append new items to an array.
{
    "_id": "hello_world_cluster",
        "array": [
            {
                "item_name": "my_item_one",
                "first_seen": 1000,
                "last_seen": 1000,
                "logic": true
            },
            {
                "item_name": "my_item_two",
                "first_seen": 2000,
                "last_seen": 2000,
                "logic": true
            },
            {
                "item_name": "my_item_three",
                "first_seen": 3000,
                "last_seen": 3000,
                "logic": true
            }
        ]
}
  1. Update items that are found in an array.
{
    "_id": "hello_world_cluster",
        "items": [
            {
                "item_name": "my_item_one",
                "first_seen": 1000,
                "last_seen": 4000,
                "logic": false
            },
            {
                "item_name": "my_item_two",
                "first_seen": 2000,
                "last_seen": 2000,
                "logic": true
            },
            {
                "item_name": "my_item_three",
                "first_seen": 3000,
                "last_seen": 3000,
                "logic": true
            }
        ]
}
hillct
@hillct
Good evening all. Can someone explain to me why $toLower fails in an Aggregation chain, for example $match:{ instrument: {$toLower:"Viola"} } where the string Viola would be user input, but it doesn’t even work even when using a quotes string as above.
hillct
@hillct
I gave up on that and just lower cased it in javascript before it touches the database
Good afternoon all. Can anyone point me to a design pattern demonstrating assembly of an aggregatino query using an array, which is assembled based of search criteria (plain text, vs tags search, etc) where the array is then passed to db.collection.aggrogate({arrayOfAggrogationPhases}){ … } ? I’m having trouble with this, getting JSON parsing issues the pushing phases onto my array. Is there a preferred method for doing this sort of thing?
auasad
@auasad
facing slow query issue with mongo, any suggestion?
Eduardo Santos de Brito
@EduSantosBrito

Hey guys, how you doing?
I have a trouble making a aggregation in my project, my aggregation result is different in Robo3T and Node.

db.getCollection('companies').aggregate([
    { '$match': { _id: { '$eq': ObjectId("5e30a4fe11e6e80d7fb544a4")} } },
    { $unwind: '$jobVacancies' },
    {
      $project: {
          jobVacancies: {
              _id: 1,
              name: 1,
              city: 1,
              openingDate: 1,
              closingDate: 1,
              createdAt: 1,
              quantity: 1,
              steps: {
                  $filter: {
                      input: '$jobVacancies.steps',
                      as: 'step',
                      cond: {
                          $and: [
                              { $eq: ['$$step.order', 0] },
                              { $ne: ['$$step.users', undefined] },
                              { $ne: ['$$step.users', null] },
                              { $ne: ['$$step.users', []] },
                          ],
                      },
                  },
              },
          },
      },
  },
  { $match: { 'jobVacancies.steps': { $ne: [] } } },
])

In Robo3T this is returning 1 object, but in Node (the same aggregation) is resulting 6 objects. Can you help me? Thank you

Pranav-Mahale
@Pranav-Mahale
Hi
syedsimanta03
@syedsimanta03
Hi guys I only know MERN stack & have good knowledge over JS. When I feel comfortable with my stack what other technologies to learn next that will be helpful for getting a job?
wes
@wscarter
How do I get the value of out of a NumberInt instance in the mongo shell?
SHIVRAJ MUTTAGI
@Shivraj-0219
Now i have started with mongo and i am facing problem with unsharded in mongod environment .Could anyone help me out clearing bug...
ljdatasci
@ljdatasci
Anybody know what this error means: MongoParseError: URI malformed, cannot be parsed?
Karthigeyan
@kaathi524
hi, I am facing issue in mongo with lambda as https://www.onooks.com/intermittent-time-out-issues-between-mongodb-atlas-and-aws-lambda/ . Can anyone help?
Ahmed Rebai
@Rebaiahmed

@Rebaiahmed
Hi Guys
I need some help
I'am looking for a ways to find not refernced documents in other collection with spring data mongodb
I just tried with this
db.getCollection('Actors').aggregate(
[
{
$lookup: {
from: "Market",
localField: "operatorsManager",
foreignField: "_id",
as: "actors"
}
},
{
$match: {
actors: []
}
}

]);
mmongodb Query but it returns all documents
not excepcted results

ilmucio
@ilmucio
are there an operation to do something like array.map(obj=>obj.field) in the aggregation framework?
hborole
@hborole
Hi

I am trying to connect to my mongod instance using the following command:
mongo --tls --tlsCAFile mongodb.pem --host localhost

But the .pem file has a passphrase which I don't know how to pass. Hence I am getting the error,

Failed global initialization: InvalidSSLConfiguration Unable to load PEM from 'mongodb.pem': Failing importing certificate(s): Passphrase is required for import/export.

Need some help! Thanks in advance.

Joseph Henshaw
@Big-jo
Hi! , please I need some design wisdom, I'm creating an application that uses two mongo databases, One database contains a User Collection(USERDB), the other contains a Post Collection(POSTDB), Would it make some sense to use a user's document objectID in the USERDB as an author id in the POSTDB ?
Phuong Nguyen
@neunygph
hi there
is anyone has experience with mongodb atlas
Samiul Salehin Pritom
@Pritom-Mazhi
hello, my code below should return 5 for nextInLine([5,6,7,8,9], 1) but, it isn't.
I dont understand what is wrong.
function nextInLine(arr, item) {
arr.push(item);
item = arr.unshift();

return item;
}
guobaxiong
@774649283
hi how to change the type of a filed? use forEach too slowly
db.zhulirecords.find({"initiatorUserId":{$type:16}}).forEach(
function(x){
db.zhulirecords.updateOne({_id: x._id}, {$set:{initiatorUserId: String(x.initiatorUserId)}})
}
);
khazim ndiaye
@zimkha
hi guys i'm new to mongo, i have a problem with mongo atlas,
I do not know what is an srv, I want to use mongo with node js, but to connect to my cluster I do not know what to do and according to the tutorial that I have nobody explained what is a srv
need help
tsavercool
@tsavercool
Is there a way to read an object back in dot notation? I'm looking for a quick and dirty way to read a collection and dump it to CSV.
Christian Roy
@roychri

Hello. I am trying to create a new user to access a new DB. I connect using a root user to the admin db and then I try to create a new user on a new db...

MongoClient.connect( process.env.JEST_MONGODB_URL, function( err, client ) {
    if ( err ) return console.error( err );
    const admin = new Admin( client.db( process.env.MONGODB_DATABASE ) );
    admin.addUser(
        process.env.MONGODB_USERNAME,
        process.env.MONGODB_PASSWORD, {
            roles: [
                {
                    role: 'readWrite',
                    db: process.env.MONGODB_DATABASE
                }
            ]
        },
        function( err, result ) {
            if ( err ) return console.error( err );
            console.log( result );
            client.close();
        });
});

Im using here client.db() and passing that to new Admin() because I thought that would create the user in that db, but its creating it in the admin db instead.

When I use the mongo shell I can use newdb and then create the new user and that works fine. How can I do this with mongodb native driver for node?

Joris W
@jorisw
Hi. How do I catch the database failing from a collection stream cursor?
Looks like I can shut down my database, and the stream cursor doesn't complain at all
Joakim
@Sefriol
Hey, is there any guidance on how to configure mongodb with replicasets on travisci? I'm trying to create tests using transactions.
Neil James Monzales
@godmode97
Hi! How can you remove a referenced object in a Schema?
Joakim
@Sefriol

Hey, is there any guidance on how to configure mongodb with replicasets on travisci? I'm trying to create tests using transactions.

The only reference I have found so far, but I'm not too big of a fan of sleep methods: https://georgeshank.com/how-to-enable-a-mongodb-replica-set-on-travis/

Fabricio
@ofabricio
{
    'key': 'ONE',
    'stages': [
        { name: 'prod', values: [ { 'value': 'one' } ] },
        { name: 'qa',   values: [ { 'value': 'two' } ] }
    ]
}
I need to do an update in that document, I'd like to either add a new stage if it doesnt exist or add to stage values if it already exists. Is this possible in a single mongo request? Or do you think i should rework my design?
ishu mishra
@coderishu
hello folks
i am beginner in backend
i am working on spring/java
Screenshot (4).png
mongodb
error
i thought to be an error related to mongodb credentials so i changed that too
but still showing same error
raphyav
@raphyav
How can I insert documents in collection if it not exist there else update it with the new values in Mongo DB. I am using node.js drivers for coding.
Erick Vicentin
@erickvicentin
Hi people!
Damien Doumer
@DamienDoumer
Hello, please a simple question: Should indexes be registered once only in a database's lifetime? What I'm currently doing is running the code to register the index at every initialization of the service which needs this. but is this the best approach or not ?
Manav Misra
@manavm1990_gitlab
Noob, so NS. WIKI that you will get ✉️s from the service advising about things that should be indexed based on what actually happening.
Ahmetcan Aksu
@ahmtcn123

Guys I searched all the stack I tried every examples but I couldnt update object inside of array

Here is the db

    mail: string
    password: string,
    db: {
        dialogEngine: {
            assistants: [
                [
                    apiKey: string,
                    maintenance: boolean
                ]
            ]
        }
    }

I want to update maintenance boolean here is the code I tried

    var update = await global.dialogEngine.db.db('users').collection('userdatabase').updateOne({
        mail: req.body.mail,
        password: req.body.password
    },
    {
        $set: {
            'db.dialogEngine.assistants.$[elem].maintenance':  req.body.maintenance
        }
    },
    {
        arrayFilters: [
            {
                'elem.apiKey': req.body.apiKey
            }
        ]
    });
syed
@Smssyed8
erverMs\server.js:28:40)
at Module._compile (internal/modules/cjs/loader.js:1144:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)
at Module.load (internal/modules/cjs/loader.js:993:32)
at Function.Module._load (internal/modules/cjs/loader.js:892:14) {
code: 'MODULE_NOT_FOUND',
requireStack: [
do i need npm install or any other command to put my export in node modules