delight-im / Android-DDP

[UNMAINTAINED] Meteor's Distributed Data Protocol (DDP) for clients on Android
Apache License 2.0
274 stars 54 forks source link

Problem with managing json using InmemoryDatabase #97

Closed musafirkhana closed 8 years ago

musafirkhana commented 8 years ago

I have a json like this.{ "role" : { "id" : 3, "name" : "Customer" } } How to i get the value "name" from document. I am using database.getCollection(collectionName).getDocument(documentId).getField("role"); for getting role its return me role={id=3,name=Customer}

How can i manage that ? Thanks

cristianhoyos66-zz commented 8 years ago

Hi, you can see this issue #94 that I did some days ago. I have not closed that because I have not proved the last answer from @mwaclawek, but I think that you can do it with your example.

ocram commented 8 years ago

Yes, thanks for helping @cristianhoyos66!

@musafirkhana Please follow the code example from the linked issue and report your findings here. What you did so far is correct. The solution is to know that the field that you retrieved in the end corresponds to the data type that you saved there in JavaScript, i.e. on the Meteor server.

Hope that helps!