angry kiwi
angry kiwi

Reputation: 11445

nodejs - mongodb - how to remove a record

This is the data

{
    "username": "runrun",
    "channel": "all",
    "expire": NumberLong("1308183908743"),
    "_id": ObjectId("4df93f54e07324af47000001")
}

This is the code I used to use to remove a record

db.collection('seesion',function(err, collection){
    collection.remove({
        "expire": {"$lte": Date.now()}
    },function(err, removed){
        console.log(removed);
    });
});

I want to delete the session which has been expired. Problem is, the code doesn't work, maybe there is something to do with numberLong ?

Upvotes: 11

Views: 12855

Answers (1)

maerics
maerics

Reputation: 156434

It looks like you misspelled "session" (as "seesion").

Upvotes: 18

Related Questions