Agregar campo a todos los documentos
Agregar un nuevo campo a todos los documentos en una colección
En MongoDB
Agregar un String
db.vehiculos.update({},{$set:{"activo":"si"}},{upsert:false,multi:true})Agregar campos fechas
db.notificaciones.update({},{$set:{"fechacrea":new Date()}},{upsert:false,multi:true})Agregar un Integer
usar NumberInt
db.persona.update({},{$set:{"edad": NumberInt(0)}},{upsert:false,multi:true})Agregar un Double
db.persona.update({},{$set:{"salario": 0}},{upsert:false,multi:true})Agregar un documento embebido
db.pronvincia.update({},{$set:{"country.idcountry":"PA"}},{upsert:false,multi:true})Agregar una lista de embebidos
Last updated
Was this helpful?