Mongo collection successfully removed or not? but Griddle react table still displaying old data?

Code within Promise function does collection remove:

....
 .then(()=> ACSTasks.remove({}))
 .then(x => console.log('Removed  : ', x))

Removed : 16

And back in meteor mongo shell

db.acs_tasks,find() -> All data still present?

so my question is why is it falsely saying it has removed when it hasn’t within the app?
as my React Griddle table is still showing and even when reload, data is there not removed?

Because on the meteor mongo shell

meteor:PRIMARY>  db.acs_tasks.remove({})

Also returns the same

WriteResult({ “nRemoved” : 16 })

and React Griddle table now works, data all removed from collection when done via command line, why within app data is not removed even though it console.log it has?

Can you show the full code surrounding your ACSTasks.remove call, so we can see how it’s being called (from the client, from within a Method, etc.).

Hi Hugh

It is called from server.js:

return await putACSClusters(details.userid)   
            .then(txt => statusCodeUpsert(details, "end_status", "".concat(txt, "", " Test Design")))
            .then(()=> FutureTasks.upsert({userid: details.userid}, {$set: {count: 0}}, {multi: true}))
            .then(txt => console.log('Correct conditionalACSEndAction end is :', txt))
            .then(()=> ACSTasks.remove({}))

collections.js:

var ACSSchemas = {};
var Collections = {};

ACSSchemas.ACSTask = new SimpleSchema({
name: {
        type: String, 
        label: "NAME",
        max: 20,
        optional: true
    },
    description: {
        type: String,
        label: "DESCRIPTION",
        max: 50,
        optional: true
    },
    id: {
        type: String,
        label: "ID",
        optional: true
    },
    created: {
        type: String,
        label: "CREATED",
        optional: true
    },

});

ACSTasks = Collections.ACSTasks = new Mongo.Collection('acs_tasks');
ACSTasks.attachSchema(ACSSchemas.ACSTask);

and this is how collections is updated in server side(server.js)

async function jsonUpdateACSCollection(jsonString) {
    var promise = await new Promise(function (resolve, reject) {

        var contentObj = EJSON.parse(jsonString);
        contentObj["ns2:users"].User.forEach(user => {

            ACSTasks.upsert({
                name: user.name[0],
                id: user.id[0],
            }, {
                $set: {
                    identityGroupName: user.identityGroupName[0],
                    description: user.description[0],
                    created: user.created[0],
                    lastModified: user.lastModified[0],
                }
            }); 
        }, (err, db) => {
            err ? reject(err) : resolve(db);
        });
    });
    return promise;
}

and client side React Griddle table

export default class Home4ACS extends TrackerReact(Component) {

    constructor() {
        super();

        this.state = {
            subscription: {
                acs_tasks: Meteor.subscribe('all_acs_tasks')
            }
        }
    }

    componentWillUnmount() {
        this.state.subscription.acs_tasks.stop();
    }

    acstasks() {
        return ACSTasks.find().fetch();
    }

    render() {

        let res = this.acstasks();

        if (res.length < 1) {
            return <div>
                <h1>Detecting ACS status...</h1>
            </div>
        }

        return (
            <div id="griddle-advanced">

                <Griddle results={res} tableClassName="table" showFilter={true} resultsPerPage="20"
                                         showSettings={true} columns={["name", "description", "id", "identityGroupName", "created", "lastModified", "lastPasswordChange"]}/>

            </div>
        )
    }
}

So not sure whether it has been removed and React not picking it up, or it has not been removed at all?