@classmethod<EOL><INDENT>def one(cls, filter=None, **kwargs):<DEDENT>
from mongoframes.queries import Condition, Group, to_refs<EOL>kwargs['<STR_LIT>'], references, subs =cls._flatten_projection(<EOL>kwargs.get('<STR_LIT>', cls._default_projection)<EOL>)<EOL>if isinstance(filter, (Condition, Group)):<EOL><INDENT>filter = filter.to_dict()<EOL><DEDENT>document = cls.get_collection().find_one(to_refs(filter), **kwargs)<EOL>if not document:<EOL><INDENT>return<EOL><DEDENT>if references:<EOL><INDENT>cls._dereference([document], references)<EOL><DEDENT>if subs:<EOL><INDENT>cls._apply_sub_frames([document], subs)<EOL><DEDENT>return cls(document)<EOL>
Return the first document matching the filter