assert is_alive
var res = new Array[String]
var nas = native.database_names
+ if nas == null then return res
var i = 0
var name = nas[i]
while not name.address_is_null do
assert is_alive
var res = new Array[String]
var nas = native.collection_names
+ if nas == null then return res
var i = 0
var name = nas[i]
while not name.address_is_null do
# ~~~
fun find(query: JsonObject): nullable JsonObject do
assert is_alive
- var c = native.find(query.to_bson.native)
+ var q = new NativeBSON.from_json_string(query.to_json.to_cstring)
+ var c = native.find(q)
+ q.destroy
if c == null then return null
var cursor = new MongoCursor(c)
- if cursor.is_ok then
- cursor.next
- return cursor.item
- end
+ if cursor.is_ok then return cursor.item
return null
end