H
H
hbrmdc2016-12-06 10:40:27
MongoDB
hbrmdc, 2016-12-06 10:40:27

How to get specific keys from mongoDB collection?

Let's say a collection in mongoDB looks like this:

directory: directory: {
  subdirectory: {
    SubSubdirectory: {
      ...
    }
    ...
  }
  someString: 'lorem...'
  ...
},
anotherDirectory: {
  ...
}

The nesting levels can be, say, up to 20.
The sizes of strings (someString) can be from a few words to, say, 100 thousand characters.
How can I access only the keys of this entire collection? And not to all at once, but by levels: first I need only two root keys (directory, anotherDirectory, ...), then nested keys in the directory (subDirectory, someString, ...)
and so on
How to do this?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question