0

I am trying to send a JSON query over the wire to a web service to be used to query a MongoDB collection. The problematic field in the document is an ISODate. I use the C++ fromjson API call to parse the JSON. I've already learnt fromjson is pretty basic and cannot parse a number of types among which is ISODate. I cannot however figure out what to use as alternative. I hope the field can remain an ISODate in the collection's documents and I only need to make some changes to my query string. The parser exception states only Date can succeed the new keyword but I can't figure out what the Date object constructor should take as argument for fromjson to parse it without vomiting and whether Date is even compatible with ISODate. Is there something better than fromjson in the C++ driver ? How does the shell do it ?

1 Answer 1

1

Figured it out. Need to use Unix time_t and suffix with 000 (not millisecond grain) and then output new Date(1383264000000) instead of a new ISODate(human readable date goes here). Sucks! All that remains begging a question is what API the mongo shell uses so it doesn't suffer from this half-baked parser.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.