Last active
December 24, 2015 10:03
-
-
Save LincolnBurrows/de5d383840af54ba94d5 to your computer and use it in GitHub Desktop.
mongoose Array 删除元素
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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