Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个从 MongoDB 数据库返回数据的 Mule 流。目前日期以格式返回"lastLoginDate" : { "$date" : 1382456335880},但我需要以格式返回"lastLoginDate" : { "Timestamp":"2013-10-22T15:39:07.070Z"}。我怎样才能在骡子中做到这一点?现在唯一的转换器是 Mongo-collection-to-JSON。
"lastLoginDate" : { "$date" : 1382456335880}
"lastLoginDate" : { "Timestamp":"2013-10-22T15:39:07.070Z"}
如果您仍然需要将其转换为所需的格式,则可以使用此转换:Timestamp: (1382456335880 / 1000) as :datetime. 结果将是:"Timestamp": "2013-10-22T15:38:55Z"
Timestamp: (1382456335880 / 1000) as :datetime
"Timestamp": "2013-10-22T15:38:55Z"
注意:值除以 1000,因为输入以毫秒为单位,DataWeave 要求以秒为单位。