Is it possible to specify fields while doing a FindAndModify, so only one field is returned?
Also, is it possible to do an upsert, to create the object if it doesn't exist.
As per: http://www.mongodb.org/display/DOCS/findAndModify+Command
I can't see any way of adding the additional arguments
EDIT: Seems to be some confusion - I am using NoRM (C#) https://github.com/atheken/NoRM/
I'm afraid it's not possible actually in NoRM. You could fork the project and add an overloaded FindAndModify method to the file NoRM/Collections/MongoCollectionGeneric.cs to support this behavior.
I think you might need to add a field
fields
in the anonymous object passed to findOne.And maybe a pull request :)