EOSIO的Mongo插件的使用

eosio提供了mongo插件,实现把数据导到mongo中,从而可以更加灵活的操作数据。

配置(config.ini)

1
2
plugin = eosio::mongo_db_plugin
mongodb-uri = mongodb://localhost:27017

本地启动mongo

1
$ sudo mongod

重启nodeos

1
$ nodeos --replay-blockchain --hard-replay-blockchain --mongodb-wipe

mongo中查询

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$ mongo
> show dbs
EOS 0.372GB
...

> use EOS
switched to db EOS

> show tables
account_controls
accounts
action_traces
block_states
blocks
pub_keys
transaction_traces
transactions

> db.accounts.find().pretty()
{
"_id" : ObjectId("5bf3cfbf4f6371c75cdc8890"),
"name" : "superoneiobp",
"createdAt" : ISODate("2018-11-20T09:11:27.309Z")
}
...
打赏
  • © 2016-2021 留叶
  • Powered by Hexo Theme Ayer
    • PV:
    • UV:

请我喝杯咖啡吧~

支付宝
微信