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

Ruby's Date objects are not stored properly #18

Closed
saki7 opened this issue Nov 26, 2012 · 3 comments
Closed

Ruby's Date objects are not stored properly #18

saki7 opened this issue Nov 26, 2012 · 3 comments

Comments

@saki7
Copy link

saki7 commented Nov 26, 2012

When you pass Ruby's date related objects (such as Date, Time, DateTime) to Fluent::Logger#post, out_mongo stores it as a plain string in mongodb.
I think it must be stored as an ISODate("...") format, like the way usual timestamps are stored.


My code:
Fluent::Logger.post('mytag', {text: 'foo', created_at: DateTime.now})

Results in:

{
  "_id" : ObjectId("50b37f022ed6f3145700005d"),
  "text" : "foo",
  "created_at" : "2012-11-26T23:38:51+09:00",
  "time" : ISODate("2012-11-26T14:38:51Z")
}

Is this fluent-plugin-mongo's problem? Or is it to_msgpack related problem? I'm quite not sure, but it must be related with the serialization process.

@repeatedly
Copy link
Member

This is not fluent-plugin-mongo and to_msgpack problem.
Ruby's Yajl and JSON convert Time related object into String object.
The cause is this conversion rule in fluent-logger-ruby.

@repeatedly
Copy link
Member

I close this issue.

@saki7
Copy link
Author

saki7 commented Nov 27, 2012

I see. Thanks!

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

2 participants