A与B对应关系是1:n,我想格式化B的日期报错:
ProjectionOperation project1 = Aggregation.project(""updatedDt"
,"B.createdDt")
.andExpression("{ $dateToString: {date: '$B.createdDt[0]', format: '%Y-%m-%d %H:%M:%S', timezone: '+08:00'}}").as("chat2Dt")
com.mongodb.MongoCommandException: Command failed with error 16006 (Location16006): 'can't convert from BSON type array to Date' on server test-seaurl.mongodb.rds.aliyuncs.com:3717. The full response is {"ok": 0.0, "errmsg": "can't convert from BSON type array to Date", "code": 16006, "codeName": "Location16006", "operationTime": {"$timestamp": {"t": 1641714252, "i": 1}}, "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1641714255, "i": 86}}, "signature": {"hash": {"$binary": {"base64": "ox+iGHeWaQimZxpyHsHkFCV50Bk=", "subType": "00"}}, "keyId": 7018457078310109185}}}