Wednesday, 7 June 2017

Queryn mongo array for exact position of element in node

Given this document as it follows:

{
    "_id" : ObjectId("569190ca24de1e0ce2dfcd4f"),
    "title" : "Once Upon a Time in the West"
    "countries" : [
        "Italy",
        "USA",
        "Spain"
    ],

How can I know how many times does Italy come in first? Thanks!



via Mellville

No comments:

Post a Comment