1.0.7 • Published 8 years ago

savejsontomongo v1.0.7

Weekly downloads
4
License
ISC
Repository
github
Last release
8 years ago

savejsontomongo

##一个直接把json插入到mongoDB里的库 ##eg:

var savejsontomongo=require('savejsontomongo');
//config mongoDB
savejsontomongo.config({
  host:'localhost',
  port:27017,
  db:'test'
});
//set collection
savejsontomongo.set_collection('users');
//save a json to mongoDB

savejsontomongo.save({name:'jerry',age:18,sex:0},function(err,id){
  if(err){
    console.log('err:'+id);
  }else{
    console.log('insert id:'+id);
  }
});

//sava a json to mongoDB from a file
savejsontomongo.saveFormFile('tom.json',function(err,id){
  if(err){
    console.log('err:'+id);
  }else{
    console.log('insert id:'+id);
  }
});
1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago