Skip to content

Instantly share code, notes, and snippets.

@simark
Last active December 31, 2015 06:19
Show Gist options
  • Save simark/7946448 to your computer and use it in GitHub Desktop.
Save simark/7946448 to your computer and use it in GitHub Desktop.
Database update
// Enlever prix/quantités usagé
db.pieces.update({_id: {$exists: true}}, { $rename: {'prixneuf':'prix', 'quantiteneuf':'quantite'}, $unset: {'quantiteusage': true, 'prixusage': true} }, {multi: true})
// Trouver factures problématiques
db.factures.find({ 'pieces': {$elemMatch: { 'quantiteusage': {$exists: true}, 'quantiteneuf': {$exists: true} }} })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment