-2
我有以下JSON。我想將它作爲Json存儲在MongoDB中並進行查詢。我該怎麼做?如何在MongoDB中查詢JSON
JSON
{
"id": 4,
"user": {
"firstname":"Finn",
"lastname":"Balor",
"email":["[email protected]","[email protected]"],
"password":"whateverHisTaglineIs",
"address":{
"street":"64 victoria street",
"country":"UK"
}
}
}
我這個存儲爲以下文件
> db.users.insert({id: 4,user: {firstname:"Finn",lastname:"Balor",email:["[email protected]","[email protected]"],password:"whateverHisTaglineIs",address:{street:"64 victoria street", country:"UK"}}})
我如何可以查詢使用國家作爲選擇這個記錄嗎?