Is it possible to store a date field using no sql and then retreive the results sorted on that field?

0 votes
Hi, We want to store a date field in a json using no sql in the format as "MM/dd/yyyy", and then retreive the results sorted on this field using otherMetaHeaders hashmap. The problem is even if we store the date object, it is probably still stored and treated as string by app42. Could you please tell us how to achieve this?
asked Feb 28, 2016 in Java by jitesh.h.lalwani (20 points)

1 Answer

0 votes

Hi Jitesh,

Could you please elaborate your use case in details of saving date along with JSON document because when you insert any document in App42 database, we automatically return document creation date in response which you can use for sorting and fetching the documents. How you can find document based on creation date? You just need to build a query which contains key as _$createdAt and value as an a time in UTC (2016-02-27T05:36:27.254Z) format from which you want to fetch the records.

Please have a look at this link to understand the steps of building a query and let me know if it helps.

Regards,

Himanshu Sharma

answered Feb 29, 2016 by hs00105 (2,005 points)
Hi,
We want to store a release date for a movie and get the results sorted by release date. Please let us know how do we achieve this?

Thanks.
Hi Jitesh,

You can achieve this in the same manner, like save release date in JSON document by putting a key (releaseDate) and value could be (2016-03-07T05:36:27.254Z). Once the data insertion is done, you can apply query to find/fetch records based on your requirement.

regards,
Himanshu Sharma
That worked. Thanks!
Great, let me know if you need any other help from my side.

Regards,
Himanshu Sharma
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...