Finds all the documents matching the query.

Params:

  • skip number of documents to skip
  • limit number of documents to return
var client = new MongoClient("mongodb://mongo:27017/")
var db_suffix = "NIT_TESTING_ID".environ
var db_name = "test_{db_suffix}"
var db = client.database(db_name)
var col = db.collection("test")
var query = new JsonObject
query["foo"] = 10
assert col.find_all(query).length > 0

Property definitions

mongodb $ MongoCollection :: find_all
	# Finds all the documents matching the `query`.
	#
	# Params:
	# * `skip` number of documents to skip
	# * `limit` number of documents to return
	#
	# ~~~
	# var client = new MongoClient("mongodb://mongo:27017/")
	# var db_suffix = "NIT_TESTING_ID".environ
	# var db_name = "test_{db_suffix}"
	# var db = client.database(db_name)
	# var col = db.collection("test")
	# var query = new JsonObject
	# query["foo"] = 10
	# assert col.find_all(query).length > 0
	# ~~~
	fun find_all(query: JsonObject, skip, limit: nullable Int): Array[JsonObject] do
		var s = skip or else 0
		var l = limit or else 0
		var res = new Array[JsonObject]
		var c = native.find(query.to_bson.native, s, l)
		if c == null then return res
		var cursor = new MongoCursor(c)
		while cursor.is_ok do
			res.add cursor.item
			cursor.next
		end
		return res
	end
lib/mongodb/mongodb.nit:595,2--623,4