javascript - Insert field in particular order in existing mongodb collection. (Not Append) -
i need insert field in existing collection in mongodb @ particular order. e.g. if have collection contains document as:
item:{ //mandatory field, exist in each document id: "1", //non-mandatory fields, may or may not exist in each document name: "john", age: "22", email:"john@gmail.com" , }
now want insert field "gender" after age , before email document becomes:
item:{ id: "1", name: "john", age: "22", gender: "male", email:"john@gmail.com"
}
my collections of pojo generated xsd, document may or may not contain fields. therefore can't override json.
Comments
Post a Comment