Skip to content
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

Error: key emails.address must not contain '.' #265

Open
prashanthmadi opened this issue Feb 17, 2017 · 16 comments
Open

Error: key emails.address must not contain '.' #265

prashanthmadi opened this issue Feb 17, 2017 · 16 comments

Comments

@prashanthmadi
Copy link

prashanthmadi commented Feb 17, 2017

I was trying to run a demeteorized app but it fails with below error. Could you help me debug this issue

I understand that mongo is not allowing .(period) symbol in keys. I couldn't find where i have included it in my meteor code

tried demeteorized -d option but that did not help either.

C:\Workspace\nodejs\koufa.demeteorized\bundle\programs\server>npm start

meteor-dev-bundle@0.0.0 start C:\Workspace\nodejs\koufa.demeteorized\bundle\programs\server
node ../../main

Note: you are using a pure-JavaScript implementation of bcrypt.
While this implementation will work correctly, it is known to be
approximately three times slower than the native implementation.
In order to use the native implementation instead, run

meteor npm install --save bcrypt

in the root directory of your application.

C:\Workspace\nodejs\koufa\.demeteorized\bundle\programs\server\node_modules\fibers\future.js:313
                                                throw(ex);
                                                ^
Error: key emails.address must not contain '.'
    at Object.wait (C:\Workspace\nodejs\koufa\.demeteorized\bundle\programs\server\node_modules\fibers\future.js:449:15)
    at MongoConnection._ensureIndex (packages/mongo/mongo_driver.js:828:10)
    at Mongo.Collection._ensureIndex (packages/mongo/collection.js:685:20)
    at setupUsersCollection (packages/accounts-base/accounts_server.js:1492:9)
    at new AccountsServer (packages/accounts-base/accounts_server.js:51:5)
    at meteorInstall.node_modules.meteor.accounts-base.server_main.js (packages/accounts-base/server_main.js:9:12)
    at fileEvaluate (packages\modules-runtime.js:181:9)
    at require (packages\modules-runtime.js:106:16)
    at C:\Workspace\nodejs\koufa\.demeteorized\bundle\programs\server\packages\accounts-base.js:1972:15
    at C:\Workspace\nodejs\koufa\.demeteorized\bundle\programs\server\packages\accounts-base.js:1983:3
    - - - - -
    at Error (native)
    at serializeInto (C:\Workspace\nodejs\koufa\.demeteorized\bundle\programs\server\npm\node_modules\meteor\npm-mongo\node_modules\bson\lib\bson\parser\serializer.js:743:19)
    at serializeObject (C:\Workspace\nodejs\koufa\.demeteorized\bundle\programs\server\npm\node_modules\meteor\npm-mongo\node_modules\bson\lib\bson\parser\serializer.js:300:18)
    at serializeInto (C:\Workspace\nodejs\koufa\.demeteorized\bundle\programs\server\npm\node_modules\meteor\npm-mongo\node_modules\bson\lib\bson\parser\serializer.js:766:17)
    at serializeObject (C:\Workspace\nodejs\koufa\.demeteorized\bundle\programs\server\npm\node_modules\meteor\npm-mongo\node_modules\bson\lib\bson\parser\serializer.js:300:18)
    at serializeInto (C:\Workspace\nodejs\koufa\.demeteorized\bundle\programs\server\npm\node_modules\meteor\npm-mongo\node_modules\bson\lib\bson\parser\serializer.js:608:17)
    at serializeObject (C:\Workspace\nodejs\koufa\.demeteorized\bundle\programs\server\npm\node_modules\meteor\npm-mongo\node_modules\bson\lib\bson\parser\serializer.js:300:18)
    at serializeInto (C:\Workspace\nodejs\koufa\.demeteorized\bundle\programs\server\npm\node_modules\meteor\npm-mongo\node_modules\bson\lib\bson\parser\serializer.js:766:17)
    at BSON.serialize (C:\Workspace\nodejs\koufa\.demeteorized\bundle\programs\server\npm\node_modules\meteor\npm-mongo\node_modules\bson\lib\bson\bson.js:49:27)
    at Query.toBin (C:\Workspace\nodejs\koufa\.demeteorized\bundle\programs\server\npm\node_modules\meteor\npm-mongo\node_modules\mongodb-core\lib\connection\commands.js:143:25)
@fiveisprime
Copy link
Collaborator

What version of Meteor are you on and did you recently update?

@fiveisprime
Copy link
Collaborator

fiveisprime commented Feb 17, 2017

I guessing that somewhere in your code you are attempting to find or update a
user object from MongoDB like this

Meteor.users.find( { emails.address: 'user@example.com' })

The MongoDB drive requires the nested values to be in quotes to access

Meteor.users.find( { 'emails.address': 'user@example.com' })

// or

Meteor.users.find( { emails: { address: 'user@example.com' } })

Check through your code and report back. :)

@prashanthmadi
Copy link
Author

Thanks for helping with this @fiveisprime

I haven't found any address/email in my code but have seen some in .meteor / .demeteor folder

COuld be that one of the module i'm using might have it...

image

@mattdell
Copy link

mattdell commented Mar 3, 2017

I'm having the same problem. Were you able to fix this @prashanthmadi ?

@prashanthmadi
Copy link
Author

are you using documentdb ? we tried with mlab and it worked :)

@mattdell
Copy link

mattdell commented Mar 3, 2017

@prashanthmadi yep! That is exactly how I just spent the last 3 hours. 😄

@prashanthmadi
Copy link
Author

@mattdell is your issue resolved ?

@mattdell
Copy link

mattdell commented Mar 3, 2017

Yep 👍

@prashanthmadi
Copy link
Author

prashanthmadi commented Mar 3, 2017

Do you have simple steps to repro this issue. I will work with documentdb team to fix it.

As you can see below that insert with “.” In key doesn’t work even with mongo shell. You can try it on your local environment

db.test.insert({"a.1":1})

2017-02-23T14:01:07.655-0800 E QUERY    [thread1] Error: can't have . in field names [a.1] : 
DBCollection.prototype._validateForStorage@src/mongo/shell/collection.js:181:1
Bulk/this.insert@src/mongo/shell/bulk_api.js:646:9
DBCollection.prototype.insert@src/mongo/shell/collection.js:271:13
@(shell):1:1 

No idea on why it's working using mlab..

@haha454
Copy link

haha454 commented Mar 14, 2017

@fiveisprime I am having the same issue when I am deploying a Meteor app using Azure MongoDB. I guess this is the line which raises the exception.

https://github.com/meteor/meteor/blob/master/packages/accounts-base/accounts_server.js#L1492

As can be seen, it does have quotes when accessing nested keys, but I still don't understand why it is working when I using a mlab.com sandbox MongoDB while it throws such exception when using Azure MongoDB.

@prashanthmadi You can only query a nested document in this way, but to insert document, I guess we cannot do so. I tested on both Azure MongoDB and mlab MongoDB, and db.test.insert({"a.1":1}) is not allowed on both.

https://docs.mongodb.com/manual/tutorial/insert-documents/
https://docs.mongodb.com/manual/tutorial/query-embedded-documents/

@prashanthmadi
Copy link
Author

Hi @weitony111, I have discussed on this issue with DocumentDB Team today. Can you send an email to askdocdbmongoapi@microsoft.com .

Disclaimer: I work at Microsoft Azure

@fiveisprime
Copy link
Collaborator

I didn't realize that, in the original issue, you were using DocumentDB over
MongoDB! It makes some kind of sense now. :) I'm guessing that DocumentDB doesn't
support this part of the API yet.

@weitony111 when you send that email, please copy maherna@microsoft.com as well
so I can track this for future DocumentDB use cases.

@prashanthmadi 👋 from Redmond.

@haha454
Copy link

haha454 commented Mar 14, 2017

@fiveisprime Oh, yeah, thanks for reminding. I actually chose MongoDB as my NoSQL API in Azure NoSQL (DocumentDB). I overlooked it since I thought it will work exactly the same way as MongoDB, but now it seems not. I'll send an email tomorrow since it is too late in Singapore now...

@fiveisprime
Copy link
Collaborator

From the DocumentDB team

Looks like the problem is with ensureIndex since unique index is not supported yet (it’s coming this week) but will only enabled for new accounts at first... until we enable migration from old accounts.

@kulttuuri
Copy link

Any news on this one @prashanthmadi @fiveisprime? Doesn't seem to be enabled yet for new accounts. Running to the same problem with fresh azure cosmosDB database. Tried fresh database and imported database. Works fine on other DB services.

@garychapman
Copy link

FWIW it's mid-October and I'm seeing the same results on Azure Cosmos DB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants