Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
    Tanmay Verma
    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
    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?