Hi all, I'm really excited about this project, thanks so much for all
your work!
(sorry if I double posted, I thought I submitted this once but I didn't see it show up in the list of topics)
I have a few questions about querying. Here's a sample of an object
stored in the db:
{
"@type": "d", "@rid": "#7:0", "@version": 0, "@class": "DbOutboundEmail",
"emailType": "BULK",
"priority": "LOW",
"transactions": [
{
"@type": "d", "@version": 0, "@class": "SmtpTransaction",
"state": "NEW",
"lastResult": "PENDING",
"attempts": 1,
"maxAttempts": 5,
"nextTry": "2012-04-06 12:11:56:113",
"dateByAttempt": ["2012-03-15 00:00:00:000"],
"smtpHostByAttempt": ["host"],
"smtpCodeByAttempt": [200],
"smtpResponseByAttempt": ["response"],
"timeoutAt": null,
"@fieldTypes": "nextTry=t"
}],
"messageId": "1",
"from": null,
"to": null,
"cc": null,
"bcc": null,
"subject": null,
"data": null
}
I've been using the "studio" web ui to test. Here are some
observations/questions:
1) Is this the correct syntax (If so I don't see any results for this)?
select from DbOutboundEmail where transactions.state = "NEW"
If I add an index, it returns results, but is there a way to search
all indexes inside the list of transactions?
select from DbOutboundEmail where transactions[0].state = "NEW"
2) Is there special syntax for querying dates? For example, this
returns results:
select from DbOutboundEmail where transactions contains (lastResult = "PENDING" AND state = "NEW")
But, this returns 0 results? I expect it to return the object listed above?
select from DbOutboundEmail where transactions contains (nextTry = "2012-04-06 12:11:56:113")
3) I need to be able to query for all objects where
transactions.nextTry < then some date. This doesn't return any results?
select from DbOutboundEmail where transactions contains (nextTry.toDateTime < "2012-05-06 12:11:56:113")
If I put parenthesis, it throws exception?
select from DbOutboundEmail where transactions contains (nextTry.toDateTime() < "2012-05-06 12:11:56:113")
Ultimately, I'd like to write a query that returns results that match
where transactions.nextTry is less than some date, transactions.state
equals "NEW" ordered by transactions.nextTry and priority. But I think
I might not understand completely about writing queries. Any guidance
and clarification will help a lot!
Thanks!
Dave