Skip to content

Instantly share code, notes, and snippets.

@LincolnBurrows
Last active December 24, 2015 10:03
Show Gist options
  • Save LincolnBurrows/de5d383840af54ba94d5 to your computer and use it in GitHub Desktop.
Save LincolnBurrows/de5d383840af54ba94d5 to your computer and use it in GitHub Desktop.
mongoose Array 删除元素
var mongoose = require('mongoose');
var schema = mongoose.Schema;
var doc_schema = new schema({array:Array});
var doc = mongoose.model('doc',doc_schema);
var doc_inst = new doc({array:[1,2,3,4,5]});
doc_inst.array.pull(3); //delete doc_inst array element '3'
console.log(doc_inst.array);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment