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

"no such cmd: insert" #106

Closed
peffis opened this issue Mar 23, 2016 · 2 comments
Closed

"no such cmd: insert" #106

peffis opened this issue Mar 23, 2016 · 2 comments

Comments

@peffis
Copy link

peffis commented Mar 23, 2016

Hi,

With version 3.3 (I suppose current master) I cannot insert documents (your tests are also failing). It works neither with maps nor with bson documents. See below.

/Stefan

1> Database = <<"test">>.
<<"test">>

2>  {ok, Connection} = mc_worker_api:connect ([{database, Database}]).
{ok,<0.107.0>}

3> mc_worker_api:insert(Connection, <<"test">>, #{<<"_id">> => <<"123">>, <<"name">> => <<"Stefan">>}).
{{false,#{<<"bad cmd">> => #{<<"documents">> => [#{<<"_id">> => <<"123">>,<<"name">> => <<"Stefan">>}],
            <<"insert">> => <<"test">>},
          <<"errmsg">> => <<"no such cmd: insert">>}},
 #{<<"_id">> => <<"123">>,<<"name">> => <<"Stefan">>}}

4> mc_worker_api:insert(Connection, <<"test">>, [{<<"_id">>, <<"123">>, <<"name">>, <<"Stefan">>}]).   
{{false,#{<<"bad cmd">> => #{<<"documents">> => [#{<<"_id">> => <<"123">>,<<"name">> => <<"Stefan">>}],
            <<"insert">> => <<"test">>},
          <<"errmsg">> => <<"no such cmd: insert">>}},
 [{<<"_id">>,<<"123">>,<<"name">>,<<"Stefan">>}]}

5> 
@henryj
Copy link

henryj commented Mar 23, 2016

I assume you're using mongodb < 2.6? If so you may try my fork which works and pending merge.
https://github.com/henryj/mongodb-erlang
#103

Do remember put something like {mongodb, [{version, 2.4}]} in your config/env tho.

@peffis
Copy link
Author

peffis commented Mar 24, 2016

Yes, this deployment is a Ubuntu 14.04 LTS so it has version 2.4.9 of mongodb-server. I was not aware that the mongo protocol had changed in later releases but I think it is good that there is a pull-request to support the legacy versions.

My problem was also though that the erlang service release had specified the dependency to the mongodb-erlang as using "master" which unfortunately also broke it as it was using the api module "mongo" rather than mc_worker_api module. So unfortunately my solution was to change the dependency to mongodb-erlang to version v0.7.4 to make it build which seems to work with this older mongodb version (and still has the mongo module). I hope the PR for legacy systems will pass until I have the time to update the service :)

Feel free to close this issue...

@comtihon comtihon closed this as completed Aug 5, 2016
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