You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a problem where I'm attempting to add a bunch of dates to user-supplied field-names. As an example, think of them like custom tags with a timestamp attached. So every field within this nested relationship will be a date, as in the below structure:
Blog Post
| -> ID = 1
| -> Tags
| -> Tag Name = Timestamp
| -> Tag Name = Timestamp
| -> ...
At present, I'm not sure if there's a way for me to ensure that the Carbon dates I work with in the logic are able to be inserted as a MongoDB Timestamp, since the only facility for managing dates is the presence of the $date property on the model, which as far as I'm aware, doesn't accept wildcards.
So my insert code requires a manual conversion to the \MongoDb\BSON\UTCDateTime class.
Given the flexible nature of Mongo with fields able to be added ad-hoc, it stands to reason that the rules that define those fields could be more flexible too.
Describe the solution you'd like
Some way to define wildcards, or regex within the $dates property, so that I can ensure that any date that matches a particular pattern is added converted to and from the appropriate date classes at the appropriate times.
Describe alternatives you've considered
At the moment, if I want to use these dynamic fields in an insert logic, or in a where logic, I must convert the Carbon/Datetime class to \MongoDb\BSON\UTCDateTime, so I'm not currently prevented from doing this, but the method feels messy and unintegrated.
Additional context
My use case is specific, but there is more I can think of, especially with accountability with our users about when certain features or systems were added to their account.
The text was updated successfully, but these errors were encountered:
I have a problem with dynamic timestamp using this package, and "\MongoDb\BSON\UTCDateTime" doesn't exist for me, I'm actually using "jenssegers/mongodb": "^3.9", and "mongodb/mongodb": "^1.12"
Is your feature request related to a problem?
I have a problem where I'm attempting to add a bunch of dates to user-supplied field-names. As an example, think of them like custom tags with a timestamp attached. So every field within this nested relationship will be a date, as in the below structure:
At present, I'm not sure if there's a way for me to ensure that the Carbon dates I work with in the logic are able to be inserted as a MongoDB Timestamp, since the only facility for managing dates is the presence of the $date property on the model, which as far as I'm aware, doesn't accept wildcards.
So my insert code requires a manual conversion to the
\MongoDb\BSON\UTCDateTime
class.Given the flexible nature of Mongo with fields able to be added ad-hoc, it stands to reason that the rules that define those fields could be more flexible too.
Describe the solution you'd like
Some way to define wildcards, or regex within the
$dates
property, so that I can ensure that any date that matches a particular pattern is added converted to and from the appropriate date classes at the appropriate times.Describe alternatives you've considered
At the moment, if I want to use these dynamic fields in an insert logic, or in a where logic, I must convert the Carbon/Datetime class to
\MongoDb\BSON\UTCDateTime
, so I'm not currently prevented from doing this, but the method feels messy and unintegrated.Additional context
My use case is specific, but there is more I can think of, especially with accountability with our users about when certain features or systems were added to their account.
The text was updated successfully, but these errors were encountered: