Always getting not null object even though there are no objects with these parameters;

@dknutsen well I am even more closer now thanks to you! :slight_smile: But, there is still one bug. It’s like he filters the first subject correctly and every next time he still keeps reference to the same subject and insert the marks (that is grades) in that subject. Do you have any idea why? Here is my snippet of code, I would appreciate if you could look one more time… :slight_smile:

unesiOcenu(val1, val2){
			var student = this.store.peekRecord("student", val1);
			var subject = this.store.peekRecord("subject", val2);
			var mark = this.get('ocena');
			
			alert(student.get('firstName') +  " " +  student.get('lastName'));
			alert(subject.get('title'));
			
			var grades = this.store.peekAll('grade');

			grades.find(function(item, index){
				const student2 = item.get('student');
				const subject2 = item.get('subject');
				if(student2 === student && subject2 === subject){
					return true;
				}
				return false;
			});

			if(grades.get('firstObject')){
				grades.get('firstObject').get('marks').pushObject(mark);
				grades.save();
			}else{
				this.store.createRecord('grade', {
					marks: [mark],
					student: student,
					subject: subject 
				}).save().then(function(ocena){
					student.get('grades').pushObject(ocena);
					student.save();
					subject.get('grades').pushObject(ocena);
					subject.save();
				})
			}
		}

-My models, template and sample of firebase data are in this link: Is there a way to check if some record exists before I create a new one?