How to stop reading child_added with Firebase cloud functions?

I try to get all 10 records using this:

exports.checkchanges = functions.database.ref('school/{class}').onCreate(snap => {

    const class=snap.params.class;

    var ref = admin.database().ref('/students')
    return ref.orderByChild(class).startAt('-').on("child_added", function(snapshot) {

        const age=snapshot.child("age");
        // do the thing


The problem is that after I get the 10 records I need correctly, even after few days when a new record is added meeting those terms, this function is still invoked.

When I change on(“child_added to once(“child_added I get only 1 record instead of 10. And when I change on(“child_added to on(“value I get null on this:

const age=snapshot.child("age");

So how can I prevent the function from being invoked for future changes?