vibe.d beta banner
get vibe.d
0.7.30

Function MongoCollection.findAndModifyExt

Combines a modify and find operation to a single atomic operation with generic options support.

Prototype

Bson findAndModifyExt(T, U, V)(
  T query,
  U update,
  V options
);

Parameters

NameDescription
query MongoDB query expression to identify the matched document
update Update expression for the matched document
options Generic BSON object that contains additional options fields, such as "new": true

Throws

An Exception will be thrown if an error occurs in the communication with the database server.

See Also

http://docs.mongodb.org/manual/reference/command/findAndModify

Example

import vibe.db.mongo.mongo;

void test()
{
	auto coll = connectMongoDB("127.0.0.1").getCollection("test");
	coll.findAndModifyExt(["name": "foo"], ["$set": ["value": "bar"]], ["new": true]);
}
}

/**
Counts the results of the specified query expression.

Throws Exception if a DB communication error occured.
See_Also: (LINK http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-{{count%28%29}
Authors

Sönke Ludwig

Copyright

© 2012-2016 RejectedSoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.