MongoCollection.find - multiple declarations
Function MongoCollection.find
MongoCursor!R find(R, T, U)
(
T query,
U returnFieldSelector,
QueryFlags flags,
int num_skip = 0,
int num_docs_per_chunk = 0
);
Function MongoCollection.find
Queries the collection for existing documents, limiting what fields are returned by the database. (called projection)
MongoCursor!R find(R, T, U)
(
T query,
U projection,
FindOptions options = FindOptions .init
)
if (!is(U == FindOptions));
See Also
- Querying: http://www.mongodb.org/display/DOCS/Querying - Projection: https://www.mongodb.com/docs/manual/tutorial/project-fields-from-query-results/#std-label-projections - findOne
Example
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]);
}
Function MongoCollection.find
Queries the collection for existing documents.
If no arguments are passed to find(), all documents of the collection will be returned.
See Also
- http://www.mongodb.org/display/DOCS/Querying - findOne
Example
import vibe .db .mongo .mongo;
void test()
{
auto coll = connectMongoDB("127.0.0.1") .getCollection("test");
// find documents with status == "A"
coll .find(["status": "A"]);
}
}
/**
Queries all documents of the collection.
See_Also:
- <a href="http://www.mongodb.org/display/DOCS/Querying">http://www.mongodb.org/display/DOCS/Querying</a>
- findOne
*/
MongoCursor!R find(R = Bson)() { return find!R(Bson .emptyObject, FindOptions .init);
Function MongoCollection.find
Queries all documents of the collection.
See Also
- http://www.mongodb.org/display/DOCS/Querying - findOne
Example
import vibe .db .mongo .mongo;
void test()
{
auto coll = connectMongoDB("127.0.0.1") .getCollection("test");
// find all documents in the "test" collection.
coll .find();
}