I'm storing elements with a Int64 field in MongoDb. I'm generating a value using all the bigfield and real 64 bits values.
Document looks like { fileds... messageUid : -3130564683773456202 }
No problem to write this long value with springboot-data.
Now I want to make a search on this value and SpringBoot-data returns nothing ...
findMessagesByMessageUid(long _messageUid) returns nothing.
findMessagesByMessageUid(Long _messageUid) returns nothing.
I've try in mongoShell directly 1 - find({messageUid: -3130564683773456202}) This is not working because the shell transform the number into a double and at end the value does not match exactly
2 - find({messageUid: NumberLong(-3130564683773456202)}) This is not working because the value is too large (there is a limit, I read that somewhere)
3 - find({messageUid: NumberLong("-3130564683773456202")}) This is working correctly
So I would like to know How to write the 3rd version of the query with SpringBoot-data
I've try different things around
@Query("{messageUid:NumberLong(?0)}")
public Message findMessageByMessageUid( long messageUid );
=> JSON Parse exception on bootup
@Query("{messageUid:NumberLong(?0)}")
public Message findMessageByMessageUid( String messageUid );
=> JSON Parse exception on bootup
Basically we can't use NumberLong in the @Query string.
I also tried
public Message findMessageByMessageUid( String messageUid );
=> Return no matching document
Can someone tells me how can we make a working search on NumberLong with Spring-data ?