I have this MongoDB documentFile Collection entry:
db.DocumentFile.find().pretty()
{
"_id" : ObjectId("587f0d61473c92b933a68efa"),
"_class" : "com.xxx.dao.domain.DocumentFile",
"fileName" : "DocumentFile1",
"ending" : "jpg",
"projectId" : "587f0d61473c92b933a68ef9",
"active" : true,
"userIdBlackList" : [
"587f0d61473c92b933a68ef8"
]}
And now I will find document files where some id is not in userIdBlackList. I tried this one:
db.DocumentFile.find({"userIdBlackList" : { "$ne" : "587f0d61473c92b933a68ef8"}}).pretty();
But I still get the document file:
{
"_id" : ObjectId("587f0d61473c92b933a68efa"),
"_class" : "com.smartinnotec.legalprojectmanagement.dao.domain.DocumentFile",
"fileName" : "DocumentFile1",
"ending" : "jpg",
"projectId" : "587f0d61473c92b933a68ef9",
"active" : true,
"userIdBlackList" : [
"587f0d61473c92b933a68ef8"
]}
Is there a possibility with MongoDB to say: return document when some string is not included in @Document#someArrayOfDocument?
I also have tried this queries
db.DocumentFile.find({"587f0d61473c92b933a68ef8" : { "$nin" : ["587f0d61473c92b933a68ef8"]}}).pretty() -> returns the document, don't know why
db.DocumentFile.find({"587f0d61473c92b933a68ef8" : { "$in" : ["587f0d61473c92b933a68ef8"]}}).pretty() -> does not return the document, also dont know why
db.DocumentFile.find({"587f0d61473c92b933a68ef8" : { "$nin" : userIdBlackList}}).pretty() -> [main] ReferenceError: userIdBlackList is not defined -> but how I can specify userIdBlackList ?