2014-04-01 28 views
0

我有這樣的對象在我的MongoDB數據庫:查詢哈希裏面存儲在一個字段類型散列通配符

"owner": { 
    "user_id": 
    }, 
    "answers": { 
    "items": { 
     "0": { 
     "owner": { 
      "reputation": 
      "user_id": 
      "user_type": 
      "profile_image": 
      "display_name": 
      "link": 
     }, 
     "is_accepted": 
     "score": 
     "last_activity_date": 
     "last_edit_date": 
     "creation_date": 
     "answer_id": 
     "question_id": 
     } 
    }, 
    "has_more": false, 
    }, 
    "is_answered": true, 
    "view_count": 
    "answer_count": 
    "score": 
} 

我對如何查詢answers.items.<any number>.score.gte => 1與mongoid有點糊塗了。我嘗試了幾個不同的選項,但我似乎無法找到有效的東西。

回答

0

我能夠通過跳過數字解決這個問題,只是使用(:「answer.score」.gte => 1)