I got an array (as a result of a mongoDB request) with some elements like this:
{ "_id": "ExxTDXJSwvRbLdtpg", "content": [ { "content": "First paragraph", "language":"en", "timestamp":1483978498 }, { "content": "Erster Abschnitt", "language":"de", "timestamp":1483978498 } ] }
But I need to get only one content field for each element of the data array, which should be selected by the language. Thus, the result should be (when choosing English content):
{ "_id": "ExxTDXJSwvRbLdtpg", "content": "First paragraph" }
instead of getting all the content data ...
I tried to do this with find(c => c.language === 'en) , but I don't know how to use this for all elements of the data array. Perhaps you can also get the data directly as a mongodb request ??
source share