Skip to content

Instantly share code, notes, and snippets.

@CraftyFella
Last active December 20, 2015 04:09
Show Gist options
  • Save CraftyFella/6069007 to your computer and use it in GitHub Desktop.
Save CraftyFella/6069007 to your computer and use it in GitHub Desktop.
Mongovue Query Examples
// Querying arrays by their size
{
"Field1": {$size: 0}
"Field2": {$not: {$size: 0}}
}
// Querying nested fields using a unique identifier
{
"Events.Payload.Body._t" : "EventType",
"Events.Payload.Body._id" : CSUUID("2267495d-63e3-4aa3-ae67-86372a7968fd")
}
// Aggregate with lots of examples of different queries..
{ $match : { "Risk.contactDetails.outBoundingOptIn" : "True" } },
{ $match : { "CommencedAt" : { $gte : ISODate("2014-01-14T00:00:00.000Z"),
$lt: ISODate("2014-01-15T00:00:00.000Z") } }},
{ $unwind : "$Quotes" },
{ $match : { "Quotes.Brand" : { $in :["AHH3", "HLF3", "SNN3"] } } },
{ $match : { "Quotes.Position" : { $in :[1, 2] } } },
{ $group : { _id : "$Quotes.Brand",
count : { $sum : 1 }}},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment