[Opa] outstanding database questions

Owen Gunden ogunden at phauna.org
Thu Mar 1 20:59:41 UTC 2012


On Thu, Mar 1, 2012 at 3:44 PM, Frederic Ye <frederic.ye at mlstate.com> wrote:
>
> On 1 mars 2012, at 21:37, Owen Gunden wrote:
>
>> On Thu, Mar 1, 2012 at 3:23 PM, Owen Gunden <ogunden at phauna.org> wrote:
>>>> 3) There is no difference in classic and js-like syntax wrt to the database
>>>> embedded syntax.
>>>>    Only separator differs "," vs ";" (and maybe write operator "=" vs "<-")
>>>>    Have you got translated example that doesn't work ?
>>>
>>> Doh; no I didn't, just assumed it would be different.
>>
>> Translating the first code in the manual section 7.2 below. I changed
>> "or" to "/" and "," to ";". It doesn't like the "database" block:
>>
>> % opa --database mongo --parser classic mongo.opa
>> In mongo.opa [6:3-6:3 | global chars=168-168]
>> Syntax error at line 6, column 3
>> The error may be in the following citation, usually in the red part
>> (starting at ⚐) or just before:
>> <<o
>>
>> type user_status = {regular} / {premium} / {admin}
>> type user_id = int
>> type user = { user_id id; string name; int age; user_status status }
>> database ⚐users {
>>  user /all[{id}]
>>  /all[_]/status = { regular }
>> }
>>
>
> "database" is a js-like keyword, if you are using classic syntax, it's "db".
>
> But you seem to be using js-like syntax here, so you should use --parser js-like (or nothing if you are in a recent Opa build, since it's default)

Actually I am trying to figure out how to do high-level mongo stuff
with classic syntax. I posted that example because Rudy said there is
no difference. I have been examining the trx code and it looks like
the whole database "block" thing (in the curly braces) is a strictly
js-like feature?

Can somebody post an example of a multiple-key db declaration with
classic syntax?


More information about the Opa mailing list