Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
    Akshay Iyer
    I had a doubt!
    I was exploring $group.
    I wanted to match the data by a specific customer and then group by status and then group by priority on each status ( And retain the data from 1st grouping as well).
    Tanmay Verma
    my product collection is like:
        name: "shirt",
        translations: [
                  language: "fr",
                  name: "chemise"
                  language: "es",
                  name: "camisa"
    I need a query so that I will get: { name: camisa }
    if the language is "es"
    Juha Lindstedt
    { ’translations.language’: ’es’, ’translations.name’: ’camisa’ } 😉
    Christian Amor Kvalheim
    if you want to pull up only the spanish field one possible way (might be others) is to do db.t.aggregate([{$match: {name: "shirt"}}, {$unwind: "$translations"}, {$match: {"translations.language": "es"}}, {$project: {"name": "$translations.name"}}]).pretty()
    that returns a document with the field name in it
    that is the spanish translation
    Tanmay Verma
    Thank you so much!! :)
    I am currently facing a problem in mongodb wherein, I can successfully insert a document based on a model from mongoose repeatedly despite the contraints. I am using docker to contain the mongodb image
    Additionally, when I connect to the mongo shell of the said docker image, wehn I query the inserted document, there seems to be no result but I can see the db and the collection established

    http://learnmongodbthehardway.com/schema/schemabasics/ In the last paragraph of Embedding session, it says:

    The third problem is exposed when one tries to perform pagination of the comments. There is no way to limit the comments returned from the Blog Post using normal finds so we will have to retrieve the whole blog document and filter the comments in our application.

    But there is $slice for that: db.posts.find( {}, { comments: { $slice: [ 20, 10 ] } } ). Am I wrong?

    Jordi Pinyana
    Hello !! Has anyone worked with mongo Rust driver ? Or if u know another room related, i need to ask something related to save() method on the mongodb rust crate
    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