“MongoDb entspannen sich” Code-Antworten

MongoDb entspannen sich

{
  $unwind:
    {
      path: <field path>,
      includeArrayIndex: <string>,
      // to include documents whose sizes field is null, missing, or an empty array.
      preserveNullAndEmptyArrays: <boolean>
    }
}
North Bear

MongoDb abwickeln

unwind:
 It is used for array attribute to show seprate result for that array.

// Inserted data : 
db.inventory.insertOne({ "_id" : 1, "item" : "ABC1", 
sizes: [ "S", "M", "L"] })

// unwind query 
db.inventory.aggregate( [ { $unwind : "$sizes" } ] )

// output
{ "_id" : 1, "item" : "ABC1", "sizes" : "S" }
{ "_id" : 1, "item" : "ABC1", "sizes" : "M" }
{ "_id" : 1, "item" : "ABC1", "sizes" : "L" }
Abhishek

MongoDb abwickeln

db.vehicledetails.aggregate([{$unwind : {path: "$model_year", preserveNullAndEmptyArrays: true}}]).pretty()
Important Ibis

Ähnliche Antworten wie “MongoDb entspannen sich”

Fragen ähnlich wie “MongoDb entspannen sich”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen