New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB count: BSON value is type 'int_', expected to be one of [double_] #1058

Closed
callumenator opened this Issue Apr 5, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@callumenator

callumenator commented Apr 5, 2015

This throws an exception for me on Windows 7 64bit, using mongo version 3.0.1 64bit, Vibe 0.7.23:

import std.stdio;
import vibe.d;

MongoClient client;

void test()
{
    auto coll = client.getCollection("test.collection");
    auto n = coll.count(["_id": Bson(0)]);
    writeln(n);
}

shared static this()
{
    client = connectMongoDB("127.0.0.1");
    test();
}

object.Exception@C:\Users\cal\AppData\Roaming\dub\packages\vibe-d-0.7.23\source\vibe\data\bson.d(611): BSON value is type 'int_', expected to be one of [double_]

What is the right fix for this? Presumably this works for most people.

@MartinNowak

This comment has been minimized.

Show comment
Hide comment
@MartinNowak

MartinNowak Apr 6, 2015

Contributor

What throws, writeln? What makes you think it only fails for you?

Contributor

MartinNowak commented Apr 6, 2015

What throws, writeln? What makes you think it only fails for you?

@s-ludwig

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Apr 6, 2015

Member

They changed some field types from double to int for MongoDB 3.x. Probably the best idea would be to generally implement implicit conversions for handling all MongoDB replies similar to what JavaScript would do.

Member

s-ludwig commented Apr 6, 2015

They changed some field types from double to int for MongoDB 3.x. Probably the best idea would be to generally implement implicit conversions for handling all MongoDB replies similar to what JavaScript would do.

@s-ludwig s-ludwig closed this in 8a835d1 Apr 6, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment