tingodb
tingodb copied to clipboard
Cannot read property 'native3' of undefined
Oddly.
I did a small interface around tingodb for my app's purposes, and this stacktrace happened during a simple get test:
Call:
this.db.collection(this.name).find(search, {w: 1}).toArray(cb);
To inspect I changed it to this:
Collection.prototype.get = function(search, cb){
console.log(search);
this.db.collection(this.name).find(search, {w: 1}).toArray(function(err, data){
console.log(err);
console.log(data);
cb(err, data);
});
};
output:
the _id
bit is weird. Upon further tests seems like it inserts it without an _id
but after the insertion the object inserted is edited to have _id
parameter consistent with what's in the db. In either case shouldn't matter to the get....
I not sure that you query is valid for bookmarks attribute. I don't think it it will on mongodb. You probably need to use elemMatch https://docs.mongodb.org/manual/reference/operator/query/elemMatch/
removing the bookmarks and permissions attributes from the search query still gives the same native3
error.
Seems like the cause was the permissions
object with the empty array being inserted as a record. After it is inserted the search queries end up giving native3
error.
Further tests point that the cause is having a record with an empty array object in the collection that causes the issue.
turning searchInArray
argument for tingoDB to false
(from true
from earlier) changed the error to Cannot read property 'native' of undefined
Tried fresh reinstall, got issue:
Spent hours uninstalling and reinstalling MS Visual Studio versions and getting various errors (CL.exe not found or a lot of rudimentary syntax). Found this post: https://github.com/websockets/bufferutil/issues/18
Installed MS visual studio 2015, locked npm to launched 2015:
npm config set msvs_version 2015
Launched Microsoft VisualStudio 2015, then -> File -> New -> Project -> Visual C++ -> Install Visual C++ Tools for Desktop
Exited Visual Studio so it can do the update. Downloaded 4GB, including mandatory Windows 8.1 SDK with it also (even though I'm on Windows 7)
... which gave me syntax errors, but ones that looked less rudimentary (ei, not, 'cannot recognized token Class' type)
Decided to delete node-gyp off my system. Deleted from the Documents folder, from Roaming/npm, and from program files/nodejs/node modules
this fixed the tingodb installation process. However, I'm still getting the native3
error.
The issues seems to have been _id being in the search query (but I resolved this ages ago, oops x.x)