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

Error on filter $date #4

Open
abalad opened this Issue Nov 29, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@abalad

abalad commented Nov 29, 2016

I'm trying to do a query in a MongoDB database with date values but the following situation is occurring:

Filtering with date only goes all normal.
Filter: filter:{"$and":[ {"dt_evento":{"$date":"2016-11-28T23:21:43.0000"}} ]}

Filtering with Data + ID
Filter: filter:{"$and":[ {"dt_evento":{"$date":"2016-11-28T23:21:43.0000"}},{"bem_id": "58338261bab1178e0a393cec"} []}]

unknow operadtor $and

http://community.dreamfactory.com/t/serious-bug-filter-date-operator-and-on-mongodb/3477

@svensteudter

This comment has been minimized.

Show comment
Hide comment
@svensteudter

svensteudter Oct 6, 2017

Hi,

quite some time ago. But I had the same issue and it was not resolved almost 1 year later and multiple versiosn later.

This "bug" is located in multiple versions always at the same location in src/Resources/Table.php in "function toMongoObjects($record)" is the if clause " if (1 === count($data)) {" limiting the loop to be run at most once, so if a $date object in an array is submitted the date is not converted to MongoDate.

Fixing this is easy: Just remove the "if (1 === count($data)) {" and one of closing brackets. This also works for already installed DF instances by modifying in vendor/dreamfactory/df-mongodb/src/Resources/Table.php.

svensteudter commented Oct 6, 2017

Hi,

quite some time ago. But I had the same issue and it was not resolved almost 1 year later and multiple versiosn later.

This "bug" is located in multiple versions always at the same location in src/Resources/Table.php in "function toMongoObjects($record)" is the if clause " if (1 === count($data)) {" limiting the loop to be run at most once, so if a $date object in an array is submitted the date is not converted to MongoDate.

Fixing this is easy: Just remove the "if (1 === count($data)) {" and one of closing brackets. This also works for already installed DF instances by modifying in vendor/dreamfactory/df-mongodb/src/Resources/Table.php.

@abalad

This comment has been minimized.

Show comment
Hide comment
@abalad

abalad Oct 6, 2017

Thank you @svensteudter, I really did it at that time. And I opened that issue before I fixed the problem, then forgot to send the fix.

abalad commented Oct 6, 2017

Thank you @svensteudter, I really did it at that time. And I opened that issue before I fixed the problem, then forgot to send the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment