| MongoCollectionFindAndModify Method (IMongoQuery, IMongoSortBy, IMongoUpdate, IMongoFields, Boolean, Boolean) | 
 Note: This API is now obsolete.
            Finds one matching document using the query and sortBy parameters and applies the specified update to it.
            
 
    Namespace: 
   MongoDB.Driver
    Assembly:
   MongoDB.Driver.Legacy (in MongoDB.Driver.Legacy.dll) Version: 2.5.0+57.Branch.master.Sha.6a4e00a2d91090c65a9b11364b9ebfdb9c7da076
 Syntax
Syntax[ObsoleteAttribute("Use the overload of FindAndModify that has a FindAndModifyArgs parameter instead.")]
public virtual FindAndModifyResult FindAndModify(
	IMongoQuery query,
	IMongoSortBy sortBy,
	IMongoUpdate update,
	IMongoFields fields,
	bool returnNew,
	bool upsert
)<ObsoleteAttribute("Use the overload of FindAndModify that has a FindAndModifyArgs parameter instead.")>
Public Overridable Function FindAndModify ( 
	query As IMongoQuery,
	sortBy As IMongoSortBy,
	update As IMongoUpdate,
	fields As IMongoFields,
	returnNew As Boolean,
	upsert As Boolean
) As FindAndModifyResult[<ObsoleteAttribute("Use the overload of FindAndModify that has a FindAndModifyArgs parameter instead.")>]
abstract FindAndModify : 
        query : IMongoQuery * 
        sortBy : IMongoSortBy * 
        update : IMongoUpdate * 
        fields : IMongoFields * 
        returnNew : bool * 
        upsert : bool -> FindAndModifyResult 
[<ObsoleteAttribute("Use the overload of FindAndModify that has a FindAndModifyArgs parameter instead.")>]
override FindAndModify : 
        query : IMongoQuery * 
        sortBy : IMongoSortBy * 
        update : IMongoUpdate * 
        fields : IMongoFields * 
        returnNew : bool * 
        upsert : bool -> FindAndModifyResult Parameters
- query
- Type: MongoDB.DriverIMongoQuery
 The query (usually a QueryDocument or constructed using the Query builder).
- sortBy
- Type: MongoDB.DriverIMongoSortBy
 The sort order to select one of the matching documents.
- update
- Type: MongoDB.DriverIMongoUpdate
 The update to apply to the matching document.
- fields
- Type: MongoDB.DriverIMongoFields
 Which fields of the modified document to return in the FindAndModifyResult.
- returnNew
- Type: SystemBoolean
 Whether to return the new or old version of the modified document in the FindAndModifyResult.
- upsert
- Type: SystemBoolean
 Whether to do an upsert if no matching document is found.
Return Value
Type: 
FindAndModifyResultA 
FindAndModifyResult.
 See Also
See Also