5

Started migrating to my own mongo db after announcement of parse going away next year.

I have done the migrate operation and data seems to be present however any underscore tables don't work with Mongo shell. I'm not particularly mongo proficient however here's what I'm seeing:

> show databases
local  0.078GB
test   0.203GB
> use test
switched to db test
> show collections
Chat
ChatStatus
Message
Session
SessionBooking
TrainerProfile
UserFavorite
_Cardinality
_Index
_Installation
_JobSchedule
_JobStatus
_PushStatus
_SCHEMA
_User
system.indexes
> users = db._User.find()
2016-02-09T01:07:31.394+0000 E QUERY    TypeError: Cannot call method 'find' of undefined
    at (shell):1:18

I'm not sure why it's presenting as undefined. Help much appreciated.

silverdagger
  • 1,124
  • 13
  • 37
  • 8
    Possible duplicate of [MongoDB Shell - access collection with period in name?](http://stackoverflow.com/questions/4680873/mongodb-shell-access-collection-with-period-in-name). It's just a shell idiom. The real method is always `.getCollection()` ie. `db.getCollection("_User").find()` or even `db["_User"].find()` is valid JavaScript for the shell. – Blakes Seven Feb 09 '16 at 01:15
  • 2
    db.getCollection("_User").find() worked! Thanks! – silverdagger Feb 09 '16 at 01:28
  • I see why this is analagous to the cited question, but imagine the parse.com migrators having this problem. They won't google "period in collection name". This is a useful q/a because it deals with parse migration in a way that's in-bounds for SO. I hope @BlakesSeven writes the helpful comment as an answer that I can up-vote. – danh Feb 09 '16 at 03:11
  • @danh So here is what happens when accepted as a duplicate. The question still stays here with your title and tags, so people are likely to find it if they are searching for the same problem. The only real reason for marking as a duplicate is that there would be little point in repeating the same solution that is already listed to what is basically the same problem. There is no reason to be squeemish. Most of us make such calls with much consideration. And reverse them if there is good reason to. That's why this does not need another answer. – Blakes Seven Feb 09 '16 at 03:42
  • Thanks @BlakesSeven db.getCollection("_User").find() helped a lot. – Sakina Sugra Feb 25 '16 at 12:19

0 Answers0