Session: Querying: How to use NOT operator?

IDocumentQuery contains NOT operator which can be used to negate next predicate

Note

NOT operator cannot be used alone without succeeding predicate.

Example I

// load up to 128 entities from 'Employees' collection
// where FirstName NOT equals 'Robert'
List<Employee> employees = session
	.Advanced
	.DocumentQuery<Employee>()
	.Not
	.WhereEquals(x => x.FirstName, "Robert")
	.ToList();

Example II

// load up to 128 entities from 'Employees' collection
// where FirstName NOT equals 'Robert'
// and LastName NOT equals 'King'
List<Employee> employees = session
	.Advanced
	.DocumentQuery<Employee>()
	.Not
	.OpenSubclause()
	.WhereEquals(x => x.FirstName, "Robert")
	.AndAlso()
	.WhereEquals(x => x.LastName, "King")
	.CloseSubclause()
	.ToList();