Mongo Query on Subfields

后端 未结 3 1408
情书的邮戳
情书的邮戳 2021-01-06 15:59

I have a document -

  {\"_id\" : ObjectId(\"51385d2308d427ce306f0100\"),
  \"aid\" : \"1\",
  \"studyId\" : \"study-1\",
  \"mediaType\" : \"mic         


        
3条回答
  •  时光说笑
    2021-01-06 16:27

    you could use mapReduce() where the map() function would contain something like:

    // loop all key/value pairs in status without knowing its key
    for ( item in this.status ) {
        // if value is required: emit the data and break the loop
        if ( this.status[item] == "required" ) {
            emit( ... )
            break;
        }
    }
    

    does this help ?

    Cheers

    Ronald

提交回复
热议问题