Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not insert documents with function of time #9

Open
EastAnt opened this issue Aug 10, 2015 · 3 comments
Open

Can not insert documents with function of time #9

EastAnt opened this issue Aug 10, 2015 · 3 comments

Comments

@EastAnt
Copy link

EastAnt commented Aug 10, 2015

I'd like to insert documents like:
{"crash_no":123,"msg":"test for time","time":datetime.datetime.now()}
But it seemed that datetime.datetime.now() function will serialize fail as json.loads not supported.How can I insert documents with time in ISOdate format?

BTW, I find out there is no aggregate function?Will this function be developed some time?That will be great! ^_^

@jerry57
Copy link
Contributor

jerry57 commented Aug 10, 2015

Can you please make up a sample testsuite that has this problem and I will try to look into it. I would also suggest posting to the Robotframework users group to see if anyone there can help out.

@EastAnt
Copy link
Author

EastAnt commented Aug 11, 2015

Almost like below:
${dict}={"crash_no":123,"msg":"test for time","time":datetime.datetime.now()}
[Arguments] ${dict}
Save MongoDB Records ${dict}

This will always got the error: raise ValueError("No JSON object could be decoded")

@rdagum
Copy link

rdagum commented Dec 21, 2017

I get the same error (ValueError: No JSON object could be decoded) with a similar scenario:

Insert DateTime
  ${scn1} =    catenate
  ...  {
  ...     "createdAt" : ISODate("2017-08-30T20:39:46.036Z"),
  ...     "createdBy" : "Clark Kent",
  ...     "name" : "This is a name"
  ...  }
  Save MongoDB Records    ${MDB_DBNAME}    ${MDB_COLLECTION_ADMINBOOKS}    ${scn1}

Is there a workaround to insert DateTime fields?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants