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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -