Skip to content

Instantly share code, notes, and snippets.

@tdantas
Created October 28, 2012 20:05

Revisions

  1. tdantas revised this gist Oct 28, 2012. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion question.js
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,8 @@
    // Environment: NodeJS

    // Lets suppose that you have a collection of items, and your function must persist all items using the
    //database.insert(item, callback ) function. When you finish the task, you should call the callback function. If one // item raise a error, the callback(err) must be called and never call the callback anymore.
    //database.insert(item, callback ) function. When you finish the task, you should call the callback function.
    // If one item raise a error, the callback(err) must be called and never call the callback anymore.


    function saveBulk(items, callback) {
  2. tdantas revised this gist Oct 28, 2012. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion question.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,8 @@
    //Question:
    // Environment: NodeJS

    // Lets suppose that you have a collection of items, and your function must persist all items using the //database.insert(item, callback ) function. When you finish the task, you should call the callback function. If one // item raise a error, the callback(err) must be called and never call the callback anymore.
    // Lets suppose that you have a collection of items, and your function must persist all items using the
    //database.insert(item, callback ) function. When you finish the task, you should call the callback function. If one // item raise a error, the callback(err) must be called and never call the callback anymore.


    function saveBulk(items, callback) {
  3. tdantas created this gist Oct 28, 2012.
    13 changes: 13 additions & 0 deletions question.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    //Question:
    // Environment: NodeJS

    // Lets suppose that you have a collection of items, and your function must persist all items using the //database.insert(item, callback ) function. When you finish the task, you should call the callback function. If one // item raise a error, the callback(err) must be called and never call the callback anymore.


    function saveBulk(items, callback) {
    // Your code here
    }

    saveBulk([ {name:"thiago"}, {name: "r42"}, { name: "rulio"} , { name: "nodejs"} ], function(err) {
    console.log("Ok");
    });