MongoCollection.find

Queries the collection for existing documents, limiting what fields are returned by the database. (called projection)

  1. MongoCursor!R find(T query, U returnFieldSelector, QueryFlags flags, int num_skip, int num_docs_per_chunk)
  2. MongoCursor!R find(T query, U projection, FindOptions options)
    struct MongoCollection
    MongoCursor!R
    find
    (
    R = Bson
    T
    U
    )
    (,,
    FindOptions options = FindOptions.init
    )
    if (
    !is(U == FindOptions)
    )
  3. MongoCursor!R find(Q query, FindOptions options)
  4. MongoCursor!R find()

Examples

import vibe.db.mongo.mongo;

void test()
{
	auto coll = connectMongoDB("127.0.0.1").getCollection("test");
	// find documents with status == "A", return list of {"item":..., "status":...}
	coll.find(["status": "A"], ["item": 1, "status": 1]);
}

See Also

Meta