arithmetic of fields for comparison?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

arithmetic of fields for comparison?

dcrissman
I ran into client side expression yesterday. It is not currently supported and required another solution, but I am just asking is this something we might want to support in the future?

withValue("whenAvailableDate + expectedExecutionMilliseconds < " + ClientConstants.getDateFormat().format(new Date()))

Translates:

{
    "field": "whenAvailableDate + expectedExecutionMilliseconds",
    "op": "<",
    "rvalue": "20150330T18:21:47.327+0000"
 }
Reply | Threaded
Open this post in threaded view
|

Re: arithmetic of fields for comparison?

bserdar
As far as I can remember, this is not directly supported by Mongodb.
It *can* be implemented using javascript queries, but that means a
collection scan unless there is another criterion to limit the scope.

For LDAP, it requires manually scanning a subtree.

For RDBMS, it is a table scan.

Change your data model to deal with these: use whenAvailableDate and
expirationDate instead of expectedExecutionMilliseconds. It is usually
a good idea to have the field you're going to search on as part of the
document, instead of the pieces to derive it.

On Tue, Mar 31, 2015 at 6:52 AM, dcrissman [via lightblue-dev]
<[hidden email]> wrote:

> I ran into client side expression yesterday. It is not currently supported
> and required another solution, but I am just asking is this something we
> might want to support in the future?
>
> withValue("whenAvailableDate + expectedExecutionMilliseconds < " +
> ClientConstants.getDateFormat().format(new Date()))
>
> Translates:
>
> {
>     "field": "whenAvailableDate + expectedExecutionMilliseconds",
>     "op": "<",
>     "rvalue": "20150330T18:21:47.327+0000"
>  }
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://dev.forum.lightblue.io/arithmetic-of-fields-for-comparison-tp362.html
> To start a new topic under lightblue-dev, email
> [hidden email]
> To unsubscribe from lightblue-dev, click here.
> NAML
Reply | Threaded
Open this post in threaded view
|

Re: arithmetic of fields for comparison?

jewzaam
Administrator
The query was updated to pull the comparison out to code.  We could add a new field for when the execution expires.

On Tue, Mar 31, 2015 at 8:58 AM bserdar [via lightblue-dev] <[hidden email]> wrote:
As far as I can remember, this is not directly supported by Mongodb.
It *can* be implemented using javascript queries, but that means a
collection scan unless there is another criterion to limit the scope.

For LDAP, it requires manually scanning a subtree.

For RDBMS, it is a table scan.

Change your data model to deal with these: use whenAvailableDate and
expirationDate instead of expectedExecutionMilliseconds. It is usually
a good idea to have the field you're going to search on as part of the
document, instead of the pieces to derive it.

On Tue, Mar 31, 2015 at 6:52 AM, dcrissman [via lightblue-dev]
<[hidden email]> wrote:

> I ran into client side expression yesterday. It is not currently supported
> and required another solution, but I am just asking is this something we
> might want to support in the future?
>
> withValue("whenAvailableDate + expectedExecutionMilliseconds < " +
> ClientConstants.getDateFormat().format(new Date()))
>
> Translates:
>
> {
>     "field": "whenAvailableDate + expectedExecutionMilliseconds",
>     "op": "<",
>     "rvalue": "20150330T18:21:47.327+0000"
>  }
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://dev.forum.lightblue.io/arithmetic-of-fields-for-comparison-tp362.html
> To start a new topic under lightblue-dev, email
> To unsubscribe from lightblue-dev, click here.
> NAML
If you reply to this email, your message will be added to the discussion below:
To start a new topic under lightblue-dev, email [hidden email]
To unsubscribe from lightblue-dev, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: arithmetic of fields for comparison?

jewzaam
Administrator
In reply to this post by bserdar

On Tue, Mar 31, 2015 at 9:04 AM Juzam <[hidden email]> wrote:
The query was updated to pull the comparison out to code.  We could add a new field for when the execution expires.

On Tue, Mar 31, 2015 at 8:58 AM bserdar [via lightblue-dev] <[hidden email]> wrote:
As far as I can remember, this is not directly supported by Mongodb.
It *can* be implemented using javascript queries, but that means a
collection scan unless there is another criterion to limit the scope.

For LDAP, it requires manually scanning a subtree.

For RDBMS, it is a table scan.

Change your data model to deal with these: use whenAvailableDate and
expirationDate instead of expectedExecutionMilliseconds. It is usually
a good idea to have the field you're going to search on as part of the
document, instead of the pieces to derive it.

On Tue, Mar 31, 2015 at 6:52 AM, dcrissman [via lightblue-dev]
<[hidden email]> wrote:

> I ran into client side expression yesterday. It is not currently supported
> and required another solution, but I am just asking is this something we
> might want to support in the future?
>
> withValue("whenAvailableDate + expectedExecutionMilliseconds < " +
> ClientConstants.getDateFormat().format(new Date()))
>
> Translates:
>
> {
>     "field": "whenAvailableDate + expectedExecutionMilliseconds",
>     "op": "<",
>     "rvalue": "20150330T18:21:47.327+0000"
>  }
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://dev.forum.lightblue.io/arithmetic-of-fields-for-comparison-tp362.html
> To start a new topic under lightblue-dev, email
> To unsubscribe from lightblue-dev, click here.
> NAML
If you reply to this email, your message will be added to the discussion below:
To start a new topic under lightblue-dev, email [hidden email]
To unsubscribe from lightblue-dev, click here.
NAML