Skip to content
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
Closed

Comments

@callumenator
Copy link

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
Copy link
Contributor

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

@s-ludwig
Copy link
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants