-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not .create() values with model stored in MongoDb having "one-way association" with another model stored in MySQL #4484
Comments
@maheshwarishivam Thanks for posting, we'll take a look as soon as possible. For help with questions about Sails, click here. If you’re interested in hiring @sailsbot and her minions in Austin, click here. |
I have also posted a Question on Stack Overflow explaining the same: |
UPDATE: Setting However, using a model setting which is ONLY TO BE USED WITH SAILS-MONGO Adapter for a Model using Now, I'm wondering, if this is bug or an undocumented feature? |
This is a problem with the mongo adapter, and it looks like it's on the radar at sails: https://trello.com/c/EgGWOsj0 The problem comes from generating an object id in mongo (which has to be a string) from an association in another type of db. https://github.com/balderdashy/sails-mongo/blob/e0a2aeac95086ea5275da0dc56b93d75b24a6222/lib/private/machines/private/normalize-mongo-object-id.js |
Thanks for the reply. Now I see! This is a duplicate of #4367 |
Sails version: v1.0.2
Node version: v8.1.2
NPM version: 4.2.0
DB adapter name: sails-mongo
DB adapter version: ^1.0.1
Operating system: Mac OSX
Hi,
This seems to be a bug in
sails-mongo
adapter v 1.0.1.Sails Mongo Adapter seems to assume that the foreign keys (One Way Association defined using "model" attribute) have to be "Mongo Keys" even if the referenced model lives in "MySQL".
Here is how to replicate:
I have a
Users
model stored in MongoDb and aUserTypes
model stored in MySQL:Users.js:
and UserTypes.js:
where
default
datastore isMySQL
andmongoDb
datastore isMongoDb
.When I try to create a new User:
I get following error:
However,
.populate()
works just fine:yields the following result:
Am I doing something wrong or is this actually a bug?
The text was updated successfully, but these errors were encountered: