Hi,
I am getting errors when using deserializeBson.
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute defaultvalue)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute defaultvalue)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute defaultvalue)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute defaultvalue)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute defaultvalue)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute defaultvalue)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute defaultvalue)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(233): Error: need 'this' for 'getAttribute' of type 'nothrow @safe NameAttribute(NameAttribute defaultvalue)'
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(170): instantiated from here: deserialize!(BlogModel, BsonSerializer)
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/bson.d(1016): instantiated from here: deserialize!(BsonSerializer, BlogModel, Bson)
source/blog.d(51): instantiated from here: deserializeBson!(BlogModel)
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(223): Error: function vibe.data.bson.BsonSerializer.readDictionary!(BlogModel).readDictionary (scope void delegate(string) entry_callback) is not callable using argument types (void)
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/serialization.d(170): Error: template instance vibe.data.serialization.deserialize!(BlogModel, BsonSerializer) error instantiating
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/bson.d(1016): instantiated from here: deserialize!(BsonSerializer, BlogModel, Bson)
source/blog.d(51): instantiated from here: deserializeBson!(BlogModel)
../../../darius/.dub/packages/vibe-d-0.7.18/source/vibe/data/bson.d(1016): Error: template instance vibe.data.serialization.deserialize!(BsonSerializer, BlogModel, Bson) error instantiating
source/blog.d(51): instantiated from here: deserializeBson!(BlogModel)
source/blog.d(51): Error: template instance vibe.data.bson.deserializeBson!(BlogModel) error instantiating
Using this code:
`
BlogModel obtain(int id)
{
auto data = blog.findOne(["id":id]);
enforce(!data.isNull(),"Blog does not exist");
auto res = deserializeBson!BlogModel(data);
return res;
}
`
I do not see the issue exactly. I tried also doing
auto res = new BlogModel;deserializeBson(res,data);
but would still give a similar error but point it to deserializedBson. Could someone explain to me what I be doing wrong with that function?