th.nim
import nimpy
import nimongo.bson
import nimongo.mongo
proc fib(): seq[Bson] {.exportpy.} =
var m: Mongo = newMongo()
let connected = m.connect()
let col = m["feed"]["post"]
var docs: seq[Bson]
for document in col.find(%*{}).items():
docs.add(document)
return docs
main.py
import nimporter
import th
h = th.fib()
for item in h:
print(item)
and in nimporter module at line 123 i added two compile parameters
'-d:nimOldCaseObjects', #because of an error
'--bound_checks:off', #because of an error
Output:
<capsule object NULL at 0x7f1975a47ae0>
<capsule object NULL at 0x7f1975a77d50>
<capsule object NULL at 0x7f1975a77f60>
<capsule object NULL at 0x7f19759488a0>
<capsule object NULL at 0x7f1975948840>
...
how can i get a data structure like dict or json in python?