docs.descendants is Loading empty
Tag : chash , By : user104292
Date : March 29 2020, 07:55 AM
I hope this helps . Are you sure the casing is correct because I'm sure XDocument is case sensitive and in your code sample you have "Intel" where as is in your comment below you have "INTEL"? EDIT XDocument doc = XDocument.Load(@"C:\Temp\Test.xml");
XName name = XName.Get("INTEL", "http://www.TestWebsite.com/schema/data");
var nodes = doc.Root.Descendants(name);
foreach (var node in nodes)
{
Console.WriteLine(node.Value);
}
Console.ReadLine();
|
Model.findOne not returning docs but returning a wrapper object
Date : March 29 2020, 07:55 AM
hop of those help? That's exactly the purpose of mongoose, wrapping mongo objects. It's what provides the ability to call mongoose methods on your documents. If you'd like the simple object, you can call .toObject() or use a lean query if you don't plan on using any mongoose magic on it at all. That being said, the equality check should still hold as doc.password returns doc._doc.password.
|
Sorting with $in not returning all docs
Date : March 29 2020, 07:55 AM
around this issue What's happening is that this sorted query must be performed in-memory as it's not supported by an index, and this limits the results to 32 MB. This behavior is documented here, with a JIRA about addressing this here. Furthermore, you can't define an index to support this query as you're sorting on a field that isn't part of the query, and neither of these cases apply: db.getCollection('logs').aggregate([
{$match: {'uid.$id': {
'$in': [
ObjectId("580e3397812de36b86d68c04"),
ObjectId("580e33a9812de36b86d68c0b"),
ObjectId("580e339a812de36b86d68c09"),
ObjectId("580e339a812de36b86d68c08"),
ObjectId("580e33a9812de36b86d68c0a"),
ObjectId("580e33bd812de36b86d68c11"),
ObjectId("580e33c0812de36b86d68c13")
]}, levelno: { '$gte': 10 }
}},
{$sort: {_id: 1}}
], { allowDiskUse: true })
|
$lookup within the same collection is nesting docs instead of returning all docs
Date : March 29 2020, 07:55 AM
should help you out That is because you create an empty array __department in the document that didn't find a match in the $lookup. This is how your orphan document looks like: {
"_id" : ObjectId("5a1982646462db032d58c3f9"),
"department" : false,
"desc" : "Operations Department",
"type" : "main",
"__department" : []
}
{
$project: {
_id: 1,
department: 1,
name: 1,
type: 1,
__department: {
$cond: [{
$eq: ["$__department", []]
},
[{
_id: 0,
department: "None",
desc: "None",
type: "None"
}], '$__department'
]
}
}
}
[{
'$lookup': {
'as': '__department',
'foreignField': '_id',
'from': 'depart',
'localField': 'department'
}
},
{
'$project': {
_id: 1,
department: 1,
name: 1,
type: 1,
__department: {
$cond: [{
$eq: ["$__department", []]
},
[{
_id: 0,
department: "None",
desc: "None",
type: "None"
}], '$__department'
]
}
}
},
{'$unwind': "$__department"},
{'$group': {'__department': {'$first': '$__department'},
'_id': '$_id',
'department': {'$first': '$department'},
'name': {'$first': '$name'},
'type': {'$first': '$type'}}}]
|
Solr returning docs on empty query - How to stop?
Date : March 29 2020, 07:55 AM
|