Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 20 18:42
    dschenkelman commented #2037
  • Jan 20 18:42
    dschenkelman commented #2037
  • Jan 20 18:42
    dschenkelman commented #2037
  • Jan 20 16:37

    mbroadst on master

    fix(topology): always emit SDAM… fix: properly handle err messag… refactor(topology): use a wait … and 1 more (compare)

  • Jan 20 16:37

    mbroadst on master

    fix(topology): always emit SDAM… fix: properly handle err messag… refactor(topology): use a wait … and 1 more (compare)

  • Jan 20 16:37

    mbroadst on master

    fix(topology): always emit SDAM… fix: properly handle err messag… refactor(topology): use a wait … and 1 more (compare)

  • Jan 20 16:22

    mbroadst on v3.5.2

    chore(release): 3.5.2 (compare)

  • Jan 20 16:22

    mbroadst on v3.5.2

    chore(release): 3.5.2 (compare)

  • Jan 20 16:22

    mbroadst on v3.5.2

    chore(release): 3.5.2 (compare)

  • Jan 20 14:24

    mbroadst on v3.5.1

    (compare)

  • Jan 20 14:24

    mbroadst on v3.5.1

    (compare)

  • Jan 20 14:24

    mbroadst on v3.5.1

    (compare)

  • Jan 20 14:16

    mbroadst on 3.5

    refactor(topology): use a wait … (compare)

  • Jan 20 14:16

    mbroadst on 3.5

    refactor(topology): use a wait … (compare)

  • Jan 20 14:16

    mbroadst on 3.5

    refactor(topology): use a wait … (compare)

  • Jan 19 16:34

    mbroadst on 3.5

    chore(release): 3.5.1 fix(topology): always emit SDAM… fix: properly handle err messag… (compare)

  • Jan 19 16:34

    mbroadst on 3.5

    chore(release): 3.5.1 fix(topology): always emit SDAM… fix: properly handle err messag… (compare)

  • Jan 19 16:34

    mbroadst on 3.5

    chore(release): 3.5.1 fix(topology): always emit SDAM… fix: properly handle err messag… (compare)

  • Jan 17 22:55

    mbroadst on master

    fix(transactions): use options … fix(cmap): accept all node TLS … refactor: integrate logger into… and 7 more (compare)

  • Jan 17 22:55

    mbroadst on master

    fix(transactions): use options … fix(cmap): accept all node TLS … refactor: integrate logger into… and 7 more (compare)

syedsimanta03
@syedsimanta03
@lpegoraro so u hv submitted ur credit card info as they are asking for it for mongoLab addon?
Luiz Henrique Pegoraro
@lpegoraro
@syedsimanta03 I already had one registered there, so maybe it is needed... sorry, forgot about that, never got charged for that app though
syedsimanta03
@syedsimanta03
@lpegoraro thatz cool
syedsimanta03
@syedsimanta03
const courses = Course
  .find( { author: "Simanta", isPublished: true } )
  .limit(10)
  .sort({ name: 1 })
  .select({ name: 1, tags: 1 })

  console.log(courses);
Can you plz explain why should we use 1 in .select({ name: 1, tags: 1 }) -> select query
syedsimanta03
@syedsimanta03
app.post('/name', (req, res) => {
  let name = req.body.first + ' ' + req.body.last;
  res.json({name: 'firstname lastname'});
});
the - req.body.first -> so .first or .last is coming from the html or what is it actually after req.body.
AliFetvaci
@aliFetvaci61

processedAt field (TIMESTAMP) In the Collection has Different format WHY ? Can you Explain ?

For Example
May 21, 2019 3:43:12 PM
Tue May 21 15:45:42 EET 2019
Thu May 30 09:25:54 EET 2019
Jun 12, 2019 2:42:09 PM
Jun 12, 2019 4:16:19 PM
Thu Jun 20 15:43:18 EET 2019
Fri Jun 21 08:57:21 EET 2019
Jun 21, 2019 4:24:04 PM
Mon Jun 24 13:24:21 EET 2019
Mon Jun 24 13:24:16 EET 2019

taphuocanh94
@taphuocanh94

Hi all, I have a problem with mongoose, help me please

const M_Posts = new Schema({
    title: { type: String, required: true },
    content: { type: String, required: true },
    by_user: { type: Schema.Types.ObjectId, ref: 'Users' },
    comments: [{
        content: String,
        by_user: { type: Schema.Types.ObjectId, ref: 'Users' },
        reply_for: { type: Schema.Types.ObjectId, ref:'posts.comments' },
    }],
});
const Posts = mongoose.model('posts', M_Posts);
Posts.create({ title: 'Post 1', content: 'Post 1 content' })
    .then(post => {
        var comment_1 = post.comments.create({
            content: 'Content comment 1',
        });

        var reply_comment_1 = post.comments.create({
            content: 'Reply for comment 1',
            reply_for: comment_1._id,
        });

        post.comments.push(comment_1);
        post.comments.push(reply_comment_1);
        return post.save();
    }).then(post => {
        console.log(post);
        return Posts.findById(post._id).populate('comments.reply_for');
    }).then(console.log).catch(console.log);

This is my posts schema. When I run this code, I'm received an error:

{ MissingSchemaError: Schema hasn't been registered for model "posts.comments".
Use mongoose.model(name, schema)
    at new MissingSchemaError (\node_modules\mongoose\lib\error\missingSchema.js:22:11)
    at NativeConnection.Connection.model (\node_modules\mongoose\lib\connection.js:973:11)
    at getModelsMapForPopulate (\node_modules\mongoose\lib\helpers\populate\getModelsMapForPopulate.js:200:59)
    at populate (\node_modules\mongoose\lib\model.js:4083:21)
    at _populate (\node_modules\mongoose\lib\model.js:4053:5)
    at utils.promiseOrCallback.$wrapCallback.cb (\node_modules\mongoose\lib\model.js:4028:5)
    at Promise (\node_modules\mongoose\lib\utils.js:271:5)
    at new Promise (<anonymous>)
    at Object.promiseOrCallback (\node_modules\mongoose\lib\utils.js:270:10)
    at Function.Model.populate (\node_modules\mongoose\lib\model.js:4027:16)
    at Posts.create.then.then.post (\app\models\Comments.js:33:22)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  message:
   'Schema hasn\'t been registered for model "posts.comments".\nUse mongoose.model(name, schema)',
  name: 'MissingSchemaError' }
Evgen Koshmaryk
@koshmaryk
Hello! Can anyone help? Suppose we have replica_set of 3 members. If one member gone down. After come back and finally getting the ‘SECONDARY’ state by this member is it guaranty of full sync with primary?
Stavros Kefaleas
@skiabox
hello
Robert D. Blanchet Jr.
@blanchet4forte
if I have a document with an array of sub documents. what are my options for upserting an element in that array?
Dj-jom2x
@Dj-jom2x
hello i have question do you really need to pay if you wanted to install mongodb enterprise on your local server? i install it it looks like same as community .. does it have trial that ends like that? or limits.. and need license?
Nuri Ha
@Nurih_twitter
You can use $addToSet to avoid inserting same element twice.
Yutao Zhang
@lava1206
Hello, everyone.
I have a Django site(ubuntu) that uses MongoDB along with SQLite DB
I want to dump the MongoDB from remote server to my local PC
Please help me
thank you
sy4tech
@sy4tech
hello
@lava1206
you can swipe dump on the ubuntu using mongodump and you can download it to your pc
tj4000
@jt4000
Hello, I'm new in MongoDB and I have a question aobut MongoDB.
Is it possibly to apply mongoDB:s insert and/or update code (code below) into a view or stored javascript?
https://www.simform.com/wp-content/uploads/2017/11/table2-768x663.png
Thank you!
Dj-jom2x
@Dj-jom2x
are you looking for node driver @jt4000 ?
tj4000
@jt4000
Not looking for node driver. I am looking for a answer in relation to MongoDB
Dj-jom2x
@Dj-jom2x
hmm
Dj-jom2x
@Dj-jom2x
can you emphasize your question xD to me it sounds like "can you" do insert update or delete thru MongoDB using javascript which is https://www.npmjs.com/package/mongodb this one does xD I i need some enlightenment to your question xD .. or that "stored javascript" you can insert a code in db.. like this
image.png
Shashi Kiran
@kiranshashiny
Hello
Shashi Kiran
@kiranshashiny

How do I pass in the find argument to a mongo db connection from a REST API.

Here, I'd like to pass in stocksummaryID ( the search argument ) to the mongodb collection find as an argument.

app.post('/stocksummary/**', (req, res) => {

   const stocksummaryId = req.params[0];
   console.log ( "the stocksummaryId is ", stocksummaryId);

   const foundSummary = stocksummary.find(subject => subject.displayName === stocksummaryId);

   console.log ( "the stocksummmary post is ", foundSummary);

   MongoClient.connect(url, function(err, db) {
           if (err) throw err;
           var dbo = db.db("mydb");
           // find just one. GTX, ATEN
           const cursor = dbo.collection('stocks_summary').find({ Symbol: "WUBA" }).toArray( function ( err, result ) {
             console.log ( result );
             db.close();
        });
   });

   if (foundSummary) {
        res.status(202).header({Location: `http://localhost:${port}/stocksummary/${foundSummary.id}`}).send(foundSummary);

The symbol that gets in to the POST is let's say some stock symbol. e.g: WUBA or MSFT,
This is not visible inside the MongoClient.connect callback !

I want to be able to send it inside the MongoClient.connect so that I can feed it to the find() query.

Appreciate any help in this regard.

Muhammad Umair Ghufran
@MuhammadUmairghufran
Hey Everyone, Anyone can help me installing and configure MongoDb in MacOS Catalina 10.15
Miguel Espinoza
@purefan

Hi everyone! Im trying to come up with a query and so far no luck. I have a collection where documents look like:

{
  goal: 40,
  steps: [
    { reached: 30 },
    { reached: 40 }
  ]
}

And I want to get all the documents that do not have a step matching goal in its own document. goal could change (it could be 30, or some other number) and thats why I cant hardcode the condition. Can someone help me please?

drethegreat1
@drethegreat1
Hi everyone - Does anyone know about alert generation with Mode
using Mongo DB
Sujeet Buddiga
@sujeetbuddiga
Hi Everyone
Harsha MV
@harshamv_twitter
Sujeet Buddiga
@sujeetbuddiga
@harshamv_twitter I have checked that, but the problem is when I have a nested document.
Which is an object of documents, How do I choose only selective fields to be returned?
Jasmin Mustafic
@J-Mustafic

Hello everyone,

Does MongoDB native driver v3.3.4 work with $jsonSchema validator?

I don't get any errors when defined with this validator, but it does not validate anything, just let's all go through.
Document validation works when done like explained here: https://mongodb.github.io/node-mongodb-native/3.3/tutorials/collections/, but I don't get any feedback why the validation failed and $jsonSchema seems to provide this functionality.

Also I know about ORM's(or ODM's in this case) but I am trying to avoid it at the time, that is why go with native driver.

Miguel Espinoza
@purefan
@J-Mustafic I feel you're talking about 2 different situations, but in my experience, yes, the Node mongo driver works with $jsonSchema, but its not a nice experience for the developer, I had a project working with it and decided to move it to a raml validator on an express application because that was easier, it provided better errors too
Jasmin Mustafic
@J-Mustafic
@purefan Thank you for your answer, I appreciate it. I finally made $jsonSchema to work. I've looked into some other solutions but we decided to include mongoose to make developing faster since we are kind of on a tight schedule and mongoose has it all out of the box.
Miguel Espinoza
@purefan
@J-Mustafic No problem :) All the best with mongoose!
Jasmin Mustafic
@J-Mustafic
Thanks. :)
Abhijit Das
@SilverFoxA
Do we have $facet aggregation in MongoDB Node Driver?
Ashish117
@Ashish117

Hi guys little help. This is my schema

{
        bulk: [
                [
                  [
                    {
                      title:  String,
                      price:  String,
                      stock:  String,
                      code: String,
                      url: String,
                      img: String
                    }
                  ]
                ]
        ]
}

I want to search title. if title = "Apple iPhone xS 128gb" and when i search the string "iphone" it should return all array with title containing "iphone".

Data.find({"[0].bulk[0][0][0].title": req.params.title})

Ashim Raj Konwar
@zypher606
Hi Guys, need a little help on connecting to mongodb through proxy. Can someone help me out with good npm packages?
P. S. I tried tunnel-ssh but it didn't work
amrita-syn
@amrita-syn
is node-mongodb-native compatible with mongo 4.2 ?
Dima Kondratenko
@Fanaticys
Hello, Guys. How is it possible to check whether field is relation or not? I don't have any model or schema in code. In my case relationship was created in database. It means that I can't have code or some schema to check if filed of some entity is relationship. Relationship is created by user.
For now I see only one approach to solve this issue is to mark somewhere in database that this field of specific entity is relationship. But maybe mongo has more elegant approach out of the box.
Bhupender Singh
@Divine-Arrow

Hello guys, I need a little help. related google compute engine

I want to use mongodb in compute engine. instead of using mongo atlas can I use it as same with compute engine

OriginalAnkit
@OriginalAnkit

Hello guys, I need a little help. related google compute engine

I want to use mongodb in compute engine. instead of using mongo atlas can I use it as same with compute engine

hi please ask

hi guys,
Its been a year I am working on mongodb and now I am facing performance issues (like 1 lakh user data)
please suggest ways to handle such data
Daniel-sogbey
@Daniel-sogbey
Hi guys how can I store media files in mongodb
petkocfc
@petkocfc
Hello, is there anybody that could help me with loosing mongo collections. I have explained my problem here https://serverfault.com/questions/998684/mongodb-collections-and-documents-lost-disappeared-in-replica-set
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.