Skip to content

Instantly share code, notes, and snippets.

@asgs
Created November 21, 2017 18:14
Show Gist options
  • Save asgs/e2367b9f643df06ff52b36ce19dea875 to your computer and use it in GitHub Desktop.
Save asgs/e2367b9f643df06ff52b36ce19dea875 to your computer and use it in GitHub Desktop.
Mongodb data validator
{
"$and" : [
{
"temp" : {
"$type" : "string"
}
},
{
"$or" : [
{
"user" : {
"$exists" : "false",
"$type" : "null"
}
},
{
"user.name" : {
"$type" : "string",
"$exists" : "true"
}
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment