how to query JSON in mongodb -
i have following json. want store in mongodb json , query it. how can it?
json
{ "id": 4, "user": { "firstname":"finn", "lastname":"balor", "email":["fb@wwe.com","fb1@wwe.com"], "password":"whateverhistaglineis", "address":{ "street":"64 victoria street", "country":"uk" } } }
i storing following document
> db.users.insert({id: 4,user: {firstname:"finn",lastname:"balor",email:["fb@wwe.com","fb1@wwe.com"],password:"whateverhistaglineis",address:{street:"64 victoria street", country:"uk"}}})
how can query record using country selector?
you need query below, go through mongodb documentation , learn mongodb mongodb university.
db.users.find({"user.address.country": "uk"})
Comments
Post a Comment