0

So I can't seem to get the results I want so I'm asking for your kind help on it. Imagine a MongoDB database built for multi-language content, something like this:

"info": {
    "en": {
        "greetings": {
            "hello":"hello",
            "goodbye":"goodbye"
         },
         "directions": {
             "left": "left",
             "right": "right"
         }
    },

    "pt": {
        "greetings": {
            "hello":"olá",
            "goodbye":"adeus"
         },
         "directions": {
             "left": "esquerda",
             "right": "direita"
         }
    }
}

Now if I want to query in order to get the directions object in both English and Portuguese but not the greetings, how should I do it?

If it helps, my purpose is to subscribe to exactly that content on a meteor app's template, so no need for all other objects within a given language object, just the one I need for any given template.

Thanks in advance!

João Moreira
  • 99
  • 1
  • 5
  • I suggest you change your document structure then [Update MongoDB field using value of another](https://stackoverflow.com/questions/3974985/update-mongodb-field-using-value-of-another-field) – styvane Aug 19 '16 at 20:41

1 Answers1

0

how about you iterate?

db.collection.find().forEach((language){
    some code here
})
JFAP
  • 3,617
  • 1
  • 24
  • 25