vedfi / mondroid

Mongodb Client w/ Flutter
GNU General Public License v3.0
63 stars 7 forks source link

my app cant display this data #10

Closed jeffryafandi closed 1 year ago

jeffryafandi commented 1 year ago

it leaves blank on the document viewer that contains this data:

{ "_id": 0, "mobsArray": [], "shop": [ { "_id": "jefffy", "stock": { "$numberDouble": "Infinity" }, "price": 788, "type": "coupon" }, { "_id": "sword", "stock": 3, "price": 12, "type": "coupon" } ], "__v": 2 }

jeffryafandi commented 1 year ago

Screenshot_20230608-024413 Screenshot_20230608-024410

here are some screenshots

vedfi commented 1 year ago

Hello Sir;

It seems like there is a problem with _id field. It must be an ObjectId. Your document has an Integer value in _id field.

jeffryafandi commented 1 year ago

hello thanks for the reply, isn't it's fine if the id is Integer as long as i declare it on mongo schema?

sorry I quite new on this thing.. also it's worked on my string collection schema

jeffryafandi commented 1 year ago

Screenshot_20230608-040028 i just changed the type and re creating my document and it's still blank

jeffryafandi commented 1 year ago

i guess it can't handle Infinity as Number??

uhm i can prove this.. I'm sure of this

vedfi commented 1 year ago

Actually Documents in MongoDB must have an _id member, which uniquely identifies the document within a collection. This _id value is type of an ObjectId by default. You can change its type to another. But Mondroid cannot update a document without an ObjectId. You can view your document in records page but you cannot modify it in editing page.

I will be testing your data. Maybe there is a problem about Infinity like you said.

jeffryafandi commented 1 year ago

cool! thank your for your explanation..

hoping you to have a wonderful day...

vedfi commented 1 year ago

Screenshot_20230608_001619.jpg

Screenshot_20230608_001625.jpg

I created the document in mondroid, only changed _id value to an ObjectId instead of an Integer. It seems to be working fine. Also Mondroid doesnt have an $numberDouble operator, so its considered as a string.

jeffryafandi commented 1 year ago

Screenshot_20230608-042238 Screenshot_20230608-042314 IMG_20230608_042326

it's working fine but when i changed the Number into Infinity, the document isn't displayed there

Hmm..

jeffryafandi commented 1 year ago

thanks for answering anyways, you should take a good sleep, isn't it midnight on your region?

jeffryafandi commented 1 year ago

oww found alternative to see what's inside my document, thank you for your screenshot, i haven't noticed that feature until few minutes ago.. haha

IMG_20230608_043431

vedfi commented 1 year ago

There is a bug with parsing Infinity values in jsonDecoder. I will be releasing a bugfix asap. Thx for your feedback.