MongoDB shell getCollectionNames not working properly - mongodb-query

When in mongo shell 3.x I found this strange behaviour:
Typing db.getCollectionNames() i get [] but I know that there are collections
Typing db.myColl.findOne() in fact it returns a document as I expect
Does anyone know why?
Thanks

You're already on 3.x. so this shouldn't have any impact i take ?
docs.mongodb.com/manual/reference/method/db.getCollectionNames
as the link says it returns empty array for shell lower than 3.X

For MongoDB 3.0 deployments using the WiredTiger storage engine, if
you run db.getCollectionNames() from a version of the mongo shell
before 3.0 or a version of the driver prior to 3.0 compatible version,
db.getCollectionNames() will return no data, even if there are
existing collections.
FOr more details, refer here

Related

Upgrade django-synchro for django 2.2 : OperationalError - no such table: django_content_type"

I am trying to upgrade django-synchro to django 2.2. I have already upgraded the project to django 2.1 but I have now a problem with ContentType object
The upgraded version to django 2.1 can be found here
(python runtests.py works, all tests pass)
With django 2.2.3 I have the error
django.db.utils.OperationalError: no such table: django_content_type
It seems that at initialisation, migrations are done on default database and the rest it is done on test database (in memory). So ContentType are not seen in the rest of the code. An error occur when models.py is read
(content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE))
Any ideas would be very appreciated...
I have looked in Django 2.2 release notes
There are two backwards incompatible changes in 2.2 that can maybe do the error :
TransactionTestCase serialized data loading : Initial data
migrations are now loaded in TransactionTestCase at the end of the
test, after the database flush. In older versions, this data was
loaded at the beginning of the test, but this prevents the test
--keepdb option from working properly (the database was empty at the end of the whole test suite). This change shouldn’t have an impact on
your tests unless you’ve customized TransactionTestCase’s internals.
Test : Deferrable database constraints are now checked at the end of
each TestCase test on SQLite 3.20+, just like on other backends that
support deferrable constraints. These checks aren’t implemented for
older versions of SQLite because they would require expensive table
introspection there.
For me, it was this note from the Django 2.2 release notes
Tests will fail on SQLite if apps without migrations have relations to
apps with migrations. This has been a documented restriction since
migrations were added in Django 1.7, but it fails more reliably now.
You’ll see tests failing with errors like no such table:
_. This was observed with several third-party apps
that had models in tests without migrations. You must add migrations
for such models.
I'm not sure if the error message is particularly helpful. But a round of upgrades and checking that I had no really old django modules lying around seemed to fix it.

Sitefinity and The database schema version is higher than the running Sitefinity version. Downgrade is not allowed

Has anyone come across a situation where they are unable to start a Sitefinity site due to this error
The database schema version (6421) is higher than the running Sitefinity version (6410). Downgrade is not allowed
I've searched for a decent answer but I haven't been able to find one yet. Any help would be good.
It means that you ran build 6421 on this database (and possibly upgaded it). Now you are trying to run a lower build 6410, which is not allowed by default.
You can override this behavior by setting ignoreDowngradeExceptions="true" on the connection string, although you should be careful with using this approach on a production environment.
In case of these two builds, overriding the default behavior will most probably not be a problem because they both belong to the same Sitefinity version (10.0), so there should be no schema changes between them.
It would be a problem though, if you try to run a 9.2 build on a 10.0 database.
I know its late. Maybe still can help someone else. Execute this query. Its works for me.
update [DB_NAME].[dbo].[sf_schema_vrsns]
set version_number = 6410
where version_number = 6421
update [DB_NAME].[dbo].[sf_schema_vrsns]
set [assembly] = REPLACE([assembly],'10.0.6421.0','10.0.6410.0')
where [assembly] like '%10.0.6421.0%';

Cloudant to CouchDB

We are developing an application which uses Cloudant as database, which is a variant of Couchdb. Cloudant started to become a bit expensive for us also not reliable because of the last issues. We have lost our connection to DBs for one day. So we decided to build our own Couchdb server.
There are actually two alternatives for us CouchDB 1.6 and 2.0 Developer Preview. Second one provides every feature we need, if we compile it Full Text Search enabled. The first one has no Mango Query, no Dreyfus and Closeau. We can only install couchdb-lucene to enable full text search, but we are actually using Mango, Dreyfus and Closeau intensively in our application.
The problem is that 2.0 is a developer preview version. I am not sure if it is OK to use it on production environment or not. I am searching for alternatives without making too many changes on our application code, for example: is it possible to compile 1.6 with Mango, Dreyfus and Closeau?
No it's not possible to compile Couchdb 1.6 with Mango, Dreyfus and Closeau because of changes made in the code base to support them. You're probably better off sticking with cloudant until CouchDB 2.0 is released rather than attempting to run it in production.

Get All Documents from a CouchBase Bucket without View or N1QL

I am implementing an Express Web service using CouchBase as my database. To get all documents stored in a bucket, i created a view using the web console.
My question is if there is a way to do the same thing but without creating a view or using N1QL.
I was looking at the Couchbase Server REST API, but i didn't found a way.
Thank you
You could design your schema around something like this. I am thinking of a key pattern specifically that would allow for a bulk get of a range of docs.
Beyond that, there is no way without a view or N1QL.
In Couchbase 3.0 and higher, you can also use DCP to stream all documents from a bucket. Currently the DCP protocol is only implemented in java, you can see an example here: http://github.com/branor/couchbase-dcp-consumer
Note that there is a problem in the 1.1.0+ version of the couchbase core-io library, so you need to use version 1.1.0-dp (developer preview) to open a stream. DCP support in the SDK is still experimental, so I wouldn't use it in production yet.
Create a document that will hold the keys of all your documents.
While inserting a key value pair in couchbase, also append the key to that document.
Eg:
<Key1, Value1>
<Key2, Value2>
.
.
.
<Keyx, Valuex>
<All_Keys, <Key1, Key2, Key3...Keyx>>
To get all the documents,
Just do a client.get("All_Keys") and then do a client.getBulk() operation.

What is the URL query parameter for EQL in Endeca 5.x?

I have to generate an Endeca Url that has an EQL (Nrs) parameter as well, e.g.:
N=200590+82&Nrs=collection()/record[p_MyProperty<=100+or+p_MyOtherProperty>200]
I've tried it out on Endeca 6.0 and it perfectly works but our target system is 5.0 which completely ignores the Nrs parameter. Adding or removing this parameter the result set is the same.
Does 5.x uses different syntax for EQL? Or is it a feature from 6.0? Maybe in our Endeca instance this feature is turned off?
The Nrs parameter is available in Endeca 5.1.4.
I have a feature support document that tells me that EQL was introduced in version 5.1.1. And specifically not supported in 5.0.
You could try using some features that did work in 5.0.
You could also do some baseline calculations with record filters. That might give you the intended effect. (Pretty much pre-calculate the ranges you need and select them via record filter.)
Documentation for record filters:
https://docs.oracle.com/cd/E29584_01/webhelp/mdex_basicDev/src/rbdv_urlparams_nr.html