General Ideas

14 views
Skip to first unread message

Bernardo Ramos

unread,
Oct 9, 2011, 8:35:21 AM10/9/11
to UnQL
Filters like this could be supported:

(suppose an 'orders' collection with the 'items' element being an
array)

"(total_value > 500) and (length(items) == 1) and (items.unitPrice <
50)"

"(total_value < 100) and ( (length(items) > 10) or (items.qty >
10) )"

"(total_value >= 100) or (sum(items.qty) >= 10)"


Note that they have conditions for the base document and the child
ones in the same filter.

Bernardo Ramos

unread,
Oct 9, 2011, 8:37:04 AM10/9/11
to UnQL
This is an idea to identify what must be returned:

(I don't know if this is already implemented...)


SELECT orders.items.idProduct, orders.items.qty

could return arrays: -- is this mode right? what do you think?

[
[2500, 1],
[2121, 3]
]


SELECT { orders.items.idProduct, orders.items.qty }

returns objects:

[
{idProduct: 2500, qty: 1},
{idProduct: 2121, qty: 3}
]



And using alias in one of them:

SELECT { id: orders.items.idProduct, orders.items.qty }

[
{id: 2500, qty: 1},
{id: 2121, qty: 3}
]

Dustin

unread,
Oct 9, 2011, 2:03:52 PM10/9/11
to un...@googlegroups.com

On Sunday, October 9, 2011 5:37:04 AM UTC-7, Bernardo Ramos wrote:

SELECT orders.items.idProduct, orders.items.qty

could return arrays:   -- is this mode right? what do you think?

 [
  [2500, 1],
  [2121, 3]
 ]

  ... not quite, this should be:

   SELECT [order.items.idProduct, orders.items.qty];
 
SELECT { orders.items.idProduct, orders.items.qty }

returns objects:

 [
  {idProduct: 2500, qty: 1},
  {idProduct: 2121, qty: 3}
 ]

  And this should be:

   SELECT { idProduct: orders.items.idProduct, qty: orders.items.qty }


  -- I see what you did there, but IMO, too much implicitness can lead to confusion.
Reply all
Reply to author
Forward
0 new messages