SoftInstigate / restheart

Rapid API Development with MongoDB
https://restheart.org
GNU Affero General Public License v3.0
805 stars 171 forks source link

Filtering on a nested id #34

Closed atanasbozhkov closed 9 years ago

atanasbozhkov commented 9 years ago

I am using the latest version of restheart with mongodb 3.0.3. I am trying to get a record by filtering on a nested id. (Similar to Issue#10 )

I have the following document in my Passport collection:

"_id": {
    "$oid": "553a25f1bc2e8b53c7000002"
}, 
"answer": "none", 
"password": "somePassword", 
"provider": "local",  
"user": {
    "$oid": "553a25f1bc2e8b53c7000001"
}
}

I am trying to get the record by filtering on the user.id field. So when I tried to get it - I try the following request (as shown in the previous issue):

 $ http http://localhost:8080/test/Passport?filter="{'user._id':'553a25f1bc2e8b53c7000001'}"

But it returns an empty set? I've also tried setting the &detect_oids parameter to different values, but to no avail. Any idea what might be causing this?

ujibang commented 9 years ago

should be

http http://localhost:8080/test/Passport?filter="{'user: {$oid': '553a25f1bc2e8b53c7000001'}}"

atanasbozhkov commented 9 years ago

Yeah - your quotes are a bit wrong but I can confirm that

http http://localhost:8080/test/Passport?filter={'user': {'$oid': '553a25f1bc2e8b53c7000001'}}

works perfectly. Thanks a lot.