2

I am using seneca-mongo-store to save the entities into backend mongodb. Here is the code I am using to save

function addObject(object){
    connectToMongo('stupidDB')
    seneca.ready(function(){
        var collection = seneca.make$('install')
        console.log("entering object")
        console.log(object)
        collection.save$(object, function(err, reply){
            if( err ) 
                console.log(err)
            else
                console.log("Reply : " + reply)
            closeConnection()
        })
    })
}

The result of execution of this code is

$ node mongoConnect.js
2016-08-08T12:01:25.470Z 912dfpdw7ytw/1470657685436/29552/- INFO        hello   Seneca/0.7.2/912dfpdw7ytw/1470657685436/29552/-
entering object
{ date: 1470657685818,
  product: 'MCS',
  release: '16.2.1',
  'SESSION ID IN LOG FILES': { '/tmp': 'json object', '/u01/app': 'json object' },
  'CRYPTOGRAPHIC NAMES CHECK': { '/tmp': 'json object', '/u01/app': 'json object' } }
Reply : $-/-/install;id=1p2kfa;{date:1470657685818,product:MCS,release:16.2.1,SESSION ID IN LOG FILES:{/tmp:json object,/u01/app:json object},
seneca database connection closed!

The object is being passed but only a part of it is being stored. Is there a length restriction on it in secena plugin? Is there a setting I can change to save large json objects? Or there is some error in my way of using it? As per mongodb specifications a document can be of 16 mb size.

  • Nishant - I have started working on seneca-mongo recently. I have a question. In the seneca-mongo- they have options for save, list, etc. how do you update an entry in a document? Update/Modify? – Soundarya Thiagarajan Aug 17 '16 at 08:50
  • I read in the documentation that using save you can update the document. You just need to pass the "id" key:value pair as part of the object/entity. I have not tried it myself though. Let me know if that works for you. – Nishant Shah Aug 20 '16 at 17:18
  • Yep it works .. :) same way as you told. – Soundarya Thiagarajan Aug 22 '16 at 06:40

0 Answers0