Link to home
Start Free TrialLog in
Avatar of MrTV
MrTVFlag for Thailand

asked on

Maximum value plus one mongodb express

how can I find the maxinum of number not count from how many row and plus one  in express mongodb


app.post('/api/department',(request,response)=>{

    database.collection("Department").count({},function(error,numOfDocs){

        if(error){

            console.log(error);

        }

        database.collection("Department").insertOne({

                DepartmentId : numOfDocs+1,


ASKER CERTIFIED SOLUTION
Avatar of Arty K
Arty K
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial