如何使用 mongodb-erlang 索引字段
How to index a field with mongodb-erlang
我想使用 mongodb-erlang (https://github.com/comtihon/mongodb-erlang) 索引一个字段。示例代码在 shell 中有效,但当我从代码中调用时崩溃了。有人对这个问题有想法吗?我正在使用 mongo 2.6.5
mongo:ensure_index(DBConn, conversations, {key, {page_id, 1}, unique, true, dropDups, true})
谢谢
我使用mongodb-erlang已经一年多了,示例代码如下:
Index_spec = [{key,{column_a,1},unique,true,sparse,true}
],
X = collection_a,
ok = mongo:ensure_index(Connection,X,Index_spec),
我想使用 mongodb-erlang (https://github.com/comtihon/mongodb-erlang) 索引一个字段。示例代码在 shell 中有效,但当我从代码中调用时崩溃了。有人对这个问题有想法吗?我正在使用 mongo 2.6.5
mongo:ensure_index(DBConn, conversations, {key, {page_id, 1}, unique, true, dropDups, true})
谢谢
我使用mongodb-erlang已经一年多了,示例代码如下:
Index_spec = [{key,{column_a,1},unique,true,sparse,true}
],
X = collection_a,
ok = mongo:ensure_index(Connection,X,Index_spec),