{"action":"opened","issue":{"url":"https://api.github.com/repos/louischatriot/nedb/issues/307","labels_url":"https://api.github.com/repos/louischatriot/nedb/issues/307/labels{/name}","comments_url":"https://api.github.com/repos/louischatriot/nedb/issues/307/comments","events_url":"https://api.github.com/repos/louischatriot/nedb/issues/307/events","html_url":"https://github.com/louischatriot/nedb/issues/307","id":100474146,"number":307,"title":"New data update issue ","user":{"login":"pushpendrachauhan","id":8198972,"avatar_url":"https://avatars.githubusercontent.com/u/8198972?v=3","gravatar_id":"","url":"https://api.github.com/users/pushpendrachauhan","html_url":"https://github.com/pushpendrachauhan","followers_url":"https://api.github.com/users/pushpendrachauhan/followers","following_url":"https://api.github.com/users/pushpendrachauhan/following{/other_user}","gists_url":"https://api.github.com/users/pushpendrachauhan/gists{/gist_id}","starred_url":"https://api.github.com/users/pushpendrachauhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pushpendrachauhan/subscriptions","organizations_url":"https://api.github.com/users/pushpendrachauhan/orgs","repos_url":"https://api.github.com/users/pushpendrachauhan/repos","events_url":"https://api.github.com/users/pushpendrachauhan/events{/privacy}","received_events_url":"https://api.github.com/users/pushpendrachauhan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-12T06:07:20Z","updated_at":"2015-08-12T06:07:20Z","closed_at":null,"body":"Whenever i am querying db for all entries in db i am not getting the update data.\r\n\r\nLets suppose i made a connection to db and named is a \"con\" in the starting and db is having 10 fields, Then i run my script and some more data is populated to db lets say 20 rows, Now when i use same connection \"con\" to query db to list all rows in db, I get only 10 records which was already present in db in the starting but we are not getting that 20 new rows which was inserted.\r\n\r\nTo get rid of this problem we are making new connection to db just before the list query and assigning it to \"con\" variable. Here is the example of problem we are facing.\r\n \r\n// new connection to db , db already having 10 records in it\r\nvar con=new Datastore({ filename: __dirname + '/db.json', autoload: true });\r\n\r\n//some insert statement now db is having 10+20 total 30 records.\r\n\r\n// querying the db to get all rows\r\ncon.find({}).sort({ IN: 1 }).exec(function (err, docs) {\r\n// getting only 10 records but total 30 records are present in db\r\n});\r\n\r\n// querying the db with new connection to db\r\ncon=new Datastore({ filename: __dirname + '/db.json', autoload: true });\r\ncon.find({}).sort({ IN: 1 }).exec(function (err, docs) {\r\n// getting all records old+new = 30 records \r\n});\r\n\r\nI am assuming it is due to the fact that it loads the (.json) file in memory when connection was made first time, New records comes later on so they are not present in memory and query returns the records which was loaded first time."}}