Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
    Jordi Pinyana
    thank you
        "_id" : 137,
        "name" : "Tamika Schildgen",
        "scores" : [
                "type" : "exam",
                "score" : 4.433956226109692
                "type" : "quiz",
                "score" : 65.50313785402548
                "type" : "homework",
                "score" : 89.5950384993947
    How can i remove lowest score of type homework
    I'm trying to write mongodb schema for a CMS i'm working on, and i have a User model/schema that contains the password of the user and email etc, i wonder if i should separate an Author model for his/her authentication model?
    Hi guys,
    I just have an issue with installing mongodb compass community on ubuntu 18.04, I downloaded several versions but when I open it, it start loading then disappear
    If it will not work forever, do you suggest using pycharm with pymongo or NoSQLBooster for mongodb?
    Christian Amor Kvalheim
    Shanon Jackson
    Mmmmmmm trying to learn MongoDB on a side project wondering if any expert can lend some advice on how to structure this data.
    My user has some listings stored on his document -> the listings are a listing of an "Item"
    Items are part of a Category i.e Item "Hammer" category: "Tool"
    i don't think i want to nest items under their category I.E
    Category : {
    items: [Item, iTem, Item, Item]
    name: "XYZ"
    because then how will my Listing reference a specific item?
    Tirdea Mihai
    @ShanonJackson disclaimer : I'm no mongo expert by a long shot. Why not separate Categories and Items ( products?) in 2 different collections ? This example might be relevant - http://learnmongodbthehardway.com/schema/categoryhierarchy/
    Christian Amor Kvalheim
    @ShanonJackson I second @Melcus on the suggestion. Sometimes normalisation is in order.
    Jaymin Limbachiya
    $findRes = $collection->find(
        array('N_NAME'=>' عبدالوهاب علي سليمان')
    I am trying to run this query to find Arabic records
    Jaymin Limbachiya
    record is exist but return array is null
    can u please help me to fix lang. issue
    Christian Amor Kvalheim
    you have a white space at the start of your string maybe that is the issue. Mongodb supports utf8 only so you also need to make sure your string is utf8. Not sure what language you are using but you might need to check how you ensure a string is utf8 if the default for the language is not.
    puli peter
    How to fetch the data from mongodb to nodejs and generate the text file or json file
    anybody gave me any link for implement sharding and replica in nodejs
    Luis Dasta
    Can you run commands like .aggregate() on result from a .aggregate()?
    such as:
    db.collection.aggregate(//logic).aggregate(second aggregation)
    Hi. Is it possible to implement a changestream that only triggers when a document is created, and not deleted?
    never mind i figured it out. I just have to put a conditional for the operationType
    Does anyone know, what can cause huge schema lock wait time (WT_STAT_SESSION_LOCK_SCHEMA_WAIT)? When that type of lock is used? Thanks!
    Unhandled rejection MongoError: not authorized on admin to execute command { listIndexes: "sessions", cursor: { } }
    at Function.MongoError.create (/Users/Arooj/Desktop/projects/ahmadinc/node_modules/mongodb-core/lib/error.js:31:11)
    any ideas how to fix this , using atlas mongodb (previously mlab)
    Burak Bayrakdar
    Why & how would a simple db.col.find() query need a "schema lock"? On a collection without any schema validation etc.
    Evgen 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?
    Hello! In this guide example 4 and 5 contains exactly the same. I think it may be fixed http://learnmongodbthehardway.com/schema/transactions/
    very nice example, btw
    Choubani Amir
    the link to mongodb documentation, doesn't work ?
    hello everybody. is there any documentation how to properly configure mongo authentication in service mesh scenarios? I'd like to have the application to talk locally with the proxy in plain text and with no auth, and have the proxy communicate with mongo creating the tls channel and performing the authentication. I managed to configure envoy to talk over tls but not authentication
    Hi , i have documents where one of the field is string and the value is of int. Now I have to perform >,<,<= operator . But I'm not able to write expression using builder C# drivers to convert and compare the values
    I need to use mongodb to save user chat information. If all users share a collection, it is expected that there will be query performance problems. Consider using one collection for each user, but I don’t know the number of collections (or other) in the same database in mongodb. Are there any restrictions, or will there be performance issues with this approach?
    Hello, is it possible to create a mongodb user with the lowest amount of right except executing the logRotate command (db.runCommand( { logRotate : 1 } ))?
    The aim is to create a script to rotate our mongodb log (running on windows) to be executed every X amount of time.
    Farzad Sadeghi
    Does the new mongo shell(mongosh) support the same js customization file as the old one?
    Hi, I'm trying to do "MongoDB Transactions vs Two-Phase commit". Right now, I can run project "mongodb-schema-simulator", with "AccountTwoPhaseCommit" two func executeW1 and excuteMajority worked perfectly just around 6min, but with "AccountTranssactionSimulationTest" when I 'enable' func "excuteMongoTransactionSnapshot", it takes me more than hour without results. Did I do any thing wrong?
    Philip Bannon

    Hi All, I have a document like this:

        "_id" : ObjectId("60e5ae42fcc92f14c3a41208"),
        "userId" : "xxxx",
        "projectCreator" : {
            "userId" : "xxx|xxxx"
        "hashTags" : [
        "projectCategories" : {
            "60d76ef0597444095b8ab4b2" : "Backend",
            "60d76ef0597444095b8ab232" : "Infrastructure" 
        "createdDate" : ISODate("2021-07-07T13:38:10.655Z"),
        "updatedAt" : ISODate("2021-07-08T11:48:36.200Z"),
        "_class" : "xxxx.model.project.Project"

    I would like to get back all the unique values from projectCategories and their counts. Something like this:

    Infrastructure: NUMBER OF OCCURRENCES

    I've tried to do aggregate([ { $match: { _id : {$exists: true} }} , { $project: {_id: 0, result: { $objectToArray: "$projectCategories" } } }]).pretty() however this also returns documents where the projectCategories is null. I cant seem to figure this out. Any help would be great!! thanks

    1 reply
    Keith Miller

    Hello :) I am working on a fairly straight forward task (I think).

    This code is just me fleshing out the new feature (utilizing the aggregrate method):

        async fn top_phrases(&self) -> Result<()> {
            let collection = self.handle.collection::<Document>("logged_messages");
            let pipeline = vec![
                doc! { 
                    "$group": { 
                        "_id": "$trigger",
                        "phrase": { "$first": "$phrase" },
                        "count": { "$sum": 1 },
                doc! { "$count": "-1" },
                doc! { "$limit": 10 },
            let mut phrases = collection.aggregate(pipeline, None).await?;
            while let Some(phrase) = phrases.next().await {
                let test: PhraseFrequency = from_document(phrase?)?;
                println!("{}", test.to_message());

    Here is my struct that derives the Deserialize trait:

    pub struct PhraseFrequency {
        phrase: String,
        count: usize,

    When trying to run I panic on this line:

                Message::TopPhrases => {
                    let _ = self.top_phrases().await.unwrap();

    The panic message states: missing fieldphrase``

    I expect this is related to Serde
    Keith Miller
    Perhaps I should just be using find
    Keith Miller
    Ah I think it's related to my query actually interesting
    Ah yeah nvm I'm just an idiot
    am wondering if this amazing book is being update?
    Hi - does anyone know if mongo CSFLE supports sorting results using an encrypted field?