RejectedSoftware Forums

Sign up

inout method vibe.data.bson.Bson.opIndex is not callable using a mutable object

Hi,

this is the output for compiling a diet template

Error: inout method vibe.data.bson.Bson.opIndex is not callable using a mutable object
//product.dt 
...
   - foreach( field; schema.fields)

schema is a Bson object obtained from mongodb using findOne();
I get the same output from schema["fields"];

But the same code works in a normal .d file

Any ideas?

Re: inout method vibe.data.bson.Bson.opIndex is not callable using a mutable object

Am 09.11.2013 12:21, schrieb Tiberiu Gal:

Hi,

this is the output for compiling a diet template

Error: inout method vibe.data.bson.Bson.opIndex is not callable using a mutable object
//product.dt
...
    - foreach( field; schema.fields)

schema is a Bson object obtained from mongodb using findOne();
I get the same output from schema["fields"];

But the same code works in a normal .d file

Any ideas?

Sounds like the error message is hiding the real cause. If you can
prepare a complete test case, I can try to find out where it comes from
(I have similar code to your description that compiles fine).

Re: inout method vibe.data.bson.Bson.opIndex is not callable using a mutable object

It turns out I was using it wrong

 - foreach(field; schema.fields)
    span=field.name // this is wrong
    span=field.name.get!string // this works

this is not intuitive - but it works